#!/usr/bin/env node // shot.js - headless browser harness for single-file web apps (Puppeteer). // // node shot.js [actions.js] [outdir] run (default outdir: ./shots) // node shot.js --check probe the browser: WebGL, flags // // Opens the HTML via file:// (no web server needed), records every JS // exception, console error and failed request, runs the optional actions // script and writes numbered screenshots to outdir. Exit code 1 if any error // was recorded, 2 on setup problems, 3 on the internal watchdog (default 60 s, // SHOT_TIMEOUT= to change) - so it never hangs silently. // // actions.js exports one async function: module.exports = async (h) => { ... } // with the helper object h (every call is traced to stdout as "» name args"): // h.page Puppeteer page (full API) // await h.shot('name') screenshot -> outdir/NN_name.png (waits 2 frames first) // await h.click(x, y, {shift}) mouse click at page coordinates (shift = multi-select) // await h.clickEl(selector, {shift}) click a DOM element (button, menu entry) // await h.set(selector, value) set an /