From 14e14289f08f3d96fb56c8e082e7fed1e8bafe71 Mon Sep 17 00:00:00 2001 From: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Date: Fri, 11 Jul 2025 21:15:06 +0530 Subject: [PATCH] fix: e2e tests flakes (#22415) * fix: e2e flakes * Update apps/web/playwright/dynamic-booking-pages.e2e.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * Update delete-account.e2e.ts --------- Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> --- apps/web/playwright/app-list-card.e2e.ts | 4 ++++ apps/web/playwright/app-router-not-found.e2e.ts | 4 ++++ apps/web/playwright/auth/auth-index.e2e.ts | 2 ++ apps/web/playwright/auth/forgot-password.e2e.ts | 2 ++ apps/web/playwright/bookings-list.e2e.ts | 5 ++++- apps/web/playwright/dynamic-booking-pages.e2e.ts | 2 ++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/web/playwright/app-list-card.e2e.ts b/apps/web/playwright/app-list-card.e2e.ts index 780bf759af..802fb9edb4 100644 --- a/apps/web/playwright/app-list-card.e2e.ts +++ b/apps/web/playwright/app-list-card.e2e.ts @@ -1,5 +1,9 @@ import { test } from "./lib/fixtures"; +test.describe.configure({ mode: "parallel" }); + +test.afterEach(({ users }) => users.deleteAll()); + test.describe("AppListCard", async () => { test("should remove the highlight from the URL", async ({ page, users }) => { const user = await users.create({}); diff --git a/apps/web/playwright/app-router-not-found.e2e.ts b/apps/web/playwright/app-router-not-found.e2e.ts index c886b05352..315aae9297 100644 --- a/apps/web/playwright/app-router-not-found.e2e.ts +++ b/apps/web/playwright/app-router-not-found.e2e.ts @@ -2,6 +2,10 @@ import { expectPageToBeNotFound } from "playwright/lib/testUtils"; import { test } from "./lib/fixtures"; +test.describe.configure({ mode: "parallel" }); + +test.afterEach(({ users }) => users.deleteAll()); + test.describe("App Router - error handling", () => { test("404s must render App Router's not-found page regardless of whether pages router or app router is used", async ({ page, diff --git a/apps/web/playwright/auth/auth-index.e2e.ts b/apps/web/playwright/auth/auth-index.e2e.ts index dbb8beec8b..e9476d33bc 100644 --- a/apps/web/playwright/auth/auth-index.e2e.ts +++ b/apps/web/playwright/auth/auth-index.e2e.ts @@ -3,6 +3,8 @@ import { expect } from "@playwright/test"; import { test } from "../lib/fixtures"; import { submitAndWaitForResponse } from "../lib/testUtils"; +test.describe.configure({ mode: "parallel" }); + test.describe("Can signup from a team invite", async () => { test.beforeEach(async ({ users }) => { const proUser = await users.create(); diff --git a/apps/web/playwright/auth/forgot-password.e2e.ts b/apps/web/playwright/auth/forgot-password.e2e.ts index 04bc65e011..33a775ad57 100644 --- a/apps/web/playwright/auth/forgot-password.e2e.ts +++ b/apps/web/playwright/auth/forgot-password.e2e.ts @@ -6,6 +6,8 @@ import prisma from "@calcom/prisma"; import { test } from "../lib/fixtures"; +test.describe.configure({ mode: "parallel" }); + test.afterEach(({ users }) => users.deleteAll()); test.describe("Forgot password", async () => { diff --git a/apps/web/playwright/bookings-list.e2e.ts b/apps/web/playwright/bookings-list.e2e.ts index 5fe00b7b66..dfad39877d 100644 --- a/apps/web/playwright/bookings-list.e2e.ts +++ b/apps/web/playwright/bookings-list.e2e.ts @@ -461,10 +461,13 @@ test.describe("Bookings", () => { await addFilter(page, "userId"); await openFilter(page, "userId"); + const bookingsGetResponse2 = page.waitForResponse((response) => + /\/api\/trpc\/bookings\/get.*/.test(response.url()) + ); await page .locator(`[data-testid="select-filter-options-userId"] [role="option"]:has-text("${anotherUser}")`) .click(); - await page.waitForResponse((response) => /\/api\/trpc\/bookings\/get.*/.test(response.url())); + await bookingsGetResponse2; await expect(page.locator('[data-testid="booking-item"]')).toHaveCount(0); }); diff --git a/apps/web/playwright/dynamic-booking-pages.e2e.ts b/apps/web/playwright/dynamic-booking-pages.e2e.ts index d67df43f6a..059bdacba1 100644 --- a/apps/web/playwright/dynamic-booking-pages.e2e.ts +++ b/apps/web/playwright/dynamic-booking-pages.e2e.ts @@ -19,6 +19,8 @@ test("dynamic booking", async ({ page, users }) => { const free = await users.create({ username: "free.example" }); await page.goto(`/${pro.username}+${free.username}`); + //fix race condition + await page.locator('[data-testid="day"][data-disabled="false"]').nth(0).waitFor({ state: "visible" }); await test.step("book an event first day in next month", async () => { await selectFirstAvailableTimeSlotNextMonth(page);