How can you check whether a checkbox is in the indeterminate state (neither checked nor unchecked)?
In Cypress you can test whether a checkbox is checked by:
cy.get('[data-cy=my-selector]').should('be.checked');
And conversely you can check whether it is not checked by:
cy.get('[data-cy=my-selector]').should('not.be.checked');
I can't find a way to check whether the checkbox is in the indeterminate state.
Is there any way to do that in Cypress?
Solution 1:
I just realised that I can do that with a simple css selector:
cy.get('[data-cy=my-selector]:indeterminate').should('exist');
Thanks @AlapanDas for pointing that selector out.