test(cypress): Wait for App_LoadingStatus

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2024-04-30 08:12:00 +02:00
parent e6b62d8fbc
commit 6db0245011
No known key found for this signature in database
GPG key ID: 4C614C6ED2CDE6DF
3 changed files with 17 additions and 12 deletions

View file

@ -51,12 +51,11 @@ describe('Open existing office files', function() {
cy.waitForViewer()
cy.waitForCollabora()
cy.screenshot('open-file_' + filename)
cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })
// Share action
cy.get('@loleafletframe').within(() => {
cy.get('#main-menu #menu-file > a').click()
cy.wait(1000)
cy.get('#main-menu #menu-shareas > a').should('be.visible').click()
})

View file

@ -53,15 +53,7 @@ describe('Public sharing of office documents', function() {
})
cy.waitForCollabora()
cy.get('@postMessage', { timeout: 20000 }).should(spy => {
const calls = spy.getCalls()
const findMatchingCall = calls.find(call => call.args[0].indexOf('"MessageId":"App_LoadingStatus"') !== -1)
if (!findMatchingCall) {
return expect(findMatchingCall).to.not.be.undefined
}
const object = JSON.parse(findMatchingCall.args[0])
expect(object.Values).to.have.property('Status', 'Initialized')
})
cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })
cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()

View file

@ -223,7 +223,21 @@ Cypress.Commands.add('waitForCollabora', (wrapped = false) => {
.as('loleafletframe')
cy.get('@loleafletframe').find('#main-document-content').should('be.visible')
})
Cypress.Commands.add('waitForPostMessage', (messageId, values = undefined) => {
cy.get('@postMessage', { timeout: 20000 }).should(spy => {
const calls = spy.getCalls()
const findMatchingCall = calls.find(call => call.args[0].indexOf('"MessageId":"' + messageId + '"') !== -1)
if (!findMatchingCall) {
return expect(findMatchingCall).to.not.be.undefined
}
if (!values) {
const object = JSON.parse(findMatchingCall.args[0])
values.forEach(value => {
expect(object.Values).to.have.property(value, values[value])
})
}
})
})
Cypress.Commands.add('uploadSystemTemplate', () => {
cy.login(new User('admin', 'admin'))
cy.visit('/settings/admin/richdocuments')