Skip to content

Commit

Permalink
Merge pull request #934 from nextcloud/test/cypress-fixes
Browse files Browse the repository at this point in the history
Test/cypress fixes
  • Loading branch information
max-nextcloud authored Oct 10, 2023
2 parents bf53285 + 6d115f0 commit 0a214d4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/page-details.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ describe('Page details', function() {
cy.deleteAndSeedCollective('Our Garden')
cy.seedPage('Day 1', '', 'Readme.md')
cy.seedPageContent('Our Garden/Day 2.md', 'A test string with Day 2 in the middle and a [link to Day 1](/index.php/apps/collectives/Our%20Garden/Day%201).')
cy.seedPage('TableOfContents', '', 'Readme.md')
cy.seedPageContent('Our Garden/TableOfContents.md', '## Second-Level Heading')
})

beforeEach(function() {
Expand All @@ -40,8 +42,6 @@ describe('Page details', function() {

describe('Display table of contents', function() {
it('Allows to display/close TOC and switch page modes in between', function() {
cy.seedPage('TableOfContents', '', 'Readme.md')
cy.seedPageContent('Our Garden/TableOfContents.md', '## Second-Level Heading')
cy.visit('/apps/collectives/Our%20Garden/TableOfContents')
cy.get('#titleform .action-item__menutoggle')
.click()
Expand Down
9 changes: 3 additions & 6 deletions cypress/e2e/pages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,9 @@ describe('Page', function() {
cy.get('#titleform input.title')
.blur()
cy.wait('@renamePage')
// Flaky on stable25
if (Cypress.env('ncVersion') !== 'stable25') {
cy.getEditor(Cypress.config('defaultCommandTimeout') * 2)
.should('be.visible')
.contains('This is going to be our template.')
}
cy.getEditor(Cypress.config('defaultCommandTimeout') * 2)
.should('be.visible')
.contains('This is going to be our template.')
cy.get('.app-content-list-item').eq(1)
.should('contain', 'New page from Template')
})
Expand Down
8 changes: 8 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,3 +360,11 @@ Cypress.Commands.add('seedCircleMember', (name, userId, type = 1, level) => {
}
})
})

/**
* Fail the test on the initial run to check if retries work
*/
Cypress.Commands.add('testRetry', () => {
cy.wrap(cy.state('test').currentRetry())
.should('be.equal', 2)
})

0 comments on commit 0a214d4

Please sign in to comment.