Skip to content

Commit 1a1643e

Browse files
committed
WIP
Signed-off-by: zomars <zomars@me.com>
1 parent 325d5fa commit 1a1643e

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

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

+19-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ test.describe("Bookings", () => {
6363
});
6464
});
6565
test.describe("Past bookings", () => {
66-
test("Mark first guest as no-show", async ({ page, users, bookings }) => {
66+
test("Mark first guest as no-show", async ({ page, users, bookings, webhooks }) => {
6767
const firstUser = await users.create();
6868
const secondUser = await users.create();
6969

@@ -81,10 +81,9 @@ test.describe("Bookings", () => {
8181
],
8282
});
8383
const bookingWhereFirstUserIsOrganizer = await bookingWhereFirstUserIsOrganizerFixture.self();
84-
8584
await firstUser.apiLogin();
85+
const webhookReceiver = await webhooks.createReceiver();
8686
await page.goto(`/bookings/past`);
87-
await page.pause();
8887
const pastBookings = page.locator('[data-testid="past-bookings"]');
8988
const firstPastBooking = pastBookings.locator('[data-testid="booking-item"]').nth(0);
9089
const titleAndAttendees = firstPastBooking.locator('[data-testid="title-and-attendees"]');
@@ -96,6 +95,23 @@ test.describe("Bookings", () => {
9695
await firstGuest.click();
9796
await expect(titleAndAttendees.locator('[data-testid="unmark-no-show"]')).toBeVisible();
9897
await expect(titleAndAttendees.locator('[data-testid="mark-no-show"]')).toBeHidden();
98+
await webhookReceiver.waitForRequestCount(1);
99+
const [request] = webhookReceiver.requestList;
100+
const body = request.body;
101+
// remove dynamic properties that differs depending on where you run the tests
102+
const dynamic = "[redacted/dynamic]";
103+
// @ts-expect-error we are modifying the object
104+
body.createdAt = dynamic;
105+
expect(body).toMatchObject({
106+
triggerEvent: "BOOKING_NO_SHOW_UPDATED",
107+
createdAt: "[redacted/dynamic]",
108+
payload: {
109+
message: "x_marked_as_no_show",
110+
attendees: [{ email: "first@cal.com", noShow: true, utcOffset: null }],
111+
bookingUid: bookingWhereFirstUserIsOrganizer?.uid,
112+
},
113+
});
114+
webhookReceiver.close();
99115
});
100116
test("Mark 3rd attendee as no-show", async ({ page, users, bookings }) => {
101117
const firstUser = await users.create();

packages/trpc/server/routers/publicViewer/noShow.handler.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { WebhookService } from "@calcom/features/webhooks/lib/WebhookService";
2+
import getOrgIdFromMemberOrTeamId from "@calcom/lib/getOrgIdFromMemberOrTeamId";
23
import logger from "@calcom/lib/logger";
34
import { prisma } from "@calcom/prisma";
45
import { WebhookTriggerEvents } from "@calcom/prisma/client";

0 commit comments

Comments
 (0)