diff --git a/cypress/e2e/print.spec.js b/cypress/e2e/print.spec.js index 34b1bb94614..1de7078792b 100644 --- a/cypress/e2e/print.spec.js +++ b/cypress/e2e/print.spec.js @@ -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') 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') + }) }) }) diff --git a/cypress/snapshots/base/print.spec.js/print view in single-file share.png b/cypress/snapshots/base/print.spec.js/print view in single-file share.png new file mode 100644 index 00000000000..4f3dacadbeb Binary files /dev/null and b/cypress/snapshots/base/print.spec.js/print view in single-file share.png differ diff --git a/cypress/snapshots/base/print.spec.js/print view in viewer.png b/cypress/snapshots/base/print.spec.js/print view in viewer.png new file mode 100644 index 00000000000..f891d9873ef Binary files /dev/null and b/cypress/snapshots/base/print.spec.js/print view in viewer.png differ diff --git a/cypress/snapshots/base/print.spec.js/print.md.png b/cypress/snapshots/base/print.spec.js/print.md.png deleted file mode 100644 index 7d61b0b9b39..00000000000 Binary files a/cypress/snapshots/base/print.spec.js/print.md.png and /dev/null differ