Skip to content

Scheduling infrastructure for absolutely everyone.

fix: stabilize flaky E2E booking sheet tests by waiting for button visibility (#28631)

Romit31f40764da37
diff --git a/apps/web/playwright/booking-sheet-keyboard.e2e.ts b/apps/web/playwright/booking-sheet-keyboard.e2e.ts
index 91a849903ac..617efdbfcec 100644
--- a/apps/web/playwright/booking-sheet-keyboard.e2e.ts
+++ b/apps/web/playwright/booking-sheet-keyboard.e2e.ts
@@ -100,7 +100,9 @@ async function setupBookingsAndOpenSheet({
const firstBookingItem = page.locator(`[data-booking-uid="${fixtures[0].uid}"]`);
await expect(firstBookingItem).toBeVisible();
- await firstBookingItem.locator('[role="button"]').first().click();
+ const firstButton = firstBookingItem.locator('[role="button"]').first();
+ await firstButton.waitFor({ state: "visible" });
+ await firstButton.click();
const sheet = page.locator('[role="dialog"]');
await expect(sheet).toBeVisible();
diff --git a/apps/web/playwright/bookings-list.e2e.ts b/apps/web/playwright/bookings-list.e2e.ts
index 41a3c1f2032..30251fdf7bd 100644
--- a/apps/web/playwright/bookings-list.e2e.ts
+++ b/apps/web/playwright/bookings-list.e2e.ts
@@ -798,8 +798,9 @@ test.describe("Bookings", () => {
const bookingItem = page.locator(`[data-booking-uid="${bookingFixture.uid}"]`);
await expect(bookingItem).toBeVisible();
-
- await bookingItem.locator('[role="button"]').first().click();
+ const bookingButton = bookingItem.locator('[role="button"]').first();
+ await bookingButton.waitFor({ state: "visible" });
+ await bookingButton.click();
await expect(page).toHaveURL(new RegExp(`[?&]uid=${bookingFixture.uid}(&|$)`));
} finally {