# Testing Every suite drives the **live site over HTTP**, so the dev server must be running (`make start`) before any of them. --- ## Commands | Command | Scope | |---|---| | `make test` | Everything: `test-config` → `test-post` → `test-ui` | | `make test-config` | Form/config sanity via `scripts/test-form-config.sh` | | `make test-post` | End-to-end post submission via `scripts/test-post.sh` | | `make test-ui` | Playwright suite (`npx playwright test`) | | `make test-account` | Creates the `testrunner` admin if absent (a dependency of `test-post` and `test-ui`) | Focused runs bypass `make`: ```bash npx playwright test tests/ui/maps # one suite npx playwright test tests/ui/maps --headed # watch it ``` --- ## Layout ``` playwright.config.js ← config (testDir: ./tests/ui) tests/ ├─ global-setup.js ← runs once before all projects ├─ global-teardown.js ← runs once after ├─ fixtures/ └─ ui/ ├─ helpers.js ← shared helpers; import from here rather than re-rolling ├─ auth/ ← includes auth.setup.js (see below) ├─ a11y/ dailies/ gpx/ home/ ├─ maps/ nav/ post/ stories/ trip/ ``` --- ## Config facts | Setting | Value | Why it matters | |---|---|---| | `baseURL` | `process.env.GRAV_BASE_URL \|\| 'http://localhost:8081'` | Set `GRAV_BASE_URL` to test a worktree's isolated server on `8090+` | | `retries` | `0` | A failing test is a real failure, not flake — do not paper over it with retries | | `timeout` | `30_000` | Per test | | `screenshot` | `only-on-failure` | Video off; artifacts stay small | | `reporter` | `line` | | ### Auth is a dependency project Two Playwright projects, in order: 1. **`setup`** — matches `auth.setup.js`, logs in once, writes `tests/.auth/user.json`. 2. **`chromium`** — `dependencies: ['setup']`, consumes that file as `storageState`. So every test in `chromium` starts already authenticated. **Never add a per-test login** — it duplicates the setup project and slows the suite. ### The test account `make test-account` creates a `testrunner` admin (via `bin/plugin login new-user`, admin type `both`) inside the container if `user/accounts/testrunner.yaml` is missing. It is git-ignored. - Never commit it. - Keep the password free of shell/Make/URL-special characters — it is interpolated by the Makefile, `scripts/test-post.sh`, and the Playwright setup, and a special character breaks at least one of them.