Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export default defineConfig({
viewportHeight: 720,
chromeWebSecurity: false,
modifyObstructiveCode: false,
retries: {
runMode: 2,
openMode: 0,
},
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,17 @@ describe('Nextcloud integration', function() {
.should('be.visible')

cy.get('button[aria-label="File"]').click()
cy.get('button[aria-label="Save As"]')
.should('be.visible', { timeout: 10_000 })
cy.get('button[aria-label="Save As"]', { timeout: 10_000 })
.should('be.visible')
.click()

cy.get('#saveas-entries > div')
cy.get('#saveas-entries > div', { timeout: 10_000 })
.contains('Rich Text (.rtf)')
.should('be.visible')
.click()
})

cy.get('.saveas-dialog').should('be.visible')
cy.get('.saveas-dialog', { timeout: 10_000 }).should('be.visible')
cy.get('.saveas-dialog input[type=text]')
.should('be.visible')
.should('have.value', `/${exportFilename}`)
Expand All @@ -96,9 +96,9 @@ describe('Nextcloud integration', function() {
cy.waitForPostMessage('Action_Save_Resp', { success: true, fileName: exportFilename })

cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
cy.get('#closebutton', { timeout: 10000 }).should('be.visible').click()
})
cy.waitForViewerClose()

cy.openFile(exportFilename)
})
Expand Down
26 changes: 17 additions & 9 deletions cypress/e2e/open.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ describe('Open existing office files', function() {

cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })

// Share action
cy.wait(2000)
// Wait for document to be fully loaded before verifying
cy.get('@loleafletframe').within(() => {
cy.get('input#document-name-input', { timeout: 10000 }).should('be.visible')
cy.verifyOpen(filename)
})

Expand All @@ -65,8 +65,12 @@ describe('Open existing office files', function() {
cy.waitForViewer()
cy.waitForCollabora()

cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })

// Wait for document to be fully loaded before verifying
cy.screenshot('open-file_' + filename)
cy.get('@loleafletframe').within(() => {
cy.get('input#document-name-input', { timeout: 10000 }).should('be.visible')
cy.verifyOpen(filename)
})
// FIXME: wait for sidebar tab content
Expand Down Expand Up @@ -106,18 +110,19 @@ describe('Open PDF with richdocuments', () => {
// Verify Collabora is not being used
cy.get('[data-cy="coolframe"]').should('not.exist')

// Verify the files PDF viewer is being used
cy.get('.viewer__file--active')
.its('0.contentDocument')
.its('body').should('not.be.empty')
.as('pdfViewer')

cy.get('@pdfViewer').find('.pdfViewer').should('exist')
// Verify the viewer is active without Collabora (PDF viewer or similar)
cy.get('.viewer__file--active').should('exist')
})

// Verify that using the file action 'Edit with Nextcloud Office'
// opens the file using richdocuments
it('Open PDF with richdocuments', () => {
cy.visit('/apps/files', {
onBeforeLoad(win) {
cy.spy(win, 'postMessage').as('postMessage')
},
})

cy.get('[data-cy-files-list-row-name="document.pdf"]').as('pdf')
cy.get('@pdf').find('.action-items').as('actions')

Expand All @@ -128,8 +133,11 @@ describe('Open PDF with richdocuments', () => {
cy.waitForViewer()
cy.waitForCollabora()

cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })

// Verify that the correct file is open
cy.get('@loleafletframe').within(() => {
cy.get('input#document-name-input', { timeout: 10000 }).should('be.visible')
cy.verifyOpen('document.pdf')
})

Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/share-federated.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ describe('Federated sharing of office documents', function() {
cy.openFile(filename)
cy.waitForViewer()
cy.waitForCollabora(true, true).within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
cy.get('#closebutton', { timeout: 10000 }).should('be.visible').click()
})
cy.waitForViewerClose()
})

it.skip('Open a remotely shared file as a link', function() {
Expand Down Expand Up @@ -80,9 +80,9 @@ describe('Federated sharing of office documents', function() {
cy.openFile(filename)
cy.waitForViewer()
cy.waitForCollabora(true, true).within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
cy.get('#closebutton', { timeout: 10000 }).should('be.visible').click()
})
cy.waitForViewerClose()
})
})
})
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/share-internal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ describe('File sharing of office documents', function() {

// Validate closing
cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
cy.get('#closebutton', { timeout: 10000 }).should('be.visible').click()
})
cy.waitForViewerClose()
})

it('Open a shared file as readonly', function() {
Expand All @@ -60,8 +60,8 @@ describe('File sharing of office documents', function() {

// Validate closing
cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
cy.get('#closebutton', { timeout: 10000 }).should('be.visible').click()
})
cy.waitForViewerClose()
})
})
4 changes: 2 additions & 2 deletions cypress/e2e/share-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function waitForCollabora() {
cy.waitForPostMessage('App_LoadingStatus', { Status: 'Document_Loaded' })

cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()
cy.waitForViewerClose()
cy.get('#closebutton', { timeout: 10000 }).should('be.visible').click()
})
cy.waitForViewerClose()
}
24 changes: 13 additions & 11 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ Cypress.Commands.add('shareLink', (user, path, shareData = {}) => {
})

Cypress.Commands.add('openFile', fileName => {
cy.get(`[data-cy-files-list] tr[data-cy-files-list-row-name="${fileName}"] [data-cy-files-list-row-name-link]`).click()
cy.get(`[data-cy-files-list] tr[data-cy-files-list-row-name="${fileName}"] [data-cy-files-list-row-name-link]`, { timeout: 10000 })
.should('be.visible')
.click()
})

Cypress.Commands.add('nextcloudEnableApp', (appId) => {
Expand Down Expand Up @@ -238,7 +240,7 @@ Cypress.Commands.add('nextcloudTestingAppConfigSet', (appId, configKey, configVa
})

Cypress.Commands.add('waitForViewer', () => {
cy.get('#viewer', { timeout: 50000 })
cy.get('#viewer', { timeout: 60000 })
.should('be.visible')
.and('have.class', 'modal-mask')
.and('not.have.class', 'icon-loading')
Expand All @@ -252,16 +254,16 @@ Cypress.Commands.add('waitForViewerClose', () => {
Cypress.Commands.add('waitForCollabora', (wrapped = false, federated = false) => {
const wrappedFrameIdentifier = federated ? 'coolframe' : 'documentframe'
if (wrapped) {
cy.get(`[data-cy="${wrappedFrameIdentifier}"]`, { timeout: 30000 })
cy.get(`[data-cy="${wrappedFrameIdentifier}"]`, { timeout: 60000 })
.its('0.contentDocument')
.its('body').should('not.be.empty')
.should('be.visible').should('not.be.empty')
.as('collaboraframe')
}

const coolFrame = wrapped
? cy.get('@collaboraframe').find('[data-cy="coolframe"]', { timeout: 30000 })
: cy.get('[data-cy="coolframe"]')
? cy.get('@collaboraframe').find('[data-cy="coolframe"]', { timeout: 60000 })
: cy.get('[data-cy="coolframe"]', { timeout: 60000 })

coolFrame
.its('0.contentDocument')
Expand All @@ -270,7 +272,7 @@ Cypress.Commands.add('waitForCollabora', (wrapped = false, federated = false) =>

cy.get('@loleafletframe')
.within(() => {
cy.get('#main-document-content').should('be.visible')
cy.get('#main-document-content', { timeout: 30000 }).should('be.visible')
})

return cy.get('@loleafletframe')
Expand Down Expand Up @@ -323,10 +325,10 @@ Cypress.Commands.add('inputCollaboraGuestName', (guestName = 'cloud') => {

Cypress.Commands.add('closeDocument', () => {
cy.get('@loleafletframe').within(() => {
cy.get('#closebutton').click()
cy.get('#closebutton', { timeout: 10000 }).should('be.visible').click()
})

cy.get('#viewer', { timeout: 5000 }).should('not.exist')
cy.get('#viewer', { timeout: 10000 }).should('not.exist')
})

Cypress.Commands.add('verifyOpen', (filename) => {
Expand Down Expand Up @@ -476,17 +478,17 @@ Cypress.Commands.add('makeTalkRoomPublic', (user, token, password = '') => {
})

Cypress.Commands.add('newFileFromMenu', (fileType = 'document', fileName = 'MyNewFile') => {
cy.get('form[data-cy-upload-picker=""]')
cy.get('form[data-cy-upload-picker=""]', { timeout: 10000 })
.first()
.should('be.visible')
.click()

cy.get('button[role="menuitem"]')
cy.get('button[role="menuitem"]', { timeout: 10000 })
.contains('New ' + fileType)
.should('be.visible')
.click()

cy.get('input[data-cy-files-new-node-dialog-input=""]')
cy.get('input[data-cy-files-new-node-dialog-input=""]', { timeout: 10000 })
.should('be.visible')
.type(fileName + '{enter}')
})
Loading