feat(web): panel scroll contract, layout probe and functional suite
- lock the three-column height chain on workbench/PartDesign pages so each side panel scrolls independently and the centre stage keeps its size - dock module task panels above the layout with their own scrollbar instead of letting them push the stage out of the viewport - add tools/layout-probe.mjs (page scroll, aside bounds, pane scrolling, stage stability) and CLI mode for tools/static-host.mjs with relative --root support - add the P0-P4 browser functional suite, manual scenarios and capture tooling; document it under docs/current/web-functional-suite Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
83
tools/functional-suite/cli.mjs
Normal file
83
tools/functional-suite/cli.mjs
Normal file
@@ -0,0 +1,83 @@
|
||||
// CLI contract for the headed Web FreeCAD functional suite.
|
||||
// Every option has an env equivalent so CI wrappers can stay script-free.
|
||||
|
||||
export const USAGE = `Web FreeCAD functional suite (headed by default)
|
||||
|
||||
node tools/web-freecad-functional-suite.mjs [options]
|
||||
|
||||
--only <ids> comma separated case ids (e.g. SHELL-01,CH02-part)
|
||||
--priority <list> comma separated priorities: P0,P1,P2,P3 (default all)
|
||||
--module <list> comma separated module names for MOD-* cases
|
||||
--resume <dir> continue a previous run directory (skip completed ids)
|
||||
--force with --resume, re-run completed cases
|
||||
--headless hide the browser window (default is headed)
|
||||
--gpu drop swiftshader flags (manual perf observation only)
|
||||
--slow <ms> Playwright slowMo pacing for live observation
|
||||
--highlight outline the acted element before each action
|
||||
--screenshots <s> "fails" (default) or "all"
|
||||
--jobs <n> browser workers (1 = single headed window, default 1)
|
||||
--out <dir> evidence root (default docs/current/web-functional-suite)
|
||||
--prune <n> keep only the newest n run directories
|
||||
--legacy-ids <ids> also run tools/run_user_manual_tests.mjs ids (all = 53 cases)
|
||||
--timeout-scale <x> multiply per-case timeouts (default 1)
|
||||
|
||||
With no selection flags every non-legacy case runs.`;
|
||||
|
||||
const list = value => String(value ?? "").split(",").map(item => item.trim()).filter(Boolean);
|
||||
|
||||
export function parseArgs(argv = process.argv.slice(2)) {
|
||||
const options = {
|
||||
only: list(process.env.FREECAD_SUITE_ONLY),
|
||||
priority: list(process.env.FREECAD_SUITE_PRIORITY),
|
||||
module: list(process.env.FREECAD_SUITE_MODULE),
|
||||
resume: null, force: false,
|
||||
headless: process.env.HEADLESS === "1",
|
||||
gpu: false, slow: Number(process.env.FREECAD_SLOWMO ?? 0) || 0, highlight: false,
|
||||
screenshots: process.env.FREECAD_SUITE_SCREENSHOTS === "all" ? "all" : "fails",
|
||||
jobs: 1, out: null, prune: null, legacyIds: [], timeoutScale: 1,
|
||||
};
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
const flag = argv[index];
|
||||
const value = () => argv[index + 1] ?? "";
|
||||
switch (flag) {
|
||||
case "--only": options.only = list(value()); index += 1; break;
|
||||
case "--priority": options.priority = list(value()).map(item => item.toUpperCase()); index += 1; break;
|
||||
case "--module": options.module = list(value()); index += 1; break;
|
||||
case "--resume": options.resume = value(); index += 1; break;
|
||||
case "--force": options.force = true; break;
|
||||
case "--headless": options.headless = true; break;
|
||||
case "--headed": options.headless = false; break;
|
||||
case "--gpu": options.gpu = true; break;
|
||||
case "--slow": options.slow = Number(value()) || 0; index += 1; break;
|
||||
case "--highlight": options.highlight = true; break;
|
||||
case "--screenshots": options.screenshots = value() === "all" ? "all" : "fails"; index += 1; break;
|
||||
case "--jobs": options.jobs = Math.max(1, Number(value()) || 1); index += 1; break;
|
||||
case "--out": options.out = value(); index += 1; break;
|
||||
case "--prune": options.prune = Math.max(1, Number(value()) || 1); index += 1; break;
|
||||
case "--legacy-ids": options.legacyIds = list(value()); index += 1; break;
|
||||
case "--timeout-scale": options.timeoutScale = Math.max(0.1, Number(value()) || 1); index += 1; break;
|
||||
case "--help": case "-h": options.help = true; break;
|
||||
default: throw new Error(`unknown option ${flag}\n\n${USAGE}`);
|
||||
}
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
export function selectCases(cases, options) {
|
||||
let selected = cases;
|
||||
if (options.only.length) {
|
||||
const ids = new Set(options.only);
|
||||
selected = selected.filter(item => ids.has(item.id));
|
||||
const missing = [...ids].filter(id => !cases.some(item => item.id === id));
|
||||
if (missing.length) throw new Error(`unknown case ids: ${missing.join(", ")}`);
|
||||
}
|
||||
if (options.priority.length) {
|
||||
const priorities = new Set(options.priority);
|
||||
selected = selected.filter(item => priorities.has(item.priority));
|
||||
}
|
||||
if (options.module.length) {
|
||||
const modules = new Set(options.module.map(item => item.toLowerCase()));
|
||||
selected = selected.filter(item => !item.module || modules.has(item.module.toLowerCase()));
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
Reference in New Issue
Block a user