Playwright Test Writer Skill for Cursor
Write a Playwright regression test that reproduces a bug with locators and web-first assertions. Use when the user asks for a Playwright test or an end-to-end case. Do not use for unit tests in another runner or a non-browser bug.
name: "playwright-test-writer" description: "Write a Playwright regression test that reproduces a bug with locators and web-first assertions. Use when the user asks for a Playwright test or an end-to-end case. Do not use for unit tests in another runner or a non-browser bug." paths:
- "**/*.spec.ts"
- "**/playwright"
Playwright Test Writer Skill for Cursor
Cursor skill playwright-test-writer for Playwright. Run it with /playwright-test-writer, or let Agent select it when the request matches. paths only limits automatic surfacing.
When to run
Run this when the user wants a Playwright test, a regression for a UI bug, or an end-to-end case. The result is a spec that fails before the fix and passes after it.
When to leave it
Do not upgrade dependencies or the framework version unless the user asked.
Stop for a unit-test request in pytest, Jest, or another runner, or when the repository has no Playwright config and the user did not ask to add Playwright.
Steps
- Read
playwright.configand one existing spec. Match fixtures, the base URL, and the import style. Read the installed version before using a 1.65-only reporter or lock. - Write the failure down in one sentence: who does what, and what they should see.
- Drive the UI with role or test-id locators. Assert the outcome with a web-first assertion. Do not add a timeout sleep.
- Keep the test isolated. Use the existing auth fixture. Create only the data this case needs.
- Run the single spec. If it cannot fail on the bug, the test is wrong. Record the command and the result. If the browser cannot start, write
not runand the error. Do not claim a pass.
Output
## Files written
- tests/login.spec.ts
## Covered
- A signed-in user clicks Save and sees the note.
## How to run
npx playwright test tests/login.spec.ts
## Result
pass, fail, or not run, with the command output. No production URL and no password.
## Gaps
- Browsers or projects this run did not execute.
Example: the bug is a Save button that never appears. Write the spec with getByRole and toBeVisible(), not waitForTimeout. Run that one file. If the browser cannot start, the result is not run and the gap says so.
Stop
Stop when the user asks you to hit production, to commit a live session, or to add waitForTimeout so the suite looks green.