@@ -47,3 +47,35 @@ falls back to MySQL (meant for development), which stops a search after
4747query can run past it (a LIKE-only scan over all versions reads 100,000 ids per query, about
4848150 ms; other queries are bounded by their FULLTEXT match or by the LDS/KJV rows of a verse
4949range). Rows read are counted as the id span of such a scan, otherwise as the rows returned.
50+
51+ ## Browser smoke suite
52+
53+ ` test/browser/smoke.mjs ` loads the pages in ` test/browser/pages.mjs ` in Chromium on the live site
54+ and on a Node app, compares screenshots and drives the reader (version box, copy, version
55+ selector) on the Node page. It is a manual check before a deploy or on staging, not part of CI:
56+ it needs the live site and a Node app running against a full copy of the database (setup in
57+ ` test/parity/README.md ` ).
58+
59+ ``` sh
60+ npx playwright install chromium # once
61+ npm run browser -w @scripture-guide/web -- [--only < name| path> ] [--reuse-live] [--font-mode native]
62+ ```
63+
64+ A page fails when more than ` PIXEL_THRESHOLD ` of its pixels differ (default 0.001), when one
65+ region of differing pixels holds more than ` REGION_MAX_PIXELS ` (default 100), or on a console
66+ error, failed request or interaction on the Node page. Screenshots, diffs and ` report.json ` go
67+ to ` test/browser/.out/ ` (gitignored).
68+
69+ | Variable | Default | |
70+ | ---| ---| ---|
71+ | ` NODE_BASE ` | ` http://127.0.0.1:3101 ` | Node app under test |
72+ | ` LIVE_BASE ` | ` https://scripture.guide ` | reference site |
73+ | ` FONT_CHECK_BASE ` | unset | a second Node app started with ` FONT_DIR ` /` FONT_BASE ` : fails unless the private font is declared, fetched and used there |
74+ | ` FONT_MODE ` | ` normalize ` | ` normalize ` sets the text of both pages in one font, so the diff measures layout; ` native ` compares the real fonts |
75+ | ` PIXEL_THRESHOLD ` , ` REGION_MAX_PIXELS ` , ` REGION_GAP ` | 0.001, 100, 2 | the comparison gates |
76+ | ` LIVE_MAX_AGE_DAYS ` | 7 | oldest live screenshot ` --reuse-live ` accepts |
77+
78+ Each page loads once on live per run, one after another. ` --reuse-live ` uses the live screenshot
79+ saved by an earlier run instead, when its sidecar (` <name>.live.json ` : capture time, font mode,
80+ masks, viewport) matches this run and is recent enough; otherwise that page loads live again.
81+ Prefer it while iterating on the Node side.
0 commit comments