# UI Testing Tiers UI client test toolchain. Project-wide testing layers (service / inter-service / system) live in [`../../docs/TESTING.md`](../../docs/TESTING.md); this doc only covers the UI-specific tiers added in Phase 2 of [`../PLAN.md`](../PLAN.md). ## Tier 1 — per-PR Triggered by `.gitea/workflows/ui-test.yaml` on every push and pull request that touches `ui/**`, `backend/**`, `gateway/**`, `game/**`, `pkg/**`, `client/**`, `go.work`, or `go.work.sum`. Linux runner only. Runs: - `go test` over the monorepo Go modules, excluding two areas: - `integration/` — needs Docker + testcontainers and is the project's `make -C integration integration` gate. - `client/` — the deprecated Fyne client (see `../PLAN.md` §74) is frozen; its tests are not run in CI. The `pkg//` modules are listed one by one in the workflow because they are independent go.work modules and `./pkg/...` does not recurse into separate modules. The exact command lives in `.gitea/workflows/ui-test.yaml`. - `pnpm test` (Vitest + `@testing-library/svelte` + `@testing-library/jest-dom`) — component / unit tests under `ui/frontend/tests/**/*.test.ts`. - `pnpm exec playwright test` — end-to-end smoke against `pnpm run dev` on port 5173. Four projects: - `chromium-desktop` (Desktop Chrome) - `webkit-desktop` (Desktop Safari) - `chromium-mobile-iphone-13` (iPhone 13 viewport, Chromium engine) - `chromium-mobile-pixel-5` (Pixel 5 viewport, Chromium engine) Playwright traces and screenshots are retained on failure and uploaded as Gitea Actions artefacts (`playwright-report` and `playwright-traces`, 14-day retention). ## Tier 2 — release Triggered by `.gitea/workflows/ui-release.yaml` on tag push (`v*`). Currently mirrors the Tier 1 step set; the dedicated release-only checks land in later phases: - **Visual regression baseline check** — Phase 33. Snapshots live in `ui/frontend/tests/__snapshots__/` until the project shifts to Argos or another visual-diff service. - **iOS smoke (Capacitor + Appium)** — Phase 32. Runs on a `macos-13` runner once the Capacitor mobile wrapper exists. Both blocks are present as commented sections in `.gitea/workflows/ui-release.yaml` with the phase number that re-enables them. ## Local execution From `ui/frontend/`: ```sh pnpm test # Vitest pnpm exec playwright install # one-time pnpm exec playwright test # all projects pnpm exec playwright test --project=chromium-desktop pnpm exec playwright show-report # open last HTML report ``` From the repository root, the same scope CI uses (backend serially because most packages spawn their own Postgres testcontainer and parallel bootstraps starve each other on constrained runners): ```sh go test -count=1 -p 1 ./backend/... go test -count=1 \ ./gateway/... ./game/... \ ./pkg/calc/... ./pkg/connector/... ./pkg/cronutil/... \ ./pkg/error/... ./pkg/geoip/... ./pkg/model/... \ ./pkg/postgres/... ./pkg/redisconn/... ./pkg/schema/... \ ./pkg/storage/... ./pkg/transcoder/... ./pkg/util/... ``` ## CI dry-run with `act` Until the Gitea Actions runner is wired up, the workflow is exercised locally with [`act`](https://github.com/nektos/act): ```sh act -W .gitea/workflows/ui-test.yaml --container-architecture linux/amd64 ``` `act` reads the workflow as GitHub Actions; the format is intentionally compatible.