Update Selector Playground to prioritise suggestions from Testing Library for accessible queries #29779
Labels
stale
no activity on this issue for a long period
topic: selector playground 🚸
type: user experience
Improvements needed for UX
What would you like?
Today I learned (in an interview with a potential QE candidate) about the Selector Playground feature in the Cypress GUI to help you find selectors, and that its suggestions are ordered in a certain priority. While the suggestions align with the concept of writing selectors that are resilient to change, they don't reflect the guiding principles of Testing Library for accessible, user-based queries. There is a short blurb in the Cypress Best Practices docs about the use of Testing Library for locators as a recommendation.
It would be awesome to go one step further and make the Selector Playground recommend Testing Library locators according to their best practice priority.
So, for a button like this:
I would love for the first suggestion to be
cy.findByRole('button', {name: 'Submit'})
instead ofcy.get('[data-cy="submit"]')
.(One reason you might not want that would be in an application testing multiple languages - but then I'd argue your test should still be testing that your buttons are getting the appropriate labels for that language 😏 )
Why is this needed?
Other
No response
The text was updated successfully, but these errors were encountered: