2 ms·
> Adding an automation attribute to all of your elements that are both unique and stable helps go a long way to make E2E tests enjoyable. First of all maybe it
by baal80spam 3y ago
> Adding an automation attribute to all of your elements that are both unique and stable helps go a long way to make E2E tests enjoyable.
First of all maybe it wasn't clear from my comment but I use (and like it a lot) Playwright on a daily basis.
Second - did you mean using a testid for example? Because we specifically avoid using special attributes for this purpose and instead follow best practices as detailed here: https://testing-library.com/docs/queries/about#priority https://testing-library.com/docs/queries/about#priority (main reason being: killing two birds with one stone by making sure your page is accessible).
- ddoice 3y agoImho IDs are more explicit, and a bless when working with large codebase apps, when trying to finding the related code to an element just grab the id and search for it.
- sebazzz 3y agoExactly, and because they are specific for the purpose of testing they are less likely to break due to changes in the HTML.