Skip to content

Commit

Permalink
ci: Attempt to make cypress tests more stable with a unified wait for…
Browse files Browse the repository at this point in the history
… close

Signed-off-by: Julius Knorr <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Nov 29, 2024
1 parent 4b1d0cd commit c0d7b34
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ describe('Nextcloud integration', function() {

cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
})
cy.get('#viewer', { timeout: 5000 }).should('not.exist')

// FIXME: We should not need to reload
cy.get('.breadcrumb__crumbs a').eq(0).click({ force: true })
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/new.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ describe.skip('Create new office files', function() {

cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
})
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
})
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/share-federated.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Federated sharing of office documents', function() {
cy.waitForViewer()
cy.waitForCollabora(true, true).within(() => {
cy.get('#closebutton').click()
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
cy.waitForViewerClose()
})
})

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/share-internal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ describe('File sharing of office documents', function() {
// Validate closing
cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
})
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
})

it('Open a shared file as readonly', function() {
Expand All @@ -61,7 +61,7 @@ describe('File sharing of office documents', function() {
// Validate closing
cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
})
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
})
})
5 changes: 2 additions & 3 deletions cypress/e2e/share-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ function waitForCollabora() {

cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
})

cy.get('#viewer', { timeout: 5000 }).should('not.exist')
}
}
5 changes: 5 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ Cypress.Commands.add('waitForViewer', () => {
.and('not.have.class', 'icon-loading')
})

Cypress.Commands.add('waitForViewerClose', () => {
cy.get('#viewer', { timeout: 30000 })
.should('not.exist')
})

Cypress.Commands.add('waitForCollabora', (wrapped = false, federated = false) => {
const wrappedFrameIdentifier = federated ? 'coolframe' : 'documentframe'
if (wrapped) {
Expand Down

0 comments on commit c0d7b34

Please sign in to comment.