Merge branch 'main' into web-runs-home

# Conflicts:
#	web/src/app.js
#	web/styles.css
#	web/test/ui-smoke.mjs
This commit is contained in:
2026-10-19 03:00:13 +01:00
7 changed files with 1376 additions and 56 deletions
+93 -14
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,17 +77,86 @@ 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");
// 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");
shots.push(await page.screenshot(`${out}/02-pipeline-detail.png`));
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");
step("switching to Runs: day-grouped list + usage roll-up");
await page.clickText("nav.tabs button.tab", "Runs");
@@ -98,7 +177,7 @@ try {
}
const fullDateHeader = dayHeaders.find((label) => /^\d{1,2} \w{3} \d{4}$/.test(label));
if (!fullDateHeader) throw new Error(`no full-date day header: ${dayHeaders.join(" | ")}`);
shots.push(await page.screenshot(`${out}/04-runs-day-groups.png`));
shots.push(await page.screenshot(`${out}/09-runs-day-groups.png`));
console.log(` usage: ${usageLabels.join(", ")}`);
console.log(` day headers: ${dayHeaders.slice(0, 3).join(" | ")}`);
@@ -112,7 +191,7 @@ try {
return header.textContent;
})()`);
if (!scrolledTo) throw new Error("could not scroll to the older day group");
shots.push(await page.screenshot(`${out}/07-runs-older-day-group.png`));
shots.push(await page.screenshot(`${out}/10-runs-older-day-group.png`));
console.log(` scrolled to: ${scrolledTo}`);
step("opening the filter menu: it must stay in the viewport and be reachable");
@@ -169,7 +248,7 @@ try {
if (!reach.actionsReachable) {
throw new Error(`the filter menu actions are unreachable: ${JSON.stringify(reach)}`);
}
shots.push(await page.screenshot(`${out}/08-runs-filter-menu.png`));
shots.push(await page.screenshot(`${out}/11-runs-filter-menu.png`));
console.log(` filter menu ${reach.height}px tall in a ${reach.viewport}px viewport; actions reachable`);
step("applying a status filter");
@@ -188,7 +267,7 @@ try {
if (!filteredChips.every((chip) => chip === "failed")) {
throw new Error(`filtered rows are not all failed: ${filteredChips.join(",")}`);
}
shots.push(await page.screenshot(`${out}/05-runs-filtered.png`));
shots.push(await page.screenshot(`${out}/12-runs-filtered.png`));
console.log(` filtered rows: ${filteredChips.length}, all failed`);
step("filtering to a state with no runs: the filtered-empty state + Clear filters");
@@ -214,7 +293,7 @@ try {
if (clearAction !== "Clear filters") {
throw new Error(`the filtered-empty state should offer Clear filters, got: ${clearAction}`);
}
shots.push(await page.screenshot(`${out}/09-runs-filtered-empty.png`));
shots.push(await page.screenshot(`${out}/13-runs-filtered-empty.png`));
console.log(` empty state: ${emptyMessage} (+ ${clearAction})`);
step("clearing the filters from the empty state and changing the sort");
@@ -238,20 +317,20 @@ try {
]) {
if (!sortItems.includes(label)) throw new Error(`sort menu missing: ${label}`);
}
shots.push(await page.screenshot(`${out}/10-runs-sort-menu.png`));
shots.push(await page.screenshot(`${out}/14-runs-sort-menu.png`));
await page.clickText("#runSortMenu .menu-item", "Pipeline name");
const sortLabel = await page.evaluate(`document.querySelector("#runSortBtn").textContent`);
if (!sortLabel.includes("Pipeline name")) {
throw new Error(`the sort control did not change: ${sortLabel}`);
}
await page.waitForSelector(".list.runs .run-row", { timeout: 25000 });
shots.push(await page.screenshot(`${out}/06-runs-sorted.png`));
shots.push(await page.screenshot(`${out}/15-runs-sorted.png`));
console.log(` sort control now: ${sortLabel}`);
step("opening a run detail");
await page.click(".list.runs .run-row");
await page.waitForSelector(".detail h2", { timeout: 25000 });
shots.push(await page.screenshot(`${out}/03-run-detail.png`));
await shot("16-run-detail.png");
console.log("\nUI SMOKE PASS");
for (const shot of shots) console.log(` ${shot}`);