Skip to content

Commit 22e1a57

Browse files
Claudejuliusknorr
andcommitted
Add waitForPostMessage and visibility checks to open.spec.js tests
Co-authored-by: juliusknorr <3404133+juliusknorr@users.noreply.github.com>
1 parent a8ad5b6 commit 22e1a57

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

cypress/e2e/open.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ describe('Open existing office files', function() {
6565
cy.waitForViewer()
6666
cy.waitForCollabora()
6767

68+
cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })
69+
70+
// Wait for document to be fully loaded before verifying
6871
cy.screenshot('open-file_' + filename)
6972
cy.get('@loleafletframe').within(() => {
73+
cy.get('input#document-name-input', { timeout: 10000 }).should('be.visible')
7074
cy.verifyOpen(filename)
7175
})
7276
// FIXME: wait for sidebar tab content
@@ -113,6 +117,12 @@ describe('Open PDF with richdocuments', () => {
113117
// Verify that using the file action 'Edit with Nextcloud Office'
114118
// opens the file using richdocuments
115119
it('Open PDF with richdocuments', () => {
120+
cy.visit('/apps/files', {
121+
onBeforeLoad(win) {
122+
cy.spy(win, 'postMessage').as('postMessage')
123+
},
124+
})
125+
116126
cy.get('[data-cy-files-list-row-name="document.pdf"]').as('pdf')
117127
cy.get('@pdf').find('.action-items').as('actions')
118128

@@ -123,8 +133,11 @@ describe('Open PDF with richdocuments', () => {
123133
cy.waitForViewer()
124134
cy.waitForCollabora()
125135

136+
cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })
137+
126138
// Verify that the correct file is open
127139
cy.get('@loleafletframe').within(() => {
140+
cy.get('input#document-name-input', { timeout: 10000 }).should('be.visible')
128141
cy.verifyOpen('document.pdf')
129142
})
130143

0 commit comments

Comments
 (0)