diff options
author | Vinicius Reis <vinicius.reis@nextcloud.com> | 2022-09-03 18:27:36 +0300 |
---|---|---|
committer | Vinicius Reis <vinicius.reis@nextcloud.com> | 2022-09-03 18:27:36 +0300 |
commit | 68ebbc3dfc6a9dfd58c0a1d6b1f29e58cbe96dec (patch) | |
tree | 9f00512b9f0bb01491d8fd523d542d085157ed6f /cypress | |
parent | da4235555775ce889ad39850f1e0275b51b39ff9 (diff) |
🐛 fix missing sharing tokenfix/noid/fix-sharing-folder
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/e2e/share.spec.js | 13 | ||||
-rw-r--r-- | cypress/support/commands.js | 17 |
2 files changed, 19 insertions, 11 deletions
diff --git a/cypress/e2e/share.spec.js b/cypress/e2e/share.spec.js index e8a8aefcf..9493f9f56 100644 --- a/cypress/e2e/share.spec.js +++ b/cypress/e2e/share.spec.js @@ -99,15 +99,16 @@ describe('Open test.md in viewer', function() { cy.shareFile('/folder') .then((token) => { cy.logout() - cy.visit(`/s/${token}`) + + return cy.visit(`/s/${token}`) }) .then(() => { - cy.get('#rich-workspace').should('contain', 'Hello world') + cy.get('#rich-workspace').getContent().should('contain', 'Hello world') cy.openFile('test.md') - cy.get('#editor-container').should('be.visible') - cy.get('#editor .ProseMirror').should('contain', 'Hello world') - cy.get('#editor .ProseMirror h2').should('contain', 'Hello world') - cy.get('.modal-header button.header-close').click() + cy.getModal().getContent().should('be.visible') + cy.getModal().getContent().should('contain', 'Hello world') + cy.getModal().getContent().find('h2').should('contain', 'Hello world') + cy.getModal().find('.modal-header button.header-close').click() cy.get('.modal-mask').should('not.exist') }) }) diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 889745737..576d44289 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -264,8 +264,14 @@ Cypress.Commands.add('deleteFile', fileName => { cy.get(`.files-fileList tr[data-file="${fileName}"]`).should('not.exist') }) -Cypress.Commands.add('getEditor', () => { - return cy.get('[data-text-el="editor-container"]') +Cypress.Commands.add('getModal', () => { + return cy.get('#viewer[data-handler="text"]') +}) + +Cypress.Commands.add('getEditor', { prevSubject: 'optional' }, (subject) => { + return subject + ? cy.wrap(subject).find('[data-text-el="editor-container"]') + : cy.get('[data-text-el="editor-container"]') }) Cypress.Commands.add('getMenu', { prevSubject: 'optional' }, (subject) => { @@ -278,8 +284,9 @@ Cypress.Commands.add('getActionEntry', { prevSubject: 'optional' }, (subject, na .find(`[data-text-action-entry="${name}"]`) }) -Cypress.Commands.add('getContent', () => { - return cy.getEditor().find('.ProseMirror') +Cypress.Commands.add('getContent', { prevSubject: 'optional' }, (subject) => { + return (subject ? cy.wrap(subject) : cy.getEditor()) + .find('.ProseMirror') }) Cypress.Commands.add('getOutline', () => { @@ -296,7 +303,7 @@ Cypress.Commands.add('clearContent', () => { .type('{selectAll}{backspace}', { force: true }) }) -Cypress.Commands.add('openWorkspace', (subject, name) => { +Cypress.Commands.add('openWorkspace', () => { cy.get('#rich-workspace .empty-workspace').click() cy.getEditor().find('[data-text-el="editor-content-wrapper"]').click() |