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 4501ba0 commit c87c2b4
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 @@ -24,23 +24,45 @@
import { initUserAndFiles, randUser } from '../utils/index.js'
const user = randUser()

describe('Open print.md from viewer', function() {
describe('Open print.md and compare print view', function() {
const getViewer = () => cy.get('#viewer')

Check failure on line 28 in cypress/e2e/print.spec.js

View workflow job for this annotation

GitHub Actions / eslint

'getViewer' is assigned a value but never used

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')
.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').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 c87c2b4

Please sign in to comment.