Skip to content

Scheduling infrastructure for absolutely everyone.

test: add multiple guests e2e test (#7774)

Nafees Nazike001c0b88f23
diff --git a/apps/web/pages/booking/[uid].tsx b/apps/web/pages/booking/[uid].tsx
index dd938a69071..18d002d1ba3 100644
--- a/apps/web/pages/booking/[uid].tsx
+++ b/apps/web/pages/booking/[uid].tsx
@@ -529,7 +529,9 @@ export default function Success(props: SuccessProps) {
{bookingInfo?.attendees.map((attendee) => (
<div key={attendee.name} className="mb-3 last:mb-0">
{attendee.name && <p>{attendee.name}</p>}
- <p className="text-bookinglight">{attendee.email}</p>
+ <p data-testid={`attendee-${attendee.email}`} className="text-bookinglight">
+ {attendee.email}
+ </p>
</div>
))}
</div>
diff --git a/apps/web/playwright/booking-pages.e2e.ts b/apps/web/playwright/booking-pages.e2e.ts
index ad219652037..7a956a3871f 100644
--- a/apps/web/playwright/booking-pages.e2e.ts
+++ b/apps/web/playwright/booking-pages.e2e.ts
@@ -132,4 +132,26 @@ test.describe("pro user", () => {
// This is the only booking in there that needed confirmation and now it should be empty screen
await expect(page.locator('[data-testid="empty-screen"]')).toBeVisible();
});
+
+ test("can book with multiple guests", async ({ page, users }) => {
+ const additionalGuests = ["[email protected]", "[email protected]"];
+
+ await page.click('[data-testid="event-type-link"]');
+ await selectFirstAvailableTimeSlotNextMonth(page);
+ await page.fill('[name="name"]', "test1234");
+ await page.fill('[name="email"]', "[email protected]");
+ await page.locator('[data-testid="add-guests"]').click();
+
+ await page.locator('input[type="email"]').nth(1).fill(additionalGuests[0]);
+ await page.locator('[data-testid="add-another-guest"]').click();
+ await page.locator('input[type="email"]').nth(2).fill(additionalGuests[1]);
+
+ await page.locator('[data-testid="confirm-book-button"]').click();
+
+ await expect(page.locator("[data-testid=success-page]")).toBeVisible();
+
+ additionalGuests.forEach(async (email) => {
+ await expect(page.locator(`[data-testid="attendee-${email}"]`)).toHaveText(email);
+ });
+ });
});
diff --git a/packages/features/form-builder/Components.tsx b/packages/features/form-builder/Components.tsx
index 42871e038ce..4acbd2f7580 100644
--- a/packages/features/form-builder/Components.tsx
+++ b/packages/features/form-builder/Components.tsx
@@ -172,6 +172,7 @@ export const Components: Record<BookingFieldType, Component> = {
</ul>
{!readOnly && (
<Button
+ data-testid="add-another-guest"
type="button"
color="minimal"
StartIcon={FiUserPlus}
@@ -190,6 +191,7 @@ export const Components: Record<BookingFieldType, Component> = {
{!value.length && !readOnly && (
<Button
+ data-testid="add-guests"
color="minimal"
variant="button"
StartIcon={FiUserPlus}