fix(e2e): resolve E2E test failures
- Update fixture mock user IDs to match test expectations (client-1, client-2) - Fix admin-reports strict mode violation: replace .or() with combined regex - Ensure services endpoint is mocked before navigation in beforeEach - Tests now expect UUIDs to be replaced with predictable IDs in mocks Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -73,8 +73,8 @@ test.describe("Admin Reports Data", () => {
|
|||||||
await page.waitForTimeout(2_000);
|
await page.waitForTimeout(2_000);
|
||||||
|
|
||||||
// Revenue card should show non-zero value (check dollar amount or Revenue heading)
|
// Revenue card should show non-zero value (check dollar amount or Revenue heading)
|
||||||
const revenueCard = page.locator("text=/\\$1,250/").first();
|
const revenueCard = page.locator("text=/\\$1,250|Revenue/i").first();
|
||||||
await expect(revenueCard.or(page.locator("text=/Revenue/"))).toBeVisible();
|
await expect(revenueCard).toBeVisible();
|
||||||
|
|
||||||
// Appointments card should show non-zero
|
// Appointments card should show non-zero
|
||||||
const appointmentsCard = page.locator("text=/25/").first();
|
const appointmentsCard = page.locator("text=/25/").first();
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ const MOCK_SERVICES = [
|
|||||||
|
|
||||||
test.describe("Services Deduplication", () => {
|
test.describe("Services Deduplication", () => {
|
||||||
test.beforeEach(async ({ page }) => {
|
test.beforeEach(async ({ page }) => {
|
||||||
|
// Mock services endpoint FIRST before navigation
|
||||||
|
await page.route("**/api/services**", (route) =>
|
||||||
|
route.fulfill({ json: MOCK_SERVICES })
|
||||||
|
);
|
||||||
|
|
||||||
// Login as staff
|
// Login as staff
|
||||||
await page.goto("/login");
|
await page.goto("/login");
|
||||||
await page.getByText("Alice Groomer").click();
|
await page.getByText("Alice Groomer").click();
|
||||||
await expect(page).toHaveURL("/admin");
|
await expect(page).toHaveURL("/admin");
|
||||||
|
|
||||||
// Mock services endpoint
|
|
||||||
await page.route("**/api/services**", (route) =>
|
|
||||||
route.fulfill({ json: MOCK_SERVICES })
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("admin services page shows no duplicate service names", async ({ page }) => {
|
test("admin services page shows no duplicate service names", async ({ page }) => {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ const MOCK_DEV_USERS = {
|
|||||||
{ id: "staff-2", name: "Bob Manager", email: "bob@groombook.dev", role: "manager" },
|
{ id: "staff-2", name: "Bob Manager", email: "bob@groombook.dev", role: "manager" },
|
||||||
],
|
],
|
||||||
clients: [
|
clients: [
|
||||||
{ id: "00000000-0000-0000-0000-000000000002", name: "Carol Client", email: "carol@example.com", petCount: 2 },
|
{ id: "client-1", name: "Carol Client", email: "carol@example.com", petCount: 2 },
|
||||||
{ id: "00000000-0000-0000-0000-000000000003", name: "Dave Client", email: null, petCount: 1 },
|
{ id: "client-2", name: "Dave Client", email: null, petCount: 1 },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user