Skip to content

Commit

Permalink
Add intercepts and waits to cypress functions to avoid timing failures
Browse files Browse the repository at this point in the history
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed Dec 5, 2023
1 parent 2cf965e commit 9d54fd2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cypress/e2e/groupfoldersUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,23 @@ export function fileOrFolderDoesNotExistInTrashbin(name: string) {
}

export function enterFolder(name: string) {
cy.intercept({ times: 1, method: 'PROPFIND', url: `**/dav/files/**/${name}` }).as('propFindFolder')
cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${name}"]`).click()
cy.wait('@propFindFolder')
}

export function enterFolderInTrashbin(name: string) {
cy.intercept({ times: 1, method: 'PROPFIND', url: `**/dav/files_trashbin/**/${name}.d*` }).as('propFindFolder')
cy.get(`[data-cy-files-list] [data-cy-files-list-row-name^="${name}.d"]`).click()
cy.wait('@propFindFolder')
}

export function deleteFile(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"]`).scrollIntoView()
cy.get(`[data-cy-files-list] [data-cy-files-list-row-action="delete"]`).click()
cy.wait('@delete')
}

export function restoreFile(name: string) {
Expand Down

0 comments on commit 9d54fd2

Please sign in to comment.