Skip to content

Commit

Permalink
tests(cypress): Add read only code block test
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Sep 6, 2023
1 parent 468edd4 commit ff3ea00
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions cypress/e2e/nodes/CodeBlock.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,31 @@ 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.get('#app-content').scrollTo('bottom')
cy.getContent().find('.split-view__preview').eq(2).should('be.visible')
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(() => {
Expand Down

0 comments on commit ff3ea00

Please sign in to comment.