End-to-End Testing¶
Synthetic-events harness¶
tests/e2e/test_synthetic_events.py runs a CI-safe end-to-end test:
- Spin up backend with a temp data dir
- Generate synthetic events from
tests/corpus/safety_test_cases.json: - Safe gaming chat
- Off-platform contact request
- Secrecy phrase
- Scam ("free robux")
- Bullying escalation
- Self-harm language
- Phishing link
- Plus deliberate false-positive borderline cases
- Complete first-run setup with the one-time setup token
- Pair a synthetic child device and assign it to a child profile
- POST each event to
/api/events - Classify with a canned local classifier fixture (no Ollama required)
- Assert risk levels and categories match expected
- Verify alerts are created according to policy
- Verify dashboard APIs return the expected event/alert feeds
- 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.