Where AI really shines
Spot the test-authoring tasks where AI is the obvious tool — pattern-following, typing-heavy work where the agent does the labour and you do the deciding.
You watched the agent extract a POM and a fixture. Both followed the same shape: clear template, concrete input, mechanical output. That's the sweet spot — and once you spot the shape, it's everywhere.
More places it shines
Same shape, different jobs:
- Split a long spec file. A 600-line file with twenty
test(...)blocks across four features needs grouping. The agent infers the natural seams (by feature, by user role, by happy/error path) and proposes a split. - Migrate to semantic locators. Sweep
tests/forpage.locator('#…')/page.locator('.…')calls, open the matching page inplaywright-cli, grab thegetByRole/getByLabelequivalent, and rewrite. - Parameterized variants. One happy-path test plus a list of states ("logged out", "no items", "expired token"); the agent emits eight variants from the same shell.
- Test data factories. Hand the agent observed API responses from a session and it produces typed factories with sensible defaults.
- Accessibility assertions. Sweep the snapshot for missing labels, headings, alt text — fold into
expect(...).toHaveAccessibleName(...)checks. - Test descriptions. Read a dense flow, propose a clearer test name. Boring, fast, useful.
- Coverage filling. "Read
tests/checkout/. List scenarios from the spec doc that aren't covered." Then pick what's worth adding yourself.
Where it doesn't shine
These are still your job:
- What to assert. The agent picks something — usually the cart counter. Whether that is the assertion that catches the regression you care about is a judgment call.
- What to abstract. A POM with one caller is overhead. A fixture that hides login changes the meaning of every test that uses it. Abstractions are taste calls; the agent has none.
- What to test at all. The hardest decision in testing isn't writing the test — it's knowing which behaviour deserves one. The agent can't smell what matters in your product.
Agents draft. You ship.
You made it 🎭
And that's the workshop! The AI block sits on top of the basics and writing-tests groups, and you've now seen both ends. You should now be able to:
- Record, read, and refactor a Playwright test
- Use UI mode and the trace viewer to debug anything
- Pick locators that survive a redesign and assertions that don't race
- Hand a browser to your coding agent through CLI
- Generate tests from a prompt
- Lift repeated locators into POMs and repeated setup into fixtures with the agent doing the typing
- Recognize the test-authoring jobs where AI pays back tokens — and the ones where it doesn't
Where to go next:
- Checkly's weekly Playwright videos on YouTube — bite-sized walkthroughs
- The Playwright community Discord — the team and the community both hang out there
playwright.dev/docs/best-practices— keep this one bookmarked
Thanks for spending the day with me. Go test something. 🎭
Hands on
Spot more places to send the agent
Exercise 1 of 1
Enjoy the rest of the day!
And we'll see each other tomorrow at the conference! 🎉