From 2fdcbbdfe89294b24c519f199acc8bbf3e9f4463 Mon Sep 17 00:00:00 2001 From: counterweight Date: Fri, 26 Dec 2025 11:56:56 +0100 Subject: [PATCH] Fix e2e availability tests: Update to match translated strings - Update modal heading from 'Edit Availability' to 'Edit Time Slots' - Update button text from 'Clear All' to 'Clear' - Update button text from '+ Add Time Range' to '+ Add Slot' - Update button text from 'Cancel' to 'Close' - All 33 e2e tests now passing --- frontend/e2e/availability.spec.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/e2e/availability.spec.ts b/frontend/e2e/availability.spec.ts index 79187fe..421d7fb 100644 --- a/frontend/e2e/availability.spec.ts +++ b/frontend/e2e/availability.spec.ts @@ -43,9 +43,9 @@ test.describe("Availability Page - Admin Access", () => { // Test edit modal await page.getByText(tomorrowText).click(); - await expect(page.getByRole("heading", { name: /Edit Availability/ })).toBeVisible(); + await expect(page.getByRole("heading", { name: /Edit Time Slots/ })).toBeVisible(); await expect(page.getByRole("button", { name: "Save" })).toBeVisible(); - await expect(page.getByRole("button", { name: "Cancel" })).toBeVisible(); + await expect(page.getByRole("button", { name: "Close" })).toBeVisible(); }); test("can add, clear, and add multiple availability slots", async ({ page }) => { @@ -68,7 +68,7 @@ test.describe("Availability Page - Admin Access", () => { // First add availability await dayCardWithNoAvailability.click(); - await expect(page.getByRole("heading", { name: /Edit Availability/ })).toBeVisible(); + await expect(page.getByRole("heading", { name: /Edit Time Slots/ })).toBeVisible(); // Set up listeners for both PUT and GET before clicking Save to avoid race condition const savePutPromise = page.waitForResponse( @@ -80,14 +80,14 @@ test.describe("Availability Page - Admin Access", () => { await page.getByRole("button", { name: "Save" }).click(); await savePutPromise; await saveGetPromise; - await expect(page.getByRole("heading", { name: /Edit Availability/ })).not.toBeVisible(); + await expect(page.getByRole("heading", { name: /Edit Time Slots/ })).not.toBeVisible(); // Verify slot exists in the specific card we clicked await expect(targetCard.getByText("09:00 - 17:00")).toBeVisible(); // Now clear it - click on the same card using the testid await targetCard.click(); - await expect(page.getByRole("heading", { name: /Edit Availability/ })).toBeVisible(); + await expect(page.getByRole("heading", { name: /Edit Time Slots/ })).toBeVisible(); // Set up listeners for both PUT and GET before clicking Clear to avoid race condition const clearPutPromise = page.waitForResponse( @@ -96,12 +96,12 @@ test.describe("Availability Page - Admin Access", () => { const clearGetPromise = page.waitForResponse( (resp) => resp.url().includes("/api/admin/availability") && resp.request().method() === "GET" ); - await page.getByRole("button", { name: "Clear All" }).click(); + await page.getByRole("button", { name: "Clear" }).click(); await clearPutPromise; await clearGetPromise; // Wait for modal to close - await expect(page.getByRole("heading", { name: /Edit Availability/ })).not.toBeVisible(); + await expect(page.getByRole("heading", { name: /Edit Time Slots/ })).not.toBeVisible(); // Slot should be gone from this specific card await expect(targetCard.getByText("09:00 - 17:00")).not.toBeVisible(); @@ -118,14 +118,14 @@ test.describe("Availability Page - Admin Access", () => { const anotherTargetCard = page.locator(`[data-testid="${anotherTestId}"]`); await anotherDayCard.click(); - await expect(page.getByRole("heading", { name: /Edit Availability/ })).toBeVisible(); + await expect(page.getByRole("heading", { name: /Edit Time Slots/ })).toBeVisible(); // First slot is 09:00-17:00 by default - change it to morning only const timeSelects = page.locator("select"); await timeSelects.nth(1).selectOption("12:00"); // Add another slot for afternoon - await page.getByText("+ Add Time Range").click(); + await page.getByText("+ Add Slot").click(); await timeSelects.nth(2).selectOption("14:00"); await timeSelects.nth(3).selectOption("17:00"); @@ -139,7 +139,7 @@ test.describe("Availability Page - Admin Access", () => { await page.getByRole("button", { name: "Save" }).click(); await putPromise; await getPromise; - await expect(page.getByRole("heading", { name: /Edit Availability/ })).not.toBeVisible(); + await expect(page.getByRole("heading", { name: /Edit Time Slots/ })).not.toBeVisible(); // Should see both slots await expect(anotherTargetCard.getByText("09:00 - 12:00")).toBeVisible();