web: URL routes, deep links and history navigation (L6)
This commit is contained in:
+448
-6
@@ -108,13 +108,38 @@ const showComposer = () =>
|
||||
// its `online` handler resets the backoff — and waits for the green banner
|
||||
// before the step reads anything.
|
||||
async function ensureConnected(timeout = 25000) {
|
||||
const ok = await page.evaluate(
|
||||
`document.querySelector(".conn-banner")?.classList.contains("conn-ok") ?? false`,
|
||||
);
|
||||
if (!ok) await page.evaluate(`window.dispatchEvent(new Event("online"))`);
|
||||
await page.waitForSelector(".conn-banner.conn-ok", { timeout });
|
||||
const deadline = Date.now() + timeout;
|
||||
while (Date.now() < deadline) {
|
||||
const ok = await page.evaluate(
|
||||
`document.querySelector(".conn-banner")?.classList.contains("conn-ok") ?? false`,
|
||||
);
|
||||
if (ok) return;
|
||||
// The page's own recovery path: an `online` event resets the client's
|
||||
// backoff and re-opens the configured endpoint. A dropped long-lived socket
|
||||
// can take a few tries on the shared server, so nudge until the deadline.
|
||||
await page.evaluate(`window.dispatchEvent(new Event("online"))`);
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
}
|
||||
// One last honest wait, so the failure names the banner selector.
|
||||
await page.waitForSelector(".conn-banner.conn-ok", { timeout: 2000 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Hard-navigate to a page route and connect, exactly as a pasted link would: a
|
||||
* full document load parses the URL at boot and keeps it pending until the socket
|
||||
* comes up. The configured endpoint is already in localStorage from the live
|
||||
* run's first connection, so clicking Connect is the same user action.
|
||||
*/
|
||||
async function openDeepLink(path) {
|
||||
await page.goto(`http://127.0.0.1:${port}${path}`);
|
||||
await page.waitForSelector("#connectBtn", { timeout: 15000 });
|
||||
await page.click("#connectBtn");
|
||||
await ensureConnected(30000);
|
||||
}
|
||||
|
||||
/** The current path+query the page shows. */
|
||||
const currentLocation = () => page.evaluate(`location.pathname + location.search`);
|
||||
|
||||
// Open a run's detail. The connection is asserted first, and if the socket drops
|
||||
// between steps the page's reconnect does not replay the detail request, so the
|
||||
// click is retried once after re-establishing the connection.
|
||||
@@ -2126,7 +2151,9 @@ try {
|
||||
}
|
||||
|
||||
step("Closing search clears the query and leaves the view intact (S1)");
|
||||
await searchTargets("release", "field");
|
||||
// `plan` is known to return field hits (the emphasis step above uses it); the
|
||||
// close assertion only needs a query in flight, not a particular kind.
|
||||
await searchTargets(SEARCH_QUERY, "field");
|
||||
const beforeClose = await viewSnapshot();
|
||||
await page.click("#searchClose");
|
||||
await eventually(() => page.evaluate(`!document.querySelector("#searchInput")`), {
|
||||
@@ -4684,6 +4711,421 @@ try {
|
||||
);
|
||||
console.log(" chat_shells re-fetched after the stream reconnect (real request)");
|
||||
|
||||
// --- L6: URL routes, deep links and history -------------------------------
|
||||
// Every later hard navigation records uncaught errors/unhandled rejections, so
|
||||
// a route that throws can never pass as a rendered fallback.
|
||||
await page.addInitScript(`(() => {
|
||||
window.__pipelinesPageErrors = [];
|
||||
window.addEventListener("error", (event) => {
|
||||
window.__pipelinesPageErrors.push(String(event.message || event.error || "error"));
|
||||
});
|
||||
window.addEventListener("unhandledrejection", (event) => {
|
||||
window.__pipelinesPageErrors.push(String(event.reason || "unhandled rejection"));
|
||||
});
|
||||
})()`);
|
||||
|
||||
step("L6: deep links, URL routing and Back/Forward");
|
||||
await page.clickText("nav.tabs button.tab", "Runs");
|
||||
await page.waitForSelector(".list.runs .run-row", { timeout: 25000 });
|
||||
const discovered = await page.evaluate(`(() => {
|
||||
const rows = [...document.querySelectorAll(".list.runs .run-row")];
|
||||
const idOf = (row) =>
|
||||
Number(row.querySelector(".run-row-meta[data-run-id]")?.dataset.runId ?? 0);
|
||||
const ids = rows.map(idOf).filter((id) => id > 0);
|
||||
const waitingRow = rows.find((row) => row.querySelector(".chip-waiting"));
|
||||
return {
|
||||
ids,
|
||||
preferred: ids.includes(440) ? 440 : (ids[0] ?? 0),
|
||||
waiting: waitingRow ? idOf(waitingRow) : 0,
|
||||
};
|
||||
})()`);
|
||||
if (!discovered.preferred) throw new Error("L6: no real run id on the Runs list");
|
||||
console.log(
|
||||
` live run ids on the list: ${discovered.ids.join(", ")} (using ${discovered.preferred})`,
|
||||
);
|
||||
|
||||
// An in-page pipeline selection is a real pushState: the detail route records
|
||||
// the id and version, and the hard link below uses the id it found.
|
||||
await page.clickText("nav.tabs button.tab", "Pipelines");
|
||||
await page.waitForSelector("#pipelineRows button.row", { timeout: 25000 });
|
||||
const pipelineSelection = await page.evaluate(`(async () => {
|
||||
const rows = [...document.querySelectorAll("#pipelineRows button.row")];
|
||||
const row =
|
||||
rows.find((candidate) =>
|
||||
(candidate.querySelector(".row-title")?.textContent ?? "").includes("Plan and land"),
|
||||
) ?? rows[0];
|
||||
if (!row) return null;
|
||||
row.click();
|
||||
const deadline = Date.now() + 20000;
|
||||
while (Date.now() < deadline) {
|
||||
if (document.querySelector(".detail h2")) break;
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
}
|
||||
return {
|
||||
path: location.search ? location.pathname + location.search : location.pathname,
|
||||
name: document.querySelector(".detail h2")?.textContent ?? "",
|
||||
};
|
||||
})()`);
|
||||
if (!pipelineSelection?.path) throw new Error("L6: the pipeline detail did not open");
|
||||
const pipelineId = Number((/^\/pipelines\/([0-9]+)/.exec(pipelineSelection.path) ?? [])[1] ?? 0);
|
||||
if (!pipelineId) throw new Error(`L6: pipeline detail route ${JSON.stringify(pipelineSelection.path)}`);
|
||||
console.log(
|
||||
` in-page pipeline selection pushed ${pipelineSelection.path} (${JSON.stringify(pipelineSelection.name)})`,
|
||||
);
|
||||
|
||||
// A hard navigation to a run route: boot parses the URL, the first connection
|
||||
// loads the runs list and then the run, and the detail owns the requested id.
|
||||
const runPath = `/runs/${discovered.preferred}`;
|
||||
await openDeepLink(runPath);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`document.querySelector(".run-detail .run-identity")?.textContent?.startsWith("run ${discovered.preferred} ") ?? false`,
|
||||
),
|
||||
{ timeout: 30000, what: `the deep-linked run ${discovered.preferred}` },
|
||||
);
|
||||
const deepRunUrl = await currentLocation();
|
||||
if (deepRunUrl !== runPath) throw new Error(`L6: run URL is ${deepRunUrl}, expected ${runPath}`);
|
||||
// The nav badge reads the pipeline count; a run deep link must not leave a
|
||||
// false `Pipelines (0)` beside a populated list.
|
||||
const runNav = await page.evaluate(
|
||||
`[...document.querySelectorAll("nav.tabs button.tab")].map((b) => b.textContent.trim())`,
|
||||
);
|
||||
const pipelinesTab = runNav.find((label) => label.startsWith("Pipelines")) ?? "";
|
||||
if (pipelinesTab === "Pipelines (0)") {
|
||||
throw new Error(`L6: the run deep link left a false Pipelines (0) in the nav: ${JSON.stringify(runNav)}`);
|
||||
}
|
||||
console.log(` hard navigation ${runPath} opened run ${discovered.preferred}'s detail; nav ${JSON.stringify(runNav)}`);
|
||||
await shot(`L6-deeplink-run-${discovered.preferred}.png`);
|
||||
|
||||
// The same for a pipeline route: /pipelines/:id means latest.
|
||||
const pipelinePath = `/pipelines/${pipelineId}`;
|
||||
await openDeepLink(pipelinePath);
|
||||
await eventually(
|
||||
() => page.evaluate(`!!document.querySelector(".detail h2")`),
|
||||
{ timeout: 30000, what: `the deep-linked pipeline ${pipelineId}` },
|
||||
);
|
||||
const deepPipeline = await page.evaluate(`(() => ({
|
||||
path: location.pathname + location.search,
|
||||
name: document.querySelector(".detail h2")?.textContent ?? "",
|
||||
}))()`);
|
||||
if (deepPipeline.path !== pipelinePath) {
|
||||
throw new Error(`L6: pipeline URL is ${deepPipeline.path}, expected ${pipelinePath}`);
|
||||
}
|
||||
if (pipelineSelection.name && deepPipeline.name !== pipelineSelection.name) {
|
||||
throw new Error(
|
||||
`L6: deep-linked pipeline rendered ${JSON.stringify(deepPipeline.name)}, expected ${JSON.stringify(pipelineSelection.name)}`,
|
||||
);
|
||||
}
|
||||
console.log(` hard navigation ${pipelinePath} opened ${JSON.stringify(deepPipeline.name)}`);
|
||||
await shot(`L6-deeplink-pipeline-${pipelineId}.png`);
|
||||
|
||||
// A pipeline-stage route opens the Graph tab and the named definition pane,
|
||||
// and brings that pane into view (the graph above it is taller than a viewport).
|
||||
const stagePath = `/pipelines/${pipelineId}/stage/planner`;
|
||||
await openDeepLink(stagePath);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`document.querySelector(".detail-tab.active")?.textContent === "Graph" &&
|
||||
!!document.querySelector(".graph-pane") && !document.querySelector(".graph-pane").hidden`,
|
||||
),
|
||||
{ timeout: 30000, what: "the deep-linked pipeline stage pane" },
|
||||
);
|
||||
const stageState = await page.evaluate(`(() => {
|
||||
const pane = document.querySelector(".graph-pane");
|
||||
const rect = pane.getBoundingClientRect();
|
||||
const head = document.querySelector(".graph-pane-head")?.getBoundingClientRect() ?? null;
|
||||
const close = document.querySelector(".graph-pane-close")?.getBoundingClientRect() ?? null;
|
||||
const topbar = document.querySelector(".topbar")?.getBoundingClientRect() ?? null;
|
||||
return {
|
||||
path: location.pathname + location.search,
|
||||
tab: document.querySelector(".detail-tab.active")?.textContent ?? "",
|
||||
title: document.querySelector(".graph-pane-title")?.textContent ?? "",
|
||||
top: Math.round(rect.top),
|
||||
viewport: window.innerHeight,
|
||||
topbarBottom: topbar ? Math.round(topbar.bottom) : 0,
|
||||
headTop: head ? Math.round(head.top) : null,
|
||||
headBottom: head ? Math.round(head.bottom) : null,
|
||||
closeTop: close ? Math.round(close.top) : null,
|
||||
};
|
||||
})()`);
|
||||
if (stageState.path !== stagePath) throw new Error(`L6: pipeline stage URL is ${stageState.path}`);
|
||||
if (stageState.tab !== "Graph") throw new Error(`L6: pipeline stage opened tab ${stageState.tab}`);
|
||||
if (!stageState.title) throw new Error("L6: the pipeline stage pane has no title");
|
||||
if (stageState.headTop == null || stageState.headTop < stageState.topbarBottom) {
|
||||
throw new Error(
|
||||
`L6: the opened stage pane head (top ${stageState.headTop}) is hidden under the sticky top bar (bottom ${stageState.topbarBottom})`,
|
||||
);
|
||||
}
|
||||
if (stageState.headBottom > stageState.viewport) {
|
||||
throw new Error(`L6: the opened stage pane head is below the viewport (bottom ${stageState.headBottom})`);
|
||||
}
|
||||
if (stageState.closeTop == null || stageState.closeTop < stageState.topbarBottom) {
|
||||
throw new Error(
|
||||
`L6: the stage pane Close control (top ${stageState.closeTop}) is hidden under the top bar (bottom ${stageState.topbarBottom})`,
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
` hard navigation ${stagePath} opened the Graph tab and the ${JSON.stringify(stageState.title)} pane (head ${stageState.headTop}px, top bar ${stageState.topbarBottom}px)`,
|
||||
);
|
||||
await shot(`L6-deeplink-pipeline-${pipelineId}-stage.png`);
|
||||
|
||||
// The graph also selects its terminals, and the URL it pushes for one must
|
||||
// re-open the same pane (a terminal is not a named stage, but it is a node the
|
||||
// page itself writes a /stage/ URL for). Find a terminal in the live graph.
|
||||
const terminalKey = await page.evaluate(`(() => {
|
||||
const node = [...document.querySelectorAll(".graph-node[data-key]")]
|
||||
.find((n) => (n.dataset.key ?? "").startsWith("#"));
|
||||
return node?.dataset.key ?? "";
|
||||
})()`);
|
||||
if (terminalKey) {
|
||||
const terminalPath = `/pipelines/${pipelineId}/stage/${encodeURIComponent(terminalKey)}`;
|
||||
await openDeepLink(terminalPath);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`!!document.querySelector(".graph-pane") && !document.querySelector(".graph-pane").hidden`,
|
||||
),
|
||||
{ timeout: 30000, what: `the deep-linked terminal pane ${terminalKey}` },
|
||||
);
|
||||
const terminalState = await page.evaluate(`(() => ({
|
||||
path: location.pathname + location.search,
|
||||
title: document.querySelector(".graph-pane-title")?.textContent ?? "",
|
||||
headTop: Math.round(document.querySelector(".graph-pane-head")?.getBoundingClientRect().top ?? -1),
|
||||
topbarBottom: Math.round(document.querySelector(".topbar")?.getBoundingClientRect().bottom ?? 0),
|
||||
}))()`);
|
||||
if (terminalState.path !== terminalPath) {
|
||||
throw new Error(
|
||||
`L6: the terminal stage URL was rewritten to ${terminalState.path}, expected ${terminalPath}`,
|
||||
);
|
||||
}
|
||||
if (!terminalState.title) throw new Error("L6: the terminal stage pane has no title");
|
||||
if (terminalState.headTop < terminalState.topbarBottom) {
|
||||
throw new Error("L6: the terminal stage pane head is hidden under the top bar");
|
||||
}
|
||||
console.log(
|
||||
` hard navigation ${terminalPath} re-opened the ${JSON.stringify(terminalState.title)} terminal pane (URL unchanged)`,
|
||||
);
|
||||
await shot(`L6-deeplink-pipeline-${pipelineId}-terminal.png`);
|
||||
} else {
|
||||
console.log(" -- the live graph has no terminal node; skipped the terminal stage deep link");
|
||||
}
|
||||
|
||||
// In-page moves: Pipelines -> Runs -> a run detail, then Back/Forward. A window
|
||||
// marker proves the document was never reloaded.
|
||||
const marker = `L6-no-reload-${Date.now()}`;
|
||||
await page.evaluate(`window.__pipelinesNoReload = ${JSON.stringify(marker)}`);
|
||||
await page.clickText("nav.tabs button.tab", "Runs");
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`location.pathname === "/runs" && !!document.querySelector(".list.runs .run-row")`,
|
||||
),
|
||||
{ timeout: 25000, what: "the Runs list after a pushState move" },
|
||||
);
|
||||
console.log(` pushState Pipelines -> Runs: ${await currentLocation()}`);
|
||||
|
||||
const runRowSelector = `.list.runs .run-row-meta[data-run-id="${discovered.preferred}"]`;
|
||||
const clickedRun = await page.evaluate(`(() => {
|
||||
const node = document.querySelector(${JSON.stringify(runRowSelector)});
|
||||
if (!node) return false;
|
||||
node.click();
|
||||
return true;
|
||||
})()`);
|
||||
if (!clickedRun) throw new Error(`L6: run ${discovered.preferred} was not on the Runs list`);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`location.pathname === "/runs/${discovered.preferred}" &&
|
||||
(document.querySelector(".run-detail .run-identity")?.textContent?.startsWith("run ${discovered.preferred} ") ?? false)`,
|
||||
),
|
||||
{ timeout: 30000, what: `run ${discovered.preferred} after a pushState selection` },
|
||||
);
|
||||
console.log(` pushState Runs -> run detail: ${await currentLocation()}`);
|
||||
|
||||
await page.evaluate(`history.back()`);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`location.pathname === "/runs" && !!document.querySelector(".list.runs .run-row")`,
|
||||
),
|
||||
{ timeout: 25000, what: "Back to the Runs list" },
|
||||
);
|
||||
const backState = await page.evaluate(`(() => ({
|
||||
path: location.pathname,
|
||||
marker: window.__pipelinesNoReload ?? null,
|
||||
staleDetail: !!document.querySelector(".run-detail .run-identity"),
|
||||
}))()`);
|
||||
if (backState.path !== "/runs") throw new Error(`L6: Back landed on ${backState.path}`);
|
||||
if (backState.staleDetail) throw new Error("L6: Back left a stale run detail rendered");
|
||||
if (backState.marker !== marker) throw new Error("L6: Back reloaded the document");
|
||||
console.log(` history.back() -> /runs, marker survived (${backState.marker})`);
|
||||
await shot("L6-history-back.png");
|
||||
|
||||
await page.evaluate(`history.forward()`);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`location.pathname === "/runs/${discovered.preferred}" &&
|
||||
(document.querySelector(".run-detail .run-identity")?.textContent?.startsWith("run ${discovered.preferred} ") ?? false)`,
|
||||
),
|
||||
{ timeout: 30000, what: "Forward back to the run detail" },
|
||||
);
|
||||
const forwardState = await page.evaluate(`(() => ({
|
||||
path: location.pathname,
|
||||
marker: window.__pipelinesNoReload ?? null,
|
||||
}))()`);
|
||||
if (forwardState.marker !== marker) throw new Error("L6: Forward reloaded the document");
|
||||
console.log(` history.forward() -> ${forwardState.path}, marker survived`);
|
||||
|
||||
// Leaving Runs while an executing run's poll is active must stop that poll: a
|
||||
// silent get_run loop for a detail the view no longer shows would otherwise run
|
||||
// forever. Conditional because the live server may have no executing run.
|
||||
const executingId = await page.evaluate(`(() => {
|
||||
const row = [...document.querySelectorAll(".list.runs .run-row")].find((n) => n.querySelector(".chip-running"));
|
||||
const meta = row?.querySelector(".run-row-meta[data-run-id]");
|
||||
return meta ? Number(meta.getAttribute("data-run-id")) : null;
|
||||
})()`);
|
||||
if (executingId != null) {
|
||||
await page.click(`.list.runs .run-row-meta[data-run-id="${executingId}"]`);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`(document.querySelector(".run-detail .run-identity")?.textContent?.startsWith("run ${executingId} ") ?? false)`,
|
||||
),
|
||||
{ timeout: 30000, what: `the executing run ${executingId}` },
|
||||
);
|
||||
await page.evaluate(`window.__pipelinesSentTypes = []`);
|
||||
await page.clickText("nav.tabs button.tab", "Pipelines");
|
||||
await eventually(() => page.evaluate(`location.pathname === "/pipelines"`), {
|
||||
timeout: 15000,
|
||||
what: "Pipelines after leaving the executing run",
|
||||
});
|
||||
await new Promise((resolve) => setTimeout(resolve, 2600));
|
||||
const leftoverPolls = await page.evaluate(
|
||||
`(window.__pipelinesSentTypes || []).filter((type) => type === "get_run").length`,
|
||||
);
|
||||
if (leftoverPolls > 0) {
|
||||
throw new Error(
|
||||
`L6: leaving Runs left the executing run's poll active (${leftoverPolls} get_run frame(s) after 2.6s)`,
|
||||
);
|
||||
}
|
||||
console.log(
|
||||
` left executing run ${executingId} for /pipelines; no get_run poll fired in the next 2.6s`,
|
||||
);
|
||||
} else {
|
||||
console.log(" -- no executing run available; skipped the leave-Runs poll check");
|
||||
}
|
||||
|
||||
// The decide deep link is exercised only against a genuinely waiting run; with
|
||||
// none, say so rather than claiming a capture of a state that never rendered.
|
||||
if (discovered.waiting) {
|
||||
await openDeepLink(`/runs/${discovered.waiting}?action=decide`);
|
||||
await eventually(() => page.evaluate(`!!document.querySelector(".decision-sheet")`), {
|
||||
timeout: 30000,
|
||||
what: `the decision sheet for waiting run ${discovered.waiting}`,
|
||||
});
|
||||
const decideUrl = await currentLocation();
|
||||
if (decideUrl !== `/runs/${discovered.waiting}`) {
|
||||
throw new Error(`L6: the decide action was not consumed to /runs/${discovered.waiting}: ${decideUrl}`);
|
||||
}
|
||||
console.log(
|
||||
` hard navigation /runs/${discovered.waiting}?action=decide opened the decision sheet, action consumed`,
|
||||
);
|
||||
await shot(`L6-deeplink-decide-${discovered.waiting}.png`);
|
||||
await page.evaluate(`document.querySelector(".decision-sheet .decision-cancel")?.click()`);
|
||||
await eventually(() => page.evaluate(`!document.querySelector(".decision-sheet")`), {
|
||||
timeout: 5000,
|
||||
what: "the decision sheet to close without sending",
|
||||
});
|
||||
} else {
|
||||
console.log(
|
||||
" NOTE: the ?action=decide path was not exercised live (no waiting run on the server); test/routes.test.mjs covers its parsing",
|
||||
);
|
||||
}
|
||||
|
||||
// A missing run falls back honestly: the list with real rows, /runs in the URL,
|
||||
// the server's refusal in the banner and no stale run identity.
|
||||
await openDeepLink("/runs/900000000");
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`location.pathname === "/runs" && document.querySelectorAll(".list.runs .run-row").length > 0`,
|
||||
),
|
||||
{ timeout: 30000, what: "the missing-run fallback to the Runs list" },
|
||||
);
|
||||
const missingState = await page.evaluate(`(() => ({
|
||||
path: location.pathname + location.search,
|
||||
rows: document.querySelectorAll(".list.runs .run-row").length,
|
||||
staleDetail: !!document.querySelector(".run-detail .run-identity"),
|
||||
error: document.querySelector(".banner.error")?.textContent ?? "",
|
||||
pageErrors: window.__pipelinesPageErrors ?? [],
|
||||
}))()`);
|
||||
if (missingState.path !== "/runs") throw new Error(`L6: missing run fell back to ${missingState.path}`);
|
||||
if (!missingState.rows) throw new Error("L6: missing run rendered no run rows");
|
||||
if (missingState.staleDetail) throw new Error("L6: missing run left a stale run detail");
|
||||
if (!missingState.error) throw new Error("L6: missing run showed no server refusal");
|
||||
if (missingState.pageErrors.length) {
|
||||
throw new Error(`L6: page errors: ${missingState.pageErrors.join(" | ")}`);
|
||||
}
|
||||
console.log(
|
||||
` missing run -> /runs with ${missingState.rows} real rows, banner ${JSON.stringify(missingState.error.replace(/^Error:\\s*/, ""))}`,
|
||||
);
|
||||
await shot("L6-missing-run.png");
|
||||
|
||||
// The same honest fallback for a pipeline the server does not have.
|
||||
await openDeepLink("/pipelines/900000000");
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`location.pathname === "/pipelines" && document.querySelectorAll("#pipelineRows button.row").length > 0`,
|
||||
),
|
||||
{ timeout: 30000, what: "the missing-pipeline fallback to the Pipelines list" },
|
||||
);
|
||||
const missingPipeline = await page.evaluate(`(() => ({
|
||||
path: location.pathname + location.search,
|
||||
rows: document.querySelectorAll("#pipelineRows button.row").length,
|
||||
staleDetail: !!document.querySelector(".detail h2"),
|
||||
error: document.querySelector(".banner.error")?.textContent ?? "",
|
||||
pageErrors: window.__pipelinesPageErrors ?? [],
|
||||
}))()`);
|
||||
if (missingPipeline.path !== "/pipelines") {
|
||||
throw new Error(`L6: missing pipeline fell back to ${missingPipeline.path}`);
|
||||
}
|
||||
if (!missingPipeline.rows) throw new Error("L6: missing pipeline rendered no pipeline rows");
|
||||
if (missingPipeline.staleDetail) throw new Error("L6: missing pipeline left a stale pipeline detail");
|
||||
if (!missingPipeline.error) throw new Error("L6: missing pipeline showed no server refusal");
|
||||
if (missingPipeline.pageErrors.length) {
|
||||
throw new Error(`L6: page errors: ${missingPipeline.pageErrors.join(" | ")}`);
|
||||
}
|
||||
console.log(
|
||||
` missing pipeline -> /pipelines with ${missingPipeline.rows} real rows, banner ${JSON.stringify(missingPipeline.error.replace(/^Error:\\s*/, ""))}`,
|
||||
);
|
||||
await shot("L6-missing-pipeline.png");
|
||||
|
||||
// A move made before the socket is up must become the destination the first
|
||||
// connection opens; only an untouched boot deep link is replayed. Load `/`,
|
||||
// choose Runs while disconnected, then connect and require URL and view to
|
||||
// agree (regression: the stale boot route used to win at connect time).
|
||||
await page.goto(`http://127.0.0.1:${port}/`);
|
||||
await page.waitForSelector("#connectBtn", { timeout: 15000 });
|
||||
await page.clickText("nav.tabs button.tab", "Runs");
|
||||
const preConnect = await currentLocation();
|
||||
if (preConnect !== "/runs") {
|
||||
throw new Error(`L6: a Runs choice before connecting left ${preConnect}, expected /runs`);
|
||||
}
|
||||
await page.click("#connectBtn");
|
||||
await ensureConnected(30000);
|
||||
await eventually(
|
||||
() =>
|
||||
page.evaluate(
|
||||
`location.pathname === "/runs" && !!document.querySelector(".list.runs .run-row")`,
|
||||
),
|
||||
{ timeout: 30000, what: "the pre-connect Runs choice after connecting" },
|
||||
);
|
||||
console.log(" a Runs choice made before connecting survived the first connection (/runs, list rendered)");
|
||||
|
||||
console.log("\nUI SMOKE PASS");
|
||||
for (const shot of shots) console.log(` ${shot}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user