diff --git a/packages/app/src/features/runs/history.tsx b/packages/app/src/features/runs/history.tsx index 48d492aa..8a065b83 100644 --- a/packages/app/src/features/runs/history.tsx +++ b/packages/app/src/features/runs/history.tsx @@ -22,7 +22,7 @@ export function RunHistory({ jobId }: { jobId: string }) { const clearStatuses = () => void navigate({ to: "/jobs/$jobId", params: { jobId }, search: { ...search, states: undefined, sort: undefined, direction: undefined, cursor: undefined, previous: undefined } }); return
{runs.isPending &&

Loading run history…

}{runs.error &&

{runs.error.message}

} - {runs.data && <> + {runs.data && <>
Job runs{search.sort ? "" : ", newest first"}
{columns.slice(1, 2).map(([column, label]) => sortColumn(column)} />)}{columns.slice(2).map(([column, label]) => sortColumn(column)} />)}{runs.data.items.map(run => diff --git a/packages/app/src/features/runs/list.tsx b/packages/app/src/features/runs/list.tsx index 346a3662..9f1b828c 100644 --- a/packages/app/src/features/runs/list.tsx +++ b/packages/app/src/features/runs/list.tsx @@ -25,7 +25,7 @@ export function RunList({ jobId, limit = 30 }: { jobId?: string; limit?: number ; return
{runs.isPending &&

Loading runs…

}{runs.error &&

{runs.error.message}

} - {runs.data && <>
Job runs{search.sort ? "" : ", newest first"}
Estimated
{statusHeader}{sortableHeader("job", "Job name")}{sortableHeader("run", "Run")}{sortableHeader("created", "Created")}{runs.data.items.map(run => )}{runs.data.items.length === 0 && }
Job runs{search.sort ? "" : ", newest first"}
Project nameEstimated
{run.project_id && run.project_name ? {run.project_name} : —}{run.job_name}{run.run_name || "Run"}{run.estimated_time ? `${formatEstimatedTime(run.estimated_time.low)}–${formatEstimatedTime(run.estimated_time.median)}–${formatEstimatedTime(run.estimated_time.high)}` : "—"}
{search.states?.length ? <>

No runs match the selected statuses.

: jobId ? "No runs found." : "No runs yet"}
} + {runs.data && <>{statusHeader}{sortableHeader("job", "Job name")}{sortableHeader("run", "Run")}{sortableHeader("created", "Created")}{runs.data.items.map(run => )}{runs.data.items.length === 0 && }
Job runs{search.sort ? "" : ", newest first"}
Project nameEstimated
{run.project_id && run.project_name ? {run.project_name} : —}{run.job_name}{run.run_name || "Run"}{run.estimated_time ? `${formatEstimatedTime(run.estimated_time.low)}–${formatEstimatedTime(run.estimated_time.median)}–${formatEstimatedTime(run.estimated_time.high)}` : "—"}
{search.states?.length ? <>

No runs match the selected statuses.

: jobId ? "No runs found." : "No runs yet"}
} {pagination}
; } diff --git a/packages/app/test/runs.browser.test.mjs b/packages/app/test/runs.browser.test.mjs index 9fd74b76..9c3fc1c0 100644 --- a/packages/app/test/runs.browser.test.mjs +++ b/packages/app/test/runs.browser.test.mjs @@ -10,11 +10,12 @@ after(async () => { await browser?.close(); if (server) await new Promise(resolv async function setup() { const context = await browser.newContext(), page = await context.newPage(); page.setDefaultTimeout(10000); await page.route("**/api/v1/session", route => route.fulfill({ json: { authenticated: true, user: { id: "owner", email: "owner@example.test" }, workspace: { id: "tenant", name: "Workspace" }, capabilities: [], expiresAt: "2026-10-10T00:00:00Z" } })); return { context, page }; } test("all-jobs runs index uses a tenant-scoped page, navigation, refresh, and created time", async () => { const { context, page } = await setup(); const requests = []; let refreshes = 0; - const runs = Array.from({ length: 21 }, (_, index) => ({ id: `00000000-0000-4000-8000-${String(index + 1).padStart(12, "0")}`, project_id: projectId, project_name: "Project Alpha", job_id: jobId, job_name: "Review builds", run_name: `Run ${index}`, state: index === 0 ? "running" : "succeeded", created_at: time, updated_at: time, started_at: index === 0 ? time : null, agent_kind: "codex" })); + const runs = Array.from({ length: 21 }, (_, index) => ({ id: `00000000-0000-4000-8000-${String(index + 1).padStart(12, "0")}`, project_id: projectId, project_name: "Project Alpha", job_id: jobId, job_name: "Review builds", run_name: `Run ${index}`, state: index === 0 ? "running" : "succeeded", created_at: time, updated_at: time, started_at: index === 0 ? time : null, agent_kind: "codex", estimated_time: { low: 60, median: 120, high: 180 } })); await page.route("**/api/v1/runs?**", route => { const url = new URL(route.request().url()); requests.push(url); refreshes++; const second = url.searchParams.has("cursor"); return route.fulfill({ json: { items: second ? [runs[20]] : runs.slice(0, 20), nextCursor: second ? null : "page-2" } }); }); await page.goto(origin + "/job-runs"); await page.getByRole("heading", { name: "Job Runs", exact: true }).waitFor(); await page.getByRole("link", { name: "Run 0", exact: true }).waitFor(); assert.equal(await page.getByRole("link", { name: "Jobs", exact: true }).count(), 0); assert.equal(await page.getByRole("link", { name: "Runs", exact: true }).evaluate(el => el.className.includes("border-factorize-500")), true); const table = page.getByRole("table"); assert.deepEqual(await table.locator("thead th").allTextContents(), ["Status", "Project name", "Job name", "Run", "Estimated", "Created"]); assert.equal(await page.getByText("Run 0", { exact: true }).count(), 1); assert.equal(await page.getByRole("link", { name: "Project Alpha", exact: true }).first().getAttribute("href"), `/projects/${projectId}`); assert.equal(await page.locator("td time").count(), 20); assert.equal(await page.locator("td time").first().getAttribute("datetime"), time); + const firstRowCells = await table.locator("tbody tr").first().locator("td").all(); const estimatedBox = await firstRowCells[4].boundingBox(); const createdBox = await firstRowCells[5].boundingBox(); assert.ok(estimatedBox && createdBox && estimatedBox.x + estimatedBox.width <= createdBox.x, "Estimated and Created columns must not overlap"); assert.ok(requests.every(url => url.searchParams.get("limit") === "20" && !url.searchParams.has("jobId"))); await page.getByRole("link", { name: "Next page" }).click(); await page.getByRole("link", { name: "Run 20", exact: true }).waitFor(); await page.reload(); await page.getByRole("link", { name: "Run 20", exact: true }).waitFor(); assert.ok(refreshes >= 2); await context.close();