From 1bb601f24a3775ad4560b7a39e8b9e4bb837dfb9 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Fri, 6 Sep 2024 18:07:01 +0200 Subject: [PATCH] test: Adjust Cypress tests for new public share UI Signed-off-by: Ferdinand Thiessen --- cypress/e2e/sharing/download-share.cy.ts | 2 +- cypress/e2e/sharing/files-shares.cy.ts | 2 +- cypress/support/commands.ts | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cypress/e2e/sharing/download-share.cy.ts b/cypress/e2e/sharing/download-share.cy.ts index faed8d555..21c147820 100644 --- a/cypress/e2e/sharing/download-share.cy.ts +++ b/cypress/e2e/sharing/download-share.cy.ts @@ -67,7 +67,7 @@ describe(`Download ${fileName} from viewer in link share`, function() { }) it('Open the viewer on file click', function() { - cy.openFileInShare('image1.jpg') + cy.openFile('image1.jpg') cy.get('body > .viewer').should('be.visible') }) diff --git a/cypress/e2e/sharing/files-shares.cy.ts b/cypress/e2e/sharing/files-shares.cy.ts index 0488c6914..15d9fac69 100644 --- a/cypress/e2e/sharing/files-shares.cy.ts +++ b/cypress/e2e/sharing/files-shares.cy.ts @@ -69,7 +69,7 @@ describe('See shared folder with link share', function() { }) it('Open the viewer on file click', function() { - cy.openFileInShare('image1.jpg') + cy.openFile('image1.jpg') cy.get('body > .viewer').should('be.visible') }) diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 25027f89d..2809143fd 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -28,7 +28,7 @@ import { addCompareSnapshotCommand } from 'cypress-visual-regression/dist/comman addCommands() addCompareSnapshotCommand() -const url = Cypress.config('baseUrl').replace(/\/index.php\/?$/g, '') +const url = Cypress.config('baseUrl')!.replace(/\/index.php\/?$/g, '') Cypress.env('baseUrl', url) /** @@ -97,8 +97,10 @@ Cypress.Commands.add('openFile', fileName => { cy.wait(250) }) -Cypress.Commands.add('openFileInShare', fileName => { - cy.get(`.files-fileList tr[data-file="${CSS.escape(fileName)}"] a.name`).click() +Cypress.Commands.add('openFileInSingleShare', () => { + cy.get('tr[data-cy-files-list-row-name]') + .should('have.length', 1) + .click() // eslint-disable-next-line cy.wait(250) })