lundi 30 décembre 2019

cy.click('div.wrapper') or cy.check('input[type=checkbox]', { force: true })?

Let's say there is some hidden checkbox wrapped with a styled div element:

<div class="wrapper beautiful-checkbox">
  <input type="checkbox" style="display: none">
</div>

In Cypress I want to test when user clicks on this element to choose this option. Which cy event is more suitable from the perspective of real user interaction:

  • cy.click('div.wrapper') - test user click event on wrapper element
  • cy.check('input[type=checkbox]', { force: true }) - test check event on the actual hidden checkbox using force: true option

Aucun commentaire:

Enregistrer un commentaire