-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathmarkdown.spec.js
More file actions
46 lines (36 loc) · 2.51 KB
/
markdown.spec.js
File metadata and controls
46 lines (36 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
describe('Node-RED Dashboard 2.0 - Markdown', () => {
beforeEach(() => {
cy.deployFixture('dashboard-markdown')
cy.visit('/dashboard/page1')
})
it('will render static markdown', () => {
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-static').should('exist')
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-static').find('h1').should('have.text', 'Static Markdown')
})
// this markdown node has dynamic markdown, with static mermaid
it('allow for dynamic markdown content and static mermaid charts', () => {
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-1').should('exist')
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-1').find('h1').should('have.text', 'Injected Payload Value')
cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-button-str'))
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-1').should('contain.text', 'Injected content: Hello World')
cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-button-num'))
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-1').should('contain.text', 'Injected content: 5')
cy.reloadDashboard()
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-1').should('contain.text', 'Injected content: 5')
})
// this markdown node has a full mermaid chart defined on msg.payload
it('allow for full mermaid charts to be defined by msg', () => {
// Mermaid renders asynchronously and can take longer than Cypress's 4s default on slower
// or busy systems, so extend the timeout on the SVG-node assertions specifically.
const MERMAID_TIMEOUT = 30000
cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-button-graph-E'))
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-2').find('.nodes .node', { timeout: MERMAID_TIMEOUT }).should('have.length', 5)
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-2').find('.nodes .node').eq(4).should('have.text', 'E')
cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-button-graph-F'))
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-2').find('.nodes .node', { timeout: MERMAID_TIMEOUT }).should('have.length', 5)
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-2').find('.nodes .node').eq(4).should('have.text', 'F')
cy.reloadDashboard()
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-2').find('.nodes .node', { timeout: MERMAID_TIMEOUT }).should('have.length', 5)
cy.get('#nrdb-ui-widget-dashboard-ui-markdown-2').find('.nodes .node').eq(4).should('have.text', 'F')
})
})