Checked-in browser smoke test for the UI #14
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
npm testcovers only the pure logic (crypto, model, ops, print helpers, build).src/app.js(the whole UI, ~690 lines) has no automated tests. Browser behavior for #10-#13 was verified with throwaway headless-Chromium scripts that were never committed, so a later change can break drop/paste/Cancel/print whilenpm teststill passes.Goal
A committed smoke test that drives a real browser through the main flows, with no new npm dependencies, that skips itself when no browser is available (like the existing test that skips without
data/seed.json).Approach
test/browser.test.jsundernode --test. Launch Chromium/Chrome headless with--remote-debugging-port, talk to it over the DevTools protocol using Node's globalWebSocket(Node >= 22; skip on older) andfetch.FW_CHROMEenv var, else a short list of usual locations (Playwright cache, google-chrome, chromium, Edge). If none is found, skip with a clear message.assemble/encrypt, notdata/seed.json). Use a fresh--user-data-dirand a free port; always kill the browser and delete temp files, even on failure.test/helpers/cdp.js): launch, evaluate, click-by-text, set-value, wait-for, dialog auto-handling (confirm accept/decline), in-page helpers to make PNG/JPEG Files and fire drop/paste/picker events, and a stub forshowSaveFilePickerthat captures the saved HTML.Flows to cover
Page.printToPDFafter Print (masked and full); assert the PDF text has the running header, numbered steps,[withheld]vs real text (parse text with a tiny built-in check on the PDF or simply assert on the built print DOM before printing; no PDF library dependency).Acceptance
npm testruns it when a browser exists and skips cleanly (reported as skipped) when not.data/,dist/orF:.FW_CHROME.Out of scope
Firefox/Safari, visual (pixel) comparisons, CI wiring.
Open question