From 06234fa4d50b71e74a81a47e81f763f39dfed39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Tue, 20 Aug 2024 15:13:13 +0200 Subject: [PATCH] fixup! test(cypress): Add simple federated editing tests --- cypress/e2e/share-federated.spec.js | 7 ++----- cypress/support/commands.js | 13 ++++++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cypress/e2e/share-federated.spec.js b/cypress/e2e/share-federated.spec.js index f0a7e1748a..7d00b44644 100644 --- a/cypress/e2e/share-federated.spec.js +++ b/cypress/e2e/share-federated.spec.js @@ -32,12 +32,9 @@ describe('Federated sharing of office documents', function() { }) cy.openFile(filename) cy.waitForViewer() - cy.waitForCollabora() - - // Validate closing - cy.get('@loleafletframe').within(() => { + cy.waitForCollabora(true, true).within(() => { cy.get('#closebutton').click() + cy.get('#viewer', { timeout: 5000 }).should('not.exist') }) - cy.get('#viewer', { timeout: 5000 }).should('not.exist') }) }) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 08e9e2baea..7f8c31f41e 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -228,9 +228,10 @@ Cypress.Commands.add('waitForViewer', () => { .and('not.have.class', 'icon-loading') }) -Cypress.Commands.add('waitForCollabora', (wrapped = false) => { +Cypress.Commands.add('waitForCollabora', (wrapped = false, federated = false) => { + const wrappedFrameIdentifier = federated ? 'coolframe' : 'documentframe' if (wrapped) { - cy.get('[data-cy="documentframe"]', { timeout: 30000 }) + cy.get(`[data-cy="${wrappedFrameIdentifier}"]`, { timeout: 30000 }) .its('0.contentDocument') .its('body').should('not.be.empty') .should('be.visible').should('not.be.empty') @@ -245,7 +246,13 @@ Cypress.Commands.add('waitForCollabora', (wrapped = false) => { .its('0.contentDocument') .its('body').should('not.be.empty') .as('loleafletframe') - cy.get('@loleafletframe').find('#main-document-content').should('be.visible') + + cy.get('@loleafletframe') + .within(() => { + cy.get('#main-document-content').should('be.visible') + }) + + return cy.get('@loleafletframe') }) Cypress.Commands.add('waitForPostMessage', (messageId, values = undefined) => {