Skip to main content

/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:

  1. Reads the spec's frontmatter to identify the correct fixture and data references.
  2. Translates each method: line into TypeScript calls on the appropriate page objects and helpers.
  3. 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.
  4. 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

/generate-test 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:

  1. A runnable test at tests/e2e/project/team/add-key-member.spec.ts.
  2. Any new page-object methods that were needed (written into the existing POM files).
  3. 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.