home / testing / playwright

Playwright CLI

Official · Microsoft
84k

Browser testing and automation CLI for running Playwright tests, recording flows, and inspecting reports or traces.

$npm i -D @playwright/test
Language
TypeScript
Stars
83,738
Category
Testing & QA
Agent
Ready
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis

Playwright is a browser testing and automation CLI centered on Playwright Test, with commands to run suites, record flows, install browser runtimes, and inspect reports or traces. It fits best as a verification and browser-debug surface for web apps rather than a generic shell-first scraping tool.

What It Enables
  • Run end-to-end suites across Chromium, Firefox, and WebKit with filtering, sharding, retries, and headed or headless execution.
  • Record user flows with codegen, then inspect failures through HTML reports, trace viewer, screenshots, video, and other Playwright artifacts.
  • Set up repo-local agent definitions with init-agents, and use the built-in browser or test-runner MCP surfaces when agent-assisted workflows are needed.
Agent Fit
  • Exit codes, non-interactive test flags, and CI-oriented commands make playwright test a solid verify loop for agents after UI or backend changes.
  • Structured output is real but concentrated in reporters such as --reporter=json; many other commands open browsers, HTML UIs, or inspectors instead of returning JSON.
  • Useful both directly and through the built-in MCP surfaces, but the core CLI is strongest for test execution and debugging rather than arbitrary one-off browser control.
Caveats
  • Browser-using commands need both the Playwright package and downloaded browser binaries; downloading browsers alone is not a full install path.
  • codegen, show-report, show-trace, and --ui are interactive or UI-heavy, so unattended workflows usually revolve around playwright test and reporter artifacts.