fix(cypress): Await copy move request to avoid flaky CI

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2024-01-26 16:25:43 +01:00
parent 02432159f5
commit 4b3e6eabab
No known key found for this signature in database
GPG key ID: 45FAE7268762B400

View file

@ -47,6 +47,9 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
cy.login(currentUser)
cy.visit('/apps/files')
// intercept the move so we can wait for it
cy.intercept('COPY', /\/remote.php\/dav\/files\//).as('copyFile')
getRowForFile('original.txt').should('be.visible')
triggerActionForFile('original.txt', 'move-copy')
@ -55,6 +58,9 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
// click copy
cy.get('.file-picker').contains('button', 'Copy to new-folder').should('be.visible').click()
// wait for copy to finish
cy.wait('@copyFile')
getRowForFile('new-folder').find('[data-cy-files-list-row-name-link]').click()
cy.url().should('contain', 'dir=/new-folder')
@ -68,6 +74,9 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
cy.login(currentUser)
cy.visit('/apps/files')
// intercept the move so we can wait for it
cy.intercept('MOVE', /\/remote.php\/dav\/files\//).as('moveFile')
getRowForFile('original.txt').should('be.visible')
triggerActionForFile('original.txt', 'move-copy')
@ -76,6 +85,9 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
// click copy
cy.get('.file-picker').contains('button', 'Move to new-folder').should('be.visible').click()
// wait for move to finish
cy.wait('@moveFile')
// wait until visible again
getRowForFile('new-folder').should('be.visible')
// original should be moved -> not exist anymore
@ -94,7 +106,7 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
cy.login(currentUser)
cy.visit('/apps/files')
// intercept the copy so we can wait for it
// intercept the move so we can wait for it
cy.intercept('MOVE', /\/remote.php\/dav\/files\//).as('moveFile')
getRowForFile('original').should('be.visible')
@ -124,6 +136,9 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
cy.login(currentUser)
cy.visit('/apps/files')
// intercept the move so we can wait for it
cy.intercept('MOVE', /\/remote.php\/dav\/files\//).as('moveFile')
getRowForFile('new-folder').should('be.visible').find('[data-cy-files-list-row-name-link]').click()
cy.url().should('contain', 'dir=/new-folder')
@ -135,6 +150,9 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
// click move
cy.get('.file-picker').contains('button', 'Move').should('be.visible').click()
// wait for move to finish
cy.wait('@moveFile')
// wait until visible again
cy.get('main').contains('No files in here').should('be.visible')
// original should be moved -> not exist anymore