Skip to contentPlayForge

How do I open the Playwright HTML report?

Written by Jatin Thacker, Automation Architect · Updated

Run npx playwright show-report, which serves the last report from the playwright-report folder and opens it in your browser. The report must first be produced by running tests with the HTML reporter, for example npx playwright test --reporter=html.

This answer is one piece of Chapter 26: Reporting.

  • HTML Reports & Custom Reporters
  • Allure: Reports for Managers
  • JUnit XML for CI Dashboards

The HTML report is a page listing every test from the run, with its steps, errors, and any screenshots, videos or traces attached to it. It is usually the first thing to open after a red run, and the thing to download from a CI job.

Two things often confuse people. First, the default reporter is list locally, so a plain run prints to the terminal and writes no HTML report unless the config or --reporter=html asks for one. Second, the report opens by itself only when a test failed. That is the open option, with values always, never and on-failure, the default.

The report is written to playwright-report in the current folder; change it with the outputFolder option or the PLAYWRIGHT_HTML_OUTPUT_DIR variable. show-report takes a folder name or a .zip, which is how you open a report downloaded from CI. It needs this command, because opening index.html straight from disk does not work as expected.

The browser tab was not opened for this page. The run below wrote a report, show-report printed the address it was serving, and a request to it returned Playwright Test Report.

terminal(https://practice.learnplayforge.com)
$ PLAYWRIGHT_HTML_OUTPUT_DIR=playwright-report npx playwright test before-each.spec.js --reporter=html $ npx playwright show-report playwright-report
Output
Running 2 tests using 1 worker

[1/2] [chromium] › before-each.spec.js:7:1 › the cart starts empty
[2/2] [chromium] › before-each.spec.js:11:1 › adding the grinder updates the total
  2 passed (4.0s)

  Serving HTML report at http://localhost:9323. Press Ctrl+C to quit.

$ curl -s http://localhost:9323/ | grep -o "<title>[^<]*</title>"
<title>Playwright Test Report</title>
Test yourself
Every test passes and your config uses the HTML reporter with default options. What happens to the report?

Practised in the full course: the drill Merging HTML reports.

See the chapter

AI can write the test now. The job is knowing whether it checks anything. That's what the course teaches, one chapter at a time.

163 lessons · 226 drills · start free

← All questions

Training a team? Talk to us.