Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 127 additions & 0 deletions apps/web/playwright/booking-flow.e2e.ts

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Significant overlap with existing booking-pages.e2e.ts tests

Several tests in this new file closely duplicate scenarios already covered in apps/web/playwright/booking-pages.e2e.ts. For example, the "can book with additional guests" test (line 95-113) mirrors the existing "can book with multiple guests" test at apps/web/playwright/booking-pages.e2e.ts:340-363, and the "can complete the full booking flow end-to-end" test (line 63-75) effectively does what bookFirstEvent already tests at apps/web/playwright/booking-pages.e2e.ts:157-159. This isn't a bug, but it adds E2E execution time without clear incremental coverage. Worth clarifying whether this file is intended to replace sections of booking-pages.e2e.ts or serve a distinct purpose.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good observation. This file is intended as a self-contained, focused E2E suite specifically for the public booking flow (navigate → select slot → fill details → confirm). While there is some overlap with booking-pages.e2e.ts, that file covers a broader set of concerns (SSR/OG tags, special characters, prefill, layouts, reschedule, cancellation, slot reservation).

This file groups the core happy-path booking scenarios in one place for readability. If the team prefers consolidating into booking-pages.e2e.ts to avoid the extra execution time, happy to refactor — leaving as-is for now since the overlap is partial and the intent is distinct.

Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import { randomString } from "@calcom/lib/random";
import { expect } from "@playwright/test";

import { test } from "./lib/fixtures";
import {
bookTimeSlot,
confirmBooking,
selectFirstAvailableTimeSlotNextMonth,
testEmail,
testName,
} from "./lib/testUtils";

test.describe.configure({ mode: "parallel" });

test.afterEach(async ({ users }) => {
await users.deleteAll();
});

test.describe("Booking flow — public page navigation", () => {
test("can navigate to a public booking page and see event types", async ({ page, users }) => {
const user = await users.create({ name: "Booking Flow User" });
await page.goto(`/${user.username}`);

await expect(page.locator('[data-testid="event-types"]')).toBeVisible();
const eventTypeLinks = page.locator('[data-testid="event-type-link"]');
await expect(eventTypeLinks.first()).toBeVisible();
expect(await eventTypeLinks.count()).toBeGreaterThanOrEqual(1);
});

test("can select a time slot on a public booking page", async ({ page, users }) => {
const user = await users.create({ name: "Timeslot User" });
await page.goto(`/${user.username}`);

await page.click('[data-testid="event-type-link"]');
await selectFirstAvailableTimeSlotNextMonth(page);

await expect(page.locator('[name="name"]')).toBeVisible();
await expect(page.locator('[name="email"]')).toBeVisible();
});
});

test.describe("Booking flow — attendee details and confirmation", () => {
test("can fill attendee details and confirm a booking", async ({ page, users }) => {
const user = await users.create({ name: "Confirm Booking User" });
await page.goto(`/${user.username}`);

await page.click('[data-testid="event-type-link"]');
await selectFirstAvailableTimeSlotNextMonth(page);

const bookerEmail = `booker-${randomString(4)}@example.com`;
const bookerName = "E2E Test Booker";

await page.fill('[name="name"]', bookerName);
await page.fill('[name="email"]', bookerEmail);

await confirmBooking(page);

await expect(page.locator("[data-testid=success-page]")).toBeVisible();
await expect(page.locator(`[data-testid="attendee-name-${bookerName}"]`)).toHaveText(bookerName);
await expect(page.locator(`[data-testid="attendee-email-${bookerEmail}"]`)).toHaveText(bookerEmail);
});

test("can complete the full booking flow end-to-end", async ({ page, users }) => {
const user = await users.create({ name: "Full Flow User" });
await page.goto(`/${user.username}`);

await page.click('[data-testid="event-type-link"]');
await selectFirstAvailableTimeSlotNextMonth(page);

await bookTimeSlot(page);

await expect(page.locator("[data-testid=success-page]")).toBeVisible();
await expect(page.locator(`[data-testid="attendee-name-${testName}"]`)).toHaveText(testName);
await expect(page.locator(`[data-testid="attendee-email-${testEmail}"]`)).toHaveText(testEmail);
});
});

test.describe("Booking flow — additional options", () => {
test("can add notes to a booking", async ({ page, users }) => {
const user = await users.create({ name: "Notes Booking User" });
await page.goto(`/${user.username}`);

await page.click('[data-testid="event-type-link"]');
await selectFirstAvailableTimeSlotNextMonth(page);

await page.fill('[name="name"]', testName);
await page.fill('[name="email"]', testEmail);
await page.fill('[name="notes"]', "This is a test booking note");

await confirmBooking(page);

await expect(page.locator("[data-testid=success-page]")).toBeVisible();
});

test("can book with additional guests", async ({ page, users }) => {
const user = await users.create({ name: "Guest Booking User" });
await page.goto(`/${user.username}`);

const guestEmail = "guest@example.com";

await page.click('[data-testid="event-type-link"]');
await selectFirstAvailableTimeSlotNextMonth(page);

await page.fill('[name="name"]', testName);
await page.fill('[name="email"]', testEmail);
await page.locator('[data-testid="add-guests"]').click();
await page.locator('input[type="email"]').nth(1).fill(guestEmail);

await confirmBooking(page);

await expect(page.locator("[data-testid=success-page]")).toBeVisible();
await expect(page.locator(`[data-testid="attendee-email-${guestEmail}"]`)).toHaveText(guestEmail);
});

test("booking success page shows correct booking title", async ({ page, users }) => {
const user = await users.create({ name: "Title Check User" });
await page.goto(`/${user.username}`);

await page.click('[data-testid="event-type-link"]');
await selectFirstAvailableTimeSlotNextMonth(page);

await bookTimeSlot(page);

await expect(page.locator("[data-testid=success-page]")).toBeVisible();
await expect(page.locator("[data-testid=booking-title]")).toBeVisible();
});
});
Loading