test: add v3 latency probe and modernize api coverage

This commit is contained in:
Scott Idem
2026-05-21 17:48:00 -04:00
parent f5cf1ef398
commit 55d3d49595
4 changed files with 341 additions and 36 deletions

View File

@@ -74,6 +74,21 @@ git add tests/
git commit -m "test: add <description>"
```
Latency probing
- Use the gated probe in `tests/v3_api_latency_probe.test.ts` for quick live rounds against V3 list endpoints.
- Run it only when you have the live API key available:
```bash
RUN_V3_LATENCY_PROBE=1 PUBLIC_AE_API_SECRET_KEY=... npx playwright test tests/v3_api_latency_probe.test.ts -c playwright.config.ts
```
- Tune the rounds with `V3_LATENCY_ROUNDS` and the pause between calls with `V3_LATENCY_PAUSE_MS`.
- Reports are written to `tests/results/` as JSON and Markdown per run.
- Optional bug-finding thresholds:
- `V3_LATENCY_MAX_ERROR_RATE` (default `0`) — fail if an endpoint exceeds this error rate
- `V3_LATENCY_MAX_P95_MS` (optional) — fail if endpoint p95 exceeds the threshold
- `V3_LATENCY_REQUIRE_ROWS=1` (optional) — fail if all rounds return zero rows
- `V3_LATENCY_OUTPUT_DIR` (optional) — override report directory (default `tests/results`)
Help
- If a test fails due to external network calls or platform-specific behavior, try mocking the relevant endpoints and move the test to `tests/disabled` if it cannot be made deterministic.