| .. | ||
| lib | ||
| specs | ||
| .env.example | ||
| playwright.config.ts | ||
| README.md | ||
Web tests (Playwright) — superadmin-ui + region APIs
Browser/UI coverage for http://localhost:4175 (superadmin-ui) plus
API-level region assertions against the backend. Complements
tests/e2e/regions (Maestro, mobile apps).
Layout
tests/web/
playwright.config.ts # specs/, baseURL SUPERADMIN_URL, 1 worker
.env.example # copy to tests/web/.env (never commit secrets)
lib/helpers.ts # UI login, unique stamps, polygon builder
lib/trpc.ts # tRPC-over-HTTP helper (staffLogin, trpcCall)
specs/auth.spec.ts # login happy path + wrong password
specs/regions.spec.ts # regions list loads; create region (UI)
specs/regions-negative.spec.ts # API negatives: dup priorities/creds/name,
# pri 0, delete refusal, SEC 403/401
specs/admins.spec.ts # create admin (UI) + login as new admin
specs/resolution.spec.ts # read-only lat/lng resolution matrix (§2)
specs/consts-read.spec.ts # read-only essentialConsts shape per region
Prerequisites
- Backend on
API_URL(defaulthttp://127.0.0.1:8787) with region migrations applied; superadmin-ui onSUPERADMIN_URL(defaulthttp://localhost:4175). - Playwright browsers:
npx playwright install chromium(or reuse the ms-playwright cache). R1_ADMIN_NAME/R1_ADMIN_PASSWORD(any non-superadmin staffer) for the 1.18 forbidden check;TEST_BOT_TOKEN/TEST_CHAT_IDfor region creation (any values; routing is asserted elsewhere).
Run
cp tests/web/.env.example tests/web/.env # fill in passwords
# from the repo root:
npx playwright test --config tests/web/playwright.config.ts
# single file:
npx playwright test --config tests/web/playwright.config.ts regions
Note: workers: 1 is deliberate — region creation is global mutable state.
Regions are non-deletable by design, so UI/API creation cases leave
timestamped PW-* regions behind (see regions-negative.spec.ts header).