Files
mygo/.agents/skills/playwright-cli/references/playwright-tests.md
T
ld 52dd56ff06 build(web): replace Playwright MCP with project-scoped Playwright CLI
- feat: add `.agents/skills/playwright-cli/` with complete Skill
  markdown, agent interface, and 9 reference files covering session
  management, spec-driven testing, video recording, tracing, storage,
  request mocking, element attributes, test debugging, and running
  custom code
- feat: add `.playwright/cli.config.json` to configure the Playwright
  CLI
- feat: add `web/package.json` `playwright:cli` script that resolves
  `playwright cli` from the repo root
- build: remove `@playwright/mcp` dependency from `web/package.json`
- build: set `XDG_CACHE_HOME` in `mise.toml`
- build: delete `.codex/config.toml` (MCP server config)
- docs: update `README.md`, `docs/web/roadmap.md`,
  `docs/web/decisions.md`, and `web/README.md` to reflect the new
  Playwright CLI approach
2026-07-15 23:10:43 +08:00

1.6 KiB

Running Playwright Tests

Run Playwright tests from web/ through the repository script. To avoid opening the interactive HTML report, use the PLAYWRIGHT_HTML_OPEN=never environment variable.

# Run all tests
PLAYWRIGHT_HTML_OPEN=never mise exec -- npm run test:e2e --

Debugging Playwright Tests

To debug a failing Playwright test, run it with --debug=cli option. This command will pause the test at the start and print the debugging instructions.

IMPORTANT: run the command in the background and check the output until "Debugging Instructions" is printed. Make sure to stop the command after you have finished.

Once instructions containing a session name are printed, use mise exec -- npm run playwright:cli -- to attach the session and explore the page.

# Run the test
PLAYWRIGHT_HTML_OPEN=never mise exec -- npm run test:e2e -- --debug=cli
# ...
# ... debugging instructions for "tw-abcdef" session ...
# ...

# Attach to the test
mise exec -- npm run playwright:cli -- attach tw-abcdef

Keep the test running in the background while you explore and look for a fix. The test is paused at the start, so you should step over or pause at a particular location where the problem is most likely to be.

Every action you perform with mise exec -- npm run playwright:cli -- generates corresponding Playwright TypeScript code. This code appears in the output and can be copied directly into the test. Most of the time, a specific locator or an expectation should be updated, but it could also be a bug in the app. Use your judgement.

After fixing the test, stop the background test run. Rerun to check that test passes.