diff options
author | Azul <azul@riseup.net> | 2021-12-30 18:08:52 +0300 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2022-01-03 13:45:25 +0300 |
commit | 17ddab7df008f9b148ce9df8144fd33cd0c8490e (patch) | |
tree | b505ee84917131fafb777e56aa71234765f25c7d | |
parent | f7d57e9abb146301a91cea1ea48231c2b9c0f05b (diff) |
cypress: inspect the viewer in one test
Open the test.md file once and then check all the things.
Signed-off-by: Azul <azul@riseup.net>
-rw-r--r-- | cypress/integration/viewer.spec.js | 43 |
1 files changed, 18 insertions, 25 deletions
diff --git a/cypress/integration/viewer.spec.js b/cypress/integration/viewer.spec.js index 47bfad682..9dc820b9e 100644 --- a/cypress/integration/viewer.spec.js +++ b/cypress/integration/viewer.spec.js @@ -45,39 +45,32 @@ describe('Open test.md in viewer', function() { it('Open the viewer on file click', function() { cy.openFile('test.md') - cy.get('#viewer').should('be.visible') - cy.get('#viewer .modal-title').should('contain', 'test.md') - cy.get('#viewer .modal-header button.action-item__menutoggle').should('be.visible') - cy.get('#viewer .modal-header button.header-close').should('be.visible') - cy.wait(2000) - cy.get('#viewer', { timeout: 4000 }) - .should('be.visible') + 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', 'test.md') + viewer.get('.modal-header button.action-item__menutoggle') + .should('be.visible') - it('Has opened the file', function() { - cy.get('#viewer #editor .ProseMirror').should('contain', 'Hello world') - cy.get('#viewer #editor .ProseMirror h2').should('contain', 'Hello world') - }) + cy.log('Inspect editor') + const editor = viewer.get('#editor .ProseMirror') + editor.should('contain', 'Hello world') + editor.get('h2').should('contain', 'Hello world') + + cy.log('Inspect menubar') + const menubar = editor.get('.menubar .menubar-icons') + menubar.get('.icon-undo').should('be.visible') + menubar.get('.icon-bold').should('be.visible') - it('Shows the menu bar icons', function() { - // FIXME those checks are failing since the parent container is currently at 0x0 size - // due to the way we make the text app be a full screen viewer - // cy.get('#viewer-content #editor .menubar .menubar-icons .icon-undo').should('be.visible') - // cy.get('#viewer-content #editor .menubar .menubar-icons .icon-redo').should('be.visible') - // cy.get('#viewer-content #editor .menubar .menubar-icons .icon-bold').should('be.visible') + cy.screenshot() }) it('Closes the editor', function() { - cy.get('.modal-header button.header-close').click() + cy.openFile('test.md') + cy.get('#viewer .modal-header button.header-close').click() cy.get('#viewer').should('not.exist') }) - - it('Take screenshot', function() { - // gif is impossible to match with existing screenshot - // just taking a screenshot to manually compare if needed - cy.screenshot() - }) }) |