fix: resolve flaky API v2 slots-2024-04-15 E2E tests (#28589)

- Add await to unawaited bookingSeatsRepositoryFixture.create calls
- Clean up leftover selected slots before seated event tests

The flakiness was caused by two issues:
1. Missing await on bookingSeatsRepositoryFixture.create() - the HTTP
   request to fetch slots could execute before the booking seat record
   was written to the database, leading to incorrect seat counts.
2. Leftover SelectedSlots records leaking between test groups - the
   availability calculation fetches all unexpired reserved slots by
   userId (not eventTypeId), so reserved slots from earlier tests
   appeared as busy times when computing slots for seated event types.

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Romit
2026-03-28 14:52:01 +05:30
committed by GitHub
co-authored by Devin AI
parent d6852783b4
commit d80493f201
@@ -513,6 +513,8 @@ describe("Slots 2024-04-15 Endpoints", () => {
});
it("should do a booking for seated event and slot should show attendees count and bookingUid", async () => {
await selectedSlotRepositoryFixture.deleteAllByUserId(user.id);
const startTime = "2050-09-05T11:00:00.000Z";
const booking = await bookingsRepositoryFixture.create({
uid: `booking-uid-seated-${seatedEventTypeId}-${randomString()}`,
@@ -548,7 +550,7 @@ describe("Slots 2024-04-15 Endpoints", () => {
},
});
bookingSeatsRepositoryFixture.create({
await bookingSeatsRepositoryFixture.create({
referenceUid: `seat-${randomString()}`,
data: {},
booking: {
@@ -596,6 +598,8 @@ describe("Slots 2024-04-15 Endpoints", () => {
});
it("should do a booking for seated event and slot should show attendees count and bookingUid in range format", async () => {
await selectedSlotRepositoryFixture.deleteAllByUserId(user.id);
const startTime = "2050-09-05T11:00:00.000Z";
const booking = await bookingsRepositoryFixture.create({
uid: `booking-uid-seated-${seatedEventTypeId}-${randomString()}`,
@@ -631,7 +635,7 @@ describe("Slots 2024-04-15 Endpoints", () => {
},
});
bookingSeatsRepositoryFixture.create({
await bookingSeatsRepositoryFixture.create({
referenceUid: `seat-${randomString()}`,
data: {},
booking: {