diff --git a/cypress/e2e/filesUtils.ts b/cypress/e2e/filesUtils.ts index 20230593b..0c15fbf48 100644 --- a/cypress/e2e/filesUtils.ts +++ b/cypress/e2e/filesUtils.ts @@ -55,6 +55,11 @@ export function moveFile (fileName: string, dirName: string) { } export function toggleMenuAction(fileName: string) { - cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${fileName}"] [data-cy-files-list-row-actions] .action-item__menutoggle`).click() - cy.get('[data-cy-files-list-row-action]').should('be.visible') + cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${CSS.escape(fileName)}"] [data-cy-files-list-row-actions]`) + .should('be.visible') + .findByRole('button', { name: 'Actions' }) + .should('be.visible') + .click() + cy.get('[data-cy-files-list-row-action]') + .should('be.visible') } diff --git a/cypress/e2e/sidebarUtils.ts b/cypress/e2e/sidebarUtils.ts index e190ffef2..99cace688 100644 --- a/cypress/e2e/sidebarUtils.ts +++ b/cypress/e2e/sidebarUtils.ts @@ -25,7 +25,10 @@ import { toggleMenuAction } from './filesUtils' function showSidebarForFile(fileName: string) { closeSidebar() toggleMenuAction(fileName) - cy.get('[data-cy-files-list-row-action="details"] button').click() + cy.get('[data-cy-files-list-row-action="details"]') + .should('be.visible') + .findByRole('menuitem') + .click() cy.get('#app-sidebar-vue').should('be.visible') } @@ -74,18 +77,34 @@ export function createPublicShare(fileName: string) { export function addTag(fileName: string, tag: string) { showSidebarForFile(fileName) - cy.get('.app-sidebar-header__menu button').click() - cy.get('.action-button__icon.icon-tag').click() - cy.get('.system-tags input').type(`${tag}{enter}{esc}`) + cy.get('#app-sidebar-vue .app-sidebar-header') + .should('be.visible') + .findByRole('button', { name: 'Actions' }) + .click() - cy.wait(500) + cy.findByRole('menuitem', { name: 'Tags' }) + .should('be.visible') + .click() + + cy.intercept('PUT', '**/remote.php/dav/systemtags-relations/files/**').as('tag') + + cy.findByLabelText('Search or create collaborative tags') + .type(`${tag}{enter}{esc}`) + + cy.wait('@tag') } export function addComment(fileName: string, comment: string) { showSidebarForFile(fileName) - cy.get('#app-sidebar-vue').contains('Activity').click() - cy.get('.comment__editor .rich-contenteditable__input').type(comment) - cy.get('.comment__submit button').click() + cy.get('#app-sidebar-vue') + .findByRole('tab', { name: 'Activity' }) + .click() + + cy.intercept('POST', '**/remote.php/dav/comments/files/*').as('comment') + cy.get('#app-sidebar-vue') + .findByRole('textbox', { name: 'New comment' }) + .should('be.visible') + .type(`{selectAll}${comment}{enter}`) - cy.wait(500) + cy.wait('@comment') } diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 8227c1bf7..7e4f7233c 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -22,6 +22,8 @@ /* eslint-disable n/no-unpublished-import */ import { addCommands } from '@nextcloud/cypress' +import '@testing-library/cypress/add-commands' + // Add custom commands import 'cypress-wait-until' addCommands() diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index de9a4309e..20bddf2b7 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -3,6 +3,7 @@ "include": ["./**/*.ts"], "compilerOptions": { "types": [ + "@testing-library/cypress", "cypress", "dockerode", "node"