KabaLabs / Cypress-Recorder

A dev tool that records user interaction with a web application and generates cypress code to allow the developer to replicate that particular session.
ISC License
657 stars 90 forks source link

record matching patterns support data-cy #185

Open xchnshi opened 2 years ago

xchnshi commented 2 years ago

image is it possible to add option supporting data-cy id? or event self defined keyword that mentioned in cypress best practise.

json2d commented 2 years ago

because it's documented as best practice, there really ought to be a mode that gives data-cy priority

adam-stover commented 2 years ago

Is it not currently prioritizing data-cy while in CSS selectors mode? It was written with the intent to prioritize data-cy first, then data-test, then data-testid, and only if those attributes are not present on the event target do we delegate to the finder library.

Is this not working as intended? If so please let us know and provide an example if possible.

https://github.com/KabaLabs/Cypress-Recorder/blob/4e592ac74626d68e610429a26e1cfbdf8742829a/src/content-scripts/eventRecorder.ts#L26

json2d commented 2 years ago

it does work indeed! i made the wrong assumption based on the issue being still open.

adam-stover commented 2 years ago

Thanks for testing! I'll update the documentation and close this issue after a couple days.

xchnshi commented 2 years ago

data-cy is the default behavior, please close this issue.