forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
overflowmenu.spec.ts
121 lines (103 loc) · 4.02 KB
/
overflowmenu.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
describe('OverflowMenu Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/');
cy.get('#overflow-menu-demo-nav-item-link').click();
cy.url().should('eq', 'http://localhost:3000/overflow-menu-demo-nav-link');
});
describe('Simple OverflowMenu Medium', () => {
context('List view', () => {
beforeEach(() => {
cy.viewport(768, 800);
});
it('displays OverflowMenuContent', () => {
cy.get('#simple-overflow-menu .pf-c-overflow-menu__content').should('be.visible');
cy.get('#simple-overflow-menu .pf-c-overflow-menu__control').should('not.be.visible');
});
});
context('Dropdown view', () => {
beforeEach(() => {
cy.viewport(767, 800);
});
it('displays OverflowMenuControl', () => {
cy.get('#simple-overflow-menu .pf-c-overflow-menu__control').should('be.visible');
cy.get('#simple-overflow-menu .pf-c-overflow-menu__content').should('not.be.visible');
});
it('Verify toggle dropdown', () => {
cy.get('#simple-overflow-menu button').should('have.class', 'pf-c-dropdown__toggle');
});
it('Verify dropdown menu expanded', () => {
cy.get('#simple-overflow-menu button')
.last()
.click();
cy.get('#simple-overflow-menu .pf-c-dropdown').should('have.class', 'pf-m-expanded');
// close overflow menu again
cy.get('#simple-overflow-menu button')
.last()
.click();
});
});
});
describe('Additional Options OverflowMenu Large', () => {
context('List view', () => {
beforeEach(() => {
cy.viewport(992, 800);
});
it('displays OverflowMenuContent and OverflowMenuControl', () => {
cy.get(
'#additional-options-overflow-menu .pf-c-overflow-menu__content, #additional-options-overflow-menu .pf-c-overflow-menu__control'
).should('be.visible');
});
});
context('Dropdown view', () => {
beforeEach(() => {
cy.viewport(991, 800);
});
it('displays OverflowMenuControl', () => {
cy.get('#additional-options-overflow-menu .pf-c-overflow-menu__control').should('be.visible');
cy.get('#additional-options-overflow-menu .pf-c-overflow-menu__content').should('not.be.visible');
});
it('Verify toggle dropdown', () => {
cy.get('#additional-options-overflow-menu button').should('have.class', 'pf-c-dropdown__toggle');
});
it('Verify dropdown menu expanded', () => {
cy.get('#additional-options-overflow-menu button')
.last()
.click();
cy.get('#additional-options-overflow-menu .pf-c-dropdown').should('have.class', 'pf-m-expanded');
});
});
});
describe('Persist OverflowMenu X-Large', () => {
context('List view', () => {
beforeEach(() => {
cy.viewport(1200, 800);
});
it('displays OverflowMenuContent and OverflowMenuControl', () => {
cy.get(
'#persist-overflow-menu .pf-c-overflow-menu__content, #persist-overflow-menu .pf-c-overflow-menu__control'
).should('be.visible');
});
});
context('Dropdown view', () => {
beforeEach(() => {
cy.viewport(1199, 800);
});
it('displays OverflowMenuControl and Persistent items', () => {
cy.get('#persist-overflow-menu .pf-c-overflow-menu__control').should('be.visible');
cy.get(
`#persist-overflow-menu .pf-c-overflow-menu__content .pf-c-overflow-menu__group,
#persist-overflow-menu .pf-c-overflow-menu__content .pf-c-overflow-menu__item`
).should('be.visible');
});
it('Verify toggle dropdown', () => {
cy.get('#persist-overflow-menu button').should('have.class', 'pf-c-dropdown__toggle');
});
it('Verify dropdown menu expanded', () => {
cy.get('#persist-overflow-menu button')
.last()
.click();
cy.get('#persist-overflow-menu .pf-c-dropdown').should('have.class', 'pf-m-expanded');
});
});
});
});