diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-03-19 15:44:49 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-03-19 16:21:22 +0100 |
commit | 3dc38fa99ffd47010e03feb36c288fa854441d39 (patch) | |
tree | a9f07e7d6728b65c5e01adfefc4bb28e3d41be98 /cypress/e2e/files/FilesUtils.ts | |
parent | f85154f1e1a3bfcf022cd1833a3028ea9c63380e (diff) | |
download | nextcloud-server-test/cypress-flaky.tar.gz nextcloud-server-test/cypress-flaky.zip |
test(cypress): wait for button to be visibletest/cypress-flaky
Instead of just expecting the button in the DOM.
This causes flaky tests with files-renaming.
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'cypress/e2e/files/FilesUtils.ts')
-rw-r--r-- | cypress/e2e/files/FilesUtils.ts | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/cypress/e2e/files/FilesUtils.ts b/cypress/e2e/files/FilesUtils.ts index a24351bd316..c9d93f49c13 100644 --- a/cypress/e2e/files/FilesUtils.ts +++ b/cypress/e2e/files/FilesUtils.ts @@ -36,27 +36,37 @@ const searchForActionInRow = (row: JQuery<HTMLElement>, actionId: string): Cypre export const getActionEntryForFileId = (fileid: number, actionId: string): Cypress.Chainable<JQuery<HTMLElement>> => { // If we cannot find the action in the row, it might be in the action menu return getRowForFileId(fileid).should('be.visible') - .then(row => searchForActionInRow(row, actionId)) + .then((row) => searchForActionInRow(row, actionId)) } export const getActionEntryForFile = (filename: string, actionId: string): Cypress.Chainable<JQuery<HTMLElement>> => { // If we cannot find the action in the row, it might be in the action menu return getRowForFile(filename).should('be.visible') - .then(row => searchForActionInRow(row, actionId)) + .then((row) => searchForActionInRow(row, actionId)) } export const triggerActionForFileId = (fileid: number, actionId: string) => { // Even if it's inline, we open the action menu to get all actions visible getActionButtonForFileId(fileid).click({ force: true }) + // wait for the actions menu to be visible + cy.findByRole('menu').findAllByRole('menuitem').first().should('be.visible') getActionEntryForFileId(fileid, actionId) - .find('button').last() - .should('exist').click({ force: true }) + .find('button').last().as('actionButton') + .scrollIntoView() + cy.get('@actionButton') + .should('be.visible') + .click({ force: true }) } export const triggerActionForFile = (filename: string, actionId: string) => { // Even if it's inline, we open the action menu to get all actions visible getActionButtonForFile(filename).click({ force: true }) + // wait for the actions menu to be visible + cy.findByRole('menu').findAllByRole('menuitem').first().should('be.visible') getActionEntryForFile(filename, actionId) - .find('button').last() - .should('exist').click({ force: true }) + .find('button').last().as('actionButton') + .scrollIntoView() + cy.get('@actionButton') + .should('be.visible') + .click({ force: true }) } export const triggerInlineActionForFileId = (fileid: number, actionId: string) => { |