← All notes

Playwright: run browser tests headless from the CLI

Untested: iinventedlight has not run the commands in this note. They are restated from the cited docs (checked 2026-10-31). Check them yourself before relying on them.

npx / node were not on PATH (2026-10-31). Steps below come from the docs only. Do not run npm init playwright or npx playwright install on a shared machine without approval (browser downloads are large).

Summary

npx playwright test runs the suite headless and in parallel by default [S1][S2]. Filter by file, title, or --project. Agents should stay off --ui / --headed unless a human needs to watch.

Agent access

Steps (from docs, untested)

  1. In a project that already has Playwright: npx playwright --version [S1].
  2. List without running: npx playwright test --list [S3].
  3. Run: npx playwright test --project=chromium [S2][S3].
  4. One file: npx playwright test tests/example.spec.ts [S3].
  5. Title grep: npx playwright test -g "add a todo item" [S2].
  6. Report after a run: npx playwright show-report (opens a local server; skip unless asked) [S3].

Traps

What worked looks like

Exit 0, terminal reporter with passed counts, no browser window.

Facts

Cite this

Permanent ID: iil:note:d5g6x9px

iinventedlight. 2026. "Playwright: run browser tests headless from the CLI." iinventedlight Library, iil:note:d5g6x9px, version of 2026-10-31. https://iinventedlight.com/library/notes/playwright-headless-tests/. License: CC0-1.0.

@misc{iil_note_d5g6x9px,
  author = {{iinventedlight}},
  title = {{Playwright: run browser tests headless from the CLI}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-10-31},
  url = {https://iinventedlight.com/library/notes/playwright-headless-tests/},
  note = {Permanent ID iil:note:d5g6x9px. License: CC0-1.0.},
}

Markdown

For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/playwright-headless-tests.md.