Debugging tools: UI mode, codegen, inspector, trace

Knowledge Videos

Short animated explainers, organised by subject.

Debugging tools: UI mode, codegen, inspector, trace

Find out why a test fails: UI mode with a timeline of snapshots, codegen to draft locators, the inspector to step through, and the trace viewer for failures in CI.

Transcript

When a test fails, you need to see what happened. Start with U I mode. Run n p x playwright test dash dash U I. You get your tests, a list of every action, and a snapshot of the page at each step.

Not sure which locator to write? Use codegen. Run n p x playwright codegen, click through your app, and Playwright writes the code as you go. Treat it as a draft, then clean it up.

To pause and look around, run with dash dash debug. The Playwright inspector runs the test one action at a time, and can pick a locator right from the page.

When a test fails in C I, the trace viewer is your best friend. A trace is a recording of the run: every action, the page before and after, the network calls, and the console.

Remember: use U I mode while you write, codegen for a first draft, the inspector to step through, and the trace when it fails in C I.

More in this series