tests/e2e (see its README): - install.mjs: real install.sh in a Debian container - VPN-safe HOST_IP detection on simulated hosts, fresh/upgrade/re-run, and the proxy config byte-identical to nginx-proxy/nginx.conf (guards rule CS-5) - license_e2e.py: real cloud + site processes with a throwaway signing key - 400 days offline, tampered file, clock rollback, expiry deferred to workday close, renewal, remote lock - browser.mjs: web delivery modes (same-origin, plain HTTP by LAN IP, venue mode) and the install dialog on Android/iPhone/desktop/no-APK - android.mjs basics|rediscovery|stacks: pairing, venues, camera, back button, restart; IP change / server down / cold start; TLS pinning (wrong-key QR, impostor, upgrade, renewal, rediscovery) and UI bundles (apply, staged, tampered, APK too old, rollback, two venues) on isolated compose stacks built from the repo - lib/: env (paths, LAN IP autodetect, settings), proc (seeded throwaway DBs via demo_seed.py, backends, nginx, Vite, compose stacks), android (adb + WebView DevTools, boots the AVD), cdp - run-all.mjs runs everything fastest-first with a summary Nothing machine-specific is hard-coded; developer stacks/DBs are never touched. Results on this machine: install 9/9, license 17/17, browser 22/22, android basics 19/19, rediscovery 10/10, stacks 21/21. Pack README: Testing section + rule CS-11 (tests follow the code; run run-all before a release). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4.2 KiB
4.2 KiB
client-services tests
Automated checks for everything built in the native-app / LAN plan (docs/plans/native-waiter-app.md in the parent repo) and for offline licensing (KI-006).
Run them before a release and after changing anything they cover.
Quick: unit tests (seconds, no servers)
cd client-services/local_backend
pip install -r requirements-dev.txt # once
python -m pytest tests -q # license rules, LAN-IP detection + priority, TLS identity
cd ../waiter_pwa
npm test # server rediscovery scan
Full: end-to-end suites
cd client-services/tests/e2e
npm install # once (Playwright, fflate)
node run-all.mjs # everything, fastest first, with a summary
node run-all.mjs --no-android # everything except the emulator
Or run one suite at a time:
| Command | What it checks | Needs | Time |
|---|---|---|---|
node install.mjs |
install.sh: VPN-safe HOST_IP detection (simulated WireGuard/WiFi hosts); fresh install, upgrade, re-run; proxy config identical to nginx-proxy/nginx.conf |
Docker | ~1 min |
python license_e2e.py |
Offline licensing with a real cloud + site process: 400 days offline, tampered file, clock set back, expiry deferred to workday close, renewal, remote lock | Python deps of both backends | ~2 min |
node browser.mjs |
Waiter web modes (same-origin, plain HTTP by LAN IP, venue mode), install dialog + drawer entry (Android / iPhone / desktop / no APK) | Docker, Edge | ~2 min |
node android.mjs basics |
Pairing, wrong address / other venue's QR, login + live WS, back button, restart, two venues, camera permission | Android emulator | ~5 min |
node android.mjs rediscovery |
Server IP change (logged in / out), server down + manual search, cold start while offline | Android emulator | ~4 min |
node android.mjs stacks |
TLS pinning (wrong-key QR, impostor server, HTTP→TLS upgrade, cert renewal, rediscovery over TLS) and UI bundles (apply, staged, tampered, APK too old, rollback, two venues) on two docker-compose stacks built from this repo | Android emulator, Docker | ~20 min |
Requirements
- Python with
local_backend/requirements.txtandcloud-service/cloud_backend/requirements.txtinstalled. - Node 22+, Docker (Docker Desktop is fine).
- Browser suite: system Edge (default). Set
BROWSER_CHANNEL=(empty) to use Playwright's own Chromium afternpx playwright install chromium. - Android suites: the Android SDK (
ANDROID_HOME, or the default location) and an emulator AVD. Default nameXenia_Test_Phone(Pixel 4a, API 35), override withAVD=<name>. The suite builds the debug APK itself (SKIP_APK_BUILD=1reuses the last one), and boots the emulator if none is attached.
Settings (environment variables)
| Variable | Default | Meaning |
|---|---|---|
LAN_IP |
auto (first non-VPN, non-virtual adapter) | This PC's LAN address, for the "plain HTTP by LAN IP" checks |
PYTHON |
python / python3 |
Python executable |
BROWSER_CHANNEL |
msedge |
Playwright browser channel |
AVD |
Xenia_Test_Phone |
Emulator to boot |
SKIP_APK_BUILD |
unset | Reuse the last debug APK |
CLOUD_DIR |
../cloud-service/cloud_backend |
Cloud backend for the license suite |
Good to know
- Test data: suites never touch your databases. They start from a fresh copy of a demo-seeded database (
local_backend/demo_seed.py), seeded once intoout/seed.db. Delete it to reseed. - Ports used: 8055/8056 (backends), 8101 (cloud), 5180 (Vite), 15173/15174 (nginx), 18080–18444 and 28080–28443 (compose stacks). Your own dev stack's ports (80/443/8081/8443/5173/5174) are never used. Stop anything else on those ports first.
- Isolated stacks: the compose stacks run under their own project names (
xenia-e2e-v1/v2) with their own images and data. They're removed afterwards. - Output: screenshots and logs go to
out/, which is gitignored. - Licensing in tests: the license suite signs with a throwaway key, and the production signing key is never needed. The other suites run their backends without a cloud URL, so licensing is off, as on any dev setup.