jeudi 14 juin 2018

Checking states of Slide toggle not working in Cypress Tests

I am trying to test the states of slide-toggles within my app using Cypress.

These time out and fails the test:

cy.get('label.mat-slide-toggle-label').eq(2).should('be.checked')
 or
cy.get('div.mat-slide-toggle-bar').eq(2).should('be.checked')

Where as these pass

cy.get('label.mat-slide-toggle-label').eq(2).should('not.checked')
 or
cy.get('div.mat-slide-toggle-bar').eq(2).should('not.checked')

The only difference is that the state of the toggle has changed.

Can someone help explain why the "not.checked" tests pass, but the others don't?

Aucun commentaire:

Enregistrer un commentaire