/generate-test
What it does
/generate-test runs the Generator agent in isolation. It takes a finished spec
file (tests/specs/{feature}/{name}.md) and produces an executable Playwright test at
tests/e2e/{feature}/{name}.spec.ts.
The Generator:
- Reads the spec's frontmatter to identify the correct fixture and data references.
- Translates each
method:line into TypeScript calls on the appropriate page objects and helpers. - If a step is annotated
[NEW: ClassName.methodName()], it reads the PACE application source to understand the DOM, writes the new method, and adds it to the right page-object file. - Smoke-runs the generated test once against the target environment to confirm it compiles and executes without crashing. If the smoke run fails, the Generator revises and tries again — up to three attempts.
The Generator does not review the test for rule compliance. Run /review-test after generation, or use /e2e-from-scratch / /e2e-from-recording to run the full pipeline (Generator + Reviewer) automatically.
When to use it
Use /generate-test when you already have a reviewed spec and you want to:
- Turn it into TypeScript for the first time.
- Regenerate the test after editing the spec (e.g. after a Reviewer FAIL).
- Rerun the generator on a spec that was written by hand.
How to run it
- Claude Code
- Codex CLI
- Gemini CLI
- Antigravity
/generate-test tests/specs/project/team/add-key-member.md
Have the playwright-generator agent generate from tests/specs/project/team/add-key-member.md
/generate-test tests/specs/project/team/add-key-member.md
Use the playwright-generator skill on tests/specs/project/team/add-key-member.md
Example
Input:
tests/specs/project/team/add-key-member.md — a canonical spec file with frontmatter
and numbered steps.
What you get back:
- A runnable test at
tests/e2e/project/team/add-key-member.spec.ts. - Any new page-object methods that were needed (written into the existing POM files).
- A smoke-run result: either a passing run or the error output from up to three attempts.
Notes
- Three-attempt limit. If the generated test fails to run three times in a row, the Generator stops and reports the failure. Common causes: a missing data entry, a selector that no longer exists in the app, or a missing fixture method.
- The Generator does not commit. Review the output with
/review-test(or let a pipeline command run the Reviewer for you), then commit when satisfied. - POM changes are part of the output. If the Generator writes new page-object methods, those files are also part of what you review before committing.