Files
chore/.opencode/skills/playwright-cli/references/playwright-tests.md
T
ryan d910a6bc65
Chore App Build, Test, and Push Docker Images / build-and-push (push) Failing after 2m29s
feat(playwright-cli): add comprehensive test generation, tracing, and video recording documentation
- Introduced detailed documentation for test generation workflow in Playwright CLI, covering planning, generating, and healing tests.
- Added tracing capabilities documentation, including usage, output files, and best practices for debugging and performance analysis.
- Included video recording instructions, emphasizing best practices for capturing browser automation sessions with chapter markers and overlays.
- Implemented user tutorial authentication setup and tutorial tests for parent mode in the E2E testing framework.
- Created JSON files for user tutorial state management, ensuring isolated test environments.
2026-07-17 19:38:02 -04:00

1.7 KiB

Running Playwright Tests

To run Playwright tests, use the npx playwright test command, or a package manager script. To avoid opening the interactive html report, use PLAYWRIGHT_HTML_OPEN=never environment variable.

# Run all tests
PLAYWRIGHT_HTML_OPEN=never npx playwright test

# Run all tests through a custom npm script
PLAYWRIGHT_HTML_OPEN=never npm run special-test-command

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 playwright-cli to attach the session and explore the page.

# Run the test
PLAYWRIGHT_HTML_OPEN=never npx playwright test --debug=cli
# ...
# ... debugging instructions for "tw-abcdef" session ...
# ...

# Attach to the test
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 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.