forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
expandablesection.spec.ts
44 lines (40 loc) · 1.35 KB
/
expandablesection.spec.ts
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
describe('Expandable Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/');
cy.get('#expandable-section-demo-nav-item-link').click();
cy.url().should('eq', 'http://localhost:3000/expandable-section-demo-nav-link');
});
it('Verify controlled expandable', () => {
cy.get('.pf-c-expandable-section__toggle')
.first()
.click();
cy.get('.pf-c-expandable-section')
.first()
.should('have.class', 'pf-m-expanded');
});
it('Verify uncontrolled expandable', () => {
cy.get('.pf-c-expandable-section__toggle')
.last()
.click();
cy.get('.pf-c-expandable-section')
.last()
.should('have.class', 'pf-m-expanded');
});
it('Verify dynamic uncontrolled expandable', () => {
cy.get('.pf-c-expandable-section__toggle')
.find('span')
.should('contain', 'Show More');
cy.get('.pf-c-expandable-section__toggle')
.last()
.click();
cy.get('.pf-c-expandable-section__toggle')
.find('span')
.should('contain', 'Show Less');
});
it('Verify detached expandable', () => {
cy.get('#detached').should('have.class', 'pf-m-detached');
cy.get('#detached-section').should('have.class', 'pf-m-detached');
cy.get('#detached button').click();
cy.get('#detached-section').should('have.class', 'pf-m-expanded');
});
});