forked from patternfly/patternfly-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
formselect.spec.ts
56 lines (52 loc) · 1.9 KB
/
formselect.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
describe('Form Select Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/');
cy.get('#form-select-demo-nav-item-link').click();
cy.url().should('eq', 'http://localhost:3000/form-select-demo-nav-link');
});
it('Verify default value content', () => {
cy.get('#select1').should('have.value', '2');
});
it('Verify form allows correct selection', () => {
cy.get('#select1')
.select('3')
.should('have.value', '3');
});
it('Verify disabled select', () => {
cy.get('#select1.pf-c-form-control')
.find('optgroup[label="Group3"]')
.should('be.disabled');
});
it('Verify validated select', () => {
cy.get('#validated-select');
cy.get('#validated-select.pf-m-success').should('not.exist');
cy.get('#validated-select.pf-m-placeholder').should('exist');
cy.get('#validated-select').then(select => {
expect(select.attr('aria-invalid')).to.be.equal('false');
});
// Select value other than 3 so it is invalid
cy.get('#validated-select')
.select('1')
.should('have.value', '1');
cy.get('#validated-select').then(select => {
expect(select.attr('aria-invalid')).to.be.equal('true');
});
cy.get('#validated-select.pf-m-placeholder').should('not.exist');
// Select value of 3 so it is valid
cy.get('#validated-select')
.select('3')
.should('have.value', '3');
cy.get('#validated-select').then(select => {
expect(select.attr('aria-invalid')).to.be.equal('false');
});
cy.get('#validated-select.pf-m-success').should('exist');
// Select value other than 2 so it is warning
cy.get('#validated-select')
.select('2')
.should('have.value', '2');
cy.get('#validated-select').then(select => {
expect(select.attr('aria-invalid')).to.be.equal('false');
});
cy.get('#validated-select.pf-m-warning').should('exist');
});
});