fix(E2E): add missing API mocks for invoices stats and portal billing #349

Merged
groombook-engineer[bot] merged 30 commits from fix/gro-693-e2e-fixes into dev 2026-05-04 15:05:40 +00:00
2 changed files with 14 additions and 3 deletions
Showing only changes of commit 510273a6e3 - Show all commits
+5
View File
@@ -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: [] });
});
+9 -3
View File
@@ -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[] = [];