From c6afe1eaf635697b614bee7eabdde3d1c81acf1f Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Mon, 19 Oct 2026 00:38:17 +1100 Subject: [PATCH] feat(e2e): list checks by default and run all explicitly --- Taskfile.yml | 2 +- e2e/README.md | 7 +++++-- e2e/run.cjs | 25 +++++++++++++++++++++---- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Taskfile.yml b/Taskfile.yml index d49b55c1d..885198679 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -218,7 +218,7 @@ tasks: - bash e2e/stack.sh stop e2e:check: - desc: Run the browser checks against the running e2e stack (-- --record VERSION for release evidence) + desc: List browser checks; use -- all or -- CHECK to run (-- --record VERSION all for release evidence) cmds: - node e2e/run.cjs {{.CLI_ARGS}} diff --git a/e2e/README.md b/e2e/README.md index bca99f7fc..e8bebf61b 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -17,7 +17,10 @@ park, which is useful data for the dashboard. ```bash task e2e:up # build, start everything, seed -task e2e:check # all checks; or: node e2e/run.cjs routes +task e2e:check # list available checks (no stack needed) +task e2e:check -- list # explicitly list checks +task e2e:check -- workflow-phone # one check +task e2e:check -- all # all checks task e2e:down # stop; e2e/stack.sh reset also deletes the data ``` @@ -41,7 +44,7 @@ preinstalled; run with `NODE_PATH=$(npm root -g)`. ## Release evidence ```bash -node e2e/run.cjs --record v1.54.0 +node e2e/run.cjs --record v1.54.0 all ``` writes `results/v1.54.0.md`, the pass or fail of every check for that diff --git a/e2e/run.cjs b/e2e/run.cjs index 510babcfa..9ac4d0ad8 100644 --- a/e2e/run.cjs +++ b/e2e/run.cjs @@ -2,19 +2,36 @@ // Chromium. Each module in checks/ exports async ({ page, go, shot, fail }). // A check fails on a thrown error or any console or page error. // -// node e2e/run.cjs [--record VERSION] [check ...] +// node e2e/run.cjs [--record VERSION] [list | all | check ...] // // Screenshots and results.json go to e2e/out//. --record also writes // e2e/results/VERSION.md, the committed evidence for a release. const fs = require('fs'); const path = require('path'); -const { chromium } = require('playwright'); const base = process.env.ARCHIE_E2E_URL || 'http://localhost:5173'; const args = process.argv.slice(2); let record = ''; -if (args[0] === '--record') { record = args[1]; args.splice(0, 2); } -const names = args.length ? args : fs.readdirSync(path.join(__dirname, 'checks')).filter((f) => f.endsWith('.cjs')).map((f) => f.slice(0, -4)).sort(); +if (args[0] === '--record') { + record = args[1]; + if (!record || record.startsWith('-')) { + console.error('Usage: --record VERSION all|check ...'); + process.exit(1); + } + args.splice(0, 2); +} +const available = fs.readdirSync(path.join(__dirname, 'checks')).filter((f) => f.endsWith('.cjs')).map((f) => f.slice(0, -4)).sort(); +if (!args.length || (args.length === 1 && args[0] === 'list')) { + console.log(`Available browser checks:\n${available.map(name => ` ${name}`).join('\n')}\n\nRun: task e2e:check -- \nAll: task e2e:check -- all`); + process.exit(0); +} +const names = args.length === 1 && args[0] === 'all' ? available : args; +const unknown = names.filter(name => !available.includes(name)); +if (unknown.length) { + console.error(`Unknown checks: ${unknown.join(', ')}. Run task e2e:check to list available checks.`); + process.exit(1); +} +const { chromium } = require('playwright'); const stamp = new Date().toISOString().replace(/[:.]/g, '-'); const out = path.join(__dirname, 'out', stamp); fs.mkdirSync(out, { recursive: true });