From 510273a6e3301b02572c506e4d783436855b6df8 Mon Sep 17 00:00:00 2001 From: Test User Date: Tue, 21 Apr 2026 20:25:12 +0000 Subject: [PATCH] fix(E2E): add missing API mocks for invoices stats and portal billing navigation.spec.ts: - Add mock for /api/invoices/stats/summary returning the shape { revenueThisMonth, outstanding, refundsThisMonth, methodBreakdown } that InvoicesPage useEffect fetches on mount portal-data.spec.ts billing test: - Replace incorrect /api/billing** mock with correct portal endpoint mocks: /api/portal/config, /api/portal/invoices, /api/portal/payment-methods These are the actual endpoints BillingPayments component calls Both fixes address the E2E failures reported by Lint Roller on PR #348. Co-Authored-By: Paperclip --- apps/e2e/tests/navigation.spec.ts | 5 +++++ apps/e2e/tests/portal-data.spec.ts | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/e2e/tests/navigation.spec.ts b/apps/e2e/tests/navigation.spec.ts index 29a7060..2809afa 100644 --- a/apps/e2e/tests/navigation.spec.ts +++ b/apps/e2e/tests/navigation.spec.ts @@ -47,6 +47,11 @@ test.beforeEach(async ({ page }) => { if (url.includes("/api/invoices")) { return route.fulfill({ json: { data: [], total: 0 } }); } + if (url.includes("/api/invoices/stats/summary")) { + return route.fulfill({ + json: { revenueThisMonth: 0, outstanding: 0, refundsThisMonth: 0, methodBreakdown: [] }, + }); + } // Appointments, clients, services, staff, book, etc. return route.fulfill({ json: [] }); }); diff --git a/apps/e2e/tests/portal-data.spec.ts b/apps/e2e/tests/portal-data.spec.ts index 5e9b2ed..26ce82c 100644 --- a/apps/e2e/tests/portal-data.spec.ts +++ b/apps/e2e/tests/portal-data.spec.ts @@ -72,9 +72,15 @@ test.describe("Portal Data Integrity", () => { }); test("billing section renders without JS errors", async ({ page }) => { - // Mock billing endpoint - await page.route("**/api/billing**", (route) => - route.fulfill({ json: { invoices: [], balanceCents: 0 } }) + // Mock portal billing endpoints + await page.route("**/api/portal/config**", (route) => + route.fulfill({ json: { stripePublishableKey: "" } }) + ); + await page.route("**/api/portal/invoices**", (route) => + route.fulfill({ json: [] }) + ); + await page.route("**/api/portal/payment-methods**", (route) => + route.fulfill({ json: [] }) ); const consoleErrors: string[] = [];