-
Notifications
You must be signed in to change notification settings - Fork 353
/
Copy pathtableselectable.spec.ts
48 lines (40 loc) · 1.53 KB
/
tableselectable.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
describe('Table Selectable Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/table-selectable-demo-nav-link');
});
it('Verify table string', () => {
cy.get('caption').contains('Selectable Table');
});
it('Check number of rows', () => {
cy.get('.pf-v6-c-table').find('tr').should('have.length', 4);
});
it('Check number of columns', () => {
cy.get('thead').find('th').should('have.length', 6);
});
it('Test selectable checkbox', () => {
for (let i = 1; i <= 3; i++) {
cy.get(`tbody tr:nth-child(${i}) .pf-v6-c-table__check > label > input`).check();
}
for (let i = 1; i <= 3; i++) {
cy.get(`tbody tr:nth-child(${i}) .pf-v6-c-table__check > label > input`).should('be.checked');
}
});
it('Test selectable radio', () => {
// Switch to radio buttons table
cy.get('input[name=selectVariant][value=radio]').click();
for (let i = 1; i <= 3; i++) {
cy.get(`tbody tr:nth-child(${i}) .pf-v6-c-table__check > label > input`).check();
}
// Only last radio input should be checked in the end of the iteration
for (let i = 1; i <= 3; i++) {
if (i < 3) {
cy.get(`tbody tr:nth-child(${i}) .pf-v6-c-table__check > label > input`).should('not.be.checked');
} else {
cy.get(`tbody tr:nth-child(${i}) .pf-v6-c-table__check > label > input`).should('be.checked');
}
}
});
it('Check that first column canSelectAll input is missing', () => {
cy.get('thead').find('td').should('have.length', 0);
});
});