PW Playwright · TSFree course: Playwright with TypeScript
Full course

Chapter 6 · Lesson 1

What a trace is and how to open it

Difficulty: Easy
Slides
Use the arrow keys, N for notes, F for full screenOpen in a separate window ↗
Video lesson

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:

ValueWhen 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.

Practice

Try it yourself