Render run list miniatures from compact per-stage route evidence
This commit is contained in:
+16
-7
@@ -11,18 +11,27 @@ Status legend: `todo` · `partial` (some of it works) · `done` (working + captu
|
||||
### List miniature follow-up (2026-10-20)
|
||||
|
||||
Workflow and run miniatures now share the existing graph layout, right-aligned
|
||||
inside their SVG as well as their row, with a 6px extra trailing inset. Runs use
|
||||
the shared status palette; recorded visits/routes override the aggregate tint,
|
||||
and known untaken branches are hollow/dashed. With summaries only, the tint is
|
||||
the **run status**, not a claim that every stage executed. Topology comes from
|
||||
inside their SVG as well as their row, with a 6px extra trailing inset. Run LIST
|
||||
nodes now use each stage's last visit: success green, failure red, running
|
||||
accent, waiting amber and queued a distinct muted tint. Unvisited/unknown nodes
|
||||
are neutral hollow/dashed; **no aggregate run-status tint is inherited**.
|
||||
Taken edges use recorded outcome/target routes, including loops and branches.
|
||||
The additive `graph_evidence` summary projection reads only five routing/status
|
||||
fields from `run_steps`, compacts repeated loops, and batches 100 run IDs per
|
||||
query (not N detail fetches). Subscribe snapshots seed the same evidence;
|
||||
coalesced live frames preserve every changed visit in `graph_visits` and the
|
||||
client maintains last-stage/distinct-route evidence without a detail fetch.
|
||||
Older summaries remain honestly unknown. Topology comes from
|
||||
the run's own graph, an exact-version pipeline summary, or one cached
|
||||
`get_pipeline(id, version)` read per endpoint/version (never `get_run` per row,
|
||||
never a fallback to latest). Unavailable graphs stay absent. No server changes.
|
||||
never a fallback to latest). Unavailable graphs stay absent. No schema migration
|
||||
or new private input/output/transcript payload is needed.
|
||||
|
||||
Scratch browser extension `test/miniatures-browser.mjs` verifies 390/420/1100px
|
||||
alignment, distinct status colors, wrapped titles, separate applied filters and
|
||||
alignment, two successful stages before failure plus never-visited branches,
|
||||
waiting/running/queued states, legacy unknown evidence, wrapped titles, separate applied filters and
|
||||
no document overflow; captures and `geometry.json` are in
|
||||
`/private/var/folders/jp/q0qvjyg54fl_c5vhhk1ylz2m0000gn/T/opencode/status-miniature-captures/`.
|
||||
`/private/var/folders/jp/q0qvjyg54fl_c5vhhk1ylz2m0000gn/T/opencode/per-stage-run-miniatures-captures/`.
|
||||
These are deterministic fixture captures, not a new live-server parity claim.
|
||||
|
||||
Collapsed desktop navigation additionally gives Expand its own 40px flow slot
|
||||
|
||||
+1
-1
@@ -435,7 +435,7 @@
|
||||
.pipeline-mini-node { fill: currentColor; opacity: 0.55; }
|
||||
.run-mini .pipeline-mini-node { opacity: 0.85; }
|
||||
.run-mini .pipeline-mini-edge { opacity: 0.8; }
|
||||
.run-mini .mini-untaken { color: var(--muted); opacity: 0.4; stroke-dasharray: 2 2; }
|
||||
.run-mini .mini-untaken { color: var(--color-muted); opacity: 0.4; stroke-dasharray: 2 2; }
|
||||
.run-mini .pipeline-mini-node.mini-untaken { fill: none; stroke: currentColor; stroke-width: 1; }
|
||||
.row.selected .pipeline-mini { color: var(--color-accent); }
|
||||
.row:hover .pipeline-mini { color: var(--color-text); }
|
||||
|
||||
+14
-7
@@ -10,6 +10,8 @@ const NS = "http://www.w3.org/2000/svg";
|
||||
const STATUSES = new Set(["succeeded", "failed", "running", "waiting", "queued",
|
||||
"interrupted", "canceled", "blocked", "skipped"]);
|
||||
export function miniatureColor(status) {
|
||||
if (status === "waiting") return "var(--warn)";
|
||||
if (status === "running") return "var(--accent)";
|
||||
return `var(--status-${STATUSES.has(status) ? status : "unknown"})`;
|
||||
}
|
||||
|
||||
@@ -20,20 +22,22 @@ export function miniatureModel(graph, run = null) {
|
||||
edges: Object.fromEntries(Object.entries(stage.edges ?? {}).filter(([, target]) => keys.has(target))),
|
||||
})) };
|
||||
const layout = layoutGraph(shape, METRICS);
|
||||
const evidence = run && Array.isArray(run.steps) ? runGraphState(run) : null;
|
||||
const visits = new Map((run?.steps ?? []).map((step) => [step.stage, step]));
|
||||
const steps = Array.isArray(run?.steps) ? run.steps : run?.graph_evidence?.visits;
|
||||
const evidence = Array.isArray(steps) ? runGraphState({ ...run, steps }) : null;
|
||||
const visits = new Map((steps ?? []).map((step) => [step.stage, step]));
|
||||
return { ...layout, evidence: evidence != null,
|
||||
complete: Array.isArray(run?.steps) || run?.graph_evidence?.complete === true,
|
||||
nodes: layout.nodes.map((node) => {
|
||||
const step = visits.get(node.key);
|
||||
// A recorded current stage is evidence even in a compact list summary.
|
||||
const current = run?.executing && run.current_stage === node.key;
|
||||
const status = current ? run.status : step?.status;
|
||||
const status = step?.status ?? (current ? run.status : null);
|
||||
const color = status === "completed" ? edgeStrokeColor(step.outcome) : status ? miniatureColor(status) : null;
|
||||
return { ...node, color,
|
||||
untaken: evidence != null && !step && !current };
|
||||
untaken: Boolean(run) && !step && !current };
|
||||
}),
|
||||
edges: layout.edges.map((edge) => ({ ...edge,
|
||||
untaken: evidence != null && !edgeIsExecuted(edge, evidence),
|
||||
untaken: Boolean(run) && (!evidence || !edgeIsExecuted(edge, evidence)),
|
||||
color: evidence && edgeIsExecuted(edge, evidence) ? edgeStrokeColor(edge.outcome) : null,
|
||||
})),
|
||||
};
|
||||
@@ -53,6 +57,7 @@ export function renderMiniGraph(graph, run = null) {
|
||||
if (edge.points.length < 2) continue;
|
||||
const line = document.createElementNS(NS, "polyline");
|
||||
line.setAttribute("class", `pipeline-mini-edge${edge.untaken ? " mini-untaken" : ""}`);
|
||||
line.setAttribute("data-route", `${edge.source}:${edge.outcome}:${edge.target}`);
|
||||
line.setAttribute("points", edge.points.map((p) => `${p.x},${p.y}`).join(" "));
|
||||
if (edge.color) line.style.color = edge.color;
|
||||
svg.append(line);
|
||||
@@ -60,14 +65,16 @@ export function renderMiniGraph(graph, run = null) {
|
||||
for (const node of model.nodes) {
|
||||
const rect = document.createElementNS(NS, "rect");
|
||||
rect.setAttribute("class", `pipeline-mini-node${node.untaken ? " mini-untaken" : ""}`);
|
||||
rect.setAttribute("data-stage", node.key);
|
||||
for (const key of ["x", "y", "width", "height"]) rect.setAttribute(key, String(node[key]));
|
||||
rect.setAttribute("rx", "3");
|
||||
if (node.color) rect.style.color = node.color;
|
||||
svg.append(rect);
|
||||
}
|
||||
const wrap = h("span", { class: `pipeline-mini${run ? " run-mini" : ""}`,
|
||||
"aria-hidden": "true", "data-evidence": model.evidence ? "visits" : "summary" }, svg);
|
||||
if (run) wrap.style.color = miniatureColor(run.status);
|
||||
"aria-hidden": "true", "data-evidence": model.evidence ? model.complete ? "visits" : "partial" : "unknown" }, svg);
|
||||
// Unknown/unvisited graph elements must never inherit the aggregate result.
|
||||
if (run) wrap.style.color = "var(--color-muted)";
|
||||
return wrap;
|
||||
}
|
||||
|
||||
|
||||
+32
-1
@@ -215,7 +215,10 @@ function applyRunStateFields(current, frame) {
|
||||
cancel_requested: before.cancel_requested || frame.cancel_requested === true,
|
||||
cleanup_unconfirmed: before.cleanup_unconfirmed || frame.cleanup_unconfirmed === true,
|
||||
};
|
||||
// Detail already maintains full visits below; compact evidence is list-only.
|
||||
const graphEvidence = Array.isArray(current.steps) ? current.graph_evidence : mergeGraphEvidence(current.graph_evidence, frame);
|
||||
const changed =
|
||||
graphEvidence !== current.graph_evidence ||
|
||||
merged.notify_mode !== before.notify_mode ||
|
||||
!sameResourceWait(merged.resource_wait, before.resource_wait) ||
|
||||
merged.status !== before.status ||
|
||||
@@ -227,7 +230,33 @@ function applyRunStateFields(current, frame) {
|
||||
merged.executing !== before.executing ||
|
||||
merged.cancel_requested !== before.cancel_requested ||
|
||||
merged.cleanup_unconfirmed !== before.cleanup_unconfirmed;
|
||||
return changed ? { ...current, ...merged } : current;
|
||||
return changed ? { ...current, ...merged, ...(graphEvidence ? { graph_evidence: graphEvidence } : {}) } : current;
|
||||
}
|
||||
|
||||
// Reuse the detail's monotonic visit merge, then compact by last stage visit and
|
||||
// distinct route. Keep completeness separate: a delta from an older server or
|
||||
// a mid-run first frame cannot prove that earlier stages were never visited.
|
||||
function mergeGraphEvidence(current, frame) {
|
||||
if (!frame.graph_evidence && !frame.graph_visits?.length && !frame.step) return current;
|
||||
let visits = current?.visits ?? [];
|
||||
const incoming = [...(frame.graph_evidence?.visits ?? []), ...(frame.graph_visits ?? []),
|
||||
...(frame.step ? [frame.step] : [])];
|
||||
for (const step of incoming) {
|
||||
const { sequence, stage, status, outcome, target } = step;
|
||||
visits = upsertStep(visits, { sequence, stage, status, outcome, target });
|
||||
}
|
||||
const latest = new Map();
|
||||
const routes = new Map();
|
||||
for (const visit of visits) {
|
||||
latest.set(visit.stage, visit.sequence);
|
||||
if (visit.outcome && visit.target) routes.set(JSON.stringify([visit.stage, visit.outcome, visit.target]), visit.sequence);
|
||||
}
|
||||
visits = visits.filter((visit) => latest.get(visit.stage) === visit.sequence ||
|
||||
(visit.outcome && visit.target && routes.get(JSON.stringify([visit.stage, visit.outcome, visit.target])) === visit.sequence));
|
||||
// Explicit allowlist: graph evidence never copies diagnostic/private fields.
|
||||
visits = visits.map(({ sequence, stage, status, outcome, target }) => ({ sequence, stage, status, outcome, target }));
|
||||
const result = { complete: Boolean(current?.complete || frame.graph_evidence?.complete), visits };
|
||||
return JSON.stringify(result) === JSON.stringify(current) ? current : result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,7 +269,9 @@ export function newRunSummaryFromFrame(frame) {
|
||||
const pipelineId = Number(frame?.pipeline_id);
|
||||
const name = String(frame?.name ?? "");
|
||||
if (!(pipelineId > 0) || blank(name)) return null;
|
||||
const graphEvidence = mergeGraphEvidence(null, frame);
|
||||
return {
|
||||
...(graphEvidence ? { graph_evidence: graphEvidence } : {}),
|
||||
resource_wait: frame.resource_wait ?? null,
|
||||
id: Number(frame.run_id),
|
||||
pipeline_id: pipelineId,
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { foldRunEvent } from "../src/runEvents.js";
|
||||
import { miniatureModel } from "../src/miniGraph.js";
|
||||
|
||||
test("coalesced live visits update list nodes and routes without a detail fetch", () => {
|
||||
const identity = { run_id: 1, pipeline_id: 7, name: "Run", version: 2 };
|
||||
let runs = foldRunEvent([], { ...identity, status: "running", graph_evidence: { complete: true, visits: [] } }).runs;
|
||||
const visits = [
|
||||
{ sequence: 1, stage: "a", status: "completed", outcome: "success", target: "b" },
|
||||
{ sequence: 2, stage: "b", status: "completed", outcome: "success", target: "c" },
|
||||
{ sequence: 3, stage: "c", status: "running", diagnostic: "PRIVATE" },
|
||||
];
|
||||
runs = foldRunEvent(runs, { ...identity, status: "running", current_stage: "c", graph_visits: visits, step: visits[2] }).runs;
|
||||
runs = foldRunEvent(runs, { ...identity, status: "failed", step: { sequence: 3, stage: "c", status: "failed" } }).runs;
|
||||
const model = miniatureModel({ stages: [
|
||||
{ key: "a", edges: { success: "b", error: "never" } },
|
||||
{ key: "b", edges: { success: "c" } }, { key: "c", edges: {} }, { key: "never", edges: {} },
|
||||
] }, runs[0]);
|
||||
assert.deepEqual(model.nodes.map((n) => n.color), ["var(--ok)", "var(--ok)", "var(--status-failed)", null]);
|
||||
assert.equal(model.edges.filter((e) => !e.untaken).length, 2);
|
||||
assert.equal(JSON.stringify(runs[0].graph_evidence).includes("PRIVATE"), false);
|
||||
const same = foldRunEvent(runs, { ...identity, status: "running", graph_visits: visits }).runs;
|
||||
assert.equal(same, runs);
|
||||
});
|
||||
|
||||
test("partial legacy deltas do not manufacture complete history; loops compact", () => {
|
||||
let runs = [{ id: 1, status: "running" }];
|
||||
for (let sequence = 1; sequence <= 100; sequence++) {
|
||||
runs = foldRunEvent(runs, { run_id: 1, step: { sequence, stage: "a", status: "completed", outcome: "success", target: "a" } }).runs;
|
||||
}
|
||||
assert.equal(runs[0].graph_evidence.complete, false);
|
||||
assert.equal(runs[0].graph_evidence.visits.length, 1);
|
||||
assert.equal(runs[0].graph_evidence.visits[0].sequence, 100);
|
||||
});
|
||||
@@ -12,18 +12,44 @@ test("miniatures retain real stage routes, without terminals or fabricated visit
|
||||
assert.deepEqual(model.nodes.map((n) => n.key).sort(), ["a", "b", "c"]);
|
||||
assert.equal(model.edges.length, 2);
|
||||
assert.equal(model.evidence, false);
|
||||
assert.ok(model.nodes.every((n) => n.color === null && !n.untaken));
|
||||
assert.ok(model.nodes.every((n) => n.color === null && n.untaken));
|
||||
});
|
||||
test("compact list evidence preserves successes before failure and last loop status", () => {
|
||||
const loopGraph = { stages: [
|
||||
{ key: "a", edges: { success: "b", error: "never" } },
|
||||
{ key: "b", edges: { success: "c" } },
|
||||
{ key: "c", edges: { retry: "a", error: "never" } },
|
||||
{ key: "never", edges: {} },
|
||||
] };
|
||||
const visits = [
|
||||
{ sequence: 1, stage: "a", status: "completed", outcome: "success", target: "b" },
|
||||
{ sequence: 2, stage: "b", status: "completed", outcome: "success", target: "c" },
|
||||
{ sequence: 3, stage: "c", status: "completed", outcome: "retry", target: "a" },
|
||||
{ sequence: 4, stage: "a", status: "failed", outcome: "", target: "" },
|
||||
];
|
||||
const model = miniatureModel(loopGraph, { status: "failed", graph_evidence: { complete: true, visits } });
|
||||
assert.equal(model.nodes.find((n) => n.key === "a").color, "var(--status-failed)");
|
||||
assert.equal(model.nodes.find((n) => n.key === "b").color, "var(--ok)");
|
||||
assert.equal(model.nodes.find((n) => n.key === "never").color, null);
|
||||
assert.equal(model.nodes.find((n) => n.key === "never").untaken, true);
|
||||
assert.equal(model.edges.filter((e) => !e.untaken).length, 3);
|
||||
assert.ok(model.edges.filter((e) => e.outcome === "error").every((e) => e.untaken));
|
||||
for (const status of ["waiting", "running", "queued"]) {
|
||||
const next = miniatureModel(loopGraph, { status, current_stage: "a", executing: status !== "waiting",
|
||||
graph_evidence: { complete: true, visits: [...visits.slice(0, 3), { sequence: 4, stage: "a", status }] } });
|
||||
assert.equal(next.nodes.find((n) => n.key === "a").color, miniatureColor(status));
|
||||
}
|
||||
});
|
||||
test("visited stages/routes use evidence; unvisited branches remain hollow", () => {
|
||||
const model = miniatureModel(graph, { status: "waiting", executing: true, current_stage: "b",
|
||||
steps: [{ stage: "a", status: "completed", outcome: "success", target: "b" }] });
|
||||
assert.equal(model.nodes.find((n) => n.key === "a").color, "var(--ok)");
|
||||
assert.equal(model.nodes.find((n) => n.key === "b").color, "var(--status-waiting)");
|
||||
assert.equal(model.nodes.find((n) => n.key === "b").color, "var(--warn)");
|
||||
assert.equal(model.nodes.find((n) => n.key === "c").untaken, true);
|
||||
assert.equal(model.edges.find((e) => e.outcome === "success").color, "var(--ok)");
|
||||
assert.equal(model.edges.find((e) => e.outcome === "error").untaken, true);
|
||||
for (const status of ["succeeded", "failed", "running", "waiting", "interrupted", "queued", "canceled"]) {
|
||||
assert.equal(miniatureColor(status), `var(--status-${status})`);
|
||||
assert.equal(miniatureColor(status), status === "waiting" ? "var(--warn)" : status === "running" ? "var(--accent)" : `var(--status-${status})`);
|
||||
}
|
||||
});
|
||||
test("cache deduplicates pinned reads, rejects latest mismatches and scopes by endpoint", async () => {
|
||||
|
||||
@@ -62,17 +62,22 @@ try {
|
||||
const graph = { stages: [{ key:'plan', edges:{success:'build',error:'reject'} },
|
||||
{key:'build',edges:{success:'finish'}},{key:'reject',edges:{error:'#failure'}},
|
||||
{key:'finish',edges:{success:'#success'}}] };
|
||||
const statuses = ['succeeded','failed','running','interrupted','waiting','queued'];
|
||||
const statuses = ['succeeded','failed','running','interrupted','waiting','queued','failed'];
|
||||
const visits = (status) => status === 'queued' ? [] : [
|
||||
{sequence:1,stage:'plan',status:'completed',outcome:'success',target:'build'},
|
||||
{sequence:2,stage:'build',status:'completed',outcome:'success',target:'finish'},
|
||||
{sequence:3,stage:'finish',status:status==='succeeded'?'completed':status,
|
||||
outcome:status==='succeeded'?'success':'',target:status==='succeeded'?'#success':''}];
|
||||
const state = { view:'runs', url:'scratch', loading:false, selectedRunId:1,
|
||||
openMenu:null, runFilters:{...defaultRunFilters(),pipelineId:7}, runSort:'server_order',
|
||||
pipelineFilters:{...EMPTY_PIPELINE_FILTERS},pipelineSort:'server_order', pipelinesLoaded:true,
|
||||
runsLoaded:true, pipelines:[{id:7,name:'Pinned workflow',version:3,stages:4,shape:graph}],
|
||||
runs:statuses.map((status,i)=>({id:i+1,pipeline_id:7,version:2,name:'Pinned workflow',
|
||||
title:'A wrapped run title that preserves the complete task context across narrow screens '+status,
|
||||
status,executing:['running','waiting'].includes(status),current_stage:'build',
|
||||
created_at:new Date().toISOString(),steps:i===0?[
|
||||
{stage:'plan',status:'completed',outcome:'success',target:'build'},
|
||||
{stage:'build',status:'completed',outcome:'success',target:'finish'}]:undefined})) };
|
||||
status,executing:['running','queued'].includes(status),current_stage:status==='queued'?'plan':'finish',
|
||||
completed_steps:status==='queued'||i===6?0:status==='succeeded'?3:2,
|
||||
created_at:new Date().toISOString(),
|
||||
...(i===6?{current_stage:'',executing:false}:{graph_evidence:{complete:true,visits:visits(status)}})})) };
|
||||
let runs, pipelines;
|
||||
const renderContent=()=>document.querySelector('#content').replaceChildren(
|
||||
state.view==='runs'?runs.renderRunList():pipelines.renderPipelineList());
|
||||
@@ -93,9 +98,13 @@ try {
|
||||
rows:rows.map(row=>{const mini=row.querySelector('.pipeline-mini');const r=row.getBoundingClientRect();
|
||||
const m=mini.getBoundingClientRect();const svg=mini.querySelector('svg');const node=svg.querySelector('rect');
|
||||
const status=row.querySelector('.status-icon')?.dataset.status;
|
||||
const swatch=document.createElement('span');swatch.style.color='var(--status-'+status+')';mini.append(swatch);
|
||||
const swatch=document.createElement('span');swatch.style.color=status==='waiting'?'var(--warn)':status==='running'?'var(--accent)':'var(--status-'+status+')';mini.append(swatch);
|
||||
const expectedColor=getComputedStyle(swatch).color;swatch.remove();
|
||||
return {inset:r.right-m.right,align:svg.getAttribute('preserveAspectRatio'),status,expectedColor,
|
||||
const nodes=[...svg.querySelectorAll('rect')].map(n=>({stage:n.dataset.stage,
|
||||
color:getComputedStyle(n).color,fill:getComputedStyle(n).fill,untaken:n.classList.contains('mini-untaken')}));
|
||||
const edges=[...svg.querySelectorAll('polyline')].map(n=>({route:n.dataset.route,
|
||||
color:getComputedStyle(n).color,untaken:n.classList.contains('mini-untaken')}));
|
||||
return {id:Number(row.dataset.runId),nodes,edges,evidence:mini.dataset.evidence,inset:r.right-m.right,align:svg.getAttribute('preserveAspectRatio'),status,expectedColor,
|
||||
color:getComputedStyle(mini).color,nodeColor:getComputedStyle(node).color,
|
||||
right:m.right,rowRight:r.right, rowWidth:r.width,parentWidth:row.parentElement.clientWidth,
|
||||
selected:row.classList.contains('selected')};}),
|
||||
@@ -109,19 +118,60 @@ try {
|
||||
if (view === 'runs') {
|
||||
assert.equal(geometry.titleWrap, true);
|
||||
assert.equal(geometry.filterSeparate, true);
|
||||
assert.notEqual(geometry.rows[0].color, geometry.rows[1].color);
|
||||
assert.notEqual(geometry.rows[2].color, geometry.rows[4].color);
|
||||
assert.ok(geometry.rows.every((row)=>row.color===row.expectedColor));
|
||||
const node=(row,stage)=>row.nodes.find(n=>n.stage===stage);
|
||||
const byId=(id)=>geometry.rows.find(row=>row.id===id);
|
||||
const failed=byId(2);
|
||||
assert.equal(node(failed,'plan').color,node(failed,'build').color);
|
||||
assert.notEqual(node(failed,'build').color,node(failed,'finish').color);
|
||||
assert.equal(node(failed,'finish').color,failed.expectedColor);
|
||||
assert.equal(node(failed,'reject').fill,'none');
|
||||
assert.equal(node(failed,'reject').untaken,true);
|
||||
assert.equal(failed.edges.filter(e=>!e.untaken).length,2);
|
||||
assert.ok(failed.edges.filter(e=>e.route.includes(':error:')).every(e=>e.untaken));
|
||||
assert.equal(byId(7).evidence,'unknown');
|
||||
assert.ok(byId(7).nodes.every(n=>n.untaken && n.fill==='none'));
|
||||
for (const row of geometry.rows.filter(row=>row.id!==7)) {
|
||||
assert.equal(row.evidence,'visits');
|
||||
if (['running','waiting','queued'].includes(row.status)) {
|
||||
assert.equal(node(row,row.status==='queued'?'plan':'finish').color,row.expectedColor);
|
||||
}
|
||||
}
|
||||
assert.notEqual(node(byId(3),'finish').color,node(byId(5),'finish').color);
|
||||
const selected=geometry.rows.find(row=>row.selected);
|
||||
assert.equal(selected.rowWidth,selected.parentWidth);
|
||||
}
|
||||
results.push({view,...geometry});
|
||||
await page.screenshot(resolve(out, `${view}-${width}.png`));
|
||||
if (view === 'runs') {
|
||||
await page.evaluate(`document.querySelector('.run-row[data-run-id="1"]').scrollIntoView({block:'end'})`);
|
||||
await page.evaluate(`document.querySelector('.run-row[data-run-id="2"]').scrollIntoView({block:'center'})`);
|
||||
await page.screenshot(resolve(out, `runs-evidence-${width}.png`));
|
||||
}
|
||||
}
|
||||
for (const status of ['waiting','failed']) {
|
||||
await page.evaluate(`(async () => {
|
||||
const {foldRunEvent}=await import('/src/runEvents.js');
|
||||
window.beforeLiveRuns??=fixtureState.runs;
|
||||
fixtureState.view='runs';
|
||||
fixtureState.runs=foldRunEvent(fixtureState.runs,{run_id:3,status:${JSON.stringify(status)},
|
||||
current_stage:'finish',step:{sequence:3,stage:'finish',status:${JSON.stringify(status)}}}).runs;
|
||||
paintFixture();
|
||||
document.querySelector('.run-row[data-run-id="3"]').scrollIntoView({block:'center'});
|
||||
})()`);
|
||||
const live = await page.evaluate(`(() => {
|
||||
const mini=document.querySelector('.run-row[data-run-id="3"] .run-mini');
|
||||
const nodes=[...mini.querySelectorAll('rect')];
|
||||
return {colors:nodes.map(n=>getComputedStyle(n).color),
|
||||
taken:mini.querySelectorAll('polyline:not(.mini-untaken)').length,
|
||||
unknown:mini.querySelectorAll('rect.mini-untaken').length};
|
||||
})()`);
|
||||
assert.equal(live.colors[0],live.colors[1]);
|
||||
assert.equal(live.taken,2);
|
||||
assert.equal(live.unknown,1);
|
||||
assert.notEqual(live.colors[0],live.colors[3]);
|
||||
await page.screenshot(resolve(out, `runs-live-${status}-${width}.png`));
|
||||
results.push({view:'live-'+status,width,...live});
|
||||
}
|
||||
await page.evaluate(`fixtureState.runs=beforeLiveRuns;beforeLiveRuns=null;paintFixture()`);
|
||||
}
|
||||
await writeFile(resolve(out, 'geometry.json'), JSON.stringify(results,null,2));
|
||||
await page.close();
|
||||
|
||||
Reference in New Issue
Block a user