E2E testing with cypress
-
I can integrate cypress in my quasar project. it works, but how can I identify my input-fields? In older versions of quasar I marked my input fields with Id="…". Now quasar assigns its own IDs.
here an examle of one input field:
<input tabindex=“0” data-autofocus=“true” aria-label=“Benutzername” id=“f_0f78a881-3692-4d73-bd06-383baad9734a” type=“text” class=“q-field__native q-placeholder”>How can I find this input field in my cypress-test-script? cy.get(???)
thanks, Kerstin
-
I personally use
data-cy
tag.<q-input outlined clearable lazy-rules v-model="field" clear-icon="close" label="Field" data-cy="field" />
Then on your cypress test:
cy.get('[data-cy=field]').type('some value here').should('have.value', 'some value here')
Hope this helps!
-
This post is deleted! -
@keechan Thank you so much, that tip helped me a lot
-
@kwi some examples here https://github.com/W3AS/quasar-cypress-example