Skip to content

End-to-End Testing

Synthetic-events harness

tests/e2e/test_synthetic_events.py runs a CI-safe end-to-end test:

  1. Spin up backend with a temp data dir
  2. Generate synthetic events from tests/corpus/safety_test_cases.json:
  3. Safe gaming chat
  4. Off-platform contact request
  5. Secrecy phrase
  6. Scam ("free robux")
  7. Bullying escalation
  8. Self-harm language
  9. Phishing link
  10. Plus deliberate false-positive borderline cases
  11. Complete first-run setup with the one-time setup token
  12. Pair a synthetic child device and assign it to a child profile
  13. POST each event to /api/events
  14. Classify with a canned local classifier fixture (no Ollama required)
  15. Assert risk levels and categories match expected
  16. Verify alerts are created according to policy
  17. Verify dashboard APIs return the expected event/alert feeds
  18. Review an alert, export encrypted storage, and run retention cleanup

Classifier mode

The default E2E path does not call Ollama. It monkeypatches the backend text classifier with responses from tests/corpus/safety_test_cases.json, which keeps CI deterministic and fast. Live Ollama/GPU behavior is validated as a manual release acceptance pass on a GPU node.

Running

cd backend
pytest ../tests/e2e/

The deterministic beta classifier gate expands the versioned scenario corpus to 196 context variants and enforces precision, recall, critical-risk recall, category recall, and p95 latency:

python scripts/run_classifier_benchmark.py --mode rules

With real Ollama available, run the same corpus through the complete text classifier. This is the hardware release-acceptance gate and writes an optional machine-readable report:

python scripts/run_classifier_benchmark.py --mode live \
  --output build/classifier-benchmark-live.json

Manual acceptance test (release gate)

Documented in the rollout plan — fresh Windows 11 VM, run the installer, verify all 13 steps pass.