CLI Commands in Playwright

From the Playwright cheat sheet · Running Tests & CI · verified Jul 2026

CLI Commands

Common commands for running and filtering tests

bash
# Run all tests
npx playwright test

# Run specific file
npx playwright test tests/login.spec.ts

# Run tests matching name
npx playwright test --grep "submit form"

# Run in specific project/browser
npx playwright test --project=chromium
💡 Use codegen to record browser interactions and generate test code automatically
⚡ --workers=1 forces serial execution — useful for debugging flaky tests
📌 Use --update-snapshots after intentional UI changes to refresh golden screenshots
🟢 Combine --grep with --project to run specific tests in specific browsers
clirunci

More Playwright tasks

Back to the full Playwright cheat sheet