From 49aec00de8d42634c7d2e8310613f929a183a868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 30 Aug 2023 14:02:58 +0200 Subject: [PATCH] tests(cypress): Add read only code block test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- cypress/e2e/nodes/CodeBlock.spec.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cypress/e2e/nodes/CodeBlock.spec.js b/cypress/e2e/nodes/CodeBlock.spec.js index 22bf3ad7d71..bfa174e37cf 100644 --- a/cypress/e2e/nodes/CodeBlock.spec.js +++ b/cypress/e2e/nodes/CodeBlock.spec.js @@ -62,6 +62,30 @@ describe('Front matter support', function() { }) }) + it.only('Show a code block in a public read only link', function() { + cy.shareFile('/codeblock.md') + .then((token) => { + cy.logout() + cy.visit(`/s/${token}`) + }) + .then(() => { + cy.getEditor().should('be.visible') + // Plain text block + cy.getContent().find('code').eq(0).find('.hljs-keyword').should('not.exist') + + // Javascript block + cy.getContent().find('code').eq(1).find('.hljs-keyword').eq(0).contains('const') + cy.getContent().find('code').eq(1).find('.hljs-string').eq(0).contains('"bar"') + cy.getContent().find('code').eq(1).find('.hljs-keyword').eq(1).contains('function') + + // Mermaid diagram + cy.getContent().find('.split-view__preview').eq(2).should() + cy.get('.code-block').eq(2).find('code').should('not.be.visible') + cy.get('.split-view__preview').find('svg title') + .contains('Order example') + }) + }) + it('Add a code block', function() { cy.isolateTest({ sourceFile: 'codeblock.md' }) cy.openFile('codeblock.md').then(() => {