-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathtemplate.spec.js
More file actions
53 lines (44 loc) · 2.02 KB
/
template.spec.js
File metadata and controls
53 lines (44 loc) · 2.02 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
47
48
49
50
51
52
53
describe('Node-RED Dashboard 2.0 - Templates', () => {
beforeEach(() => {
cy.deployFixture('dashboard-templates')
cy.visit('/dashboard/page1')
})
it('passes messages through, when "passthru" is enabled', () => {
cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-button-to-enabled'))
cy.checkOutput('msg.payload', 'payload 1')
})
it('does not pass messages through, when "passthru" is disabled', () => {
cy.clickAndWait(cy.get('#nrdb-ui-widget-dashboard-ui-button-to-disabled'))
cy.checkOutput('msg.payload', 'payload 1')
})
it('permits the sending of a full msg object', () => {
cy.clickAndWait(cy.get('[data-action="ui-button-full-msg"]'))
cy.checkOutput('msg.payload', 20)
cy.checkOutput('msg.topic', 'full-msg')
})
it('permits the sending a payload value and will auto-wrap into a msg structure', () => {
cy.clickAndWait(cy.get('[data-action="ui-button-payload-only"]'))
cy.checkOutput('msg.payload', 30)
})
})
describe('Node-RED Dashboard 2.0 - Templates (Single Page CSS)', () => {
beforeEach(() => {
cy.deployFixture('dashboard-templates')
})
it('loads on the correctly configured page', () => {
cy.visit('/dashboard/page1')
cy.get('body').should('have.css', 'background-color', 'rgb(0, 0, 0)')
})
it('does not persist in SPA navigation', () => {
cy.visit('/dashboard/page1')
cy.get('body').should('have.css', 'background-color', 'rgb(0, 0, 0)')
cy.get('[data-nav="dashboard-ui-page-2"]').should('be.visible')
cy.get('[data-nav="dashboard-ui-page-2"]').click({ force: true })
cy.location('pathname').should('include', '/dashboard/page2')
cy.get('body').should('not.have.css', 'background-color', 'rgb(0, 0, 0)')
})
it('does not load the CSS on other pages if we navigate directly', () => {
cy.visit('/dashboard/page2')
cy.get('body').should('not.have.css', 'background-color', 'rgb(0, 0, 0)')
})
})