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(ci): Wait for preview to load to avoid 423 errors when deleting file #2806

Merged
merged 1 commit into from
Feb 5, 2024
Merged
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
5 changes: 3 additions & 2 deletions cypress/e2e/groupfolders.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
createGroupFolder,
deleteGroupFolder,
deleteFile,
deleteFolder,
enableACLPermissions,
enterFolder,
enterFolderInTrashbin,
Expand Down Expand Up @@ -126,7 +127,7 @@ describe('Groupfolders ACLs and trashbin behavior', () => {
cy.visit('/apps/files')
enterFolder(groupFolderName)
enterFolder('subfolder1')
deleteFile('subfolder2')
deleteFolder('subfolder2')

// User1 sees it in trash
cy.logout()
Expand Down Expand Up @@ -186,7 +187,7 @@ describe('Groupfolders ACLs and trashbin behavior', () => {
cy.login(managerUser)
cy.visit('/apps/files')
enterFolder(groupFolderName)
deleteFile('subfolder1')
deleteFolder('subfolder1')

// User1 sees it in trash
cy.login(user1)
Expand Down
16 changes: 16 additions & 0 deletions cypress/e2e/groupfoldersUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,24 @@ export function enterFolderInTrashbin(name: string) {
cy.wait('@propFindFolder')
}

export function deleteFolder(name: string) {
cy.intercept({ times: 1, method: 'DELETE', url: `**/dav/files/**/${name}` }).as('delete')
cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${name}"] [data-cy-files-list-row-actions]`).click()
cy.get(`[data-cy-files-list] [data-cy-files-list-row-action="delete"]`).should('be.visible')
cy.get(`[data-cy-files-list] [data-cy-files-list-row-action="delete"]`).scrollIntoView()
cy.get(`[data-cy-files-list] [data-cy-files-list-row-action="delete"]`).click()
cy.wait('@delete').its('response.statusCode').should('eq', 204)
}

export function deleteFile(name: string) {
cy.intercept({ times: 1, method: 'DELETE', url: `**/dav/files/**/${name}` }).as('delete')
// For files wait for preview to load and release lock
cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${name}"] .files-list__row-icon img`)
.should('be.visible')
.and(($img) => {
// "naturalWidth" and "naturalHeight" are set when the image loads
expect($img[0].naturalWidth, 'image has natural width').to.be.greaterThan(0)
})
cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${name}"] [data-cy-files-list-row-actions]`).click()
cy.get(`[data-cy-files-list] [data-cy-files-list-row-action="delete"]`).should('be.visible')
cy.get(`[data-cy-files-list] [data-cy-files-list-row-action="delete"]`).scrollIntoView()
Expand Down
Loading