vue test utils how to find specific input[type="checkbox"?

1.5k Views Asked by At

I am using Quasar 2 Vue 3 and @quasar/testing-e2e-jest v3.0.0-alpha.10. I have multiple q-checkbox in my vue component template which I decorated with data-test attribute. How do I find the specific checkbox with wither id, name, and/or data-test? wrapper.find('input[type="checkbox"]); works just find.

1

There are 1 best solutions below

3
Panos Vakalopoulos On
wrapper.find('input[id="..."]')

wrapper.find('input[value="..."]')

wrapper.find('input[data-test="..."]')

basically you can search with whatever attribute you want. type is just another HTML attribute for input