From 2d75048037188177da05a3d0b72a77ce6e10c9d0 Mon Sep 17 00:00:00 2001 From: Alex van Andel Date: Wed, 28 Feb 2024 06:07:32 +0000 Subject: [PATCH] fix: Test flakiness due to unfilled name/email (#13900) * fix: Test flakiness due to unfilled name/email * Better toast-success checks * Revert "test: Create E2E tests for bookings with custom/required Phone + other questions (#11502)" This reverts commit 614741d207e99772d249db39f536c62473f1062c. * Revert "test: Create E2E tests for bookings with custom/required Multiple Emails + other questions (teste2e-multipleEmailQuestion) (#11565)" This reverts commit d1d50b0d9131e650eab2a88396e130dfb2067da4. * Revert "test: Create E2E tests for bookings with custom/required Long Text + other questions (teste2e-longTextQuestion) (#11559)" This reverts commit 96810b5ba12a11ceb6ebb695dc1fd07e461a96dd. * Revert "test: Check the webhook event tab and your funtionalities (#12433)" This reverts commit 9db9204088ed3630833c40351c2d50c0c7e808ee. * Re-instate regularBookings * Fixtures used by other tests * Removed dead code from regularBookings.ts --------- Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> --- .../web/pages/settings/my-account/profile.tsx | 6 +- .../addressQuestione2e/addressQuestion.e2e.ts | 483 ------ .../playwright/booking/allQuestions.e2e.ts | 110 -- .../booking/checkboxGroupQuestion.e2e.ts | 445 ------ .../collectiveEventType.e2e.ts | 54 - .../booking/longTextQuestion.e2e.ts | 483 ------ .../booking/multipleEmailQuestion.e2e.ts | 553 ------- .../playwright/booking/phoneQuestion.e2e.ts | 446 ------ .../booking/radioGroupQuestion.e2e.ts | 444 ------ .../booking/recurringBooking.e2e.ts | 28 - .../booking/responsiveBooking.e2e.ts | 107 -- .../playwright/booking/selectQuestion.e2e.ts | 441 ------ .../playwright/fixtures/regularBookings.ts | 534 ------- apps/web/playwright/profile.e2e.ts | 18 +- apps/web/playwright/webhook.e2e.ts | 1359 +++++++---------- .../weeklyview/components/event/EventList.tsx | 2 +- packages/ui/components/avatar/UserAvatar.tsx | 2 +- 17 files changed, 573 insertions(+), 4942 deletions(-) delete mode 100644 apps/web/playwright/booking/addressQuestione2e/addressQuestion.e2e.ts delete mode 100644 apps/web/playwright/booking/allQuestions.e2e.ts delete mode 100644 apps/web/playwright/booking/checkboxGroupQuestion.e2e.ts delete mode 100644 apps/web/playwright/booking/collectiveEventType/collectiveEventType.e2e.ts delete mode 100644 apps/web/playwright/booking/longTextQuestion.e2e.ts delete mode 100644 apps/web/playwright/booking/multipleEmailQuestion.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestion.e2e.ts delete mode 100644 apps/web/playwright/booking/radioGroupQuestion.e2e.ts delete mode 100644 apps/web/playwright/booking/recurringBooking.e2e.ts delete mode 100644 apps/web/playwright/booking/responsiveBooking.e2e.ts delete mode 100644 apps/web/playwright/booking/selectQuestion.e2e.ts diff --git a/apps/web/pages/settings/my-account/profile.tsx b/apps/web/pages/settings/my-account/profile.tsx index 0a95da3305..a6a3cedb13 100644 --- a/apps/web/pages/settings/my-account/profile.tsx +++ b/apps/web/pages/settings/my-account/profile.tsx @@ -374,7 +374,7 @@ const ProfileView = () => { diff --git a/apps/web/playwright/booking/addressQuestione2e/addressQuestion.e2e.ts b/apps/web/playwright/booking/addressQuestione2e/addressQuestion.e2e.ts deleted file mode 100644 index 74db741184..0000000000 --- a/apps/web/playwright/booking/addressQuestione2e/addressQuestion.e2e.ts +++ /dev/null @@ -1,483 +0,0 @@ -import { loginUser } from "../../fixtures/regularBookings"; -import { test } from "../../lib/fixtures"; - -test.describe("Booking With Address Question and Each Other Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - - test.beforeEach(async ({ page, users }) => { - await loginUser(users); - await page.goto("/event-types"); - }); - - test.describe("Booking With Address Question and Checkbox Group Question", () => { - test("Address required and checkbox group required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Checkbox Group question (both required)", - secondQuestion: "checkbox", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Address and checkbox group not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Checkbox Group question (only address required)", - secondQuestion: "checkbox", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Address Question and Checkbox Question", () => { - test("Address required and checkbox required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Checkbox question (both required)", - secondQuestion: "boolean", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Addres and checkbox not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Checkbox question (only address required)", - secondQuestion: "boolean", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Address Question and Long text Question", () => { - test("Addres required and Long Text required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Long Text question (both required)", - secondQuestion: "textarea", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Address and Long Text not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", false, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Long Text question (only address required)", - secondQuestion: "textarea", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Address Question and Multi email Question", () => { - test("Address required and Multi email required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Multiemail question (both required)", - secondQuestion: "multiemail", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Address and Multi email not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - false, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Multiemail question (only address required)", - secondQuestion: "multiemail", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Address Question and multiselect Question", () => { - test("Address required and multiselect text required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Multi Select question (both required)", - secondQuestion: "multiselect", - options: { ...bookingOptions, isMultiSelect: true }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Address and multiselect text not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Multi Select question (only address required)", - secondQuestion: "multiselect", - options: { ...bookingOptions, isMultiSelect: true, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Address Question and Number Question", () => { - test("Address required and Number required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("number", "number-test", "number test", true, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Number question (both required)", - secondQuestion: "number", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Address and Number not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("number", "number-test", "number test", false, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Number question (only address required)", - secondQuestion: "number", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Address Question and Phone Question", () => { - test("Address required and Phone required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone-test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Multi Select question (both required)", - secondQuestion: "phone", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Address and Phone not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("phone", "phone-test", "phone test", false, "phone-test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Multi Select question (only address required)", - secondQuestion: "phone", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Address Question and Radio group Question", () => { - test("Address required and Radio group required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Radio question (both required)", - secondQuestion: "radio", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Address and Radio group not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("radio", "radio-test", "radio test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Radio question (only address required)", - secondQuestion: "radio", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Address Question and select Question", () => { - test("Address required and select required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Select question (both required)", - secondQuestion: "select", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Address and select not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("select", "select-test", "select test", false, "select test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Select question (both required)", - secondQuestion: "select", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Address Question and Short text question", () => { - test("Address required and Short text required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("text", "text-test", "text test", true, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Multi Select question (both required)", - secondQuestion: "text", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Address and Short text not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.addQuestion("text", "text-test", "text test", false, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "address", - fillText: "Test Address question and Multi Select question (only address required)", - secondQuestion: "text", - options: { ...bookingOptions, isRequired: true }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); -}); diff --git a/apps/web/playwright/booking/allQuestions.e2e.ts b/apps/web/playwright/booking/allQuestions.e2e.ts deleted file mode 100644 index f5a0959302..0000000000 --- a/apps/web/playwright/booking/allQuestions.e2e.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* eslint-disable playwright/no-conditional-in-test */ -import { loginUser } from "../fixtures/regularBookings"; -import { test } from "../lib/fixtures"; - -test.describe("Booking With All Questions", () => { - test.beforeEach(async ({ page, users, bookingPage }) => { - await loginUser(users); - await page.goto("/event-types"); - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - }); - - const bookingOptions = { isAllRequired: true }; - - test("Selecting and filling all questions as required", async ({ bookingPage }) => { - const allQuestions = [ - "phone", - "address", - "checkbox", - "boolean", - "textarea", - "multiemail", - "multiselect", - "number", - "radio", - "select", - "text", - ]; - for (const question of allQuestions) { - if ( - question !== "number" && - question !== "select" && - question !== "checkbox" && - question !== "boolean" && - question !== "multiselect" && - question !== "radio" - ) { - await bookingPage.addQuestion( - question, - `${question}-test`, - `${question} test`, - true, - `${question} test` - ); - } else { - await bookingPage.addQuestion(question, `${question}-test`, `${question} test`, true); - } - await bookingPage.checkField(question); - } - - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAllQuestions(eventTypePage, allQuestions, bookingOptions); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Selecting and filling all questions as optional", async ({ bookingPage }) => { - const allQuestions = [ - "phone", - "address", - "checkbox", - "boolean", - "textarea", - "multiemail", - "multiselect", - "number", - "radio", - "select", - "text", - ]; - for (const question of allQuestions) { - if ( - question !== "number" && - question !== "select" && - question !== "checkbox" && - question !== "boolean" && - question !== "multiselect" && - question !== "radio" - ) { - await bookingPage.addQuestion( - question, - `${question}-test`, - `${question} test`, - false, - `${question} test` - ); - } else { - await bookingPage.addQuestion(question, `${question}-test`, `${question} test`, false); - } - await bookingPage.checkField(question, { isOptional: true }); - } - - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAllQuestions(eventTypePage, allQuestions, { - ...bookingOptions, - isAllRequired: false, - }); - - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); -}); diff --git a/apps/web/playwright/booking/checkboxGroupQuestion.e2e.ts b/apps/web/playwright/booking/checkboxGroupQuestion.e2e.ts deleted file mode 100644 index f2de0d362b..0000000000 --- a/apps/web/playwright/booking/checkboxGroupQuestion.e2e.ts +++ /dev/null @@ -1,445 +0,0 @@ -import { loginUser } from "../fixtures/regularBookings"; -import { test } from "../lib/fixtures"; - -test.describe("Booking With Checkbox Group Question and Each Other Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - - test.beforeEach(async ({ page, users, bookingPage }) => { - await loginUser(users); - await page.goto("/event-types"); - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - }); - - test.describe("Booking With Checkbox Group Question and Address Question", () => { - test("Checkbox Group required and Address required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Address question (both required)", - secondQuestion: "address", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Checkbox Group and Address not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("address", "address-test", "address test", false, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Address question (only checkbox required)", - secondQuestion: "address", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test.describe("Booking With Checkbox Group Question and Phone Question", () => { - test("Checkbox Group required and Phone required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and phone question (both required)", - secondQuestion: "phone", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Checkbox Group and Phone not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("phone", "phone-test", "phone test", false, "phone test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Phone question (only checkbox required)", - secondQuestion: "phone", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Checkbox Group Question and checkbox Question", () => { - test("Checkbox Group required and checkbox required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and checkbox question (both required)", - secondQuestion: "boolean", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Checkbox Group and checkbox not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and checkbox (only checkbox required)", - secondQuestion: "boolean", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Checkbox Group Question and Long text Question", () => { - test("Checkbox Group required and Long text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Long Text question (both required)", - secondQuestion: "textarea", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Checkbox Group and Long text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", false, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Long Text question (only checkbox required)", - secondQuestion: "textarea", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Checkbox Group Question and Multi email Question", () => { - test("Checkbox Group required and Multi email required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Multi Email question (both required)", - secondQuestion: "multiemail", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Checkbox Group and Multi email not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - false, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Multi Email question (only checkbox required)", - secondQuestion: "multiemail", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Checkbox Group Question and multiselect Question", () => { - test("Checkbox Group required and multiselect text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Multi Select question (both required)", - secondQuestion: "multiselect", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Checkbox Group and multiselect text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Multi Select question (only checkbox required)", - secondQuestion: "multiselect", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Checkbox Group Question and Number Question", () => { - test("Checkbox Group required and Number required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("number", "number-test", "number test", true, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Number question (both required)", - secondQuestion: "number", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Checkbox Group and Number not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("number", "number-test", "number test", false, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Number question (only checkbox required)", - secondQuestion: "number", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Checkbox Group Question and Radio group Question", () => { - test("Checkbox Group required and Radio group required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Radio question (both required)", - secondQuestion: "radio", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Checkbox Group and Radio group not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("radio", "radio-test", "radio test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Radio question (only checkbox required)", - secondQuestion: "radio", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Checkbox Group Question and select Question", () => { - test("Checkbox Group required and select required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Select question (both required)", - secondQuestion: "select", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Checkbox Group and select not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("select", "select-test", "select test", false, "select test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Select question (only checkbox required)", - secondQuestion: "select", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Checkbox Group Question and Short text question", () => { - test("Checkbox Group required and Short Text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("text", "text-test", "text test", true, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Text question (both required)", - secondQuestion: "text", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Checkbox Group and Short Text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.addQuestion("text", "text-test", "text test", false, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "checkbox", - fillText: "Test Checkbox Group question and Text question (only checkbox required)", - secondQuestion: "text", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - }); -}); diff --git a/apps/web/playwright/booking/collectiveEventType/collectiveEventType.e2e.ts b/apps/web/playwright/booking/collectiveEventType/collectiveEventType.e2e.ts deleted file mode 100644 index cc01cb280c..0000000000 --- a/apps/web/playwright/booking/collectiveEventType/collectiveEventType.e2e.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { test } from "../../lib/fixtures"; - -test.describe("Collective event type", () => { - const teamEventTitle = "Test Managed Event Type"; - let userId: number; - test.beforeEach(async ({ page, users, bookingPage }) => { - const userFixture = await users.create( - { name: "testuser" }, - { hasTeam: true, schedulingType: "COLLECTIVE", teamEventTitle } - ); - await userFixture.apiLogin(); - userId = userFixture.id; - await page.goto("/event-types"); - await bookingPage.goToEventType(teamEventTitle); - }); - test("Book a Collective event type", async ({ bookingPage }) => { - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillEmailAndName(eventTypePage); - await bookingPage.confirmBooking(eventTypePage); - await bookingPage.backToBookings(eventTypePage); - await bookingPage.assertLabelWithCorrectTeamName(eventTypePage, teamEventTitle); - await bookingPage.assertBookingWithCorrectTitleAndDescription(eventTypePage, { - profileName: "testuser", - bookingName: teamEventTitle, - teamName: `user-id-${userId}'s Team`, - }); - await bookingPage.clickOnBooking(eventTypePage, teamEventTitle); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBookingWithReason(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - test("Book a Collective event type (with added guest)", async ({ bookingPage }) => { - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillEmailAndName(eventTypePage); - await bookingPage.addGuests(eventTypePage, { guests: ["test@example.com"] }); - await bookingPage.confirmBooking(eventTypePage); - await bookingPage.backToBookings(eventTypePage); - await bookingPage.assertLabelWithCorrectTeamName(eventTypePage, teamEventTitle); - await bookingPage.assertBookingWithCorrectTitleAndDescription(eventTypePage, { - profileName: "testuser", - bookingName: teamEventTitle, - teamName: `user-id-${userId}'s Team`, - aditionalGuestEmail: "test@example.com", - }); - await bookingPage.clickOnBooking(eventTypePage, teamEventTitle); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBookingWithReason(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); -}); diff --git a/apps/web/playwright/booking/longTextQuestion.e2e.ts b/apps/web/playwright/booking/longTextQuestion.e2e.ts deleted file mode 100644 index 3f7818bddd..0000000000 --- a/apps/web/playwright/booking/longTextQuestion.e2e.ts +++ /dev/null @@ -1,483 +0,0 @@ -import { loginUser } from "../fixtures/regularBookings"; -import { test } from "../lib/fixtures"; - -test.describe("Booking With Long Text Question and Each Other Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - - test.beforeEach(async ({ page, users }) => { - await loginUser(users); - await page.goto("/event-types"); - }); - - test("Long Text and Address required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Address question (both required)", - secondQuestion: "address", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Long Text required and Address not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("address", "address-test", "address test", false, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Address question (only Long Text required)", - secondQuestion: "address", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test.describe("Booking With Long Text Question and Checkbox Group Question", () => { - test("Long Text and Checkbox Group required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Checkbox Group question (both required)", - secondQuestion: "checkbox", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Long Text required and Checkbox Group not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Checkbox Group question (only Long Text required)", - secondQuestion: "checkbox", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Long Text Question and checkbox Question", () => { - test("Long Text and checkbox required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Checkbox question (only Long Text required)", - secondQuestion: "boolean", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Long Text required and checkbox not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Checkbox question (only Long Text required)", - secondQuestion: "boolean", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Long Text Question and Multiple email Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Long Text and Multiple email required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Multiple email question (both required)", - secondQuestion: "multiemail", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Long Text required and Multiple email not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - false, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Multiple email question (only Long Text required)", - secondQuestion: "multiemail", - options: { hasPlaceholder: true, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Long Text Question and multiselect Question", () => { - test("Long Text and multiselect text required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and multiselect question (both required)", - secondQuestion: "multiselect", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Long Text required and multiselect text not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and multiselect question (only long text required)", - secondQuestion: "multiselect", - options: { hasPlaceholder: false, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Long Text Question and Number Question", () => { - test("Long Text and Number required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Number question (both required)", - secondQuestion: "multiselect", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test("Long Text required and Number not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Number question (only Long Textß required)", - secondQuestion: "multiselect", - options: { hasPlaceholder: false, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test.describe("Booking With Long Text Question and Phone Question", () => { - test("Long Text and Phone required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Phone question (both required)", - secondQuestion: "phone", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Long Text required and Phone not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("phone", "phone-test", "phone test", false, "phone test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Phone question (only Long Text required)", - secondQuestion: "phone", - options: { hasPlaceholder: false, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Long Text Question and Radio group Question", () => { - test("Long Text and Radio group required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Radio Group question (both required)", - secondQuestion: "radio", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Long Text required and Radio group not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("radio", "radio-test", "radio test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Radio Group question (only Long Text required)", - secondQuestion: "radio", - options: { hasPlaceholder: false, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Long Text Question and select Question", () => { - test("Long Text and select required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("select", "select-test", "select test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Select question (both required)", - secondQuestion: "select", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Long Text required and select not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("select", "select-test", "select test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Select question (only Long Text required)", - secondQuestion: "select", - options: { hasPlaceholder: false, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Long Text Question and Short text question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Long Text and Short text required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("text", "text-test", "text test", true, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Text question (both required)", - secondQuestion: "text", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Long Text required and Short text not required", async ({ bookingPage }) => { - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.addQuestion("text", "text-test", "text test", false, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "textarea", - fillText: "Test Long Text question and Text question (only Long Text required)", - secondQuestion: "text", - options: { hasPlaceholder: false, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); -}); diff --git a/apps/web/playwright/booking/multipleEmailQuestion.e2e.ts b/apps/web/playwright/booking/multipleEmailQuestion.e2e.ts deleted file mode 100644 index 77a4b754d6..0000000000 --- a/apps/web/playwright/booking/multipleEmailQuestion.e2e.ts +++ /dev/null @@ -1,553 +0,0 @@ -import { loginUser } from "../fixtures/regularBookings"; -import { test } from "../lib/fixtures"; - -test.describe("Booking With Multiple Email Question and Each Other Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - - test.beforeEach(async ({ page, users, bookingPage }) => { - await loginUser(users); - await page.goto("/event-types"); - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - }); - - test.describe("Booking With Multiple Email Question and Address Question", () => { - test("Multiple Email required and Address required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Address question (both required)", - secondQuestion: "address", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Multiple Email and Address not required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("address", "address-test", "address test", false, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Address question (only Multiple Email required)", - secondQuestion: "address", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Multiple Email Question and checkbox group Question", () => { - test("Multiple Email required and checkbox group required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and checkbox group question (both required)", - secondQuestion: "checkbox", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Multiple Email and checkbox group not required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and checkbox group question (only Multiple Email required)", - secondQuestion: "checkbox", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Multiple Email Question and checkbox Question", () => { - test("Multiple Email required and checkbox required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and checkbox question (both required)", - secondQuestion: "boolean", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Multiple Email and checkbox not required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and checkbox (only Multiple Email required)", - secondQuestion: "boolean", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Multiple Email Question and Long text Question", () => { - test("Multiple Email required and Long text required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Long Text question (both required)", - secondQuestion: "textarea", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Multiple Email and Long text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", false, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Long Text question (only Multiple Email required)", - secondQuestion: "textarea", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Multiple Email Question and multiselect Question", () => { - test("Multiple Email required and multiselect text required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Multi Select question (both required)", - secondQuestion: "multiselect", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Multiple Email and multiselect text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Multi Select question (only Multiple Email required)", - secondQuestion: "multiselect", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Multiple Email Question and Number Question", () => { - test("Multiple Email required and Number required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("number", "number-test", "number test", true, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Number question (both required)", - secondQuestion: "number", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Multiple Email and Number not required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("number", "number-test", "number test", false, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Number question (only Multiple Email required)", - secondQuestion: "number", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Multiple email Question and phone Question", () => { - test("Multiple email required and Phone required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Phone question (both required)", - secondQuestion: "phone", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Multiple email and Phone not required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("phone", "phone-test", "phone test", false, "phone test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Phone question (both required)", - secondQuestion: "phone", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Multiple Email Question and Radio group Question", () => { - test("Multiple Email required and Radio group required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Radio question (both required)", - secondQuestion: "radio", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Multiple Email and Radio group not required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("radio", "radio-test", "radio test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Radio question (only Multiple Email required)", - secondQuestion: "radio", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test.describe("Booking With Multiple Email Question and select Question", () => { - test("Multiple Email required and select required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Select question (both required)", - secondQuestion: "select", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Multiple Email and select not required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("select", "select-test", "select test", false, "select test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Select question (only Multiple Email required)", - secondQuestion: "select", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Multiple Email Question and Short text question", () => { - test("Multiple Email required and Short text required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("text", "text-test", "text test", true, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Text question (both required)", - secondQuestion: "text", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Multiple Email and Short text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.addQuestion("text", "text-test", "text test", false, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "multiemail", - fillText: "Test Multiple Email question and Text question (only Multiple Email required)", - secondQuestion: "text", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestion.e2e.ts b/apps/web/playwright/booking/phoneQuestion.e2e.ts deleted file mode 100644 index 05b8d1cc08..0000000000 --- a/apps/web/playwright/booking/phoneQuestion.e2e.ts +++ /dev/null @@ -1,446 +0,0 @@ -import { loginUser } from "../fixtures/regularBookings"; -import { test } from "../lib/fixtures"; - -test.describe("Booking With Phone Question and Each Other Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - - test.beforeEach(async ({ page, users, bookingPage }) => { - await loginUser(users); - await page.goto("/event-types"); - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - }); - - test.describe("Booking With Phone Question and Address Question", () => { - test("Phone and Address required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Address question (both required)", - secondQuestion: "address", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Phone required and Address not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("address", "address-test", "address test", false, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Address question (only phone required)", - secondQuestion: "address", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test.describe("Booking With Phone Question and checkbox group Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Phone and checkbox group required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and checkbox group question (both required)", - secondQuestion: "checkbox", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Phone required and checkbox group not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and checkbox group question (only phone required)", - secondQuestion: "checkbox", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Phone Question and checkbox Question", () => { - test("Phone and checkbox required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and checkbox question (both required)", - secondQuestion: "boolean", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - test("Phone required and checkbox not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and checkbox (only phone required)", - secondQuestion: "boolean", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Phone Question and Long text Question", () => { - test("Phone and Long text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Long Text question (both required)", - secondQuestion: "textarea", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Phone required and Long text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", false, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Long Text question (only phone required)", - secondQuestion: "textarea", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Phone Question and Multi email Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Phone and Multi email required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Multi Email question (both required)", - secondQuestion: "multiemail", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Phone required and Multi email not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - false, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Multi Email question (only phone required)", - secondQuestion: "multiemail", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Phone Question and multiselect Question", () => { - test("Phone and multiselect text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Multi Select question (both required)", - secondQuestion: "multiselect", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Phone required and multiselect text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Multi Select question (only phone required)", - secondQuestion: "multiselect", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Phone Question and Number Question", () => { - test("Phone and Number required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("number", "number-test", "number test", true, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Number question (both required)", - secondQuestion: "number", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Phone required and Number not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("number", "number-test", "number test", false, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Number question (only phone required)", - secondQuestion: "number", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Phone Question and Radio group Question", () => { - test("Phone and Radio group required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Radio question (both required)", - secondQuestion: "radio", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Phone required and Radio group not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("radio", "radio-test", "radio test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Radio question (only phone required)", - secondQuestion: "radio", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Phone Question and select Question", () => { - test("Phone and select required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Select question (both required)", - secondQuestion: "select", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Phone required and select not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("select", "select-test", "select test", false, "select test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Select question (only phone required)", - secondQuestion: "select", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Phone Question and Short text question", () => { - test("Phone and Short text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("text", "text-test", "text test", true, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Text question (both required)", - secondQuestion: "text", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Phone required and Short text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.addQuestion("text", "text-test", "text test", false, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "phone", - fillText: "Test Phone question and Text question (only phone required)", - secondQuestion: "text", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - }); -}); diff --git a/apps/web/playwright/booking/radioGroupQuestion.e2e.ts b/apps/web/playwright/booking/radioGroupQuestion.e2e.ts deleted file mode 100644 index 6f6ef77e1a..0000000000 --- a/apps/web/playwright/booking/radioGroupQuestion.e2e.ts +++ /dev/null @@ -1,444 +0,0 @@ -import { loginUser } from "../fixtures/regularBookings"; -import { test } from "../lib/fixtures"; - -test.describe("Booking With Radio Question and Each Other Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - - test.beforeEach(async ({ page, users, bookingPage }) => { - await loginUser(users); - await page.goto("/event-types"); - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - }); - - test.describe("Booking With Radio Question and Address Question", () => { - test("Radio required and Address required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Address question (both required)", - secondQuestion: "address", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Radio and Address not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("address", "address-test", "address test", false, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Address question (only radio required)", - secondQuestion: "address", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test.describe("Booking With Radio Question and checkbox group Question", () => { - test("Radio required and checkbox group required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and checkbox group question (both required)", - secondQuestion: "checkbox", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Radio and checkbox group not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and checkbox group question (only radio required)", - secondQuestion: "checkbox", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Radio Question and checkbox Question", () => { - test("Radio required and checkbox required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and checkbox question (both required)", - secondQuestion: "boolean", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - test("Radio and checkbox not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and checkbox (only radio required)", - secondQuestion: "boolean", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Radio Question and Long text Question", () => { - test("Radio required and Long text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Long Text question (both required)", - secondQuestion: "textarea", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Radio and Long text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", false, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Long Text question (only radio required)", - secondQuestion: "textarea", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Radio Question and Multi email Question", () => { - test("Radio required and Multi email required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Multi Email question (both required)", - secondQuestion: "multiemail", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Radio and Multi email not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - false, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Multi Email question (only radio required)", - secondQuestion: "multiemail", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Radio Question and multiselect Question", () => { - test("Radio required and multiselect text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Multi Select question (both required)", - secondQuestion: "multiselect", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Radio and multiselect text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Multi Select question (only radio required)", - secondQuestion: "multiselect", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Radio Question and Number Question", () => { - test("Radio required and Number required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("number", "number-test", "number test", true, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Number question (both required)", - secondQuestion: "number", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Radio and Number not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("number", "number-test", "number test", false, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Number question (only radio required)", - secondQuestion: "number", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Radio Question and Phone Question", () => { - test("Radio required and Phone required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Phone question (both required)", - secondQuestion: "phone", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Radio and Phone not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("phone", "phone-test", "phone test", false, "phone test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Phone question (only radio required)", - secondQuestion: "phone", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Radio Question and select Question", () => { - test("Radio required and select required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Select question (both required)", - secondQuestion: "select", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Radio and select not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("select", "select-test", "select test", false, "select test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Select question (only radio required)", - secondQuestion: "select", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Radio Question and Short text question", () => { - test("Radio required and Short text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("text", "text-test", "text test", true, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Text question (both required)", - secondQuestion: "text", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Radio and Short text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("text", "text-test", "text test", false, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "radio", - fillText: "Test Radio question and Text question (only radio required)", - secondQuestion: "text", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - }); -}); diff --git a/apps/web/playwright/booking/recurringBooking.e2e.ts b/apps/web/playwright/booking/recurringBooking.e2e.ts deleted file mode 100644 index 5f89ef9849..0000000000 --- a/apps/web/playwright/booking/recurringBooking.e2e.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* eslint-disable playwright/no-conditional-in-test */ -import { loginUser } from "../fixtures/regularBookings"; -import { test } from "../lib/fixtures"; - -test.describe.configure({ mode: "serial" }); - -test.describe("Booking with recurring checked", () => { - test.beforeEach(async ({ page, users, bookingPage }) => { - await loginUser(users); - await page.goto("/event-types"); - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("recurring"); - }); - - test("Updates event type with recurring events", async ({ page, bookingPage }) => { - await bookingPage.updateRecurringTab("2", "3"); - await bookingPage.updateEventType(); - await page.getByRole("link", { name: "Event Types" }).click(); - await bookingPage.assertRepeatEventType(); - }); - - test("Updates and shows recurring schedule correctly in booking page", async ({ bookingPage }) => { - await bookingPage.updateRecurringTab("2", "3"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.fillRecurringFieldAndConfirm(eventTypePage); - }); -}); diff --git a/apps/web/playwright/booking/responsiveBooking.e2e.ts b/apps/web/playwright/booking/responsiveBooking.e2e.ts deleted file mode 100644 index da7d450797..0000000000 --- a/apps/web/playwright/booking/responsiveBooking.e2e.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* eslint-disable playwright/no-conditional-in-test */ -import { loginUser } from "../fixtures/regularBookings"; -import { test } from "../lib/fixtures"; - -const resolutions = [ - { - width: 1920, - height: 1080, - }, - { - width: 1280, - height: 720, - }, - { - width: 640, - height: 480, - }, -]; - -test.describe("Booking With All Questions", () => { - test.beforeEach(async ({ page, users, bookingPage }) => { - await loginUser(users); - await page.goto("/event-types"); - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - - const allQuestions = [ - "phone", - "address", - "checkbox", - "boolean", - "textarea", - "multiemail", - "multiselect", - "number", - "radio", - "select", - "text", - ]; - for (const question of allQuestions) { - if ( - question !== "number" && - question !== "select" && - question !== "checkbox" && - question !== "boolean" && - question !== "multiselect" && - question !== "radio" - ) { - await bookingPage.addQuestion( - question, - `${question}-test`, - `${question} test`, - true, - `${question} test` - ); - } else { - await bookingPage.addQuestion(question, `${question}-test`, `${question} test`, true); - } - await bookingPage.checkField(question); - } - }); - - for (const resolution of resolutions) { - test(`Booking with ${resolution.width}x${resolution.height} resolution and all questions`, async ({ - bookingPage, - }) => { - await bookingPage.setResolution(resolution.width, resolution.height); - await bookingPage.updateEventType(); - }); - } -}); - -test.describe("Booking With no questions", () => { - test.beforeEach(async ({ page, users, bookingPage }) => { - await loginUser(users); - await page.goto("/event-types"); - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - }); - - for (const resolution of resolutions) { - test(`Booking with ${resolution.width}x${resolution.height} resolution and no questions`, async ({ - bookingPage, - }) => { - await bookingPage.setResolution(resolution.width, resolution.height); - await bookingPage.updateEventType(); - }); - } -}); - -test.describe("Booking page with no questions", () => { - test.beforeEach(async ({ page, users, bookingPage }) => { - await loginUser(users); - await page.goto("/event-types"); - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - }); - - for (const resolution of resolutions) { - test(`Booking page with ${resolution.width}x${resolution.height} resolution`, async ({ bookingPage }) => { - const eventTypePage = await bookingPage.previewEventType(); - await eventTypePage.setViewportSize({ width: resolution.width, height: resolution.height }); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.confirmBooking(eventTypePage); - }); - } -}); diff --git a/apps/web/playwright/booking/selectQuestion.e2e.ts b/apps/web/playwright/booking/selectQuestion.e2e.ts deleted file mode 100644 index 94d97a47d6..0000000000 --- a/apps/web/playwright/booking/selectQuestion.e2e.ts +++ /dev/null @@ -1,441 +0,0 @@ -import { loginUser } from "../fixtures/regularBookings"; -import { test } from "../lib/fixtures"; - -test.describe("Booking With Phone Question and Each Other Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - - test.beforeEach(async ({ page, users, bookingPage }) => { - await loginUser(users); - await page.goto("/event-types"); - await bookingPage.goToEventType("30 min"); - await bookingPage.goToTab("event_advanced_tab_title"); - }); - - test.describe("Booking With Select Question and Address Question", () => { - test("Select required and Address required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and Address question (both required)", - secondQuestion: "address", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Select and Address not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("address", "address-test", "address test", false, "address test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and Address question (only select required)", - secondQuestion: "address", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Select Question and checkbox group Question", () => { - test("Select required and checkbox group required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and Checkbox question (both required)", - secondQuestion: "checkbox", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Select and checkbox group not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and Checkbox question (only Select required)", - secondQuestion: "checkbox", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Select Question and checkbox Question", () => { - test("Select required and checkbox required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and boolean question (both required)", - secondQuestion: "boolean", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Select and checkbox not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and boolean question (only select required)", - secondQuestion: "boolean", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Select Question and Long text Question", () => { - test("Select required and Long text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and textarea question (both required)", - secondQuestion: "textarea", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Select and Long text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", false, "textarea test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and textarea question (only select required)", - secondQuestion: "textarea", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Select Question and Multi email Question", () => { - test("Select required and Multi email required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - true, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and multiemail question (both required)", - secondQuestion: "multiemail", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Select and Multi email not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion( - "multiemail", - "multiemail-test", - "multiemail test", - false, - "multiemail test" - ); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and multiemail question (only select required)", - secondQuestion: "multiemail", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Select Question and multiselect Question", () => { - test("Select required and multiselect text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and multiselect question (both required)", - secondQuestion: "multiselect", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Select and multiselect text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and multiselect question (only select required)", - secondQuestion: "multiselect", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Select Question and Number Question", () => { - test("Select required and Number required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("number", "number-test", "number test", true, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and number question (both required)", - secondQuestion: "number", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Select and Number not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("number", "number-test", "number test", false, "number test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and number question (only select required)", - secondQuestion: "number", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Select Question and Phone Question", () => { - test("Select required and select required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and phone question (both required)", - secondQuestion: "phone", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Select and Phone not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("phone", "phone-test", "phone test", false, "phone test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and phone question (only select required)", - secondQuestion: "phone", - options: { ...bookingOptions, isRequired: false }, - }); - }); - }); - - test.describe("Booking With Select Question and Radio group Question", () => { - test("Select required and Radio group required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and radio question (both required)", - secondQuestion: "radio", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Select and Radio group not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("radio", "radio-test", "radio test", false); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and radio question (only select required)", - secondQuestion: "radio", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); - - test.describe("Booking With Select Question and Short text question", () => { - test("Select required and Short text required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("text", "text-test", "text test", true, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and text question (both required)", - secondQuestion: "text", - options: bookingOptions, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - - test("Select and Short text not required", async ({ bookingPage }) => { - await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); - await bookingPage.addQuestion("text", "text-test", "text test", false, "text test"); - await bookingPage.updateEventType(); - const eventTypePage = await bookingPage.previewEventType(); - await bookingPage.selectTimeSlot(eventTypePage); - await bookingPage.fillAndConfirmBooking({ - eventTypePage, - placeholderText: "Please share anything that will help prepare for our meeting.", - question: "select", - fillText: "Test Select question and text question (only select required)", - secondQuestion: "text", - options: { ...bookingOptions, isRequired: false }, - }); - await bookingPage.rescheduleBooking(eventTypePage); - await bookingPage.assertBookingRescheduled(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); - await bookingPage.assertBookingCanceled(eventTypePage); - }); - }); -}); diff --git a/apps/web/playwright/fixtures/regularBookings.ts b/apps/web/playwright/fixtures/regularBookings.ts index 9b0baab023..a941cd14d3 100644 --- a/apps/web/playwright/fixtures/regularBookings.ts +++ b/apps/web/playwright/fixtures/regularBookings.ts @@ -1,183 +1,14 @@ import { expect, type Page } from "@playwright/test"; -import dayjs from "@calcom/dayjs"; -import { WEBAPP_URL } from "@calcom/lib/constants"; import type { MembershipRole } from "@calcom/prisma/enums"; import { localize } from "../lib/testUtils"; import type { createUsersFixture } from "./users"; -const reschedulePlaceholderText = "Let others know why you need to reschedule"; export const scheduleSuccessfullyText = "This meeting is scheduled"; -const EMAIL = "test@test.com"; -const EMAIL2 = "test2@test.com"; -const PHONE = "+55 (32) 983289947"; - -type BookingOptions = { - hasPlaceholder?: boolean; - isReschedule?: boolean; - isRequired?: boolean; - isAllRequired?: boolean; - isMultiSelect?: boolean; -}; - -interface QuestionActions { - [key: string]: () => Promise; -} - -type teamBookingtypes = { isManagedType?: boolean; isRoundRobinType?: boolean; isCollectiveType?: boolean }; - -type customLocators = { - shouldChangeSelectLocator: boolean; - shouldUseLastRadioGroupLocator: boolean; - shouldUseFirstRadioGroupLocator: boolean; - shouldChangeMultiSelectLocator: boolean; -}; - -type fillAndConfirmBookingParams = { - eventTypePage: Page; - placeholderText: string; - question: string; - fillText: string; - secondQuestion: string; - options: BookingOptions; -}; - type UserFixture = ReturnType; -function isLastDayOfMonth(): boolean { - const today = dayjs(); - const endOfMonth = today.endOf("month"); - return today.isSame(endOfMonth, "day"); -} - -const fillQuestion = async (eventTypePage: Page, questionType: string, customLocators: customLocators) => { - const questionActions: QuestionActions = { - phone: async () => { - await eventTypePage.locator('input[name="phone-test"]').clear(); - await eventTypePage.locator('input[name="phone-test"]').fill(PHONE); - }, - multiemail: async () => { - await eventTypePage.getByRole("button", { name: `${questionType} test` }).click(); - await eventTypePage.getByPlaceholder(`${questionType} test`).fill(EMAIL); - await eventTypePage.getByTestId("add-another-guest").last().click(); - await eventTypePage.getByPlaceholder(`${questionType} test`).last().fill(EMAIL2); - }, - checkbox: async () => { - if (customLocators.shouldUseLastRadioGroupLocator || customLocators.shouldChangeMultiSelectLocator) { - await eventTypePage.getByLabel("Option 1").last().click(); - await eventTypePage.getByLabel("Option 2").last().click(); - } else if (customLocators.shouldUseFirstRadioGroupLocator) { - await eventTypePage.getByLabel("Option 1").first().click(); - await eventTypePage.getByLabel("Option 2").first().click(); - } else { - await eventTypePage.getByLabel("Option 1").click(); - await eventTypePage.getByLabel("Option 2").click(); - } - }, - multiselect: async () => { - if (customLocators.shouldChangeMultiSelectLocator) { - await eventTypePage.getByLabel("multi-select-dropdown").click(); - await eventTypePage.getByTestId("select-option-Option 1").click(); - } else { - await eventTypePage.getByLabel("multi-select-dropdown").last().click(); - await eventTypePage.getByTestId("select-option-Option 1").click(); - } - }, - boolean: async () => { - await eventTypePage.getByLabel(`${questionType} test`).check(); - }, - radio: async () => { - await eventTypePage.locator('[id="radio-test\\.option\\.0\\.radio"]').click(); - }, - select: async () => { - if (customLocators.shouldChangeSelectLocator) { - await eventTypePage.getByLabel("select-dropdown").first().click(); - await eventTypePage.getByTestId("select-option-Option 1").click(); - } else { - await eventTypePage.getByLabel("select-dropdown").last().click(); - await eventTypePage.getByTestId("select-option-Option 1").click(); - } - }, - number: async () => { - await eventTypePage.getByPlaceholder(`${questionType} test`).click(); - await eventTypePage.getByPlaceholder(`${questionType} test`).fill("123"); - }, - address: async () => { - await eventTypePage.getByPlaceholder(`${questionType} test`).click(); - await eventTypePage.getByPlaceholder(`${questionType} test`).fill("address test"); - }, - textarea: async () => { - await eventTypePage.getByPlaceholder(`${questionType} test`).click(); - await eventTypePage.getByPlaceholder(`${questionType} test`).fill("textarea test"); - }, - text: async () => { - await eventTypePage.getByPlaceholder(`${questionType} test`).click(); - await eventTypePage.getByPlaceholder(`${questionType} test`).fill("text test"); - }, - }; - if (questionActions[questionType]) { - await questionActions[questionType](); - } -}; - -const fillAllQuestions = async (eventTypePage: Page, questions: string[], options: BookingOptions) => { - if (options.isAllRequired) { - for (const question of questions) { - switch (question) { - case "email": - await eventTypePage.getByPlaceholder("Email").click(); - await eventTypePage.getByPlaceholder("Email").fill(EMAIL); - break; - case "phone": - await eventTypePage.getByPlaceholder("Phone test").click(); - await eventTypePage.getByPlaceholder("Phone test").fill(PHONE); - break; - case "address": - await eventTypePage.getByPlaceholder("Address test").click(); - await eventTypePage.getByPlaceholder("Address test").fill("123 Main St, City, Country"); - break; - case "textarea": - await eventTypePage.getByPlaceholder("Textarea test").click(); - await eventTypePage.getByPlaceholder("Textarea test").fill("This is a sample text for textarea."); - break; - case "select": - await eventTypePage.getByLabel("select-dropdown").last().click(); - await eventTypePage.getByTestId("select-option-Option 1").click(); - break; - case "multiselect": - // select-dropdown - await eventTypePage.getByLabel("multi-select-dropdown").click(); - await eventTypePage.getByTestId("select-option-Option 1").click(); - break; - case "number": - await eventTypePage.getByLabel("number test").click(); - await eventTypePage.getByLabel("number test").fill("123"); - break; - case "radio": - await eventTypePage.getByRole("radiogroup").getByText("Option 1").check(); - break; - case "text": - await eventTypePage.getByPlaceholder("Text test").click(); - await eventTypePage.getByPlaceholder("Text test").fill("Sample text"); - break; - case "checkbox": - await eventTypePage.getByLabel("Option 1").first().check(); - await eventTypePage.getByLabel("Option 2").first().check(); - break; - case "boolean": - await eventTypePage.getByLabel(`${question} test`).check(); - break; - case "multiemail": - await eventTypePage.getByRole("button", { name: "multiemail test" }).click(); - await eventTypePage.getByPlaceholder("multiemail test").fill(EMAIL); - break; - } - } - } -}; - export async function loginUser(users: UserFixture) { const pro = await users.create({ name: "testuser" }); await pro.apiLogin(); @@ -191,17 +22,6 @@ export async function loginUserWithTeam(users: UserFixture, role: MembershipRole await pro.apiLogin(); } -const goToNextMonthIfNoAvailabilities = async (eventTypePage: Page) => { - try { - if (isLastDayOfMonth()) { - await eventTypePage.getByTestId("view_next_month").waitFor({ timeout: 6000 }); - await eventTypePage.getByTestId("view_next_month").click(); - } - } catch (err) { - console.info("No need to click on view next month button"); - } -}; - export function createBookingPageFixture(page: Page) { return { goToEventType: async (eventType: string) => { @@ -216,308 +36,19 @@ export function createBookingPageFixture(page: Page) { goToTab: async (tabName: string) => { await page.getByTestId(`vertical-tab-${tabName}`).click(); }, - goToEventTypesPage: async () => { await page.goto("/event-types"); }, - - setResolution: async (width: number, height: number) => { - await page.setViewportSize({ width: width, height: height }); - }, - addQuestion: async ( - questionType: string, - identifier: string, - label: string, - isRequired: boolean, - placeholder?: string - ) => { - await page.getByTestId("add-field").click(); - await page.getByTestId("test-field-type").click(); - await page.getByTestId(`select-option-${questionType}`).click(); - await page.getByLabel("Identifier").dblclick(); - await page.getByLabel("Identifier").fill(identifier); - await page.getByLabel("Label").click(); - await page.getByLabel("Label").fill(label); - if (placeholder) { - await page.getByLabel("Placeholder").click(); - await page.getByLabel("Placeholder").fill(placeholder); - } - if (!isRequired) { - await page.getByRole("radio", { name: "No" }).click(); - } - await page.getByTestId("field-add-save").click(); - }, - updateRecurringTab: async (repeatWeek: string, maxEvents: string) => { - const repeatText = (await localize("en"))("repeats_every"); - const maximumOf = (await localize("en"))("for_a_maximum_of"); - await page.getByTestId("recurring-event-check").click(); - await page - .getByTestId("recurring-event-collapsible") - .locator("div") - .filter({ hasText: repeatText }) - .getByRole("spinbutton") - .fill(repeatWeek); - await page - .getByTestId("recurring-event-collapsible") - .locator("div") - .filter({ hasText: maximumOf }) - .getByRole("spinbutton") - .fill(maxEvents); - }, updateEventType: async () => { await page.getByTestId("update-eventtype").click(); const toast = await page.waitForSelector('[data-testid="toast-success"]'); expect(toast).toBeTruthy(); }, - previewEventType: async () => { const eventtypePromise = page.waitForEvent("popup"); await page.getByTestId("preview-button").click(); return eventtypePromise; }, - - selectTimeSlot: async (eventTypePage: Page) => { - await goToNextMonthIfNoAvailabilities(eventTypePage); - await eventTypePage.getByTestId("time").first().click(); - }, - - clickReschedule: async () => { - await page.getByText("Reschedule").click(); - }, - - selectFirstAvailableTime: async () => { - await page.getByTestId("time").first().click(); - }, - - fillRescheduleReasonAndConfirm: async () => { - await page.getByPlaceholder(reschedulePlaceholderText).click(); - await page.getByPlaceholder(reschedulePlaceholderText).fill("Test reschedule"); - await page.getByTestId("confirm-reschedule-button").click(); - }, - - fillRecurringFieldAndConfirm: async (eventTypePage: Page) => { - await eventTypePage.getByTestId("occurrence-input").click(); - await eventTypePage.getByTestId("occurrence-input").fill("2"); - await goToNextMonthIfNoAvailabilities(eventTypePage); - await eventTypePage.getByTestId("time").first().click(); - await expect(eventTypePage.getByTestId("recurring-dates")).toBeVisible(); - }, - - cancelBookingWithReason: async (page: Page) => { - await page.getByTestId("cancel").click(); - await page.getByTestId("cancel_reason").fill("Test cancel"); - await page.getByTestId("confirm_cancel").click(); - }, - - assertBookingCanceled: async (page: Page) => { - await expect(page.getByTestId("cancelled-headline")).toBeVisible(); - }, - - rescheduleBooking: async (eventTypePage: Page) => { - await goToNextMonthIfNoAvailabilities(eventTypePage); - await eventTypePage.getByText("Reschedule").click(); - while (await eventTypePage.getByRole("button", { name: "View next" }).isVisible()) { - await eventTypePage.getByRole("button", { name: "View next" }).click(); - } - await eventTypePage.getByTestId("time").first().click(); - await eventTypePage.getByPlaceholder(reschedulePlaceholderText).click(); - await eventTypePage.getByPlaceholder(reschedulePlaceholderText).fill("Test reschedule"); - await eventTypePage.getByTestId("confirm-reschedule-button").click(); - await eventTypePage.waitForTimeout(400); - if ( - await eventTypePage.getByRole("heading", { name: "Could not reschedule the meeting." }).isVisible() - ) { - await eventTypePage.getByTestId("back").click(); - await eventTypePage.getByTestId("time").last().click(); - await eventTypePage.getByTestId("confirm-reschedule-button").click(); - } - }, - - assertBookingRescheduled: async (page: Page) => { - await expect(page.getByText(scheduleSuccessfullyText)).toBeVisible(); - }, - - assertRepeatEventType: async () => { - await expect(page.getByTestId("repeat-eventtype")).toBeVisible(); - }, - - cancelBooking: async (eventTypePage: Page) => { - await eventTypePage.getByTestId("cancel").click(); - await eventTypePage.getByTestId("cancel_reason").fill("Test cancel"); - await eventTypePage.getByTestId("confirm_cancel").click(); - await expect(eventTypePage.getByTestId("cancelled-headline")).toBeVisible(); - }, - - confirmBooking: async (eventTypePage: Page) => { - await eventTypePage.getByTestId("confirm-book-button").click(); - await eventTypePage.waitForURL("booking/**"); - await expect(eventTypePage.getByText(scheduleSuccessfullyText)).toBeVisible(); - }, - - fillAndConfirmBooking: async ({ - eventTypePage, - placeholderText, - question, - fillText, - secondQuestion, - options, - }: fillAndConfirmBookingParams) => { - const confirmButton = options.isReschedule ? "confirm-reschedule-button" : "confirm-book-button"; - - await expect(eventTypePage.getByText(`${secondQuestion} test`).first()).toBeVisible(); - await eventTypePage.getByPlaceholder(placeholderText).fill(fillText); - - // Change the selector for specifics cases related to select question - const shouldChangeSelectLocator = (question: string, secondQuestion: string): boolean => - question === "select" && ["multiemail", "multiselect", "address"].includes(secondQuestion); - - const shouldUseLastRadioGroupLocator = (question: string, secondQuestion: string): boolean => - question === "radio" && secondQuestion === "checkbox"; - - const shouldUseFirstRadioGroupLocator = (question: string, secondQuestion: string): boolean => - question === "checkbox" && secondQuestion === "radio"; - - const shouldChangeMultiSelectLocator = (question: string, secondQuestion: string): boolean => - question === "multiselect" && - ["address", "checkbox", "multiemail", "select"].includes(secondQuestion); - - const customLocators = { - shouldChangeSelectLocator: shouldChangeSelectLocator(question, secondQuestion), - shouldUseLastRadioGroupLocator: shouldUseLastRadioGroupLocator(question, secondQuestion), - shouldUseFirstRadioGroupLocator: shouldUseFirstRadioGroupLocator(question, secondQuestion), - shouldChangeMultiSelectLocator: shouldChangeMultiSelectLocator(question, secondQuestion), - }; - - // Fill the first question - await fillQuestion(eventTypePage, question, customLocators); - - // Fill the second question if is required - options.isRequired && (await fillQuestion(eventTypePage, secondQuestion, customLocators)); - - await eventTypePage.getByTestId(confirmButton).click(); - await eventTypePage.waitForTimeout(400); - if (await eventTypePage.getByRole("heading", { name: "Could not book the meeting." }).isVisible()) { - await eventTypePage.getByTestId("back").click(); - await eventTypePage.getByTestId("time").last().click(); - await fillQuestion(eventTypePage, question, customLocators); - options.isRequired && (await fillQuestion(eventTypePage, secondQuestion, customLocators)); - await eventTypePage.getByTestId(confirmButton).click(); - } - const scheduleSuccessfullyPage = eventTypePage.getByText(scheduleSuccessfullyText); - await scheduleSuccessfullyPage.waitFor({ state: "visible" }); - await expect(scheduleSuccessfullyPage).toBeVisible(); - }, - - fillAllQuestions: async (eventTypePage: Page, questions: string[], options: BookingOptions) => { - const confirmButton = options.isReschedule ? "confirm-reschedule-button" : "confirm-book-button"; - await fillAllQuestions(eventTypePage, questions, options); - await eventTypePage.getByTestId(confirmButton).click(); - const scheduleSuccessfullyPage = eventTypePage.getByText(scheduleSuccessfullyText); - await scheduleSuccessfullyPage.waitFor({ state: "visible" }); - await expect(scheduleSuccessfullyPage).toBeVisible(); - }, - addGuests: async (eventTypePage: Page, options: { guests: string[] }) => { - await eventTypePage.getByTestId("add-guests").click(); - for (const guest of options.guests) { - await eventTypePage.getByPlaceholder("Email").fill(guest); - } - }, - createTeam: async (name: string) => { - await page.getByTestId("teams-test").click(); - await page.getByTestId("new-team-btn").click(); - await page.getByPlaceholder("Acme Inc.").click(); - await page.getByPlaceholder("Acme Inc.").fill(name); - await page.getByTestId("continue-button").click(); - await page.getByTestId("publish-button").click(); - - await page.getByTestId("vertical-tab-Back").click(); - }, - - createTeamEventType: async (name: string, options: teamBookingtypes) => { - await page.getByTestId("new-event-type").click(); - await page.getByTestId("option-0").click(); - - // We first simulate to create a default event type to check if managed option is not available - - const managedEventDescription = (await localize("en"))("managed_event_description"); - const roundRobinEventDescription = (await localize("en"))("round_robin_description"); - const collectiveEventDescription = (await localize("en"))("collective_description"); - const quickChatText = (await localize("en"))("quick_chat"); - await expect(page.locator("div").filter({ hasText: managedEventDescription })).toBeHidden(); - await page.getByTestId("dialog-rejection").click(); - - await page.getByTestId("new-event-type").click(); - await page.getByTestId("option-team-1").click(); - await page.getByPlaceholder(quickChatText).fill(name); - if (options.isCollectiveType) { - await page - .locator("div") - .filter({ hasText: `Collective${collectiveEventDescription}` }) - .getByRole("radio") - .first() - .click(); - } - - if (options.isRoundRobinType) { - await page - .locator("div") - .filter({ hasText: `Round Robin${roundRobinEventDescription}` }) - .getByRole("radio") - .nth(1) - .click(); - } - - if (options.isManagedType) { - await page - .locator("div") - .filter({ hasText: `Managed Event${managedEventDescription}` }) - .getByRole("radio") - .last() - .click(); - - const managedEventClarification = (await localize("en"))("managed_event_url_clarification"); - await expect(page.getByText(managedEventClarification)).toBeVisible(); - } - - const continueText = (await localize("en"))("continue"); - const toast = page.getByTestId("toast-success"); - - await page.getByRole("button", { name: continueText }).click(); - expect(toast).toBeTruthy(); - await page.getByTestId("update-eventtype").click(); - }, - assertLabelWithCorrectTeamName: async (page: Page, teamName: string) => { - await expect(page.getByRole("link", { name: teamName }).first()).toBeVisible(); - }, - assertBookingWithCorrectTitleAndDescription: async ( - page: Page, - options: { profileName: string; bookingName: string; teamName: string; aditionalGuestEmail?: string } - ) => { - options.aditionalGuestEmail - ? await expect( - page.getByRole("link", { - name: `${options.bookingName} between ${options.teamName} and ${options.profileName} You , ${options.profileName} and ${options.aditionalGuestEmail}`, - }) - ).toBeVisible() - : await expect( - page.getByRole("link", { - name: `${options.bookingName} between ${options.teamName} and ${options.profileName} You and ${options.profileName}`, - }) - ).toBeVisible(); - }, - clickOnBooking: async (page: Page, teamName: string) => { - await page.getByRole("link", { name: teamName }).first().click(); - }, - - checkField: async (question: string, options?: { isOptional: boolean }) => { - if (options?.isOptional) { - await expect(page.getByTestId(`field-${question}-test`).getByTestId("optional")).toBeVisible(); - } else { - await expect(page.getByTestId(`field-${question}-test`).getByTestId("required")).toBeVisible(); - } - await expect(page.getByTestId(`field-${question}-test`)).toBeVisible(); - }, - checkRequiresConfirmation: async () => { // Check existence of the icon await expect(page.getByTestId("requires-confirmation-title").locator("svg")).toBeVisible(); @@ -526,7 +57,6 @@ export function createBookingPageFixture(page: Page) { await expect(confirmationSwitch).toBeVisible(); await confirmationSwitch.click(); }, - checkRequiresBookerEmailVerification: async () => { await expect(page.getByTestId("requires-booker-email-verification-title").locator("svg")).toBeVisible(); @@ -535,7 +65,6 @@ export function createBookingPageFixture(page: Page) { await expect(emailSwitch).toBeVisible(); await emailSwitch.click(); }, - checkHideNotes: async () => { await expect(page.getByTestId("disable-notes-title").locator("svg")).toBeVisible(); @@ -544,7 +73,6 @@ export function createBookingPageFixture(page: Page) { await expect(hideNotesSwitch).toBeVisible(); await hideNotesSwitch.click(); }, - checkRedirectOnBooking: async () => { await expect(page.getByTestId("redirect-success-booking-title").locator("svg")).toBeVisible(); @@ -555,7 +83,6 @@ export function createBookingPageFixture(page: Page) { await page.getByTestId("external-redirect-url").fill("https://cal.com"); await expect(page.getByTestId("redirect-url-warning")).toBeVisible(); }, - checkEnablePrivateUrl: async () => { await expect(page.getByTestId("hashedLinkCheck-title").locator("label div")).toBeVisible(); @@ -564,7 +91,6 @@ export function createBookingPageFixture(page: Page) { await page.getByTestId("hashedLinkCheck").click(); await expect(page.getByTestId("generated-hash-url")).toBeVisible(); }, - toggleOfferSeats: async () => { await expect(page.getByTestId("offer-seats-toggle-title").locator("svg")).toBeVisible(); @@ -575,7 +101,6 @@ export function createBookingPageFixture(page: Page) { await expect(seatSwitchField).toHaveValue("3"); await expect(page.getByTestId("show-attendees")).toBeVisible(); }, - checkLockTimezone: async () => { await expect(page.getByTestId("lock-timezone-toggle-title").locator("svg")).toBeVisible(); @@ -584,18 +109,9 @@ export function createBookingPageFixture(page: Page) { await expect(lockSwitch).toBeVisible(); await lockSwitch.click(); }, - checkEventType: async () => { await expect(page.getByTestId("requires-confirmation-badge").last()).toBeVisible(); }, - - assertBookingIsVisible: async (name: string) => { - await expect( - page.getByRole("link", { - name, - }) - ).toBeVisible(); - }, checkBufferTime: async () => { const minutes = (await localize("en"))("minutes"); const fieldPlaceholder = page.getByPlaceholder("0"); @@ -629,7 +145,6 @@ export function createBookingPageFixture(page: Page) { await page.getByTestId("select-option-60").click(); await expect(page.getByText(`60 ${minutes}`, { exact: true })).toBeVisible(); }, - checkLimitBookingFrequency: async () => { const fieldPlaceholder = page.getByPlaceholder("1").nth(1); const limitFrequency = (await localize("en"))("limit_booking_frequency"); @@ -645,7 +160,6 @@ export function createBookingPageFixture(page: Page) { await expect(fieldPlaceholder).toHaveValue("12"); await limitFrequencySwitch.click(); }, - checkLimitBookingDuration: async () => { const limitDuration = (await localize("en"))("limit_total_booking_duration"); const addlimit = (await localize("en"))("add_limit"); @@ -659,7 +173,6 @@ export function createBookingPageFixture(page: Page) { await expect(page.getByTestId("add-limit")).toHaveCount(2); await limitDurationSwitch.click(); }, - checkLimitFutureBookings: async () => { const limitFutureBookings = (await localize("en"))("limit_future_bookings"); const limitBookingsSwitch = page @@ -672,7 +185,6 @@ export function createBookingPageFixture(page: Page) { await expect(page.locator("#RANGE")).toBeChecked(); await limitBookingsSwitch.click(); }, - checkOffsetTimes: async () => { const offsetStart = (await localize("en"))("offset_start"); const offsetStartTimes = (await localize("en"))("offset_toggle"); @@ -685,54 +197,8 @@ export function createBookingPageFixture(page: Page) { page.getByText("e.g. this will show time slots to your bookers at 9:10 AM instead of 9:00 AM") ).toBeVisible(); }, - checkTimeSlotsCount: async (eventTypePage: Page, count: number) => { await expect(eventTypePage.getByTestId("time")).toHaveCount(count); }, - createBookingWebhook: async (webhookReceiver: { url: string }, eventTitle: string) => { - const events = [ - "Booking Canceled", - "Booking Created", - "Booking Rejected", - "Booking Requested", - "Booking Payment Initiated", - "Booking Rescheduled", - "Meeting Ended", - "Booking Paid", - "Recording Download Link Ready", - ]; - await page.goto(`${WEBAPP_URL}/event-types`); - await page.getByText(eventTitle).click(); - - await page.getByTestId("vertical-tab-webhooks").click(); - - await page.getByTestId("new_webhook").click(); - await page.getByLabel("Subscriber URL").fill(webhookReceiver.url); - await page.getByRole("button", { name: "Ping test" }).click(); - page - .getByTestId("dialog-creation") - .locator("div") - .filter({ hasText: '{ "ok": true, "status": 200, "message": "{}" }' }) - .nth(2); - await page.getByRole("button", { name: "Create Webhook" }).click(); - - page.getByText(webhookReceiver.url); - events.forEach((event) => { - page.getByText(event); - }); - }, - rejectFirstBooking: async () => { - await page.goto("/bookings/unconfirmed"); - await page.getByTestId("horizontal-tab-unconfirmed").click(); - await page.getByTestId("booking-item").first().getByText("Reject").click(); - await page.getByTestId("rejection-confirm").click(); - }, - fillEmailAndName: async (eventTypePage: Page) => { - const emailLabel = (await localize("en"))("email_address"); - const nameLabel = (await localize("en"))("your_name"); - - await eventTypePage.getByLabel(emailLabel).fill(EMAIL); - await eventTypePage.getByLabel(nameLabel).fill("testuser"); - }, }; } diff --git a/apps/web/playwright/profile.e2e.ts b/apps/web/playwright/profile.e2e.ts index f4b61bfe01..fae86387f3 100644 --- a/apps/web/playwright/profile.e2e.ts +++ b/apps/web/playwright/profile.e2e.ts @@ -58,7 +58,7 @@ test.describe("Update Profile", () => { await page.getByTestId("profile-update-email-submit-button").click(); - const toastLocator = await page.waitForSelector('[data-testId="toast-success"]'); + const toastLocator = await page.getByTestId("toast-success"); const textContent = await toastLocator.textContent(); @@ -84,7 +84,7 @@ test.describe("Update Profile", () => { await page.goto(verifyUrl); - const errorLocator = await page.waitForSelector('[data-testId="toast-error"]'); + const errorLocator = await page.getByTestId("toast-error"); expect(errorLocator).toBeDefined(); @@ -118,11 +118,7 @@ test.describe("Update Profile", () => { await page.getByTestId("profile-update-email-submit-button").click(); - const toastLocator = await page.waitForSelector('[data-testId="toast-success"]'); - - const textContent = await toastLocator.textContent(); - - expect(textContent).toContain(email); + expect(await page.getByTestId("toast-success").textContent()).toContain(email); // Instead of dealing with emails in e2e lets just get the token and navigate to it const verificationToken = await prisma.verificationToken.findFirst({ @@ -140,9 +136,7 @@ test.describe("Update Profile", () => { await page.goto(verifyUrl); - const successLocator = await page.waitForSelector('[data-testId="toast-success"]'); - - expect(await successLocator.textContent()).toContain(email); + expect(await page.getByTestId("toast-success").textContent()).toContain(email); // After email verification is successfull. user is sent to /event-types await page.waitForURL("/event-types"); @@ -176,9 +170,7 @@ test.describe("Update Profile", () => { await page.getByTestId("profile-update-email-submit-button").click(); - const toastLocator = await page.waitForSelector('[data-testId="toast-success"]'); - - expect(await toastLocator.isVisible()).toBe(true); + expect(await page.getByTestId("toast-success").isVisible()).toBe(true); const emailInputUpdated = page.getByTestId("profile-form-email"); diff --git a/apps/web/playwright/webhook.e2e.ts b/apps/web/playwright/webhook.e2e.ts index 10e3a042d3..23d051c4db 100644 --- a/apps/web/playwright/webhook.e2e.ts +++ b/apps/web/playwright/webhook.e2e.ts @@ -2,11 +2,9 @@ import type { Page } from "@playwright/test"; import { expect } from "@playwright/test"; import { v4 as uuidv4 } from "uuid"; -import { WEBAPP_URL } from "@calcom/lib/constants"; import prisma from "@calcom/prisma"; import { BookingStatus } from "@calcom/prisma/client"; -import { loginUser } from "./fixtures/regularBookings"; import { test } from "./lib/fixtures"; import { bookOptinEvent, @@ -14,7 +12,6 @@ import { selectFirstAvailableTimeSlotNextMonth, gotoRoutingLink, createUserWithSeatedEventAndAttendees, - bookEventOnThisPage, } from "./lib/testUtils"; // remove dynamic properties that differs depending on where you run the tests @@ -45,859 +42,629 @@ async function createWebhookReceiver(page: Page) { return webhookReceiver; } -test.describe("Webhook tests", async () => { - test.describe("BOOKING_CREATED", async () => { - test("add webhook & test that creating an event triggers a webhook call", async ({ - page, - users, - }, _testInfo) => { - const webhookReceiver = createHttpServer(); - const user = await users.create(); - const [eventType] = user.eventTypes; - await user.apiLogin(); - await page.goto(`/settings/developer/webhooks`); +test.describe("BOOKING_CREATED", async () => { + test("add webhook & test that creating an event triggers a webhook call", async ({ + page, + users, + }, _testInfo) => { + const webhookReceiver = createHttpServer(); + const user = await users.create(); + const [eventType] = user.eventTypes; + await user.apiLogin(); + await page.goto(`/settings/developer/webhooks`); - // --- add webhook - await page.click('[data-testid="new_webhook"]'); + // --- add webhook + await page.click('[data-testid="new_webhook"]'); - await page.fill('[name="subscriberUrl"]', webhookReceiver.url); + await page.fill('[name="subscriberUrl"]', webhookReceiver.url); - await page.fill('[name="secret"]', "secret"); + await page.fill('[name="secret"]', "secret"); - await Promise.all([ - page.click("[type=submit]"), - page.waitForURL((url) => url.pathname.endsWith("/settings/developer/webhooks")), - ]); + await Promise.all([ + page.click("[type=submit]"), + page.waitForURL((url) => url.pathname.endsWith("/settings/developer/webhooks")), + ]); - // page contains the url - expect(page.locator(`text='${webhookReceiver.url}'`)).toBeDefined(); + // page contains the url + expect(page.locator(`text='${webhookReceiver.url}'`)).toBeDefined(); - // --- Book the first available day next month in the pro user's "30min"-event - await page.goto(`/${user.username}/${eventType.slug}`); - await selectFirstAvailableTimeSlotNextMonth(page); + // --- Book the first available day next month in the pro user's "30min"-event + await page.goto(`/${user.username}/${eventType.slug}`); + await selectFirstAvailableTimeSlotNextMonth(page); - // --- fill form - await page.fill('[name="name"]', "Test Testson"); - await page.fill('[name="email"]', "test@example.com"); - await page.press('[name="email"]', "Enter"); + // --- fill form + await page.fill('[name="name"]', "Test Testson"); + await page.fill('[name="email"]', "test@example.com"); + await page.press('[name="email"]', "Enter"); - await webhookReceiver.waitForRequestCount(1); + await webhookReceiver.waitForRequestCount(1); - const [request] = webhookReceiver.requestList; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const body: any = request.body; - - body.createdAt = dynamic; - body.payload.startTime = dynamic; - body.payload.endTime = dynamic; - body.payload.location = dynamic; - for (const attendee of body.payload.attendees) { - attendee.timeZone = dynamic; - attendee.language = dynamic; - } - body.payload.organizer.id = dynamic; - body.payload.organizer.email = dynamic; - body.payload.organizer.timeZone = dynamic; - body.payload.organizer.language = dynamic; - body.payload.uid = dynamic; - body.payload.bookingId = dynamic; - body.payload.additionalInformation = dynamic; - body.payload.requiresConfirmation = dynamic; - body.payload.eventTypeId = dynamic; - body.payload.videoCallData = dynamic; - body.payload.appsStatus = dynamic; - body.payload.metadata.videoCallUrl = dynamic; - expect(body).toMatchObject({ - triggerEvent: "BOOKING_CREATED", - createdAt: "[redacted/dynamic]", - payload: { - type: "30-min", - title: "30 min between Nameless and Test Testson", - description: "", - additionalNotes: "", - customInputs: {}, - startTime: "[redacted/dynamic]", - endTime: "[redacted/dynamic]", - organizer: { - id: "[redacted/dynamic]", - name: "Nameless", - email: "[redacted/dynamic]", - timeZone: "[redacted/dynamic]", - language: "[redacted/dynamic]", - }, - responses: { - email: { - value: "test@example.com", - label: "email_address", - }, - name: { - value: "Test Testson", - label: "your_name", - }, - }, - userFieldsResponses: {}, - attendees: [ - { - email: "test@example.com", - name: "Test Testson", - timeZone: "[redacted/dynamic]", - language: "[redacted/dynamic]", - }, - ], - location: "[redacted/dynamic]", - destinationCalendar: null, - hideCalendarNotes: false, - requiresConfirmation: "[redacted/dynamic]", - eventTypeId: "[redacted/dynamic]", - seatsShowAttendees: true, - seatsPerTimeSlot: null, - uid: "[redacted/dynamic]", - eventTitle: "30 min", - eventDescription: null, - price: 0, - currency: "usd", - length: 30, - bookingId: "[redacted/dynamic]", - metadata: { videoCallUrl: "[redacted/dynamic]" }, - status: "ACCEPTED", - additionalInformation: "[redacted/dynamic]", - }, - }); - - webhookReceiver.close(); - }); - }); - - test.describe("BOOKING_REJECTED", async () => { - test("can book an event that requires confirmation and then that booking can be rejected by organizer", async ({ - page, - users, - }) => { - const webhookReceiver = createHttpServer(); - // --- create a user - const user = await users.create(); - - // --- visit user page - await page.goto(`/${user.username}`); - - // --- book the user's event - await bookOptinEvent(page); - - // --- login as that user - await user.apiLogin(); - - await page.goto(`/settings/developer/webhooks`); - - // --- add webhook - await page.click('[data-testid="new_webhook"]'); - - await page.fill('[name="subscriberUrl"]', webhookReceiver.url); - - await page.fill('[name="secret"]', "secret"); - - await Promise.all([ - page.click("[type=submit]"), - page.waitForURL((url) => url.pathname.endsWith("/settings/developer/webhooks")), - ]); - - // page contains the url - expect(page.locator(`text='${webhookReceiver.url}'`)).toBeDefined(); - - await page.goto("/bookings/unconfirmed"); - await page.click('[data-testid="reject"]'); - await page.click('[data-testid="rejection-confirm"]'); - await page.waitForResponse((response) => response.url().includes("/api/trpc/bookings/confirm")); - - await webhookReceiver.waitForRequestCount(1); - - const [request] = webhookReceiver.requestList; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const body = request.body as any; - - body.createdAt = dynamic; - body.payload.startTime = dynamic; - body.payload.endTime = dynamic; - body.payload.location = dynamic; - for (const attendee of body.payload.attendees) { - attendee.timeZone = dynamic; - attendee.language = dynamic; - } - body.payload.organizer.id = dynamic; - body.payload.organizer.email = dynamic; - body.payload.organizer.timeZone = dynamic; - body.payload.organizer.language = dynamic; - body.payload.uid = dynamic; - body.payload.bookingId = dynamic; - body.payload.additionalInformation = dynamic; - body.payload.requiresConfirmation = dynamic; - body.payload.eventTypeId = dynamic; - body.payload.videoCallData = dynamic; - body.payload.appsStatus = dynamic; - // body.payload.metadata.videoCallUrl = dynamic; - - expect(body).toMatchObject({ - triggerEvent: "BOOKING_REJECTED", - createdAt: "[redacted/dynamic]", - payload: { - type: "opt-in", - title: "Opt in between Nameless and Test Testson", - customInputs: {}, - startTime: "[redacted/dynamic]", - endTime: "[redacted/dynamic]", - organizer: { - id: "[redacted/dynamic]", - name: "Unnamed", - email: "[redacted/dynamic]", - timeZone: "[redacted/dynamic]", - language: "[redacted/dynamic]", - }, - responses: { - email: { - value: "test@example.com", - label: "email", - }, - name: { - value: "Test Testson", - label: "name", - }, - }, - userFieldsResponses: {}, - attendees: [ - { - email: "test@example.com", - name: "Test Testson", - timeZone: "[redacted/dynamic]", - language: "[redacted/dynamic]", - }, - ], - location: "[redacted/dynamic]", - destinationCalendar: [], - // hideCalendarNotes: false, - requiresConfirmation: "[redacted/dynamic]", - eventTypeId: "[redacted/dynamic]", - uid: "[redacted/dynamic]", - eventTitle: "Opt in", - eventDescription: null, - price: 0, - currency: "usd", - length: 30, - bookingId: "[redacted/dynamic]", - // metadata: { videoCallUrl: "[redacted/dynamic]" }, - status: "REJECTED", - additionalInformation: "[redacted/dynamic]", - }, - }); - - webhookReceiver.close(); - }); - }); - - test.describe("BOOKING_REQUESTED", async () => { - test("can book an event that requires confirmation and get a booking requested event", async ({ - page, - users, - }) => { - const webhookReceiver = createHttpServer(); - // --- create a user - const user = await users.create(); - - // --- login as that user - await user.apiLogin(); - - await page.goto(`/settings/developer/webhooks`); - - // --- add webhook - await page.click('[data-testid="new_webhook"]'); - - await page.fill('[name="subscriberUrl"]', webhookReceiver.url); - - await page.fill('[name="secret"]', "secret"); - - await Promise.all([ - page.click("[type=submit]"), - page.waitForURL((url) => url.pathname.endsWith("/settings/developer/webhooks")), - ]); - - // page contains the url - expect(page.locator(`text='${webhookReceiver.url}'`)).toBeDefined(); - - // --- visit user page - await page.goto(`/${user.username}`); - - // --- book the user's opt in - await bookOptinEvent(page); - - // --- check that webhook was called - - await webhookReceiver.waitForRequestCount(1); - - const [request] = webhookReceiver.requestList; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const body = request.body as any; - - body.createdAt = dynamic; - body.payload.startTime = dynamic; - body.payload.endTime = dynamic; - body.payload.location = dynamic; - for (const attendee of body.payload.attendees) { - attendee.timeZone = dynamic; - attendee.language = dynamic; - } - body.payload.organizer.id = dynamic; - body.payload.organizer.email = dynamic; - body.payload.organizer.timeZone = dynamic; - body.payload.organizer.language = dynamic; - body.payload.uid = dynamic; - body.payload.bookingId = dynamic; - body.payload.additionalInformation = dynamic; - body.payload.requiresConfirmation = dynamic; - body.payload.eventTypeId = dynamic; - body.payload.videoCallData = dynamic; - body.payload.appsStatus = dynamic; - body.payload.metadata.videoCallUrl = dynamic; - - expect(body).toMatchObject({ - triggerEvent: "BOOKING_REQUESTED", - createdAt: "[redacted/dynamic]", - payload: { - type: "opt-in", - title: "Opt in between Nameless and Test Testson", - customInputs: {}, - startTime: "[redacted/dynamic]", - endTime: "[redacted/dynamic]", - organizer: { - id: "[redacted/dynamic]", - name: "Nameless", - email: "[redacted/dynamic]", - timeZone: "[redacted/dynamic]", - language: "[redacted/dynamic]", - }, - responses: { - email: { - value: "test@example.com", - label: "email_address", - }, - name: { - value: "Test Testson", - label: "your_name", - }, - }, - userFieldsResponses: {}, - attendees: [ - { - email: "test@example.com", - name: "Test Testson", - timeZone: "[redacted/dynamic]", - language: "[redacted/dynamic]", - }, - ], - location: "[redacted/dynamic]", - destinationCalendar: null, - requiresConfirmation: "[redacted/dynamic]", - eventTypeId: "[redacted/dynamic]", - uid: "[redacted/dynamic]", - eventTitle: "Opt in", - eventDescription: null, - price: 0, - currency: "usd", - length: 30, - bookingId: "[redacted/dynamic]", - status: "PENDING", - additionalInformation: "[redacted/dynamic]", - metadata: { videoCallUrl: "[redacted/dynamic]" }, - }, - }); - - webhookReceiver.close(); - }); - }); - - test.describe("BOOKING_RESCHEDULED", async () => { - test("can reschedule a booking and get a booking rescheduled event", async ({ - page, - users, - bookings, - }) => { - const user = await users.create(); - const [eventType] = user.eventTypes; - - await user.apiLogin(); - - const webhookReceiver = await createWebhookReceiver(page); - - const booking = await bookings.create(user.id, user.username, eventType.id, { - status: BookingStatus.ACCEPTED, - }); - - await page.goto(`/${user.username}/${eventType.slug}?rescheduleUid=${booking.uid}`); - - await selectFirstAvailableTimeSlotNextMonth(page); - - await page.locator('[data-testid="confirm-reschedule-button"]').click(); - - await expect(page).toHaveURL(/.*booking/); - - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const newBooking = await prisma.booking.findFirst({ where: { fromReschedule: booking?.uid } })!; - expect(newBooking).not.toBeNull(); - - // --- check that webhook was called - await webhookReceiver.waitForRequestCount(1); - - const [request] = webhookReceiver.requestList; - - expect(request.body).toMatchObject({ - triggerEvent: "BOOKING_RESCHEDULED", - payload: { - uid: newBooking?.uid, - }, - }); - }); - - test("when rescheduling to a booking that already exists, should send a booking rescheduled event with the existant booking uid", async ({ - page, - users, - bookings, - }) => { - const { user, eventType, booking } = await createUserWithSeatedEventAndAttendees({ users, bookings }, [ - { name: "John First", email: "first+seats@cal.com", timeZone: "Europe/Berlin" }, - { name: "Jane Second", email: "second+seats@cal.com", timeZone: "Europe/Berlin" }, - ]); - - await prisma.eventType.update({ - where: { id: eventType.id }, - data: { requiresConfirmation: false }, - }); - - await user.apiLogin(); - - const webhookReceiver = await createWebhookReceiver(page); - - const bookingAttendees = await prisma.attendee.findMany({ - where: { bookingId: booking.id }, - select: { - id: true, - email: true, - name: true, - }, - }); - - const bookingSeats = bookingAttendees.map((attendee) => ({ - bookingId: booking.id, - attendeeId: attendee.id, - referenceUid: uuidv4(), - data: { - responses: { - name: attendee.name, - email: attendee.email, - }, - }, - })); - - await prisma.bookingSeat.createMany({ - data: bookingSeats, - }); - - const references = await prisma.bookingSeat.findMany({ - where: { bookingId: booking.id }, - include: { attendee: true }, - }); - - await page.goto(`/reschedule/${references[0].referenceUid}`); - - await selectFirstAvailableTimeSlotNextMonth(page); - - await page.locator('[data-testid="confirm-reschedule-button"]').click(); - - await expect(page).toHaveURL(/.*booking/); - - const newBooking = await prisma.booking.findFirst({ - where: { - attendees: { - some: { - email: bookingAttendees[0].email, - }, - }, - }, - }); - - // --- ensuring that new booking was created - expect(newBooking).not.toBeNull(); - - // --- check that webhook was called - await webhookReceiver.waitForRequestCount(1); - - const [firstRequest] = webhookReceiver.requestList; - - expect(firstRequest?.body).toMatchObject({ - triggerEvent: "BOOKING_RESCHEDULED", - payload: { - uid: newBooking?.uid, - }, - }); - - await page.goto(`/reschedule/${references[1].referenceUid}`); - - await selectFirstAvailableTimeSlotNextMonth(page); - - await page.locator('[data-testid="confirm-reschedule-button"]').click(); - - await expect(page).toHaveURL(/.*booking/); - - await webhookReceiver.waitForRequestCount(2); - - const [_, secondRequest] = webhookReceiver.requestList; - - expect(secondRequest?.body).toMatchObject({ - triggerEvent: "BOOKING_RESCHEDULED", - payload: { - // in the current implementation, it is the same as the first booking - uid: newBooking?.uid, - }, - }); - }); - }); - - test.describe("FORM_SUBMITTED", async () => { - test("on submitting user form, triggers user webhook", async ({ page, users, routingForms }) => { - const webhookReceiver = createHttpServer(); - const user = await users.create(null, { - hasTeam: true, - }); - - await user.apiLogin(); - - await page.goto(`/settings/developer/webhooks/new`); - - // Add webhook - await page.fill('[name="subscriberUrl"]', webhookReceiver.url); - await page.fill('[name="secret"]', "secret"); - await page.click("[type=submit]"); - - // Page contains the url - expect(page.locator(`text='${webhookReceiver.url}'`)).toBeDefined(); - - await page.waitForLoadState("networkidle"); - - const form = await routingForms.create({ - name: "Test Form", - userId: user.id, - teamId: null, - fields: [ - { - type: "text", - label: "Name", - identifier: "name", - required: true, - }, - ], - }); - - await gotoRoutingLink({ page, formId: form.id }); - const fieldName = "name"; - await page.fill(`[data-testid="form-field-${fieldName}"]`, "John Doe"); - page.click('button[type="submit"]'); - - await webhookReceiver.waitForRequestCount(1); - - const [request] = webhookReceiver.requestList; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const body = request.body as any; - body.createdAt = dynamic; - expect(body).toEqual({ - triggerEvent: "FORM_SUBMITTED", - createdAt: dynamic, - payload: { - formId: form.id, - formName: form.name, - teamId: null, - responses: { - name: { - value: "John Doe", - }, - }, - }, - name: "John Doe", - }); - - webhookReceiver.close(); - }); - - test("on submitting team form, triggers team webhook", async ({ page, users, routingForms }) => { - const webhookReceiver = createHttpServer(); - const user = await users.create(null, { - hasTeam: true, - }); - await user.apiLogin(); - - await page.goto(`/settings/developer/webhooks`); - const teamId = await clickFirstTeamWebhookCta(page); - - // Add webhook - await page.fill('[name="subscriberUrl"]', webhookReceiver.url); - await page.fill('[name="secret"]', "secret"); - await page.click("[type=submit]"); - - const form = await routingForms.create({ - name: "Test Form", - userId: user.id, - teamId: teamId, - fields: [ - { - type: "text", - label: "Name", - identifier: "name", - required: true, - }, - ], - }); - - await gotoRoutingLink({ page, formId: form.id }); - const fieldName = "name"; - await page.fill(`[data-testid="form-field-${fieldName}"]`, "John Doe"); - page.click('button[type="submit"]'); - - await webhookReceiver.waitForRequestCount(1); - - const [request] = webhookReceiver.requestList; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const body = request.body as any; - body.createdAt = dynamic; - expect(body).toEqual({ - triggerEvent: "FORM_SUBMITTED", - createdAt: dynamic, - payload: { - formId: form.id, - formName: form.name, - teamId, - responses: { - name: { - value: "John Doe", - }, - }, - }, - name: "John Doe", - }); - - webhookReceiver.close(); - }); - }); - - test.describe("Add webhook on event type config", async () => { + const [request] = webhookReceiver.requestList; // eslint-disable-next-line @typescript-eslint/no-explicit-any - const updateBody = (body: any) => { - body.createdAt = dynamic; - body.payload.bookingId = dynamic; - body.payload.eventTypeId = dynamic; - body.payload.startTime = dynamic; - body.payload.endTime = dynamic; - body.payload.organizer.id = dynamic; - body.payload.organizer.email = dynamic; - body.payload.organizer.username = dynamic; - body.payload.organizer.timeZone = dynamic; - body.payload.organizer.timeFormat = dynamic; - body.payload.organizer.language.locale = dynamic; - body.payload.responses.email.label = dynamic; - body.payload.responses.email.value = dynamic; - body.payload.uid = dynamic; - body.payload.attendees = [ - { - email: dynamic, - firstName: "", - language: { - locale: dynamic, - }, - lastName: "", - name: "testuser", - timeZone: dynamic, - }, - ]; - return body; - }; - const bodyProps = { + const body: any = request.body; + + body.createdAt = dynamic; + body.payload.startTime = dynamic; + body.payload.endTime = dynamic; + body.payload.location = dynamic; + for (const attendee of body.payload.attendees) { + attendee.timeZone = dynamic; + attendee.language = dynamic; + } + body.payload.organizer.id = dynamic; + body.payload.organizer.email = dynamic; + body.payload.organizer.timeZone = dynamic; + body.payload.organizer.language = dynamic; + body.payload.uid = dynamic; + body.payload.bookingId = dynamic; + body.payload.additionalInformation = dynamic; + body.payload.requiresConfirmation = dynamic; + body.payload.eventTypeId = dynamic; + body.payload.videoCallData = dynamic; + body.payload.appsStatus = dynamic; + body.payload.metadata.videoCallUrl = dynamic; + expect(body).toMatchObject({ + triggerEvent: "BOOKING_CREATED", createdAt: "[redacted/dynamic]", payload: { - title: "30 min between testuser and Test Testson", type: "30-min", + title: "30 min between Nameless and Test Testson", + description: "", + additionalNotes: "", customInputs: {}, - userFieldsResponses: {}, - responses: { - name: { label: "your_name", value: "Test Testson" }, - email: { label: "[redacted/dynamic]", value: "[redacted/dynamic]" }, - guests: { label: "additional_guests", value: [] }, - }, startTime: "[redacted/dynamic]", endTime: "[redacted/dynamic]", organizer: { - email: "[redacted/dynamic]", - name: "testuser", - timeZone: "[redacted/dynamic]", - timeFormat: "[redacted/dynamic]", - language: { locale: "[redacted/dynamic]" }, id: "[redacted/dynamic]", - username: "[redacted/dynamic]", + name: "Nameless", + email: "[redacted/dynamic]", + timeZone: "[redacted/dynamic]", + language: "[redacted/dynamic]", }, + responses: { + email: { + value: "test@example.com", + label: "email_address", + }, + name: { + value: "Test Testson", + label: "your_name", + }, + }, + userFieldsResponses: {}, attendees: [ { - email: "[redacted/dynamic]", - firstName: "", - language: { locale: "[redacted/dynamic]" }, - lastName: "", - name: "testuser", + email: "test@example.com", + name: "Test Testson", timeZone: "[redacted/dynamic]", + language: "[redacted/dynamic]", }, ], - uid: "[redacted/dynamic]", - bookingId: "[redacted/dynamic]", - location: "", + location: "[redacted/dynamic]", destinationCalendar: null, - seatsPerTimeSlot: null, + hideCalendarNotes: false, + requiresConfirmation: "[redacted/dynamic]", + eventTypeId: "[redacted/dynamic]", seatsShowAttendees: true, + seatsPerTimeSlot: null, + uid: "[redacted/dynamic]", eventTitle: "30 min", eventDescription: null, - requiresConfirmation: false, price: 0, currency: "usd", length: 30, + bookingId: "[redacted/dynamic]", + metadata: { videoCallUrl: "[redacted/dynamic]" }, status: "ACCEPTED", - eventTypeId: "[redacted/dynamic]", + additionalInformation: "[redacted/dynamic]", }, - }; - test.beforeEach(async ({ users }) => { - users.deleteAll(); - await loginUser(users); - }); - test("Create booking", async ({ bookingPage }) => { - const webhookReceiver = createHttpServer(); - await bookingPage.createBookingWebhook(webhookReceiver, "30 min"); - const eventTypePage = await bookingPage.previewEventType(); - await bookEventOnThisPage(eventTypePage); - await webhookReceiver.waitForRequestCount(2); - - const [_, bookingCreatedRequest] = webhookReceiver.requestList; - const body = updateBody(bookingCreatedRequest.body); - - expect(body).toMatchObject({ ...bodyProps, triggerEvent: "BOOKING_CREATED" }); - webhookReceiver.close(); }); - test("Booking rescheduled", async ({ bookingPage }) => { - const webhookReceiver = createHttpServer(); - await bookingPage.createBookingWebhook(webhookReceiver, "30 min"); - const eventTypePage = await bookingPage.previewEventType(); - await bookEventOnThisPage(eventTypePage); - await bookingPage.rescheduleBooking(eventTypePage); + webhookReceiver.close(); + }); +}); - await webhookReceiver.waitForRequestCount(3); +test.describe("BOOKING_REJECTED", async () => { + test("can book an event that requires confirmation and then that booking can be rejected by organizer", async ({ + page, + users, + }) => { + const webhookReceiver = createHttpServer(); + // --- create a user + const user = await users.create(); - const [_, bookingCreatedRequest, bookingRescheduledRequest] = webhookReceiver.requestList; + // --- visit user page + await page.goto(`/${user.username}`); - const body = updateBody(bookingRescheduledRequest.body); + // --- book the user's event + await bookOptinEvent(page); - expect(body).toMatchObject({ ...bodyProps, triggerEvent: "BOOKING_RESCHEDULED" }); - webhookReceiver.close(); - }); + // --- login as that user + await user.apiLogin(); - test("Booking cancelled", async ({ bookingPage }) => { - const webhookReceiver = createHttpServer(); - await bookingPage.createBookingWebhook(webhookReceiver, "30 min"); - const eventTypePage = await bookingPage.previewEventType(); - await bookEventOnThisPage(eventTypePage); - await bookingPage.cancelBooking(eventTypePage); + await page.goto(`/settings/developer/webhooks`); - await webhookReceiver.waitForRequestCount(3); + // --- add webhook + await page.click('[data-testid="new_webhook"]'); - const [_, _bookingCreatedRequest, bookingCancelledRequest] = webhookReceiver.requestList; + await page.fill('[name="subscriberUrl"]', webhookReceiver.url); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const body = updateBody(bookingCancelledRequest.body); + await page.fill('[name="secret"]', "secret"); - expect(body).toMatchObject({ - ...bodyProps, - triggerEvent: "BOOKING_CANCELLED", - payload: { - ...bodyProps.payload, - team: { name: "Nameless", members: [] }, - cancellationReason: "Test cancel", - destinationCalendar: [], - seatsShowAttendees: false, - status: "CANCELLED", - price: null, - requiresConfirmation: null, - responses: { - ...bodyProps.payload.responses, - name: { label: "name", value: "Test Testson" }, - guests: { label: "guests", value: [] }, + await Promise.all([ + page.click("[type=submit]"), + page.waitForURL((url) => url.pathname.endsWith("/settings/developer/webhooks")), + ]); + + // page contains the url + expect(page.locator(`text='${webhookReceiver.url}'`)).toBeDefined(); + + await page.goto("/bookings/unconfirmed"); + await page.click('[data-testid="reject"]'); + await page.click('[data-testid="rejection-confirm"]'); + await page.waitForResponse((response) => response.url().includes("/api/trpc/bookings/confirm")); + + await webhookReceiver.waitForRequestCount(1); + + const [request] = webhookReceiver.requestList; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const body = request.body as any; + + body.createdAt = dynamic; + body.payload.startTime = dynamic; + body.payload.endTime = dynamic; + body.payload.location = dynamic; + for (const attendee of body.payload.attendees) { + attendee.timeZone = dynamic; + attendee.language = dynamic; + } + body.payload.organizer.id = dynamic; + body.payload.organizer.email = dynamic; + body.payload.organizer.timeZone = dynamic; + body.payload.organizer.language = dynamic; + body.payload.uid = dynamic; + body.payload.bookingId = dynamic; + body.payload.additionalInformation = dynamic; + body.payload.requiresConfirmation = dynamic; + body.payload.eventTypeId = dynamic; + body.payload.videoCallData = dynamic; + body.payload.appsStatus = dynamic; + // body.payload.metadata.videoCallUrl = dynamic; + + expect(body).toMatchObject({ + triggerEvent: "BOOKING_REJECTED", + createdAt: "[redacted/dynamic]", + payload: { + type: "opt-in", + title: "Opt in between Nameless and Test Testson", + customInputs: {}, + startTime: "[redacted/dynamic]", + endTime: "[redacted/dynamic]", + organizer: { + id: "[redacted/dynamic]", + name: "Unnamed", + email: "[redacted/dynamic]", + timeZone: "[redacted/dynamic]", + language: "[redacted/dynamic]", + }, + responses: { + email: { + value: "test@example.com", + label: "email", + }, + name: { + value: "Test Testson", + label: "name", }, }, - }); - webhookReceiver.close(); + userFieldsResponses: {}, + attendees: [ + { + email: "test@example.com", + name: "Test Testson", + timeZone: "[redacted/dynamic]", + language: "[redacted/dynamic]", + }, + ], + location: "[redacted/dynamic]", + destinationCalendar: [], + // hideCalendarNotes: false, + requiresConfirmation: "[redacted/dynamic]", + eventTypeId: "[redacted/dynamic]", + uid: "[redacted/dynamic]", + eventTitle: "Opt in", + eventDescription: null, + price: 0, + currency: "usd", + length: 30, + bookingId: "[redacted/dynamic]", + // metadata: { videoCallUrl: "[redacted/dynamic]" }, + status: "REJECTED", + additionalInformation: "[redacted/dynamic]", + }, }); - test("Booking rejected", async ({ page, users, bookingPage }) => { - const webhookReceiver = createHttpServer(); - await bookingPage.createBookingWebhook(webhookReceiver, "Opt in"); - await page.goto(`/${users.get()[0].username}`); - await bookOptinEvent(page); + webhookReceiver.close(); + }); +}); - await bookingPage.rejectFirstBooking(); - await webhookReceiver.waitForRequestCount(3); - const [_, _bookingCreatedRequest, bookingRejectedRequest] = webhookReceiver.requestList; +test.describe("BOOKING_REQUESTED", async () => { + test("can book an event that requires confirmation and get a booking requested event", async ({ + page, + users, + }) => { + const webhookReceiver = createHttpServer(); + // --- create a user + const user = await users.create(); - const body = updateBody(bookingRejectedRequest.body); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const bodyPropsCopy: any = { ...bodyProps }; + // --- login as that user + await user.apiLogin(); - delete bodyPropsCopy.payload.seatsPerTimeSlot; - delete bodyPropsCopy.payload.seatsShowAttendees; + await page.goto(`/settings/developer/webhooks`); - expect(body).toMatchObject({ - ...bodyPropsCopy, - triggerEvent: "BOOKING_REJECTED", - payload: { - ...bodyPropsCopy.payload, - status: "REJECTED", - requiresConfirmation: true, - title: "Opt in between testuser and Test Testson", - type: "opt-in", - eventTitle: "Opt in", - destinationCalendar: [], - responses: { - ...bodyProps.payload.responses, - name: { label: "name", value: "Test Testson" }, - guests: { label: "guests", value: [] }, + // --- add webhook + await page.click('[data-testid="new_webhook"]'); + + await page.fill('[name="subscriberUrl"]', webhookReceiver.url); + + await page.fill('[name="secret"]', "secret"); + + await Promise.all([ + page.click("[type=submit]"), + page.waitForURL((url) => url.pathname.endsWith("/settings/developer/webhooks")), + ]); + + // page contains the url + expect(page.locator(`text='${webhookReceiver.url}'`)).toBeDefined(); + + // --- visit user page + await page.goto(`/${user.username}`); + + // --- book the user's opt in + await bookOptinEvent(page); + + // --- check that webhook was called + + await webhookReceiver.waitForRequestCount(1); + + const [request] = webhookReceiver.requestList; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const body = request.body as any; + + body.createdAt = dynamic; + body.payload.startTime = dynamic; + body.payload.endTime = dynamic; + body.payload.location = dynamic; + for (const attendee of body.payload.attendees) { + attendee.timeZone = dynamic; + attendee.language = dynamic; + } + body.payload.organizer.id = dynamic; + body.payload.organizer.email = dynamic; + body.payload.organizer.timeZone = dynamic; + body.payload.organizer.language = dynamic; + body.payload.uid = dynamic; + body.payload.bookingId = dynamic; + body.payload.additionalInformation = dynamic; + body.payload.requiresConfirmation = dynamic; + body.payload.eventTypeId = dynamic; + body.payload.videoCallData = dynamic; + body.payload.appsStatus = dynamic; + body.payload.metadata.videoCallUrl = dynamic; + + expect(body).toMatchObject({ + triggerEvent: "BOOKING_REQUESTED", + createdAt: "[redacted/dynamic]", + payload: { + type: "opt-in", + title: "Opt in between Nameless and Test Testson", + customInputs: {}, + startTime: "[redacted/dynamic]", + endTime: "[redacted/dynamic]", + organizer: { + id: "[redacted/dynamic]", + name: "Nameless", + email: "[redacted/dynamic]", + timeZone: "[redacted/dynamic]", + language: "[redacted/dynamic]", + }, + responses: { + email: { + value: "test@example.com", + label: "email_address", + }, + name: { + value: "Test Testson", + label: "your_name", }, }, - }); - webhookReceiver.close(); + userFieldsResponses: {}, + attendees: [ + { + email: "test@example.com", + name: "Test Testson", + timeZone: "[redacted/dynamic]", + language: "[redacted/dynamic]", + }, + ], + location: "[redacted/dynamic]", + destinationCalendar: null, + requiresConfirmation: "[redacted/dynamic]", + eventTypeId: "[redacted/dynamic]", + uid: "[redacted/dynamic]", + eventTitle: "Opt in", + eventDescription: null, + price: 0, + currency: "usd", + length: 30, + bookingId: "[redacted/dynamic]", + status: "PENDING", + additionalInformation: "[redacted/dynamic]", + metadata: { videoCallUrl: "[redacted/dynamic]" }, + }, }); - test("Booking requested", async ({ page, users, bookingPage }) => { - const webhookReceiver = createHttpServer(); - await bookingPage.createBookingWebhook(webhookReceiver, "Opt in"); - await page.goto(`/${users.get()[0].username}`); - await bookOptinEvent(page); - await webhookReceiver.waitForRequestCount(2); - const [_, bookingRequestedRequest] = webhookReceiver.requestList; + webhookReceiver.close(); + }); +}); - const body = updateBody(bookingRequestedRequest.body); +test.describe("BOOKING_RESCHEDULED", async () => { + test("can reschedule a booking and get a booking rescheduled event", async ({ page, users, bookings }) => { + const user = await users.create(); + const [eventType] = user.eventTypes; - expect(body).toMatchObject({ - ...bodyProps, - triggerEvent: "BOOKING_REQUESTED", - payload: { - ...bodyProps.payload, - title: "Opt in between testuser and Test Testson", - bookerUrl: WEBAPP_URL, - hideCalendarNotes: false, - status: "PENDING", - requiresConfirmation: true, - type: "opt-in", - eventTitle: "Opt in", + await user.apiLogin(); + + const webhookReceiver = await createWebhookReceiver(page); + + const booking = await bookings.create(user.id, user.username, eventType.id, { + status: BookingStatus.ACCEPTED, + }); + + await page.goto(`/${user.username}/${eventType.slug}?rescheduleUid=${booking.uid}`); + + await selectFirstAvailableTimeSlotNextMonth(page); + + await page.locator('[data-testid="confirm-reschedule-button"]').click(); + + await expect(page).toHaveURL(/.*booking/); + + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const newBooking = await prisma.booking.findFirst({ where: { fromReschedule: booking?.uid } })!; + expect(newBooking).not.toBeNull(); + + // --- check that webhook was called + await webhookReceiver.waitForRequestCount(1); + + const [request] = webhookReceiver.requestList; + + expect(request.body).toMatchObject({ + triggerEvent: "BOOKING_RESCHEDULED", + payload: { + uid: newBooking?.uid, + }, + }); + }); + + test("when rescheduling to a booking that already exists, should send a booking rescheduled event with the existant booking uid", async ({ + page, + users, + bookings, + }) => { + const { user, eventType, booking } = await createUserWithSeatedEventAndAttendees({ users, bookings }, [ + { name: "John First", email: "first+seats@cal.com", timeZone: "Europe/Berlin" }, + { name: "Jane Second", email: "second+seats@cal.com", timeZone: "Europe/Berlin" }, + ]); + + await prisma.eventType.update({ + where: { id: eventType.id }, + data: { requiresConfirmation: false }, + }); + + await user.apiLogin(); + + const webhookReceiver = await createWebhookReceiver(page); + + const bookingAttendees = await prisma.attendee.findMany({ + where: { bookingId: booking.id }, + select: { + id: true, + email: true, + }, + }); + + const bookingSeats = bookingAttendees.map((attendee) => ({ + bookingId: booking.id, + attendeeId: attendee.id, + referenceUid: uuidv4(), + })); + + await prisma.bookingSeat.createMany({ + data: bookingSeats, + }); + + const references = await prisma.bookingSeat.findMany({ + where: { bookingId: booking.id }, + include: { attendee: true }, + }); + + await page.goto(`/reschedule/${references[0].referenceUid}`); + + await selectFirstAvailableTimeSlotNextMonth(page); + + await page.locator('[data-testid="confirm-reschedule-button"]').click(); + + await expect(page).toHaveURL(/.*booking/); + + const newBooking = await prisma.booking.findFirst({ + where: { + attendees: { + some: { + email: bookingAttendees[0].email, + }, }, - }); - webhookReceiver.close(); + }, }); + + // --- ensuring that new booking was created + expect(newBooking).not.toBeNull(); + + // --- check that webhook was called + await webhookReceiver.waitForRequestCount(1); + + const [firstRequest] = webhookReceiver.requestList; + + expect(firstRequest?.body).toMatchObject({ + triggerEvent: "BOOKING_RESCHEDULED", + payload: { + uid: newBooking?.uid, + }, + }); + + await page.goto(`/reschedule/${references[1].referenceUid}`); + + await selectFirstAvailableTimeSlotNextMonth(page); + + await page.locator('[data-testid="confirm-reschedule-button"]').click(); + + await expect(page).toHaveURL(/.*booking/); + + await webhookReceiver.waitForRequestCount(2); + + const [_, secondRequest] = webhookReceiver.requestList; + + expect(secondRequest?.body).toMatchObject({ + triggerEvent: "BOOKING_RESCHEDULED", + payload: { + // in the current implementation, it is the same as the first booking + uid: newBooking?.uid, + }, + }); + }); +}); + +test.describe("FORM_SUBMITTED", async () => { + test("on submitting user form, triggers user webhook", async ({ page, users, routingForms }) => { + const webhookReceiver = createHttpServer(); + const user = await users.create(null, { + hasTeam: true, + }); + + await user.apiLogin(); + + await page.goto(`/settings/developer/webhooks/new`); + + // Add webhook + await page.fill('[name="subscriberUrl"]', webhookReceiver.url); + await page.fill('[name="secret"]', "secret"); + await page.click("[type=submit]"); + + // Page contains the url + expect(page.locator(`text='${webhookReceiver.url}'`)).toBeDefined(); + + await page.waitForLoadState("networkidle"); + + const form = await routingForms.create({ + name: "Test Form", + userId: user.id, + teamId: null, + fields: [ + { + type: "text", + label: "Name", + identifier: "name", + required: true, + }, + ], + }); + + await gotoRoutingLink({ page, formId: form.id }); + const fieldName = "name"; + await page.fill(`[data-testid="form-field-${fieldName}"]`, "John Doe"); + page.click('button[type="submit"]'); + + await webhookReceiver.waitForRequestCount(1); + + const [request] = webhookReceiver.requestList; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const body = request.body as any; + body.createdAt = dynamic; + expect(body).toEqual({ + triggerEvent: "FORM_SUBMITTED", + createdAt: dynamic, + payload: { + formId: form.id, + formName: form.name, + teamId: null, + responses: { + name: { + value: "John Doe", + }, + }, + }, + name: "John Doe", + }); + + webhookReceiver.close(); + }); + + test("on submitting team form, triggers team webhook", async ({ page, users, routingForms }) => { + const webhookReceiver = createHttpServer(); + const user = await users.create(null, { + hasTeam: true, + }); + await user.apiLogin(); + + await page.goto(`/settings/developer/webhooks`); + const teamId = await clickFirstTeamWebhookCta(page); + + // Add webhook + await page.fill('[name="subscriberUrl"]', webhookReceiver.url); + await page.fill('[name="secret"]', "secret"); + await page.click("[type=submit]"); + + const form = await routingForms.create({ + name: "Test Form", + userId: user.id, + teamId: teamId, + fields: [ + { + type: "text", + label: "Name", + identifier: "name", + required: true, + }, + ], + }); + + await gotoRoutingLink({ page, formId: form.id }); + const fieldName = "name"; + await page.fill(`[data-testid="form-field-${fieldName}"]`, "John Doe"); + page.click('button[type="submit"]'); + + await webhookReceiver.waitForRequestCount(1); + + const [request] = webhookReceiver.requestList; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const body = request.body as any; + body.createdAt = dynamic; + expect(body).toEqual({ + triggerEvent: "FORM_SUBMITTED", + createdAt: dynamic, + payload: { + formId: form.id, + formName: form.name, + teamId, + responses: { + name: { + value: "John Doe", + }, + }, + }, + name: "John Doe", + }); + + webhookReceiver.close(); }); }); diff --git a/packages/features/calendars/weeklyview/components/event/EventList.tsx b/packages/features/calendars/weeklyview/components/event/EventList.tsx index ed6af0e763..609f56dae2 100644 --- a/packages/features/calendars/weeklyview/components/event/EventList.tsx +++ b/packages/features/calendars/weeklyview/components/event/EventList.tsx @@ -111,7 +111,7 @@ export function EventList({ day }: Props) {