Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cypress): Wait for network requests to finish when using the FilePicker #42066

Merged
merged 1 commit into from
Dec 6, 2023
Merged
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
fix(cypress): Wait for network requests to finish when using the File…
…Picker

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Dec 6, 2023
commit 008ea1bff2c9b152e4c8bdf0c1f9bfbef75ee69b
18 changes: 18 additions & 0 deletions cypress/e2e/files/files_copy-move.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand All @@ -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')
Expand All @@ -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')

Expand All @@ -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()
Expand All @@ -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')

Expand All @@ -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')

Expand Down
Loading