-
Notifications
You must be signed in to change notification settings - Fork 355
/
switch.spec.ts
36 lines (32 loc) · 1.3 KB
/
switch.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
describe('Switch Demo Test', () => {
it('Navigate to demo section', () => {
cy.visit('http://localhost:3000/switch-demo-nav-link');
});
it('Verify Switches exist and initial state', () => {
cy.get('#simple-switch').should('exist');
cy.get('#simple-switch').should('be.checked');
cy.get('#disabled-switch-off').should('exist');
cy.get('#disabled-switch-off').should('not.be.checked');
});
it('Verify switch can be toggled', () => {
cy.get('#simple-switch').click({ force: true });
cy.get('#simple-switch').should('not.be.checked');
cy.get('#simple-switch').click({ force: true });
cy.get('#simple-switch').should('be.checked');
});
it('Verify disabled switch can not be toggled', () => {
cy.get('#disabled-switch-off').should('be.disabled');
cy.get('#disabled-switch-off').should('not.be.checked');
cy.get('#disabled-switch-off').click({ force: true });
cy.get('#disabled-switch-off').should('not.be.checked');
});
it('regression test: Github #3662', () => {
cy.get('button#showAll').click();
cy.get('#id1').should('not.be.checked');
cy.get('#id1').click({ force: true });
cy.get('#id1').should('be.checked');
cy.get('button#showAll').click();
cy.get('#id1').should('not.be.checked');
cy.get('#id2').should('be.checked');
});
});