This guide shows how isolated Playwright profiles fit into authorized QA and development work.
Use a distinct profile for local, staging, and production verification. This keeps cookies, feature flags, and cached assets from crossing environment boundaries.
node src/cli.js create catalog-local
node src/cli.js create catalog-staging
node src/cli.js create catalog-productionCreate profiles whose names explain the expected test dimension:
node src/cli.js create checkout-en-us --locale en-US --timezone America/New_York --viewport 1440x900
node src/cli.js create checkout-en-gb --locale en-GB --timezone Europe/London --viewport 1440x900
node src/cli.js create checkout-ja-jp --locale ja-JP --timezone Asia/Tokyo --viewport 1280x800Locale and timezone configuration help reproduce rendering and date-format behavior. They do not change network location.
- Launch the profile visibly.
- Sign in to an authorized test account.
- Close the browser.
- Relaunch the same profile from a test script.
The automation never needs a plaintext password. The session remains local in Chromium's storage.
Create a profile named after the issue or environment, reproduce the state, and record the CLI metadata in the bug report. Do not attach the user-data directory. Remove the profile after the issue is resolved.
Run doctor --json before an integration job and store the diagnostic result as a build artifact. It contains paths and readiness results, not cookies or browsing data. Run list --json only when profile names and local paths are acceptable in CI logs.
Never launch one profile from multiple workers. Assign a unique profile to each worker, or use ephemeral Playwright contexts when persistence is unnecessary.