fix: Disable cancel button for past bookings (#22667)

* fix: Remove cancel button for past bookings

* fix types and few improvements

* add proper tests for backend changes

* chore

* Update [bookingUid].tsx

* Update bookings-single-view.tsx

* remove comment

* Update tests

---------

Co-authored-by: Kartik Saini <[email protected]>
Co-authored-by: Anik Dhabal Babu <[email protected]>
This commit is contained in:
authored and GitHub committed 2025-09-03 12:59:07 +00:00
1 parent 216fb2141b
commit a6101b3da9
6 files changed
+135 -3

No files matched your search

+28
View File
@@ -766,3 +766,31 @@ test.describe("GTM container", () => {
expect(scriptContent).toContain("googletagmanager");
});
});
test.describe("Past booking cancellation", () => {
test("Cancel button should be hidden for past bookings", async ({ page, users, bookings }) => {
const user = await users.create({
name: "Test User",
});
await user.apiLogin();
const pastDate = new Date();
pastDate.setDate(pastDate.getDate() - 1);
const endDate = new Date(pastDate.getTime() + 30 * 60 * 1000);
const booking = await bookings.create(user.id, user.username, user.eventTypes[0].id, {
title: "Past Meeting",
startTime: pastDate,
endTime: endDate,
status: "ACCEPTED",
});
await page.goto("/bookings/past");
await page.locator('[data-testid="booking-actions-dropdown"]').nth(0).click();
await expect(page.locator('[data-testid="cancel"]')).toBeDisabled();
await page.goto(`/booking/${booking.uid}`);
await expect(page.locator('[data-testid="cancel"]')).toBeHidden();
});
});