forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard.spec.ts
58 lines (49 loc) · 1.75 KB
/
card.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
describe('Card Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/');
cy.get('#card-demo-nav-item-link').click();
cy.url().should('eq', 'http://localhost:3000/card-demo-nav-link');
});
it('Verify default title', () => {
cy.get('.pf-c-card__title').contains('Header');
});
it('Verify default body content', () => {
cy.get('.pf-c-card__body').contains('Body');
});
it('Verify card is hoverable', () => {
cy.get('article')
.first()
.should('have.class', 'pf-m-hoverable');
});
it('Verify card is compact', () => {
cy.get('article')
.eq(1)
.should('have.class', 'pf-m-compact');
});
it('Verify card is selectable and selected', () => {
cy.get('article')
.eq(2)
.should('have.class', 'pf-m-selected')
.should('have.class', 'pf-m-selectable');
});
it('Verify card is heading element', () => {
cy.get('h4').should('have.id', 'heading-card');
});
it('Verify card is flat', () => {
cy.get('#flatCard').should('have.class', 'pf-m-flat');
});
it('Verify that selectable card can be selected and unselected with keyboard input', () => {
cy.get('#selectableCard').focus();
cy.focused().should('have.class', 'pf-m-selectable');
cy.focused().should('not.have.class', 'pf-m-selected');
cy.focused().type('{enter}');
cy.focused().should('have.class', 'pf-m-selected');
cy.focused().type('{enter}');
cy.focused().should('not.have.class', 'pf-m-selected');
});
it('Verify card is expandable', () => {
cy.get('#expand-card').should('not.have.class', 'pf-m-expanded');
cy.get('.pf-c-card__header-toggle .pf-c-button').click();
cy.get('#expand-card').should('have.class', 'pf-m-expanded');
});
});