Cypress Studio: give data-testid priority when picking up a selector for recorded interaction #21364
Labels
E2E
Issue related to end-to-end testing
experiment: studio
Issues when using experimentalStudio
type: enhancement
Requested enhancement of existing feature
What would you like?
Cypress Studio is an awesome feature, however it frequently picks less than optimal selector for the any particular step. Consider DOM structure like the following:
As you can notice it is a button with an icon and text, some of the classes have random suffixes. But there's also a
data-testid
, on a button, however when it is clicked Cypress Studio picks:.c-h-flex > .copy-5
instead, which - yes, is static, but far from being unique.data-testid
(and it's alternatives like:data-cy
anddata-test
) should be given priority. Or at least there should be a config option that would allow us to give them priority. So if any kind ofdata-testid
is present, Cypress Studio should pick it instead of it's descendants or ancestors.Why is this needed?
It is needed to always pick the most unique selector of the element, when it is available.
Other
No response
The text was updated successfully, but these errors were encountered: