forked from calcom/cal.diy
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add E2E Playwright tests for booking flow #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
devin-ai-integration
wants to merge
1
commit into
main
Choose a base branch
from
devin/1782448632-booking-flow-e2e-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| }); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 atapps/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 whatbookFirstEventalready tests atapps/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 ofbooking-pages.e2e.tsor serve a distinct purpose.Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
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.tsto avoid the extra execution time, happy to refactor — leaving as-is for now since the overlap is partial and the intent is distinct.