/e2e-gen
Skip the boilerplate — describe a flow, get a working Playwright test.
Usage
/e2e-gen "user signs up, verifies email, lands on dashboard"
/e2e-gen "checkout flow with discount code"
/e2e-gen --from-pr 123 # generate tests covering the changes in PR #123
What it does
- Reads your
playwright.config.tsto understand baseURL, projects, fixtures - Looks at existing tests in
tests/to match conventions - Maps your description to selectors using:
- Routes from your app router
- Text content from your components
- Test IDs (
data-testid) where present
- Writes a complete
.spec.tsfile with:- Setup (login fixture if needed)
- Steps with proper waits (
waitForURL,expect().toBeVisible()) - Assertions at each milestone
- Cleanup
Conventions enforced
- One test per scenario (no nested describes for unrelated flows)
expect()after every navigation- Real selectors > XPath
- No hardcoded
setTimeout— use Playwright's auto-waiting - Strict mode safe (use
.first()/.getByRoleto avoid violations)
Output location
tests/<feature>.spec.ts (or wherever your config points)
Rules
- Don't generate tests for flows the user hasn't described — surface gaps instead
- If a flow needs auth/seed data, scaffold the fixture too
- Add a comment at the top:
// Generated by /e2e-gen — review before committing