End-to-end (Playwright) and load (k6) test suites for the GovernsAI stack. Intended to be consumed as a git submodule from the governsai-infra meta-repo at tests/.
e2e/ Playwright specs (dashboard, precheck, extension flows)
load/ k6 load-test scripts
load/baselines/ Immutable history of baseline P99/error-rate runs
contracts/ Cross-repo contract checks (SDK ↔ precheck, docs links)
- Node.js ≥ 20
- k6 on
PATH - A running GovernsAI stack (
cd governsai-infra && docker-compose up -d)
npm install
npm run install-browsers # one-time Playwright browser download
cp .env.example .env # then edit valuesnpm test # all specs, headless
npm run test:ui # interactive Playwright UI
npx playwright test e2e/smoke.spec.tsnpm run test:load
# or directly:
PRECHECK_BASE_URL=http://localhost:3080 k6 run load/precheck-baseline.jsThe precheck-baseline.js script ramps from 10 to 1000 RPS over 5 minutes
against POST /api/v1/precheck, asserting P99 < 50ms and error rate < 0.1%
(TASKS.md §2.5g). The k6 summary is written to load/baselines/precheck-latest.json
by default — override with SUMMARY_PATH=….
Record a new baseline under load/baselines/precheck-YYYY-MM-DD.json.
Baselines are append-only — never overwrite existing files. The
load-precheck workflow publishes new baselines automatically on its weekly
run (or on a workflow_dispatch with commit_baseline=true).
Regression gate:
node load/compare-baseline.mjs --summary load/baselines/precheck-latest.jsonFails if P99 latency regressed more than 20% vs the most recent committed baseline, or the error rate crossed the 0.1% SLO.
| Variable | Purpose |
|---|---|
GOVERNSAI_BASE_URL |
Dashboard URL for Playwright baseURL |
PRECHECK_BASE_URL |
Precheck service URL for load + contract tests |
PRECHECK_API_KEY |
Bearer token used in load + contract tests |
TEST_USER_EMAIL / TEST_USER_PASSWORD |
Seeded user for auth specs |
See .env.example for the full list.
E2E runs nightly and on every release tag; load tests run weekly via
.github/workflows/load-precheck.yml (Mondays 07:00 UTC) with a
workflow_dispatch override. Contract checks run on every PR to precheck,
typescript-sdk, python-sdk, and docs. Pipelines live in
.github/workflows/ in each consuming repo.