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
|
||||
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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue