aboutsummaryrefslogtreecommitdiffstats
path: root/cypress
diff options
context:
space:
mode:
authorPytal <24800714+Pytal@users.noreply.github.com>2023-12-06 10:49:54 -0800
committerGitHub <noreply@github.com>2023-12-06 10:49:54 -0800
commit089aec87eccf28897fac733da1436be9f02fe195 (patch)
treef2d37286ce4869aa012fb076c7449bb8e3f5465b /cypress
parent74acfa452f005fc85a011fef431cb2f8f4a2db47 (diff)
parent008ea1bff2c9b152e4c8bdf0c1f9bfbef75ee69b (diff)
downloadnextcloud-server-089aec87eccf28897fac733da1436be9f02fe195.tar.gz
nextcloud-server-089aec87eccf28897fac733da1436be9f02fe195.zip
Merge pull request #42066 from nextcloud/fix/cypress-wait-for-network-requests
fix(cypress): Wait for network requests to finish when using the FilePicker
Diffstat (limited to 'cypress')
-rw-r--r--cypress/e2e/files/files_copy-move.cy.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/cypress/e2e/files/files_copy-move.cy.ts b/cypress/e2e/files/files_copy-move.cy.ts
index a75f16339d4..81108e456a3 100644
--- a/cypress/e2e/files/files_copy-move.cy.ts
+++ b/cypress/e2e/files/files_copy-move.cy.ts
@@ -42,11 +42,16 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
})
it('Can copy a file to new folder', () => {
+ // Prepare initial state
cy.uploadContent(currentUser, new Blob(), 'text/plain', '/original.txt')
.mkdir(currentUser, '/new-folder')
cy.login(currentUser)
cy.visit('/apps/files')
+ // intercept the copy so we can wait for it
+ cy.intercept('COPY', /\/remote.php\/dav\/files\//).as('copyFile')
+
+ // Open actions and trigger copy-move action
getRowForFile('original.txt').should('be.visible')
triggerActionForFile('original.txt', 'move-copy')
@@ -55,6 +60,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 +76,9 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
cy.login(currentUser)
cy.visit('/apps/files')
+ // intercept the copy 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,8 +87,10 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
// click copy
cy.get('.file-picker').contains('button', 'Move to new-folder').should('be.visible').click()
+ cy.wait('@moveFile')
// wait until visible again
getRowForFile('new-folder').should('be.visible')
+
// original should be moved -> not exist anymore
getRowForFile('original.txt').should('not.exist')
getRowForFile('new-folder').should('be.visible').find('[data-cy-files-list-row-name-link]').click()
@@ -93,6 +106,9 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
cy.login(currentUser)
cy.visit('/apps/files')
+ // intercept the copy 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')
@@ -104,8 +120,10 @@ describe('Files: Move or copy files', { testIsolation: true }, () => {
// click move
cy.get('.file-picker').contains('button', 'Move').should('be.visible').click()
+ 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
getRowForFile('original.txt').should('not.exist')