Running and debugging tests
CLI flags, UI mode, debugging with --debug, headed runs, filtering by name/file/tag.
The test CLI
npx playwright test runs every project from playwright.config.ts in parallel headless mode. The CLI is the single entry point: you filter, pick projects, choose reporters and debug from it.
UI mode
UI mode (--ui) opens a dedicated app: filter tests, watch them re-run on file change, inspect locator picks, time-travel through the trace, view network and console. This is the most productive way to author and debug tests.
Debug a single test
Use --debug to launch the Playwright Inspector and step through the spec. Combine with a grep to focus on one test. In code, page.pause() pauses execution at that point.
HTML report
After a run, open the HTML report to see steps, screenshots, video and trace per test. Failed tests link directly into the trace viewer.