AI/AIZENME
🧪 CODE · Coding & Dev Level: Beginner ⏱ 20 MIN Free & Open Source

Record Browser Clicks with Playwright Codegen & Let AI Turn Them into Resilient E2E Tests

Run `npx playwright codegen` to record your manual clicks into raw script, then have an LLM refactor it into clean Page Object tests with resilient assertions and failure screenshots.

CORE TOOLS Playwright Codegen (Open Source), Cursor / Claude
BEST FOR Frontend developers, QA engineers, indie hackers
REQUIREMENTS Node.js with Playwright; Cursor or any LLM
✦ WHY THIS WORKFLOW

Writing locators by hand is slow, while raw recorded scripts lack assertions. Combining Playwright Codegen with AI refactoring delivers rock-solid E2E tests in minutes.

✦ Interactive Workflow Animation Preview

Step-by-Step Action Checklist

0 / 4 Completed
READY-TO-USE PROMPT TEMPLATE
Open Official Tool / Repo ↗
Below is a raw script recorded with `npx playwright codegen`:
[Paste recorded code]
Refactor it into a production-grade Playwright TypeScript test suite:
1) Replace fragile selectors with resilient `getByRole`/`getByLabel` locators and zero hardcoded sleeps;
2) Extract reusable helpers and read credentials from `process.env`;
3) Add assertions for UI visibility, URL navigation and API status, plus 1 negative validation test case.
Use Cases & Tags:
Pre-release checkout & auth smoke testsComplex form validation testingCross-browser mobile viewport checksProduction synthetic monitoring#playwright