test: check the app in a real browser, because the suites cannot

Every serious defect this session survived a green suite. The sharpest:
THREE.WebGLRenderer throws on a device with no WebGL, the exception escaped
its effect, React unmounted the whole root, and every page rendered blank.
432 frontend tests passed throughout, because jsdom never builds a WebGL
context and nothing exercised a real page in a real browser.

scripts/smoke.py closes that blind spot. It drives Chrome over the DevTools
Protocol — no framework, no npm dependency — and checks each of the 13
routes for the four failures that have actually happened here: a page that
renders nothing, horizontal scroll on a phone, an input under 16px (iOS
zooms on focus and never zooms back), and any uncaught error during load.
Non-zero exit, so it can gate a deploy.

All four checks are PROVEN to fire, by pointing the script at a page built
with each defect on purpose — which is how I found that my own
horizontal-scroll check was broken. It compared scrollWidth against
window.innerWidth, but under Chrome's mobile emulation innerWidth expands to
the CONTENT width when a page overflows: 1200 on a 390px viewport, so the
difference was always 0 and the check could never fire. It reported "ok" on
a deliberately 1200px-wide page. Now compares against
documentElement.clientWidth, which stays at the true 390, and reports
"H-SCROLL +810px" on that same page.

Worth stating plainly: the earlier clean sweep I reported was measured with
that broken check, so its horizontal-scroll result was meaningless. Re-run
with the fix, all 13 routes still pass at 390x844 and 1440x900 — but that is
the run that counts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Indiana
2026-08-07 00:57:37 +00:00
parent b2b0dc319a
commit e02aecee65
2 changed files with 193 additions and 0 deletions

View File

@@ -384,6 +384,26 @@ en/es parity gate (`npm run pretest`):
cd frontend && npm test
```
**Browser smoke** (`scripts/smoke.py`) — renders every route in a real
Chrome and checks four things jsdom structurally cannot see:
```bash
chrome --headless --remote-debugging-port=9222 &
backend/venv/bin/python scripts/smoke.py # 390x844, live site
backend/venv/bin/python scripts/smoke.py --width 1440 # desktop
```
Run it after any UI change and before any deploy; it exits non-zero on
failure. **This is not optional belt-and-braces.** Both suites were fully
green while `new THREE.WebGLRenderer()` threw on any device without WebGL,
the exception escaped its effect, and React unmounted the entire root —
every page a blank screen, no modes, no ask field, nothing. 432 frontend
tests could not see it because jsdom never builds a WebGL context. This
script catches that, plus horizontal scroll on a phone, inputs under 16px
(which make iOS zoom in and never back out), and any uncaught error during
load. All four are proven to fire, by pointing it at a page that has each
defect on purpose.
**Hardware-in-the-loop** (cannot be unit tested): the RTL-SDR sweep, mic
permissions, phone sensors, and everything in `firmware/` need real
hardware passes. `docs/CHANNELS.md` tracks exactly what has and hasn't had