feat(e2e): list checks by default and run all explicitly
This commit is contained in:
1 parent
3b6948e0c1
commit
c6afe1eaf6
3 files changed
+27
-7
No files matched your search
+1
-1
@@ -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}}
|
||||
|
||||
|
||||
+5
-2
@@ -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
|
||||
|
||||
+21
-4
@@ -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/<stamp>/. --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 -- <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 });
|
||||
|
||||
Reference in new issue
Block a user