Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
CI/CD

How to Generate an HTML Report in Playwright

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run npx playwright test --reporter=html to execute your Playwright tests and generate an HTML report in the playwright-report directory. Then run npx playwright show-report to serve and open it in your browser. The report is a self-contained folder that can be served as a web page, so you can inspect test outcomes, errors, steps and attachments without adding another reporting package.

Generate and open the report from the command line

The HTML reporter is built into Playwright Test. From the directory that contains your Playwright project, run:

npx playwright test --reporter=html

Playwright runs the test suite and writes the generated report to playwright-report by default. If the command exits with test failures, the report is still generated; the failed tests and their diagnostics appear in the report.

Serve the most recently generated report with:

npx playwright show-report

This starts a local web server and opens the report. To open a report stored in another directory, pass that directory explicitly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
npx playwright show-report my-report

You can choose the listening port, which is useful when the default port is already occupied:

npx playwright show-report --port 8080

The command-line options, including --host and --port, are documented in the Playwright command-line reference.

Configure the HTML reporter in playwright.config.ts

Use configuration when you want every run to produce an HTML report without typing a reporter flag. The reporter can be a name or a tuple containing the name and its options.

import { defineConfig } from '@playwright/test';

export default defineConfig({
  reporter: [['html', {
    outputFolder: 'my-report',
    open: 'never',
    title: 'Playwright test report'
  }]],
});

With this configuration, the report is written to my-report and is not opened automatically after the run. The following command then serves it:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
npx playwright show-report my-report

Important reporter options

Option Purpose Equivalent environment variable or command detail
outputFolder Changes the directory containing the generated report. PLAYWRIGHT_HTML_OUTPUT_DIR can set the directory outside the config file.
open Controls automatic opening after a run. Use always, never or on-failure. PLAYWRIGHT_HTML_OPEN provides the environment-variable form; on-failure is the documented default.
title Sets the title shown by the HTML report. PLAYWRIGHT_HTML_TITLE can set it from the environment.
host and port Control where the report server listens when it is opened. Use the corresponding show-report CLI options when serving manually.
Attachments base URL Provides the URL prefix used when attachments are stored separately from the report. Required when the report HTML and its files are hosted at different locations.
Asset and snippet inlining options Control whether report resources and snippets are embedded in the generated output. Check the reporter reference for the exact option names in your installed Playwright version.

Playwright’s reporter guide is rolling documentation. Check the guide that matches your installed version before relying on an option introduced after your project’s release.

Choose automatic or manual opening

For local development, on-failure is convenient because a failed run opens its report for investigation. In CI, use open: 'never' so a headless job does not try to launch a desktop browser. Upload the complete output directory as a CI artifact and serve it later with npx playwright show-report.

Do not copy only the visible HTML file. The report directory contains the assets and data needed by the viewer. If you publish the report on another server, preserve its directory structure or configure the attachment base URL when attachments live at a separate URL.

Read failures, filters and diagnostics in the report

Open the report and filter by browser and outcome. Playwright’s running-tests documentation describes filters for passed, failed, skipped and flaky tests. Selecting a test exposes its error details, attachments and individual steps. This makes the HTML report useful both as a final run summary and as a starting point for debugging.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use traces for a richer failure investigation

Configure traces when you need DOM snapshots, network information and action history rather than only an assertion message. A common policy is to collect a trace on the first retry:

import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    trace: 'on-first-retry',
  },
  reporter: [['html', { open: 'never' }]],
});

After a retry produces a trace, open the failed test in the HTML report and follow its trace link. The Trace Viewer guide explains how to inspect the resulting trace. Traces and screenshots can be large, so retain them for the runs where they provide diagnostic value instead of enabling every artifact unconditionally on a high-volume pipeline.

Generate one report from sharded CI runs

When a suite is split across shards, each job should create a blob report. Collect those blob-report directories as CI artifacts, then merge them in a separate job:

npx playwright merge-reports --reporter html ./all-blob-reports

The merged HTML report is normally written to playwright-report. The merge command expects the collected blob reports in the directory you provide. If you need custom output options or must disambiguate test roots, use a merge configuration file as described in Playwright’s sharding documentation. This approach keeps each shard’s results while giving reviewers one report to open.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Serve, archive or publish a report

Serve a custom directory or port

For a report generated outside the current working directory, provide its path:

npx playwright show-report /build/artifacts/playwright-report

To bind a particular interface and port, use the documented host and port flags:

npx playwright show-report --host 0.0.0.0 --port 8080

Binding to a non-loopback host can expose test data to your network. Use it only on a protected CI machine or behind your organization’s access controls.

Open a ZIP archive

The reporter guide documents passing a ZIP archive to show-report when index.html is at the archive’s top level. If the archive contains an extra parent directory, unpack it first or recreate the archive with the report files at the root.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Publish attachments correctly

Screenshots, videos, traces and other attachments must remain reachable from the report. If you move them to object storage or another web server, set the attachment base URL to the location that serves them. A report that loads its HTML but shows broken attachment links usually has a path or base-URL mismatch, not a test-result problem.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common problems

Symptom Likely cause Fix
“Unknown reporter html” or a missing Playwright command The command is running outside the Playwright Test project, or the package is not installed. Run it from the project containing @playwright/test and install the project dependencies before retrying.
No playwright-report directory appears The test command stopped before the reporter completed, or a custom output directory is configured. Check the command’s final error, inspect PLAYWRIGHT_HTML_OUTPUT_DIR and the outputFolder setting, then rerun.
The browser does not open automatically open is never, the environment is headless, or the run passed while the setting is on-failure. Run npx playwright show-report manually or set open: 'always' for a local run.
show-report says the port is in use Another process already listens on that port. Choose an unused port, for example npx playwright show-report --port 8080.
Attachments show as missing Only the HTML was copied, or attachments moved without updating their base URL. Publish the complete report directory or configure the attachment base URL for the new location.
The merged report is incomplete Not all shard blob artifacts were collected, or the merge path does not contain the expected blobs. Verify every shard uploads its blob report and that the merge job downloads all of them before running merge-reports.
A ZIP will not open index.html is nested below an extra directory. Repack the archive with index.html at its top level, as required by the documented ZIP workflow.

Reliability, storage and cost considerations

  • The HTML reporter runs as part of the test command; it does not require a separate reporting service.
  • Report size depends on the number of tests and retained screenshots, videos, traces and other attachments. Set retention policies for CI artifacts so storage does not grow without limit.
  • Use a stable, unique output directory per CI job or clean the directory before a run. Mixing files from different runs can create stale attachments and confusing results.
  • For sharded suites, blob reports are the intermediate format; merge only after every shard has finished and its artifact is available.
  • Do not treat a port number or output-folder default as a performance guarantee. They are configuration defaults documented by Playwright, not benchmarks.

Or skip the browser setup

Playwright’s HTML report is ideal for interactive test investigation. If you have already hosted that report at a reachable URL and only need a clean image or PDF for a ticket, dashboard or archive, ScreenshotNeo can capture the rendered page through one request. It is a capture service, not a replacement for Playwright’s test reporter.

For example, after publishing your report at https://ci.example.com/playwright-report/, call the API (see the ScreenshotNeo documentation):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://ci.example.com/playwright-report/ -o shot.webp

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://ci.example.com/playwright-report/"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({
  access_key: 'YOUR_API_KEY',
  url: 'https://ci.example.com/playwright-report/'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo removes cookie and consent banners, newsletter popups and chat widgets before capture; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and whether the request was billed. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. The free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to try it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Does generating an HTML report change the test results?

No. The reporter formats the results produced by the test run; it does not alter the assertions or browser actions.

Can I merge reports from different Playwright versions?

Keep the Playwright version consistent across shards and consult the sharding documentation for compatibility requirements before merging artifacts from different versions.

Why does my report work locally but not after publishing it?

The published copy may have lost relative assets or attachments. Preserve the report directory structure and configure an attachment base URL when files are hosted separately.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.