docs: cut CLAUDE.md to rules-only (179 → 74 lines)
CLAUDE.md now carries only what must be known *before* opening a file: hard rules, gotchas, and an entry-point table. Everything descriptive moved to the doc that lives next to the code. Moved out: - stack versions, plugin roles, asset pipeline, nav shape, user/ repo tracking rules → docs/reference/architecture.md - Playwright layout, config facts, auth-setup project, test account → docs/reference/testing.md (new) - folder map, full make command list (build/test/demo/worktree targets that only existed in CLAUDE.md) → README.md - dev/prod Twig settings table → already in docs/guides/deploy-cycle.md Fixed while verifying, all of them descriptions that had drifted: - demo fixtures were listed as italy-2026-demo + no-photos-demo; the actual folders are italy-2025 + italy-2026-demo - the map engine was cited at js/src/maplibre-utils.js; it is js/maplibre-utils.js, a hand-authored file beside the bundles - the build-output list omitted fonts/ and the generated templates/partials/weather-icons.html.twig, and did not flag that js/maplibre-utils.js and js/nav.js are sources living in js/ - README called user/ a "standalone git repo" (it is a submodule) - docs/README.md linked to a non-existent working/production-todo.md - git-sync-notes.md pointed at "CLAUDE.md §1", a section number that no longer exists Net: ~17.1k → ~8.5k chars of always-loaded context. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
# 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.
|
||||
Reference in New Issue
Block a user