Comprehensive Playwright testing framework guide. Provides setup, test writing, configuration, debugging tools, and best practices. Use when building browser automation tests, configuring test environments, debugging test failures, or implementing E2E testing strategies.
Guide for browser automation testing with Playwright. Covers setup, test development, configuration, and debugging.
For first time setup or first phase:
npm, , or ).yarnpnpmLearn core testing concepts:
--with-deps.playwright --version to confirm the installed version.npx playwright test with filters and flags.beforeEach for shared prep.// @ts-check or JSDoc types in JavaScript for type safety.Configure test environments and projects:
testIgnore, testMatch, and timeout.expect timeouts and screenshot/snapshot tolerances.use for shared defaults (baseURL, storageState, emulation, recording).--project and coordinate dependencies.globalSetup/globalTeardown runs once but with limited features.--no-deps to skip dependency projects when filtering tests.tsconfig.json in tests and output to tests-out.pretest and test scripts to build then run compiled tests.Advanced test capabilities:
base.extend and reuse setup logic.expect APIs that wait and retry for conditions.retries in config.testInfo.retry to handle retries at runtime.test.slow() to safely extend test timeouts.test.describe.configure to control mode where needed.test.skip, test.fail, test.fixme, and test.slow for control.@tag or { tag: '@fast' } for filtering.test.describe and use test.only sparingly.Troubleshoot and monitor tests:
npx playwright show-report.playwright.config.ts.request fixture for API tests with shared baseURL and headers.APIRequestContext for setup/teardown or scripts.page.addInitScript to mock browser APIs before page load.page.exposeFunction and custom logging.All resources are in resources/ organized by category:
resources/foundations/ - Getting startedresources/configuration/ - Setup and configurationresources/test-features/ - Testing capabilitiesresources/tools-and-debugging/ - Debugging and reportingWhen a task clearly requires specialized automation, explicitly invoke the relevant agent(s) listed for this repository and follow their instructions before proceeding.