Debug with Trace Viewer
Record and analyze test execution traces to debug failures with DOM snapshots, network logs, console output, and step-by-step action replay.
Prerequisites
- -Playwright test project set up
- -Failing or flaky tests to debug
Steps
Enable tracing in config
Configure Playwright to record traces automatically on test failures.
Use 'on-first-retry' in CI to capture traces only for failures, keeping artifacts small. Use 'on' during local debugging to always record.
Run tests with tracing enabled
Execute tests and generate trace files for failed tests.
Open the trace viewer
Analyze a recorded trace with the interactive viewer.
The trace viewer shows actions, DOM snapshots, network requests, console logs, and source code for each step. Use the timeline to scrub through the test execution.
Record a trace programmatically
Control trace recording within a specific test for targeted debugging.
View traces in the online viewer
Open traces in the browser-based viewer without installing anything.
Full Script
FAQ
Discussion
Loading comments...