Skip to content

Commit 0a29330

Browse files
authored
Revert "update OOO e2e tests to remove flakiness (#18367)" (#18411)
This reverts commit e6ef4e1.
1 parent e558daa commit 0a29330

File tree

2 files changed

+23
-49
lines changed

2 files changed

+23
-49
lines changed

apps/web/playwright/lib/testUtils.ts

+3-14
Original file line numberDiff line numberDiff line change
@@ -542,27 +542,16 @@ export async function expectPageToBeNotFound({ page, url }: { page: Page; url: s
542542
export async function clickUntilDialogVisible(
543543
dialogOpenButton: Locator,
544544
visibleLocatorOnDialog: Locator,
545-
page: Page,
546-
matchUrl: string,
547545
retries = 3,
548-
delay = 2000
546+
delay = 500
549547
) {
550548
for (let i = 0; i < retries; i++) {
549+
await dialogOpenButton.click();
551550
try {
552-
const responsePromise = page.waitForResponse(
553-
(response) => response.url().includes(matchUrl) && response.status() === 200
554-
);
555-
await dialogOpenButton.click();
556-
await responsePromise;
557551
await visibleLocatorOnDialog.waitFor({ state: "visible", timeout: delay });
558552
return;
559553
} catch {
560-
console.warn(`clickUntilDialogVisible: Attempt ${i + 1} failed to open dialog`);
561-
if (i === retries - 1) {
562-
console.log("clickUntilDialogVisible: Dialog did not appear after multiple attempts.");
563-
return;
564-
}
565-
await new Promise((resolve) => setTimeout(resolve, delay));
554+
if (i === retries - 1) throw new Error("Dialog did not appear after multiple attempts.");
566555
}
567556
}
568557
}

apps/web/playwright/out-of-office.e2e.ts

+20-35
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,8 @@ test.describe("Out of office", () => {
2121
await user.apiLogin();
2222

2323
await page.goto("/settings/my-account/out-of-office");
24-
await page.waitForLoadState("domcontentloaded");
25-
26-
const addOOOButton = page.getByTestId("add_entry_ooo");
27-
const dateButton = page.locator('[data-testid="date-range"]');
28-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
2924

25+
await page.getByTestId("add_entry_ooo").click();
3026
await page.getByTestId("reason_select").click();
3127

3228
await page.getByTestId("select-option-4").click();
@@ -72,12 +68,8 @@ test.describe("Out of office", () => {
7268
await user.apiLogin();
7369

7470
await page.goto(`/settings/my-account/out-of-office`);
75-
await page.waitForLoadState("domcontentloaded");
76-
77-
const addOOOButton = page.getByTestId("add_entry_ooo");
78-
const dateButton = page.locator('[data-testid="date-range"]');
79-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
8071

72+
await page.getByTestId("add_entry_ooo").click();
8173
await page.getByTestId("reason_select").click();
8274

8375
await page.getByTestId("select-option-4").click();
@@ -212,13 +204,10 @@ test.describe("Out of office", () => {
212204
await user.apiLogin();
213205

214206
await page.goto("/settings/my-account/out-of-office");
215-
await page.waitForLoadState("domcontentloaded");
216207

217-
const addOOOButton = page.getByTestId("add_entry_ooo");
218-
const dateButton = page.locator('[data-testid="date-range"]');
219-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
208+
await page.getByTestId("add_entry_ooo").click();
220209

221-
await dateButton.click();
210+
await page.locator('[data-testid="date-range"]').click();
222211

223212
await selectToAndFromDates(page, "13", "22", true);
224213

@@ -255,13 +244,10 @@ test.describe("Out of office", () => {
255244
await user.apiLogin();
256245

257246
await page.goto("/settings/my-account/out-of-office");
258-
await page.waitForLoadState("domcontentloaded");
259247

260-
const addOOOButton = page.getByTestId("add_entry_ooo");
261-
const dateButton = page.locator('[data-testid="date-range"]');
262-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
248+
await page.getByTestId("add_entry_ooo").click();
263249

264-
await dateButton.click();
250+
await page.locator('[data-testid="date-range"]').click();
265251

266252
await selectToAndFromDates(page, "13", "22");
267253

@@ -270,8 +256,9 @@ test.describe("Out of office", () => {
270256
await expect(page.locator(`data-testid=table-redirect-n-a`)).toBeVisible();
271257

272258
// add another entry
273-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
274-
await dateButton.click();
259+
await page.getByTestId("add_entry_ooo").click();
260+
261+
await page.locator('[data-testid="date-range"]').click();
275262

276263
await selectToAndFromDates(page, "11", "24");
277264

@@ -287,13 +274,10 @@ test.describe("Out of office", () => {
287274
await user.apiLogin();
288275

289276
await page.goto("/settings/my-account/out-of-office");
290-
await page.waitForLoadState("domcontentloaded");
291277

292-
const addOOOButton = page.getByTestId("add_entry_ooo");
293-
const dateButton = page.locator('[data-testid="date-range"]');
294-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
278+
await page.getByTestId("add_entry_ooo").click();
295279

296-
await dateButton.click();
280+
await page.locator('[data-testid="date-range"]').click();
297281

298282
await selectToAndFromDates(page, "13", "22");
299283

@@ -302,8 +286,9 @@ test.describe("Out of office", () => {
302286
await expect(page.locator(`data-testid=table-redirect-n-a`)).toBeVisible();
303287

304288
// add another entry
305-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
306-
await dateButton.click();
289+
await page.getByTestId("add_entry_ooo").click();
290+
291+
await page.locator('[data-testid="date-range"]').click();
307292

308293
await selectToAndFromDates(page, "13", "22");
309294

@@ -323,13 +308,13 @@ test.describe("Out of office", () => {
323308

324309
//Creates 2 OOO entries:
325310
//First OOO is created on Next month 1st - 3rd
326-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
311+
await clickUntilDialogVisible(addOOOButton, dateButton);
327312
await dateButton.click();
328313
await selectDateAndCreateOOO(page, "1", "3");
329314
await expect(page.locator(`data-testid=table-redirect-n-a`).nth(0)).toBeVisible();
330315

331316
//Second OOO is created on Next month 4th - 6th
332-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
317+
await clickUntilDialogVisible(addOOOButton, dateButton);
333318
await dateButton.click();
334319
await selectDateAndCreateOOO(page, "4", "6");
335320
await expect(page.locator(`data-testid=table-redirect-n-a`).nth(1)).toBeVisible();
@@ -356,7 +341,7 @@ test.describe("Out of office", () => {
356341
const dateButton = await page.locator('[data-testid="date-range"]');
357342

358343
//As owner,OOO is created on Next month 1st - 3rd, forwarding to 'member-1'
359-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
344+
await clickUntilDialogVisible(addOOOButton, dateButton);
360345
await dateButton.click();
361346
await selectDateAndCreateOOO(page, "1", "3", "member-1");
362347
await expect(
@@ -367,7 +352,7 @@ test.describe("Out of office", () => {
367352
await member1User?.apiLogin();
368353
await page.goto("/settings/my-account/out-of-office");
369354
await page.waitForLoadState();
370-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
355+
await clickUntilDialogVisible(addOOOButton, dateButton);
371356
await dateButton.click();
372357
await selectDateAndCreateOOO(page, "4", "5", "owner");
373358
await expect(page.locator(`data-testid=table-redirect-${owner.username ?? "n-a"}`).nth(0)).toBeVisible();
@@ -395,7 +380,7 @@ test.describe("Out of office", () => {
395380
const dateButton = await page.locator('[data-testid="date-range"]');
396381

397382
//As owner,OOO is created on Next month 1st - 3rd, forwarding to 'member-1'
398-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
383+
await clickUntilDialogVisible(addOOOButton, dateButton);
399384
await dateButton.click();
400385
await selectDateAndCreateOOO(page, "1", "3", "member-1");
401386
await expect(
@@ -406,7 +391,7 @@ test.describe("Out of office", () => {
406391
await member1User?.apiLogin();
407392
await page.goto("/settings/my-account/out-of-office");
408393
await page.waitForLoadState();
409-
await clickUntilDialogVisible(addOOOButton, dateButton, page, "outOfOfficeReasonList?batch=1");
394+
await clickUntilDialogVisible(addOOOButton, dateButton);
410395
await dateButton.click();
411396
await selectDateAndCreateOOO(page, "2", "5", "owner", 400);
412397
await expect(page.locator(`text=${t("booking_redirect_infinite_not_allowed")}`)).toBeTruthy();

0 commit comments

Comments
 (0)