79526767

Date: 2025-03-22 00:15:45
Score: 0.5
Natty:
Report link

Since it is an <input type="checkbox"> Cypress wants to use the .check() command - https://docs.cypress.io/api/commands/check.

// before checking, assert that it's not checked
cy.get('[test-id="A02-checkbox"] input').should('not.be.checked')

cy.get('[test-id="A02-checkbox"] input')
  .check()

// after checking, assert that it is checked
cy.get('[test-id="A02-checkbox"] input').should('be.checked')

// ... now you can uncheck() it
cy.get('[test-id="A02-checkbox"] input')
  .uncheck()

// after un-checking, assert that it is not checked
cy.get('[test-id="A02-checkbox"] input').should('not.be.checked')
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Leta Waldergrave