Generate an E2E test
generate-e2e-testGenerate a ready-to-run Playwright spec from a test description by scanning recent changes for real selectors, validating them live, and writing the test file.
Instructions
Scaffold a Playwright test from a description using the project's REAL selectors. Scans the agent's recent file changes (git working tree / last commit, mtime fallback), extracts data-testid / role / label / placeholder / id locators with their source locations, optionally cross-checks them against the live page, writes a ready-to-run spec, and returns next steps.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file | No | Exact spec path (*.spec.ts / *.test.ts) inside the project instead of the default location | |
| write | No | Write the file to disk (default true) | |
| config | No | playwright.config path or 1-based index | |
| pageUrl | No | Page the test starts on (default: baseURL from playwright.config) | |
| testDir | No | Directory for the generated spec (default: detected testDir or tests/) | |
| overwrite | No | Replace an existing spec at the target path (only specs this tool generated) | |
| description | Yes | What the test should cover, e.g. "login with valid credentials" | |
| liveInspect | No | Verify discovered selectors against the live page (default true when a URL is known) | |
| projectRoot | No | Project directory; defaults to the server working directory |