Scheduling infrastructure for absolutely everyone.
Revert "update OOO e2e tests to remove flakiness (#18367)" (#18411)
Anik Dhabal Babu0a293308e7e8
diff --git a/apps/web/playwright/lib/testUtils.ts b/apps/web/playwright/lib/testUtils.tsindex 7cc89f19f31..43005af7024 100644--- a/apps/web/playwright/lib/testUtils.ts+++ b/apps/web/playwright/lib/testUtils.ts@@ -542,27 +542,16 @@ export async function expectPageToBeNotFound({ page, url }: { page: Page; url: sexport async function clickUntilDialogVisible(dialogOpenButton: Locator,visibleLocatorOnDialog: Locator,- page: Page,- matchUrl: string,retries = 3,- delay = 2000+ delay = 500) {for (let i = 0; i < retries; i++) {+ await dialogOpenButton.click();try {- const responsePromise = page.waitForResponse(- (response) => response.url().includes(matchUrl) && response.status() === 200- );- await dialogOpenButton.click();- await responsePromise;await visibleLocatorOnDialog.waitFor({ state: "visible", timeout: delay });return;} catch {- console.warn(`clickUntilDialogVisible: Attempt ${i + 1} failed to open dialog`);- if (i === retries - 1) {- console.log("clickUntilDialogVisible: Dialog did not appear after multiple attempts.");- return;- }- await new Promise((resolve) => setTimeout(resolve, delay));+ if (i === retries - 1) throw new Error("Dialog did not appear after multiple attempts.");}}}diff --git a/apps/web/playwright/out-of-office.e2e.ts b/apps/web/playwright/out-of-office.e2e.tsindex c251ccaef66..8f93ae7577a 100644--- a/apps/web/playwright/out-of-office.e2e.ts+++ b/apps/web/playwright/out-of-office.e2e.ts@@ -21,12 +21,8 @@ test.describe("Out of office", () => {await user.apiLogin();await page.goto("/settings/my-account/out-of-office");- await page.waitForLoadState("domcontentloaded");-- const addOOOButton = page.getByTestId("add_entry_ooo");- const dateButton = page.locator('[data-testid="date-range"]');- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await page.getByTestId("add_entry_ooo").click();await page.getByTestId("reason_select").click();await page.getByTestId("select-option-4").click();@@ -72,12 +68,8 @@ test.describe("Out of office", () => {await user.apiLogin();await page.goto(`/settings/my-account/out-of-office`);- await page.waitForLoadState("domcontentloaded");-- const addOOOButton = page.getByTestId("add_entry_ooo");- const dateButton = page.locator('[data-testid="date-range"]');- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await page.getByTestId("add_entry_ooo").click();await page.getByTestId("reason_select").click();await page.getByTestId("select-option-4").click();@@ -212,13 +204,10 @@ test.describe("Out of office", () => {await user.apiLogin();await page.goto("/settings/my-account/out-of-office");- await page.waitForLoadState("domcontentloaded");- const addOOOButton = page.getByTestId("add_entry_ooo");- const dateButton = page.locator('[data-testid="date-range"]');- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await page.getByTestId("add_entry_ooo").click();- await dateButton.click();+ await page.locator('[data-testid="date-range"]').click();await selectToAndFromDates(page, "13", "22", true);@@ -255,13 +244,10 @@ test.describe("Out of office", () => {await user.apiLogin();await page.goto("/settings/my-account/out-of-office");- await page.waitForLoadState("domcontentloaded");- const addOOOButton = page.getByTestId("add_entry_ooo");- const dateButton = page.locator('[data-testid="date-range"]');- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await page.getByTestId("add_entry_ooo").click();- await dateButton.click();+ await page.locator('[data-testid="date-range"]').click();await selectToAndFromDates(page, "13", "22");@@ -270,8 +256,9 @@ test.describe("Out of office", () => {await expect(page.locator(`data-testid=table-redirect-n-a`)).toBeVisible();// add another entry- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");- await dateButton.click();+ await page.getByTestId("add_entry_ooo").click();++ await page.locator('[data-testid="date-range"]').click();await selectToAndFromDates(page, "11", "24");@@ -287,13 +274,10 @@ test.describe("Out of office", () => {await user.apiLogin();await page.goto("/settings/my-account/out-of-office");- await page.waitForLoadState("domcontentloaded");- const addOOOButton = page.getByTestId("add_entry_ooo");- const dateButton = page.locator('[data-testid="date-range"]');- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await page.getByTestId("add_entry_ooo").click();- await dateButton.click();+ await page.locator('[data-testid="date-range"]').click();await selectToAndFromDates(page, "13", "22");@@ -302,8 +286,9 @@ test.describe("Out of office", () => {await expect(page.locator(`data-testid=table-redirect-n-a`)).toBeVisible();// add another entry- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");- await dateButton.click();+ await page.getByTestId("add_entry_ooo").click();++ await page.locator('[data-testid="date-range"]').click();await selectToAndFromDates(page, "13", "22");@@ -323,13 +308,13 @@ test.describe("Out of office", () => {//Creates 2 OOO entries://First OOO is created on Next month 1st - 3rd- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await clickUntilDialogVisible(addOOOButton, dateButton);await dateButton.click();await selectDateAndCreateOOO(page, "1", "3");await expect(page.locator(`data-testid=table-redirect-n-a`).nth(0)).toBeVisible();//Second OOO is created on Next month 4th - 6th- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await clickUntilDialogVisible(addOOOButton, dateButton);await dateButton.click();await selectDateAndCreateOOO(page, "4", "6");await expect(page.locator(`data-testid=table-redirect-n-a`).nth(1)).toBeVisible();@@ -356,7 +341,7 @@ test.describe("Out of office", () => {const dateButton = await page.locator('[data-testid="date-range"]');//As owner,OOO is created on Next month 1st - 3rd, forwarding to 'member-1'- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await clickUntilDialogVisible(addOOOButton, dateButton);await dateButton.click();await selectDateAndCreateOOO(page, "1", "3", "member-1");await expect(@@ -367,7 +352,7 @@ test.describe("Out of office", () => {await member1User?.apiLogin();await page.goto("/settings/my-account/out-of-office");await page.waitForLoadState();- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await clickUntilDialogVisible(addOOOButton, dateButton);await dateButton.click();await selectDateAndCreateOOO(page, "4", "5", "owner");await expect(page.locator(`data-testid=table-redirect-${owner.username ?? "n-a"}`).nth(0)).toBeVisible();@@ -395,7 +380,7 @@ test.describe("Out of office", () => {const dateButton = await page.locator('[data-testid="date-range"]');//As owner,OOO is created on Next month 1st - 3rd, forwarding to 'member-1'- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await clickUntilDialogVisible(addOOOButton, dateButton);await dateButton.click();await selectDateAndCreateOOO(page, "1", "3", "member-1");await expect(@@ -406,7 +391,7 @@ test.describe("Out of office", () => {await member1User?.apiLogin();await page.goto("/settings/my-account/out-of-office");await page.waitForLoadState();- await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");+ await clickUntilDialogVisible(addOOOButton, dateButton);await dateButton.click();await selectDateAndCreateOOO(page, "2", "5", "owner", 400);await expect(page.locator(`text=${t("booking_redirect_infinite_not_allowed")}`)).toBeTruthy();