Skip to content

Commit

Permalink
test(cypress): Add test to visually compare print view in single-file…
Browse files Browse the repository at this point in the history
… share

Visually compare print view of long document in single-file share.

Signed-off-by: Jonas <[email protected]>
  • Loading branch information
mejo- committed Nov 29, 2023
1 parent 9af378d commit 624651e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions cypress/e2e/print.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,40 @@ const user = randUser()
describe('Open print.md and compare print view', function() {
before(function() {
initUserAndFiles(user, 'print.md')
})
beforeEach(function() {
cy.login(user)
cy.visit('/apps/files')
})

it('Renders print view', function() {
it('Renders print view in viewer', function() {
cy.openFile('print.md')
cy.setCssMedia('print')

cy.getEditor().should('be.visible')
cy.getContent()
.get('h1').should('contain', 'Print test')
.get('h1:not(.hidden-visually)').should('contain', 'Print test')
.should('be.visible')

cy.compareSnapshot('print.md', { capture: 'fullPage' })
cy.compareSnapshot('print view in viewer', { capture: 'fullPage' })
cy.setCssMedia('screen')
})

it('Renders print view in single-file share', function() {
cy.shareFile('/print.md', { edit: true })
.then((token) => {
cy.logout()
cy.visit(`/s/${token}`)
cy.setCssMedia('print')
})
.then(() => {
cy.getEditor().should('be.visible')
cy.getContent()
.get('h1:not(.hidden-visually)').should('contain', 'Print test')
.should('be.visible')

cy.compareSnapshot('print view in single-file share', { capture: 'fullPage' })
cy.setCssMedia('screen')
})
})
})
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed cypress/snapshots/base/print.spec.js/print.md.png
Binary file not shown.

0 comments on commit 624651e

Please sign in to comment.