Re:Playwright Test Generator
by cebert on Thursday March 14, 2024 @12:37PM
(#39706078)
We use Playwright and the Page Object Model approach to test our applications because that approach is more maintainable for larger applications. Automated E2E testing is something all developers are expected to do, not just an "SDET" engineer or QA engineer role. While we take the POM approach, I frequently use Playwright's recorder to help me get selectors and interactions with the DOM needed to verify a captured feature. Next, I take the code generated and incorporate it into object models. 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.
[ Parent
| on HN ]
Re:Playwright Test Generator
by baal80spam on Thursday March 14, 2024 @03:10PM
(#39707786)
> 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 (main reason being: killing two birds with one stone by making sure your page is accessible).
Imho 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.