# Humand Playwright Configuration

Reference guide for Playwright config patterns used by Humand E2E.

## Current POV (backoffice today)

- `baseURL` default currently points to `http://localhost:3000`
- reporter currently `html` + `github`
- auth setup project writes `auth/backoffice.auth.json`
- locale `en`
- `testIdAttribute` is `data-testid`
- includes `webServer` block to auto-start app for local/CI usage
- local runs should use the Playwright binary from `e2e/package.json` scripts with `PLAYWRIGHT_BROWSERS_PATH=0`

## Target architecture (Notion-aligned)

- web: `http://localhost:3000`
- backoffice: `http://localhost:3001`
- reporter strategy for sharding: `blob` + `github` + merged report
- same auth-setup dependency pattern

## Common config rules

- `fullyParallel: true`
- retries in CI only
- `trace: 'on-first-retry'`
- `screenshot: 'only-on-failure'`
- `video: 'retain-on-failure'`

## Projects pattern

1. `auth-setup` project
2. browser projects that depend on `auth-setup`

## Environment

Use `.env.local` for:

- `PLAYWRIGHT_BASE_URL`
- `PLAYWRIGHT_AUTH_USER`
- `PLAYWRIGHT_AUTH_PASSWORD`

Do not commit secrets.

## Recommended local workflow

1. Run `npm --prefix e2e run install:browsers` once after upgrading Playwright or setting up a new machine.
2. Run `npm --prefix e2e run setup:auth` to refresh `auth/backoffice.auth.json`.
3. Run `npm --prefix e2e run test`, `test:headed`, or a focused `playwright test` command through the same `PLAYWRIGHT_BROWSERS_PATH=0` contract.

## Notes

- Avoid `npm exec -- playwright ...` from the repo root, because it can resolve a different Playwright version than the one pinned in `e2e/package.json`.
- If a run fails with a missing browser executable, reinstall with `npm --prefix e2e run install:browsers`.

## Team guidance

Document both POV and target examples in CI docs so the team can adopt progressively without losing alignment with final architecture.
