forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoverflowmenu.spec.ts
151 lines (127 loc) · 5.67 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
describe('OverflowMenu Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('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-v6-c-overflow-menu__content').should('exist');
cy.get('#simple-overflow-menu .pf-v6-c-overflow-menu__control').should('not.exist');
});
});
context('Dropdown view', () => {
beforeEach(() => {
cy.viewport(767, 800);
});
it('displays OverflowMenuControl', () => {
cy.get('#simple-overflow-menu .pf-v6-c-overflow-menu__control').should('exist');
cy.get('#simple-overflow-menu .pf-v6-c-overflow-menu__content').should('not.exist');
});
it('Verify toggle dropdown', () => {
cy.get('#simple-overflow-menu button').should('have.class', 'pf-v6-c-menu-toggle');
});
it('Verify dropdown menu expanded', () => {
cy.get('#simple-overflow-menu button').last().click({ force: true });
cy.get('#simple-overflow-menu .pf-v6-c-menu-toggle').should('have.class', 'pf-m-expanded');
cy.get('.simple-overflow-menu.pf-v6-c-menu').should('be.visible');
// close overflow menu again
cy.get('#simple-overflow-menu button').last().click({ force: true });
});
});
});
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-v6-c-overflow-menu__content, #additional-options-overflow-menu .pf-v6-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-v6-c-overflow-menu__control').should('exist');
cy.get('#additional-options-overflow-menu .pf-v6-c-overflow-menu__content').should('not.exist');
});
it('Verify toggle dropdown', () => {
cy.get('#additional-options-overflow-menu button').should('have.class', 'pf-v6-c-menu-toggle');
});
it('Verify dropdown menu expanded', () => {
cy.get('#additional-options-overflow-menu button').last().click({ force: true });
cy.get('#additional-options-overflow-menu .pf-v6-c-menu-toggle').should('have.class', 'pf-m-expanded');
cy.get('.additional-options-overflow-menu.pf-v6-c-menu').should('be.visible');
});
});
});
describe('Persist OverflowMenu X-Large', () => {
context('List view', () => {
beforeEach(() => {
cy.viewport(1200, 800);
});
it('displays OverflowMenuContent and OverflowMenuControl', () => {
cy.get(
'#persist-overflow-menu .pf-v6-c-overflow-menu__content, #persist-overflow-menu .pf-v6-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-v6-c-overflow-menu__control').should('be.visible');
cy.get(
`#persist-overflow-menu .pf-v6-c-overflow-menu__content .pf-v6-c-overflow-menu__group,
#persist-overflow-menu .pf-v6-c-overflow-menu__content .pf-v6-c-overflow-menu__item`
).should('be.visible');
});
it('Verify toggle dropdown', () => {
cy.get('#persist-overflow-menu button').should('have.class', 'pf-v6-c-menu-toggle');
});
it('Verify dropdown menu expanded', () => {
cy.get('#persist-overflow-menu button').last().click({ force: true });
cy.get('#persist-overflow-menu .pf-v6-c-menu-toggle').should('have.class', 'pf-m-expanded');
cy.get('.persist-overflow-menu.pf-v6-c-menu').should('be.visible');
});
});
});
describe('Container Breakpoint OverflowMenu Small', () => {
context('List view', () => {
beforeEach(() => {
cy.viewport(1200, 800);
});
it('displays OverflowMenuContent', () => {
cy.get('#container-breakpoint-overflow-menu .pf-v6-c-overflow-menu__content').should('exist');
cy.get('#container-breakpoint-overflow-menu .pf-v6-c-overflow-menu__control').should('not.exist');
});
});
context('Dropdown view', () => {
beforeEach(() => {
cy.viewport(1200, 800);
cy.get('#container-breakpoint-container').invoke('attr', 'style', 'width: 575px');
});
it('displays OverflowMenuControl', () => {
cy.get('#container-breakpoint-overflow-menu .pf-v6-c-overflow-menu__control').should('exist');
cy.get('#container-breakpoint-overflow-menu .pf-v6-c-overflow-menu__content').should('not.exist');
});
it('Verify toggle dropdown', () => {
cy.get('#container-breakpoint-overflow-menu button').should('have.class', 'pf-v6-c-menu-toggle');
});
it('Verify dropdown menu expanded', () => {
cy.get('#container-breakpoint-overflow-menu button').last().click({ force: true });
cy.get('#container-breakpoint-overflow-menu .pf-v6-c-menu-toggle').should('have.class', 'pf-m-expanded');
cy.get('.container-breakpoint-overflow-menu.pf-v6-c-menu').should('be.visible');
// close overflow menu again
cy.get('#container-breakpoint-overflow-menu button').last().click({ force: true });
});
});
});
});