From 8fcbcad8e246158745c5d1d41bffb94e14f4ade0 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 | 1 + cypress/support/commands.js | 5 +++++ 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/integration.spec.js b/cypress/e2e/integration.spec.js index e031596592..4d98c1fd82 100644 --- a/cypress/e2e/integration.spec.js +++ b/cypress/e2e/integration.spec.js @@ -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 }) diff --git a/cypress/e2e/new.spec.js b/cypress/e2e/new.spec.js index 4f8cd4524b..f68ba52ffb 100644 --- a/cypress/e2e/new.spec.js +++ b/cypress/e2e/new.spec.js @@ -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') }) }) }) 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 5ffd6a0049..e66572e881 100644 --- a/cypress/e2e/share-internal.spec.js +++ b/cypress/e2e/share-internal.spec.js @@ -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() { @@ -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') }) }) diff --git a/cypress/e2e/share-link.js b/cypress/e2e/share-link.js index b84d33cdd0..560f564ccf 100644 --- a/cypress/e2e/share-link.js +++ b/cypress/e2e/share-link.js @@ -117,6 +117,7 @@ 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 069ad76888..8e840b782d 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -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) { From 42e1e459775ef685ab5a9c5a036a83a3811881fe 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 Signed-off-by: Elizabeth Danzberger --- .github/workflows/cypress-e2e.yml | 2 +- cypress/e2e/share-link.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cypress-e2e.yml b/.github/workflows/cypress-e2e.yml index 350e96bcd4..38b38ac29b 100644 --- a/.github/workflows/cypress-e2e.yml +++ b/.github/workflows/cypress-e2e.yml @@ -21,7 +21,7 @@ env: jobs: cypress: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/cypress/e2e/share-link.js b/cypress/e2e/share-link.js index 560f564ccf..b9c8addcbc 100644 --- a/cypress/e2e/share-link.js +++ b/cypress/e2e/share-link.js @@ -119,6 +119,4 @@ function waitForCollabora() { cy.get('#closebutton').click() cy.waitForViewerClose() }) - - cy.get('#viewer', { timeout: 5000 }).should('not.exist') }