Skip to content

Commit

Permalink
fixup! test(cypress): Add simple federated editing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juliushaertl committed Aug 20, 2024
1 parent 16eb17a commit 06234fa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
7 changes: 2 additions & 5 deletions cypress/e2e/share-federated.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
})
13 changes: 10 additions & 3 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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) => {
Expand Down

0 comments on commit 06234fa

Please sign in to comment.