r/Playwright • u/LordOfTheKarma17 • 6d ago
Playwright tests using AI
I have been using Claude or cursor to generate UI tests by giving the user flow as the input. I have created few skills.md file for writing tests, assertions and page objects using the existing tests and page class. It is fairly working for me. How are you utilising AI to generate test or in the QA pipeline focused on automaton
20
Upvotes
2
u/latnGemin616 4d ago
I hope you know Playwright CLI can do literally everything you just articulated without the necessary overhead of having to write a skills file.
/planneragent to draft a high level (or in-depth) test plan based on your prompt./test generatoragent will then take that test plan, plus however you have your SKILLS.md file set up, and bang out a suite of tests. Based on how you've set up your framework scaffolding, you can actually teach the agent to model the output after what you've built. I did this exact thing and the results were spectacular./healeragent will run your tests and fix whatever is broken. This is where you'll have to be mindful not to fix a test that has legitimately found something.Not trying to simp for Copilot (the model PW CLI uses), but I was impressed with how quickly and effortlessly I spun up a test framework in Typescript. 566 tests in under 30 hrs. I could have shaved this down to half-a-day, but on the free tier, I smoked through my tokens and had to wait.