web: pipeline list, filter/sort and detail (P1/P2/P3)

Close three rows of the browser client's parity checklist, matching the Android
app's wording and behaviour:

- P1 pipeline list: name; "id {id} · v{version} · {N stages}"; "updated d MMM
  HH:mm"; a last-run line joined from list_runs (status chip plus
  "{ago} · {duration} · run {id}", or "no runs recorded").
- P2 filter + sort: Filter menu (name contains, Runs Any/Has runs/No runs, the
  seven server run statuses, Clear filters) and Sort menu (Server order default,
  Name A-Z/Z-A, Most recent run, Fewest/Most stages, Reset). Server order is
  preserved.
- P3 pipeline detail: Summary/Graph/Source tabs; Summary shows the content hash
  (monospace), latest version, created/updated and a collapsed-by-default
  Versions section. The Graph tab carries the browser guidance note only; the
  rendered graph stays P6.

New src/pipelines.js holds the pure, DOM-free helpers (timestamps, durations,
last-run join, comparators, filter, empty states); app.js is wiring only.
web/test/pipelines.test.mjs covers the helpers; web/test/ui-smoke.mjs captures
the list, controls and detail against the live server. All server strings are
set with textContent.
This commit is contained in:
2026-10-19 02:52:35 +01:00
parent 4721b8af10
commit 13404b2a2b
6 changed files with 1368 additions and 52 deletions
+90 -10
View File
@@ -37,6 +37,16 @@ function step(label) {
console.log(`• ${label}`);
}
async function shot(name) {
const path = `${out}/${name}`;
shots.push(await page.screenshot(path));
console.log(` capture ${path}`);
return path;
}
const text = (selector) =>
page.evaluate(`document.querySelector(${JSON.stringify(selector)})?.textContent ?? ""`);
try {
await mkdir(out, { recursive: true });
@@ -67,24 +77,94 @@ try {
await page.waitForSelector(".row-title", { timeout: 25000 });
await page.waitForText("connected", { timeout: 25000 });
const pipelineCount = await page.evaluate(
`document.querySelectorAll(".list button.row").length`,
`document.querySelectorAll("#pipelineRows button.row").length`,
);
if (!pipelineCount) throw new Error("connected but no pipelines rendered");
shots.push(await page.screenshot(`${out}/01-pipelines.png`));
console.log(` pipelines rendered: ${pipelineCount}`);
step("opening a pipeline detail");
await page.click(".list button.row");
await page.waitForSelector(".detail h2");
shots.push(await page.screenshot(`${out}/02-pipeline-detail.png`));
// 1. The list with its filter menu open: the name field, the Runs section, the
// Last run status multi-select and the Clear filters reset (P1 + P2).
step("capturing the pipeline list with the filter menu open");
await page.click("#filterToggle");
await page.waitForSelector(".filter-panel");
await shot("01-pipelines-controls.png");
// 2. The sort menu, and exercising it changes the ordering (P2).
step("capturing and exercising the sort menu");
await page.click("#sortToggle");
await page.waitForSelector(".sort-panel");
await shot("02-pipelines-sort.png");
await page.clickText(".sort-panel .sort-option", "Name A\u2013Z");
const sorted = await text("#sortToggle");
if (!sorted.includes("Name A\u2013Z")) throw new Error(`sort did not apply: ${sorted}`);
await page.click("#sortToggle");
await page.waitForSelector(".sort-panel");
await page.clickText(".sort-panel button", "Reset");
const reset = await text("#sortToggle");
if (!reset.includes("Server order")) throw new Error(`sort reset failed: ${reset}`);
// 3. The name facet narrows live; an unmatched name shows the name-only empty state.
step("narrowing by name and capturing the name-only empty state");
await page.click("#filterToggle");
await page.waitForSelector(".filter-panel");
await page.fill("#pipelineNameFilter", "Android");
const narrowed = await page.evaluate(
`document.querySelectorAll("#pipelineRows button.row").length`,
);
if (!narrowed || narrowed >= pipelineCount) {
throw new Error(`name filter did not narrow (${narrowed} of ${pipelineCount})`);
}
console.log(` name filter narrowed ${pipelineCount} -> ${narrowed}`);
await page.fill("#pipelineNameFilter", "zzz-no-such-pipeline");
await page.waitForText('No pipelines match "zzz-no-such-pipeline".');
await shot("03-pipelines-empty-name.png");
await page.click(".empty button");
await page.waitForSelector("#pipelineRows button.row");
// 4. A run facet with no matches shows the general empty state and a reset.
step("capturing the run-facet empty state");
await page.click("#status-interrupted");
await page.waitForText("No pipelines match the current filters.");
await shot("04-pipelines-empty-filters.png");
await page.click(".empty button");
await page.waitForSelector("#pipelineRows button.row");
await page.click("#filterToggle");
// 5. Pipeline detail: Summary (name, subtitle, content hash, created/updated).
step("opening a pipeline detail (Summary)");
await page.click("#pipelineRows button.row");
await page.waitForSelector(".detail h2");
await page.waitForSelector(".monospace");
await page.evaluate(`document.querySelector(".detail")?.scrollIntoView({ block: "start" })`);
await shot("05-pipeline-summary.png");
// 6. The Versions section is collapsed by default; expanding shows its rows.
step("expanding the Versions section");
await page.click(".section-toggle");
await page.waitForSelector(".versions-list");
await page.evaluate(`document.querySelector(".versions-list")?.scrollIntoView({ block: "start" })`);
await shot("06-pipeline-summary-versions.png");
// 7. Source tab: the rendered pipeline source in a monospace block.
step("opening the Source tab");
await page.clickText(".detail-tabs button", "Source");
await page.waitForSelector(".source-code");
await page.evaluate(`document.querySelector(".detail")?.scrollIntoView({ block: "start" })`);
await shot("07-pipeline-source.png");
// 8. Graph tab: the guidance note only; the rendered graph is P6.
step("opening the Graph tab (guidance note only)");
await page.clickText(".detail-tabs button", "Graph");
await page.waitForSelector(".graph-note");
await shot("08-pipeline-graph.png");
// 9. Runs regression: the pre-existing run list + detail still work.
step("switching to Runs and opening a run detail");
await page.clickText("nav.tabs button.tab", "Runs");
await page.waitForSelector(".list button.row", { timeout: 25000 });
await page.click(".list button.row");
await page.waitForSelector("#content .list button.row", { timeout: 25000 });
await page.click("#content .list button.row");
await page.waitForSelector(".detail h2", { timeout: 25000 });
shots.push(await page.screenshot(`${out}/03-run-detail.png`));
await shot("09-run-detail.png");
console.log("\nUI SMOKE PASS");
for (const shot of shots) console.log(` ${shot}`);