diff options
author | Julien Veyssier <eneiluj@posteo.net> | 2022-01-07 14:58:10 +0300 |
---|---|---|
committer | Julien Veyssier <eneiluj@posteo.net> | 2022-01-07 14:58:10 +0300 |
commit | 6a338dbfd3bcc19bd6f2effc6bf8890ccc5abdb0 (patch) | |
tree | 57a4458316f324935259314a61e77d188afb5bc1 /cypress | |
parent | de69b33a26be0edac009a73a22946e548af7e79a (diff) |
refs #2049 add cypress test for local image upload
Signed-off-by: Julien Veyssier <eneiluj@posteo.net>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/fixtures/table.png | bin | 0 -> 433 bytes | |||
-rw-r--r-- | cypress/integration/images.spec.js | 47 |
2 files changed, 45 insertions, 2 deletions
diff --git a/cypress/fixtures/table.png b/cypress/fixtures/table.png Binary files differnew file mode 100644 index 000000000..96fcef4dc --- /dev/null +++ b/cypress/fixtures/table.png diff --git a/cypress/integration/images.spec.js b/cypress/integration/images.spec.js index de23d2769..251ed6453 100644 --- a/cypress/integration/images.spec.js +++ b/cypress/integration/images.spec.js @@ -22,6 +22,7 @@ import { randHash } from '../utils/' +import 'cypress-file-upload' const randUser = randHash() describe('Open test.md in viewer', function() { @@ -106,13 +107,16 @@ describe('Open test.md in viewer', function() { const popover = cy.get('div#' + popoverId) popover.should('have.class', 'open') cy.get('div#' + popoverId + ' li:nth-child(3)').click() + cy.wait(2000) 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') + .wait(2000) .type('{enter}') - //cy.get('div#' + popoverId + ' li:nth-child(3) form > label').click() + // click on the validation button is an alternative to typing {enter} + // cy.get('div#' + popoverId + ' li:nth-child(3) form > label').click() - cy.wait(4000) + cy.wait(2000) cy.log('Check the image is visible and well formed') const editor = cy.get('#editor .ProseMirror') editor.get('div.image:nth-child(1)') @@ -125,6 +129,45 @@ describe('Open test.md in viewer', function() { .should('contain', '.jpg') }) + cy.screenshot() + }) + + it('Upload a local imagee', function() { + cy.openFile('test.md') + 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(1)').click() + + cy.wait(4000) + cy.get('.menubar input[type="file"]') + .attachFile('table.png') + + 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', 'table.png') + editor.get('div.image:nth-child(1) img').invoke('attr', 'src') + .should('contain', 'apps/text/image?documentId=') + .should('contain', 'imageFileName') + .should('contain', 'table.png') + }) cy.screenshot() }) |