Playwright Test is an end-to-end test framework for modern web apps. It bundles test runner, assertions, isolation, parallelization and rich tooling.
- Supports Chromium, WebKit, and Firefox browsers
- Cross-platform: Windows, Linux, and macOS
- Headless or headed mode
- Native mobile emulation for Chrome (Android) and Mobile Safari
- Parallel test execution by default
- Rich tooling and debugging capabilities
- Node.js: latest 22.x, or 24.x
- Operating System:
- Windows 11 or later
- macOS 14 or later
Initialize Playwright in your project:
npm init playwright@latestDuring installation, you will be prompted to choose:
- TypeScript or JavaScript (default: TypeScript)
- Tests folder name (default:
tests, ore2eiftestsalready exists) - Add a GitHub Actions workflow (recommended for CI)
- Install Playwright browsers (default: yes)
You can also create and run tests using the VS Code Extension.
After installation, your project structure will look like this:
playwright.config.ts # Test configuration
package.json
package-lock.json
tests/
example.spec.ts # Minimal example test
tests-examples/
demo-todo-app.spec.ts # Demo todo app test example
playwright.config.ts- Configuration file for target browsers, timeouts, retries, projects, reporters, and moretests/- Contains basic test filestests-examples/- Contains more comprehensive example tests (e.g., demo todo app)
npx playwright testBy default, tests run:
- In headless mode (no browser UI visible)
- In parallel across all browsers (Chromium, Firefox, WebKit)
- Results are displayed in the terminal
See the browser while tests run:
npx playwright test --headedRun tests in a single browser:
npx playwright test --project=chromiumRun a specific test file:
npx playwright test tests/example.spec.tsRun the demo todo app test:
npx playwright test tests-examples/demo-todo-app.spec.tsList all available tests:
npx playwright test --listOpen UI Mode:
npx playwright test --uiFor more details on filtering, headed mode, sharding and retries, see Running Tests documentation.
Run tests with UI Mode for watch mode, live step view, time travel debugging and more:
npx playwright test --uiUI Mode provides an interactive interface to run and debug your tests with real-time feedback.
After test execution, the HTML Reporter provides a dashboard filterable by browser, passed, failed, skipped, flaky tests and more.
The report auto-opens only when failures occur. To open it manually:
npx playwright show-reportClick on any test to inspect errors, attachments, and execution steps.
Update Playwright and download new browser binaries:
npm install -D @playwright/test@latest
npx playwright install --with-depsnpx playwright --versionFor complete documentation, visit Playwright Documentation.