Key points
A trace is a full recording of a test run: every step has a snapshot of the page before and after, next to a log, the console and the network. You can "go back in time" and see what was there at each moment.
When a trace is saved
The use.trace setting in playwright.config.ts decides:
| Value | When it is saved |
|---|---|
'on-first-retry' | Only on a retry of a failed test (the wizard default) |
'retain-on-failure' | On every run, but kept only if the test failed |
'on' | Always |
'off' | Never |
To get a trace for one run without editing the file: npx playwright test --trace on.
How to open it
- From the report: click View Trace next to the test.
- From the terminal:
npx playwright show-trace test-results/.../trace.zip.