From fa6a178e61e3912c59e0738434e48bde0e3e746e Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Mon, 1 Jul 2024 11:54:12 +0200 Subject: [PATCH] [SP] e2e test for layout selector (#19196) * [SP] e2e test for layout selector GitOrigin-RevId: 233f17dc27811d7b66e76e927e58667d6df42122 --- server-ce/test/editor.spec.ts | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/server-ce/test/editor.spec.ts b/server-ce/test/editor.spec.ts index 292691cafc..beaa0cf844 100644 --- a/server-ce/test/editor.spec.ts +++ b/server-ce/test/editor.spec.ts @@ -295,6 +295,64 @@ describe('editor', () => { }) }) }) + + describe('layout selector', () => { + let projectId: string + beforeEach(() => { + login('user@example.com') + cy.visit(`/project`) + createProject(`project-${uuid()}`, { type: 'Example Project' }) + }) + + it('show editor only and switch between editor and pdf', () => { + cy.get('.pdf-viewer').should('be.visible') + cy.get('.cm-editor').should('be.visible') + + cy.findByText('Layout').click() + cy.findByText('Editor only').click() + + cy.get('.pdf-viewer').should('not.exist') + cy.get('.cm-editor').should('be.visible') + + cy.findByText('Switch to PDF').click() + + cy.get('.pdf-viewer').should('be.visible') + cy.get('.cm-editor').should('not.be.visible') + + cy.findByText('Switch to editor').click() + + cy.get('.pdf-viewer').should('not.exist') + cy.get('.cm-editor').should('be.visible') + }) + + it('show PDF only and go back to Editor & PDF', () => { + cy.get('.pdf-viewer').should('be.visible') + cy.get('.cm-editor').should('be.visible') + + cy.findByText('Layout').click() + cy.findByText('PDF only').click() + + cy.get('.pdf-viewer').should('be.visible') + cy.get('.cm-editor').should('not.be.visible') + + cy.findByText('Layout').click() + cy.findByText('Editor & PDF').click() + + cy.get('.pdf-viewer').should('be.visible') + cy.get('.cm-editor').should('be.visible') + }) + + it('PDF in a separate tab (tests editor only)', () => { + cy.get('.pdf-viewer').should('be.visible') + cy.get('.cm-editor').should('be.visible') + + cy.findByText('Layout').click() + cy.findByText('PDF in separate tab').click() + + cy.get('.pdf-viewer').should('not.exist') + cy.get('.cm-editor').should('be.visible') + }) + }) }) function createRandomLetterString() {