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
This commit is contained in:
parent
e2376855ce
commit
2fdcbbdfe8
1 changed files with 10 additions and 10 deletions
|
|
@ -43,9 +43,9 @@ test.describe("Availability Page - Admin Access", () => {
|
||||||
|
|
||||||
// Test edit modal
|
// Test edit modal
|
||||||
await page.getByText(tomorrowText).click();
|
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: "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 }) => {
|
test("can add, clear, and add multiple availability slots", async ({ page }) => {
|
||||||
|
|
@ -68,7 +68,7 @@ test.describe("Availability Page - Admin Access", () => {
|
||||||
|
|
||||||
// First add availability
|
// First add availability
|
||||||
await dayCardWithNoAvailability.click();
|
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
|
// Set up listeners for both PUT and GET before clicking Save to avoid race condition
|
||||||
const savePutPromise = page.waitForResponse(
|
const savePutPromise = page.waitForResponse(
|
||||||
|
|
@ -80,14 +80,14 @@ test.describe("Availability Page - Admin Access", () => {
|
||||||
await page.getByRole("button", { name: "Save" }).click();
|
await page.getByRole("button", { name: "Save" }).click();
|
||||||
await savePutPromise;
|
await savePutPromise;
|
||||||
await saveGetPromise;
|
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
|
// Verify slot exists in the specific card we clicked
|
||||||
await expect(targetCard.getByText("09:00 - 17:00")).toBeVisible();
|
await expect(targetCard.getByText("09:00 - 17:00")).toBeVisible();
|
||||||
|
|
||||||
// Now clear it - click on the same card using the testid
|
// Now clear it - click on the same card using the testid
|
||||||
await targetCard.click();
|
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
|
// Set up listeners for both PUT and GET before clicking Clear to avoid race condition
|
||||||
const clearPutPromise = page.waitForResponse(
|
const clearPutPromise = page.waitForResponse(
|
||||||
|
|
@ -96,12 +96,12 @@ test.describe("Availability Page - Admin Access", () => {
|
||||||
const clearGetPromise = page.waitForResponse(
|
const clearGetPromise = page.waitForResponse(
|
||||||
(resp) => resp.url().includes("/api/admin/availability") && resp.request().method() === "GET"
|
(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 clearPutPromise;
|
||||||
await clearGetPromise;
|
await clearGetPromise;
|
||||||
|
|
||||||
// Wait for modal to close
|
// 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
|
// Slot should be gone from this specific card
|
||||||
await expect(targetCard.getByText("09:00 - 17:00")).not.toBeVisible();
|
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}"]`);
|
const anotherTargetCard = page.locator(`[data-testid="${anotherTestId}"]`);
|
||||||
await anotherDayCard.click();
|
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
|
// First slot is 09:00-17:00 by default - change it to morning only
|
||||||
const timeSelects = page.locator("select");
|
const timeSelects = page.locator("select");
|
||||||
await timeSelects.nth(1).selectOption("12:00");
|
await timeSelects.nth(1).selectOption("12:00");
|
||||||
|
|
||||||
// Add another slot for afternoon
|
// 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(2).selectOption("14:00");
|
||||||
await timeSelects.nth(3).selectOption("17: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 page.getByRole("button", { name: "Save" }).click();
|
||||||
await putPromise;
|
await putPromise;
|
||||||
await getPromise;
|
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
|
// Should see both slots
|
||||||
await expect(anotherTargetCard.getByText("09:00 - 12:00")).toBeVisible();
|
await expect(anotherTargetCard.getByText("09:00 - 12:00")).toBeVisible();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue