Skip to content

Commit 8231356

Browse files
authored
test: E2E test to verify event multiple duration works correctly (calcom#23144)
* fix: multiple booking duration isn't working * followup test
1 parent 469a942 commit 8231356

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

apps/web/playwright/dynamic-booking-pages.e2e.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { test } from "./lib/fixtures";
66
import {
77
bookTimeSlot,
88
confirmReschedule,
9+
confirmBooking,
910
doOnOrgDomain,
1011
selectFirstAvailableTimeSlotNextMonth,
1112
selectSecondAvailableTimeSlotNextMonth,
@@ -98,6 +99,58 @@ test("dynamic booking info prefilled by query params", async ({ page, users }) =
9899
activeState = await listItemLocator.getAttribute("data-active");
99100
expect(activeState).toEqual("false");
100101
});
102+
103+
test("multiple duration selection updates event length correctly", async ({ page, users }) => {
104+
const user = await users.create();
105+
await user.apiLogin();
106+
107+
await test.step("update event title to include duration placeholder", async () => {
108+
await page.goto("/event-types");
109+
await page.waitForSelector('[data-testid="event-types"]');
110+
await page.click(`text=Multiple duration`);
111+
await page.waitForSelector('[data-testid="event-title"]');
112+
await expect(page.getByTestId("vertical-tab-event_setup_tab_title")).toHaveAttribute(
113+
"aria-current",
114+
"page"
115+
);
116+
await page.getByTestId("vertical-tab-event_advanced_tab_title").click();
117+
await page.fill('[name="eventName"]', "{Event duration} event btwn {Organiser} {Scheduler}");
118+
await page.locator('[data-testid="update-eventtype"]').click();
119+
await page.waitForResponse("/api/trpc/eventTypes/update?batch=1");
120+
});
121+
122+
await page.goto(`/${user.username}/multiple-duration`);
123+
124+
await page.locator('[data-testid="multiple-choice-30mins"]').waitFor({ state: "visible" });
125+
126+
await test.step("verify default 30min duration is selected", async () => {
127+
const duration30 = page.getByTestId("multiple-choice-30mins");
128+
const activeState = await duration30.getAttribute("data-active");
129+
expect(activeState).toEqual("true");
130+
});
131+
132+
await test.step("book with 90min duration and verify title", async () => {
133+
await page.getByTestId("multiple-choice-90mins").click();
134+
135+
const duration90 = page.getByTestId("multiple-choice-90mins");
136+
const activeState = await duration90.getAttribute("data-active");
137+
expect(activeState).toEqual("true");
138+
139+
await selectFirstAvailableTimeSlotNextMonth(page);
140+
141+
await page.fill('[name="name"]', "Test User");
142+
await page.fill('[name="email"]', "test@example.com");
143+
await confirmBooking(page);
144+
145+
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
146+
147+
const bookingTitle = page.locator('[data-testid="booking-title"]');
148+
await expect(bookingTitle).toBeVisible();
149+
const titleText = await bookingTitle.textContent();
150+
expect(titleText).toContain("90");
151+
});
152+
});
153+
101154
// eslint-disable-next-line playwright/no-skipped-test
102155
test.skip("it contains the right event details", async ({ page }) => {
103156
const response = await page.goto(`http://acme.cal.local:3000/owner1+member1`);

0 commit comments

Comments
 (0)