From 24be8a63f2266b5c9a5668afbc9be35f6d5413b6 Mon Sep 17 00:00:00 2001 From: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Date: Sat, 4 Feb 2023 03:33:35 +0530 Subject: [PATCH] fix: filter booking in upcoming (#6406) * fix: filter booking in upcoming Signed-off-by: Udit Takkar * fix: test Signed-off-by: Udit Takkar * fix: wipe-my-cal failing test Signed-off-by: Udit Takkar --------- Signed-off-by: Udit Takkar Co-authored-by: Peer Richelsen Co-authored-by: Peer Richelsen --- apps/web/pages/bookings/[status].tsx | 5 +++-- apps/web/playwright/wipe-my-cal.e2e.ts | 15 ++++----------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/apps/web/pages/bookings/[status].tsx b/apps/web/pages/bookings/[status].tsx index 8e7e74e8c1..a2faa08121 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() {

{t("today")}

- + {bookingsToday.map((booking: BookingOutput) => ( )}
- {/*

{t("all")}

*/}
diff --git a/apps/web/playwright/wipe-my-cal.e2e.ts b/apps/web/playwright/wipe-my-cal.e2e.ts index cc417cf258..da7e6ad0bd 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((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(); });