diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 479e852f..a0055e69 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -26,7 +26,7 @@ jobs: - run: (cd app && flutter pub get) - run: ci/test.sh - run: ci/test_a11y.sh - - run: ci/coverage.sh + - run: ci/test_coverage.sh integration: name: integration_test (xvfb) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb261a30..f72a57ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ heading, and (b) bumping `project.yaml` `version:` in the same commit. ### Added +- Makefile targets for every test layer and the UI harness: `test`, `test-a11y`, `test-integration`, `test-e2e`, `test-all`, `coverage`, `smoke-bundle`, `ui-dev`, `ui-stop`, `ui-smoke`. `push-check` now runs `test + test-a11y` (fast pre-push gate, <90s). - Per-layer CI shell scripts under `ci/`: `test.sh` (analyze + format + unit + widget + golden, ~5s), `test_a11y.sh` (a11y contract), `test_integration.sh` (integration_test one file at a time — desktop can't batch them reliably), `test_e2e.sh` (daemon subprocess + browser WASM Playwright smoke), `smoke_bundle.sh` (xvfb-run the Linux release bundle for 5s; catches dynamic-linker / asset-bundle / plugin-init regressions that widget tests can't see), `coverage.sh` (flutter test --coverage + lcov summary). - `.gitea/workflows/test.yml` — four-job pipeline (`unit`, `integration`, `startup-bundle`, `e2e`) that shells out to the `ci/*.sh` scripts. **Not activated yet** — Gitea Actions has to be enabled in the instance settings first. GitHub-Actions-syntax-compatible, so copying to `.github/workflows/` is a one-file move when the repo migrates. - Web WASM harness under `tools/ui/` — Playwright driver so Claude Code (and humans) can drive the Flutter build in a real browser via the Semantics tree. `build.sh` / `serve.sh` / `stop.sh` manage a local `http.server` on `:4280` with port-based reclaim and kill (so orphaned listeners from earlier runs get swept). `driver.ts` exposes `ClideDriver` with `byLabel` / `click` / `type` / `readText` / `screenshot` / `dumpSemanticsTree` / `waitUntilReady` (auto-clicks the `flt-semantics-placeholder` to enable the semantics tree). First Playwright test `smoke.spec.ts` asserts welcome + disconnected labels render in the browser. diff --git a/Makefile b/Makefile index 8855a57b..2e0a14de 100644 --- a/Makefile +++ b/Makefile @@ -70,20 +70,48 @@ else endif .PHONY: test -test: ## flutter test (unit + widget). -ifeq ($(APP_PRESENT),yes) - flutter test -else - @echo "(pubspec.yaml not scaffolded yet; skipping)" -endif +test: ## Fast: analyze + format + unit + widget + golden (<60s). + ci/test.sh + +.PHONY: test-a11y +test-a11y: ## A11y contract (semantic coverage + keyboard + contrast + i18n). + ci/test_a11y.sh .PHONY: test-integration -test-integration: build ## Integration tests (daemon + CLI + fixture repos). -ifeq ($(APP_PRESENT),yes) - flutter test integration_test || echo "(no integration_test suite yet)" -else - @echo "(pubspec.yaml not scaffolded yet; skipping)" -endif +test-integration: ## Integration tests (real app boot; xvfb on headless Linux). + ci/test_integration.sh + +.PHONY: test-e2e +test-e2e: build ## Daemon subprocess + web WASM Playwright smoke. + ci/test_e2e.sh + +.PHONY: test-all +test-all: test test-a11y test-integration test-e2e ## Everything, sequentially. + +.PHONY: coverage +coverage: ## flutter test --coverage + lcov summary. + ci/test_coverage.sh + +.PHONY: smoke-bundle +smoke-bundle: ## Build Linux release bundle and run it under xvfb for 5s. + ci/smoke_bundle.sh + +# -- web UI harness (for Claude Code to drive the app) ----------------- + +.PHONY: ui-dev +ui-dev: ## Build web WASM + start localhost:4280 in the background. + tools/ui/build.sh + tools/ui/serve.sh + +.PHONY: ui-stop +ui-stop: ## Stop the background web server. + tools/ui/stop.sh + +.PHONY: ui-smoke +ui-smoke: ## Build + serve + run Playwright smoke + stop. + tools/ui/build.sh + tools/ui/serve.sh + @sh -c 'trap "tools/ui/stop.sh >/dev/null 2>&1" EXIT; cd tools/ui && npx playwright test smoke.spec.ts' .PHONY: build-linux build-linux: ## flutter build linux (desktop bundle). @@ -133,7 +161,7 @@ security: ## Dart advisory review + ptyc source review (manual — no floating d # -- pre-push gate ------------------------------------------------------- .PHONY: push-check -push-check: analyze format test ## Full pre-push gate — everything that must pass before a push. +push-check: test test-a11y ## Pre-push gate: fast unit + widget + golden + a11y (<90s). .PHONY: hooks hooks: ## Install the repo's git hooks (points core.hooksPath at .githooks/). diff --git a/ci/test_coverage.sh b/ci/test_coverage.sh new file mode 100755 index 00000000..fa2f2be0 --- /dev/null +++ b/ci/test_coverage.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# Generate + summarize lcov coverage. No thresholds yet (see plan's +# "Open questions deferred" — we let the suite run for a week of real +# commits before setting hard gates that would just need tuning). +set -euo pipefail +cd "$(dirname "$0")/.." + +echo "==> flutter test --coverage" +(cd app && flutter test --coverage) + +echo "==> root dart coverage (skipped until dart_test + coverage integrate)" +# dart test doesn't emit lcov natively; wire package:coverage later. + +if command -v lcov >/dev/null 2>&1; then + echo "==> lcov summary" + lcov --summary app/coverage/lcov.info +fi