From fab19ed5aa41b0a1d4013ccb3791c54393e9cffd Mon Sep 17 00:00:00 2001 From: 0xjjjjjj <0xjjjjjj@users.noreply.github.com> Date: Sun, 8 Mar 2026 09:41:32 -0700 Subject: [PATCH] fix: use correct DashboardMetrics shape in mobile sidebar e2e stubs The dashboard page accesses metrics.throughput.primary.points which requires the full DashboardMetrics type structure. The original stub returned a flat object with wrong fields, causing TypeError in all authenticated tests. Also adds stubs for boards, agents, activity, gateways, and board-groups APIs that the dashboard and boards pages query on load. Co-Authored-By: Claude Opus 4.6 --- frontend/cypress/e2e/mobile_sidebar.cy.ts | 52 ++++++++++++++++++++--- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/frontend/cypress/e2e/mobile_sidebar.cy.ts b/frontend/cypress/e2e/mobile_sidebar.cy.ts index 2e8070a6..8475551c 100644 --- a/frontend/cypress/e2e/mobile_sidebar.cy.ts +++ b/frontend/cypress/e2e/mobile_sidebar.cy.ts @@ -7,17 +7,59 @@ describe("/dashboard - mobile sidebar", () => { setupCommonPageTestHooks(apiBase); + const emptySeries = { + primary: { range: "7d", bucket: "day", points: [] }, + comparison: { range: "7d", bucket: "day", points: [] }, + }; + function stubDashboardApis() { cy.intercept("GET", `${apiBase}/metrics/dashboard*`, { statusCode: 200, body: { - total_boards: 0, - total_tasks: 0, - tasks_by_status: {}, - active_agents: 0, - pending_approvals: 0, + generated_at: new Date().toISOString(), + range: "7d", + kpis: { + inbox_tasks: 0, + in_progress_tasks: 0, + review_tasks: 0, + done_tasks: 0, + tasks_in_progress: 0, + active_agents: 0, + error_rate_pct: 0, + median_cycle_time_hours_7d: null, + }, + throughput: emptySeries, + cycle_time: emptySeries, + error_rate: emptySeries, + wip: emptySeries, + pending_approvals: { items: [], total: 0 }, }, }).as("dashboardMetrics"); + + cy.intercept("GET", `${apiBase}/boards*`, { + statusCode: 200, + body: { items: [], total: 0 }, + }).as("boardsList"); + + cy.intercept("GET", `${apiBase}/agents*`, { + statusCode: 200, + body: { items: [], total: 0 }, + }).as("agentsList"); + + cy.intercept("GET", `${apiBase}/activity*`, { + statusCode: 200, + body: { items: [], total: 0 }, + }).as("activityList"); + + cy.intercept("GET", `${apiBase}/gateways/status*`, { + statusCode: 200, + body: { gateways: [] }, + }).as("gatewaysStatus"); + + cy.intercept("GET", `${apiBase}/board-groups*`, { + statusCode: 200, + body: { items: [], total: 0 }, + }).as("boardGroupsList"); } function visitDashboardAuthenticated() {