-
Notifications
You must be signed in to change notification settings - Fork 353
/
Copy pathduallistselectordeprecatedtree.spec.ts
69 lines (62 loc) · 4.1 KB
/
duallistselectordeprecatedtree.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
describe('Dual List Selector deprecated TreeDemo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/dual-list-selector-deprecated-tree-demo-nav-link');
});
it('Verify existence', () => {
cy.get('.pf-v6-c-dual-list-selector').should('exist');
});
it('Verify expanding options', () => {
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 3);
cy.get('.pf-v6-c-dual-list-selector__list-item .pf-v6-c-dual-list-selector__item-toggle').eq(0).click();
cy.get('.pf-v6-c-dual-list-selector__list-item').eq(0).should('have.class', 'pf-m-expanded');
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 4);
});
it('Verify available search works', () => {
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 4);
cy.get('.pf-v6-c-dual-list-selector__tools-filter input').eq(0).type('Option 2');
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 1);
cy.get('.pf-v6-c-dual-list-selector__tools-filter input')
.eq(0)
.type('{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}');
cy.get('.pf-v6-c-dual-list-selector__list-item .pf-v6-c-dual-list-selector__item-toggle').last().click();
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 5);
});
it('Verify checkbox selects an option', () => {
cy.get('.pf-v6-c-dual-list-selector__controls-item button').eq(0).should('have.attr', 'disabled');
cy.get('.pf-v6-c-dual-list-selector__list-item .pf-v6-c-dual-list-selector__item-check').last().click();
cy.get('.pf-v6-c-dual-list-selector__controls-item button').eq(0).should('not.have.attr', 'disabled');
cy.get('.pf-v6-c-dual-list-selector__list-item .pf-v6-c-dual-list-selector__item-check').eq(1).click();
cy.get('.pf-v6-c-dual-list-selector__controls-item button').eq(0).click();
cy.get('.pf-v6-c-dual-list-selector__list').eq(2).find('li').should('have.length', 2);
});
it('Verify add all filtered options works', () => {
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 3);
cy.get('.pf-v6-c-dual-list-selector__tools-filter input').eq(0).type('Option 1');
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 1);
cy.get('.pf-v6-c-dual-list-selector__controls-item').eq(1).click();
cy.get('.pf-v6-c-dual-list-selector__list').eq(1).find('li').should('have.length', 3);
cy.get('.pf-v6-c-dual-list-selector__tools-filter input')
.eq(0)
.type('{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}');
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 1);
});
it('Verify chosen search works', () => {
cy.get('.pf-v6-c-dual-list-selector__list').eq(1).find('li').should('have.length', 3);
cy.get('.pf-v6-c-dual-list-selector__tools-filter input').eq(1).type('Option 1');
cy.get('.pf-v6-c-dual-list-selector__list').eq(1).find('li').should('have.length', 1);
});
it('Verify remove all filtered options works', () => {
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 1);
cy.get('.pf-v6-c-dual-list-selector__list').eq(1).find('li').should('have.length', 1);
cy.get('.pf-v6-c-dual-list-selector__controls-item').eq(2).click();
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 2);
cy.get('.pf-v6-c-dual-list-selector__list').eq(1).find('li').should('have.length', 0);
cy.get('.pf-v6-c-dual-list-selector__tools-filter input')
.eq(1)
.type('{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}{backspace}');
cy.get('.pf-v6-c-dual-list-selector__list').eq(1).find('li').should('have.length', 2);
cy.get('.pf-v6-c-dual-list-selector__controls-item').eq(2).click();
cy.get('.pf-v6-c-dual-list-selector__list').eq(0).find('li').should('have.length', 3);
cy.get('.pf-v6-c-dual-list-selector__list').eq(1).find('li').should('have.length', 0);
});
});