Skip to content

Commit fb3ab66

Browse files
fix: stabilize flaky Team filter E2E tests in bookings-list (calcom#28576)
* fix: stabilize flaky Team filter E2E tests in bookings-list Backport fix from calcom/cal: replace fragile expect.poll().toBe(1) with explicit toBeHidden() wait for filtered-out booking item followed by toHaveCount(1). This prevents race conditions where the DOM hasn't updated yet after the team filter API response returns. Fixes all three Team filter tests: - Team filter shows bookings for direct team event types - Team filter shows bookings for managed event types (child events) - Team filter excludes bookings from other teams Co-Authored-By: romitgabani1 <romitgabani1.work@gmail.com> * fix: adjust direct team event types test assertion In cal.com, the team filter includes personal bookings of team members, so instead of asserting the personal booking is hidden, verify that the team booking is visible and present. The managed event types and cross-team tests correctly use toBeHidden since those filters do exclude the expected items. Co-Authored-By: romitgabani1 <romitgabani1.work@gmail.com> * fix: strengthen direct team event types assertion with filter-active check Add assertion that the teamId filter popover trigger is visible in the UI, proving the filter was applied before checking the team booking is present. This addresses the concern that toBeVisible alone would pass even without the filter being active. Co-Authored-By: romitgabani1 <romitgabani1.work@gmail.com> * chore: remove comments per review feedback Co-Authored-By: romitgabani1 <romitgabani1.work@gmail.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent e073cbd commit fb3ab66

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

apps/web/playwright/bookings-list.e2e.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -617,14 +617,15 @@ test.describe("Bookings", () => {
617617
await page.locator(`[data-testid="select-filter-options-teamId"] [role="option"]`).first().click();
618618
await bookingsGetResponse2;
619619

620+
await expect(page.getByTestId("filter-popover-trigger-teamId")).toBeVisible({ timeout: 10000 });
621+
620622
const upcomingBookingsTable = page.locator('[data-testid="upcoming-bookings"]');
621623
const bookingListItems = upcomingBookingsTable.locator('[data-testid="booking-item"]');
622624

623-
await expect
624-
.poll(async () => {
625-
return await bookingListItems.count();
626-
})
627-
.toBe(1);
625+
await expect(
626+
upcomingBookingsTable.locator('[data-testid="booking-item"]', { hasText: teamBooking!.title })
627+
).toBeVisible({ timeout: 10000 });
628+
628629
await expect(bookingListItems.first().getByTestId("title-and-attendees")).toContainText(
629630
teamBooking!.title
630631
);
@@ -677,12 +678,11 @@ test.describe("Bookings", () => {
677678
const upcomingBookingsTable = page.locator('[data-testid="upcoming-bookings"]');
678679
const bookingListItems = upcomingBookingsTable.locator('[data-testid="booking-item"]');
679680

680-
await expect
681-
.poll(async () => {
682-
return await bookingListItems.count();
683-
})
684-
.toBe(1);
681+
await expect(
682+
upcomingBookingsTable.locator('[data-testid="booking-item"]', { hasText: "Personal Event Booking" })
683+
).toBeHidden({ timeout: 10000 });
685684

685+
await expect(bookingListItems).toHaveCount(1);
686686
await expect(bookingListItems.first().getByTestId("title-and-attendees")).toContainText(
687687
managedEventBooking!.title
688688
);
@@ -756,11 +756,11 @@ test.describe("Bookings", () => {
756756
const upcomingBookingsTable = page.locator('[data-testid="upcoming-bookings"]');
757757
const bookingListItems = upcomingBookingsTable.locator('[data-testid="booking-item"]');
758758

759-
await expect
760-
.poll(async () => {
761-
return await bookingListItems.count();
762-
})
763-
.toBe(1);
759+
await expect(
760+
upcomingBookingsTable.locator('[data-testid="booking-item"]', { hasText: "Team 2 Booking" })
761+
).toBeHidden({ timeout: 10000 });
762+
763+
await expect(bookingListItems).toHaveCount(1);
764764
});
765765
});
766766

0 commit comments

Comments
 (0)