From d638301e0c7eca92a13d4e09ea6a4f9d70f8acd6 Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Fri, 29 Nov 2024 08:20:43 +0100 Subject: [PATCH 1/2] ci: Attempt to make cypress tests more stable with a unified wait for close Signed-off-by: Julius Knorr --- cypress/e2e/integration.spec.js | 2 +- cypress/e2e/new.spec.js | 2 +- cypress/e2e/share-federated.spec.js | 2 +- cypress/e2e/share-internal.spec.js | 4 ++-- cypress/e2e/share-link.js | 3 +-- cypress/support/commands.js | 5 +++++ 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/cypress/e2e/integration.spec.js b/cypress/e2e/integration.spec.js index baa4b8b071..2379b93afa 100644 --- a/cypress/e2e/integration.spec.js +++ b/cypress/e2e/integration.spec.js @@ -93,8 +93,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 }) diff --git a/cypress/e2e/new.spec.js b/cypress/e2e/new.spec.js index 3254b76903..1217885494 100644 --- a/cypress/e2e/new.spec.js +++ b/cypress/e2e/new.spec.js @@ -76,8 +76,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') }) }) }) diff --git a/cypress/e2e/share-federated.spec.js b/cypress/e2e/share-federated.spec.js index 52f7c71587..9bdfa146fb 100644 --- a/cypress/e2e/share-federated.spec.js +++ b/cypress/e2e/share-federated.spec.js @@ -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() }) }) diff --git a/cypress/e2e/share-internal.spec.js b/cypress/e2e/share-internal.spec.js index 4331d8a5ae..d94c90a298 100644 --- a/cypress/e2e/share-internal.spec.js +++ b/cypress/e2e/share-internal.spec.js @@ -53,8 +53,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() { @@ -76,7 +76,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') }) }) diff --git a/cypress/e2e/share-link.js b/cypress/e2e/share-link.js index 07613bcb37..d0050f5ddc 100644 --- a/cypress/e2e/share-link.js +++ b/cypress/e2e/share-link.js @@ -129,7 +129,6 @@ function waitForCollabora() { cy.get('@loleafletframe').within(() => { cy.get('#closebutton').click() + cy.waitForViewerClose() }) - - cy.get('#viewer', { timeout: 5000 }).should('not.exist') } diff --git a/cypress/support/commands.js b/cypress/support/commands.js index e827be7862..b3e669b2e2 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -244,6 +244,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) { From 1b8ebdcfaf12e803b0a08a294bbff309f057d94a Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Fri, 29 Nov 2024 08:22:58 +0100 Subject: [PATCH 2/2] ci: Run cypress on ubuntu-latest Signed-off-by: Julius Knorr --- .github/workflows/cypress.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 141ee6da43..df385846ae 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -19,7 +19,7 @@ env: jobs: cypress: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: fail-fast: false