Skip to content

Commit 72238cc

Browse files
authored
Merge pull request #4285 from nextcloud/ci/cypress-close-timeout
ci: Attempt to make cypress tests more stable with a unified wait for close
2 parents 4b1d0cd + 4616995 commit 72238cc

File tree

7 files changed

+13
-9
lines changed

7 files changed

+13
-9
lines changed

.github/workflows/cypress-e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ env:
2121
jobs:
2222
cypress:
2323

24-
runs-on: ubuntu-22.04
24+
runs-on: ubuntu-latest
2525

2626
strategy:
2727
fail-fast: false

cypress/e2e/integration.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ describe('Nextcloud integration', function() {
7979

8080
cy.get('@loleafletframe').within(() => {
8181
cy.get('#closebutton').click()
82+
cy.waitForViewerClose()
8283
})
83-
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
8484

8585
// FIXME: We should not need to reload
8686
cy.get('.breadcrumb__crumbs a').eq(0).click({ force: true })

cypress/e2e/new.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ describe.skip('Create new office files', function() {
6262

6363
cy.get('@loleafletframe').within(() => {
6464
cy.get('#closebutton').click()
65+
cy.waitForViewerClose()
6566
})
66-
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
6767
})
6868
})
6969
})

cypress/e2e/share-federated.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('Federated sharing of office documents', function() {
3535
cy.waitForViewer()
3636
cy.waitForCollabora(true, true).within(() => {
3737
cy.get('#closebutton').click()
38-
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
38+
cy.waitForViewerClose()
3939
})
4040
})
4141

cypress/e2e/share-internal.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ describe('File sharing of office documents', function() {
3838
// Validate closing
3939
cy.get('@loleafletframe').within(() => {
4040
cy.get('#closebutton').click()
41+
cy.waitForViewerClose()
4142
})
42-
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
4343
})
4444

4545
it('Open a shared file as readonly', function() {
@@ -61,7 +61,7 @@ describe('File sharing of office documents', function() {
6161
// Validate closing
6262
cy.get('@loleafletframe').within(() => {
6363
cy.get('#closebutton').click()
64+
cy.waitForViewerClose()
6465
})
65-
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
6666
})
6767
})

cypress/e2e/share-link.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ function waitForCollabora() {
114114

115115
cy.get('@loleafletframe').within(() => {
116116
cy.get('#closebutton').click()
117+
cy.waitForViewerClose()
117118
})
118-
119-
cy.get('#viewer', { timeout: 5000 }).should('not.exist')
120-
}
119+
}

cypress/support/commands.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ Cypress.Commands.add('waitForViewer', () => {
229229
.and('not.have.class', 'icon-loading')
230230
})
231231

232+
Cypress.Commands.add('waitForViewerClose', () => {
233+
cy.get('#viewer', { timeout: 30000 })
234+
.should('not.exist')
235+
})
236+
232237
Cypress.Commands.add('waitForCollabora', (wrapped = false, federated = false) => {
233238
const wrappedFrameIdentifier = federated ? 'coolframe' : 'documentframe'
234239
if (wrapped) {

0 commit comments

Comments
 (0)