diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-06-09 10:23:16 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2022-06-09 10:35:56 +0300 |
commit | 5b33a9b83949617a6fc49eb44cf743e6e8a0a0c8 (patch) | |
tree | c3e8df9c77388105b2fdcbde497ff2948c1416cd /cypress | |
parent | 5e925250938ecf2716d786ed4811d2c49a8cb061 (diff) |
Add test for 0 byte file
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'cypress')
-rw-r--r-- | cypress/e2e/viewer.spec.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cypress/e2e/viewer.spec.js b/cypress/e2e/viewer.spec.js index ca5bc4a3f..769337373 100644 --- a/cypress/e2e/viewer.spec.js +++ b/cypress/e2e/viewer.spec.js @@ -31,6 +31,7 @@ describe('Open test.md in viewer', function() { // Upload test files cy.uploadFile('test.md', 'text/markdown') + cy.uploadFile('empty.md', 'text/markdown') }) beforeEach(function() { @@ -66,6 +67,29 @@ describe('Open test.md in viewer', function() { cy.screenshot() }) + it('Open an empty file', function() { + cy.openFile('empty.md') + + cy.log('Inspect viewer') + const viewer = cy.get('#viewer') + viewer.should('be.visible') + .and('have.class', 'modal-mask') + .and('not.have.class', 'icon-loading') + viewer.get('.modal-title').should('contain', 'empty.md') + viewer.get('.modal-header button.action-item__menutoggle') + .should('be.visible') + + cy.log('Inspect editor') + const editor = viewer.get('#editor .ProseMirror') + editor.should('contain', '') + + cy.log('Inspect menubar') + cy.getActionEntry('undo').should('be.visible') + cy.getActionEntry('bold').should('be.visible') + + cy.screenshot() + }) + it('Closes the editor', function() { cy.openFile('test.md') cy.get('#viewer .modal-header button.header-close').click() |