diff options
author | Julien Veyssier <eneiluj@posteo.net> | 2022-01-06 20:12:28 +0300 |
---|---|---|
committer | Julien Veyssier <eneiluj@posteo.net> | 2022-01-07 12:53:14 +0300 |
commit | 0e74b10dd0398414099a010866e9510c16a2e10a (patch) | |
tree | 1245c230bb5b1d887b4d438241d4d4f2dc84ab7b /cypress | |
parent | 3f1813437aeea07d3b60aa95db7489b209376a73 (diff) |
refs #2049 cypress test: insert image from link
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/integration/images.spec.js | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/cypress/integration/images.spec.js b/cypress/integration/images.spec.js index 74407671b..7a17352f1 100644 --- a/cypress/integration/images.spec.js +++ b/cypress/integration/images.spec.js @@ -39,14 +39,14 @@ describe('Open test.md in viewer', function() { cy.login(randUser, 'password') }) - it('See test.md in the list', function() { + it('See test.md in the list and open it', function() { cy.get('#fileList tr[data-file="test.md"]', { timeout: 10000 }) .should('contain', 'test.md') + }) it('Insert an image from files', function() { cy.openFile('test.md') - cy.log('Open submenu') const viewer = cy.get('#viewer') const submenu = viewer.get('.action-item.submenu') @@ -72,8 +72,6 @@ describe('Open test.md in viewer', function() { cy.log('Check the image is visible and well formed') const editor = cy.get('#editor .ProseMirror') - editor.should('contain', 'Hello world') - editor.get('h2').should('contain', 'Hello world') editor.get('div.image') .should('be.visible') .invoke('attr', 'data-src') @@ -88,6 +86,49 @@ describe('Open test.md in viewer', function() { cy.screenshot() }) + it('Insert an image from a link', function() { + cy.openFile('test.md') + cy.log('Open submenu') + const viewer = cy.get('#viewer') + const submenu = viewer.get('.action-item.submenu') + submenu.click() + submenu.should('have.class', 'action-item--open') + + const trigger = submenu.get('.action-item.submenu > div.v-popover > .trigger') + trigger + .should('have.class', 'trigger') + .invoke('attr','aria-describedby') + .should('contain', 'popover_') + .as('popoverId') + + cy.get('@popoverId').then(popoverId => { + cy.log('Click on action entry') + const popover = cy.get('div#' + popoverId) + popover.should('have.class', 'open') + cy.get('div#' + popoverId + ' li:nth-child(3)').click() + cy.log('Type and validate') + cy.get('div#' + popoverId + ' li:nth-child(3) input[type=text]') + .type('https://nextcloud.com/wp-content/themes/next/assets/img/headers/engineering-small.jpg') + .type('{enter}') + //cy.get('div#' + popoverId + ' li:nth-child(3) form > label').click() + + cy.wait(4000) + cy.log('Check the image is visible and well formed') + const editor = cy.get('#editor .ProseMirror') + editor.get('div.image:nth-child(1)') + .should('be.visible') + .invoke('attr', 'data-src') + .should('contain', '.jpg') + editor.get('div.image:nth-child(1) img').invoke('attr', 'src') + .should('contain', 'apps/text/image?documentId=') + .should('contain', 'imageFileName') + .should('contain', '.jpg') + }) + + + cy.screenshot() + }) + it('Closes the editor', function() { cy.openFile('test.md') cy.get('#viewer .modal-header button.header-close').click() |