Skip to content

Scheduling infrastructure for absolutely everyone.

fix: filter booking in upcoming (#6406)

Udit Takkar24be8a63f226
diff --git a/apps/web/pages/bookings/[status].tsx b/apps/web/pages/bookings/[status].tsx
index 8e7e74e8c18..a2faa081215 100644
--- a/apps/web/pages/bookings/[status].tsx
+++ b/apps/web/pages/bookings/[status].tsx
@@ -88,6 +88,8 @@ export default function Bookings() {
return false;
}
shownBookings[booking.recurringEventId] = [booking];
+ } else if (status === "upcoming") {
+ return new Date(booking.startTime).toDateString() !== new Date().toDateString();
}
return true;
};
@@ -121,7 +123,7 @@ export default function Bookings() {
<p className="mb-2 text-xs font-medium uppercase leading-4 text-gray-500">{t("today")}</p>
<div className="overflow-hidden rounded-md border border-gray-200">
<table className="w-full max-w-full table-fixed">
- <tbody className="divide-y divide-gray-200 bg-white">
+ <tbody className="divide-y divide-gray-200 bg-white" data-testid="today-bookings">
<Fragment>
{bookingsToday.map((booking: BookingOutput) => (
<BookingListItem
@@ -138,7 +140,6 @@ export default function Bookings() {
</div>
)}
<div className="pt-2 xl:pt-0">
- {/* <p className="mb-2 text-xs font-medium uppercase leading-4 text-gray-500">{t("all")}</p> */}
<div className="overflow-hidden rounded-md border border-gray-200">
<table className="w-full max-w-full table-fixed">
<tbody className="divide-y divide-gray-200 bg-white" data-testid="bookings">
diff --git a/apps/web/playwright/wipe-my-cal.e2e.ts b/apps/web/playwright/wipe-my-cal.e2e.ts
index cc417cf258d..da7e6ad0bdf 100644
--- a/apps/web/playwright/wipe-my-cal.e2e.ts
+++ b/apps/web/playwright/wipe-my-cal.e2e.ts
@@ -38,22 +38,15 @@ test.describe("Wipe my Cal App Test", () => {
await expect(page.locator("data-testid=wipe-today-button")).toBeVisible();
const $openBookingCount = await page.locator('[data-testid="bookings"] > *').count();
- expect($openBookingCount).toBe(3);
+ const $todayBookingCount = await page.locator('[data-testid="today-bookings"] > *').count();
+ expect($openBookingCount + $todayBookingCount).toBe(3);
await page.locator("data-testid=wipe-today-button").click();
// Don't await send_request click, otherwise mutation can possibly occur before observer is attached
page.locator("data-testid=send_request").click();
- const $openBookings = page.locator('[data-testid="bookings"]');
- await $openBookings.evaluate((ul) => {
- return new Promise<void>((resolve) =>
- new window.MutationObserver(() => {
- if (ul.childElementCount === 2) {
- resolve();
- }
- }).observe(ul, { childList: true })
- );
- });
+ // There will not be any today-bookings
+ await expect(page.locator('[data-testid="today-bookings"]')).toBeHidden();
await users.deleteAll();
});