-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsteps-spec.js
66 lines (55 loc) · 1.55 KB
/
steps-spec.js
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
54
55
56
57
58
59
60
61
62
63
64
65
66
describe('Steps', () => {
before(() => {
cy.visit("/")
cy.contains('.nav-item', 'Steps').click()
})
// a helper to get first demo block
const firstSteps = () => cy.get('.demo-steps').first()
it('shows basic steps', () => {
// the "Next Step" button reference
firstSteps()
.contains('Next step')
.as('next step')
// returns completed steps elements
const completedSteps = () =>
firstSteps().find('.is-success.is-text')
// initially first badge is not done
completedSteps()
.should('have.length', 0)
// first click turns first step complete
cy.get('@next step').click()
completedSteps()
.should('have.length', 1)
// second and third clicks complete the other steps
cy.get('@next step').click().click()
completedSteps()
.should('have.length', 3)
})
it('expands the code', () => {
const getHeight = () =>
firstSteps()
.find('.meta')
.invoke('height')
// initially meta information is closed
getHeight()
.should('eq', 0)
// open meta information
firstSteps()
.find('.demo-block-control').click()
firstSteps()
.find('.highlight code').should('be.visible')
getHeight()
.should('gt', 0)
// close it
firstSteps()
.find('.demo-block-control').click()
getHeight()
.should('eq', 0)
})
it.skip('hides code by default', () => {
// hmm, the element is behind other elements, why
// is it visible?
firstSteps()
.find('.highlight code').should('not.be.visible')
})
})