diff --git a/cypress/e2e/nodes/ImageView.spec.js b/cypress/e2e/nodes/ImageView.spec.js index eab983f4ec6..4432869de97 100644 --- a/cypress/e2e/nodes/ImageView.spec.js +++ b/cypress/e2e/nodes/ImageView.spec.js @@ -85,8 +85,8 @@ describe('Image View', () => { }) it('with preview', () => { - cy.get('.files-fileList tr[data-file="github.png"]') - .should('have.attr', 'data-id') + cy.getFile('github.png') + .should('have.attr', 'data-cy-files-list-row-fileid') .then(imageId => { const fileName = `${Cypress.currentTest.title}.md` diff --git a/cypress/e2e/viewer.spec.js b/cypress/e2e/viewer.spec.js index 0499cf0397d..020f39cd42d 100644 --- a/cypress/e2e/viewer.spec.js +++ b/cypress/e2e/viewer.spec.js @@ -36,7 +36,7 @@ describe('Open test.md in viewer', function() { }) it('See test.md in the list', function() { - cy.get('.files-fileList tr[data-file="test.md"]', { timeout: 10000 }) + cy.getFile('test.md') .should('contain', 'test.md') }) diff --git a/cypress/e2e/workspace.spec.js b/cypress/e2e/workspace.spec.js index 0997dca6cfc..d087002f6fd 100644 --- a/cypress/e2e/workspace.spec.js +++ b/cypress/e2e/workspace.spec.js @@ -44,7 +44,7 @@ describe('Workspace', function() { cy.uploadFile('test.md', 'text/markdown', `${currentFolder}/README.md`) cy.createFolder(`${currentFolder}/subdirectory`) cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`) - cy.get('.files-fileList').should('contain', 'README.md') + cy.getFile('README.md').should('contain', 'README.md') cy.get('#rich-workspace .ProseMirror') .should('contain', 'Hello world') cy.openFolder('subdirectory') @@ -56,7 +56,7 @@ describe('Workspace', function() { it('Hides the workspace when switching to another view', function() { cy.uploadFile('test.md', 'text/markdown', `${currentFolder}/README.md`) cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`) - cy.get('.files-fileList').should('contain', 'README.md') + cy.getFile('README.md').should('contain', 'README.md') cy.get('#rich-workspace .ProseMirror') .should('contain', 'Hello world') cy.get('a[href*="/apps/files/recent"]') @@ -71,7 +71,7 @@ describe('Workspace', function() { .as('addDescription') cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`) - cy.get('.files-fileList').should('not.contain', 'Readme.md') + cy.getFile('README.md').should('not.contain', 'Readme.md') cy.get('.files-controls').first().within(() => { cy.get('.button.new').click() @@ -133,7 +133,7 @@ describe('Workspace', function() { it('takes README.md into account', function() { cy.uploadFile('test.md', 'text/markdown', `${Cypress.currentTest.title}/README.md`) cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`) - cy.get('.files-fileList').should('contain', 'README.md') + cy.getFile('README.md').should('contain', 'README.md') cy.get('#rich-workspace .ProseMirror') .should('contain', 'Hello world') }) @@ -250,7 +250,7 @@ describe('Workspace', function() { cy.modifyUser(user, 'language', 'de_DE') cy.uploadFile('test.md', 'text/markdown', `${Cypress.currentTest.title}/Anleitung.md`) cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`) - cy.get('.files-fileList').should('contain', 'Anleitung.md') + cy.getFile('Anleitung.md').should('contain', 'Anleitung.md') cy.get('#rich-workspace .ProseMirror') .should('contain', 'Hello world') }) @@ -259,7 +259,7 @@ describe('Workspace', function() { cy.modifyUser(user, 'language', 'fr') cy.uploadFile('test.md', 'text/markdown', `${Cypress.currentTest.title}/Anleitung.md`) cy.visit(`apps/files?dir=/${encodeURIComponent(currentFolder)}`) - cy.get('.files-fileList').should('contain', 'Anleitung.md') + cy.getFile('Anleitung.md').should('contain', 'Anleitung.md') }) }) @@ -303,10 +303,8 @@ describe('Workspace', function() { }) const openSidebar = filename => { - cy.get(`.files-fileList tr[data-file="${filename}"]`) - .should('contain', filename) - cy.get(`.files-fileList tr[data-file="${filename}"] .icon-more`).click() - cy.get(`.files-fileList tr[data-file="${filename}"] .icon-details`).click() + cy.getFile(filename).should('contain', filename) + cy.getFile(filename).find('.files-list__row-mtime').click() cy.get('.app-sidebar-header').should('contain', filename) } diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 16907181806..701c3f8b671 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -314,9 +314,9 @@ Cypress.Commands.add('getFile', fileName => { }) Cypress.Commands.add('deleteFile', fileName => { - cy.get(`.files-fileList tr[data-file="${fileName}"] a.name .action-menu`).click() - cy.get(`.files-fileList tr[data-file="${fileName}"] a.name + .popovermenu .action-delete`).click() - cy.get(`.files-fileList tr[data-file="${fileName}"]`).should('not.exist') + cy.get(`[data-cy-files-list] tr[data-cy-files-list-row-name="${fileName}"] .files-list__row-actions butotn`).click() + cy.get(`.files-list__row-action-delete button`).click() + cy.get(`[data-cy-files-list] tr[data-cy-files-list-row-name="${fileName}"]`).should('not.exist') }) Cypress.Commands.add('getModal', () => {