From 1c5e92c1496083baf330d7a79d46347efc19494d Mon Sep 17 00:00:00 2001 From: gitstart-calcom Date: Thu, 19 Oct 2023 23:28:23 +0000 Subject: [PATCH] add changes --- .../booking/multiSelectQuestion.e2e.ts | 507 ++++++++++++++++++ .../multi-select-and-address-question.e2e.ts | 27 - ...-select-and-checkbox-group-question.e2e.ts | 27 - .../multi-select-and-checkbox-question.e2e.ts | 27 - ...multi-select-and-long-text-question.e2e.ts | 27 - ...select-and-multiple-emails-question.e2e.ts | 27 - .../multi-select-and-number-question.e2e.ts | 27 - .../multi-select-and-phone-question.e2e.ts | 27 - ...lti-select-and-radio-group-question.e2e.ts | 27 - .../multi-select-and-select-question.e2e.ts | 27 - ...ulti-select-and-short-text-question.e2e.ts | 27 - .../phone-and-address-question.e2e.ts | 27 - .../phone-and-checkbox-group-question.e2e.ts | 27 - .../phone-and-checkbox-question.e2e.ts | 27 - .../phone-and-long-text-question.e2e.ts | 27 - .../phone-and-multiple-emails-question.e2e.ts | 27 - .../phone-and-multiselect-question.e2e.ts | 27 - .../phone-and-number-question.e2e.ts | 27 - .../phone-and-radio-group-question.e2e.ts | 27 - .../phone-and-select-question.e2e.ts | 27 - .../phone-and-short-text-question.e2e.ts | 27 - .../playwright/booking/utils/bookingUtils.ts | 250 --------- 22 files changed, 507 insertions(+), 790 deletions(-) create mode 100644 apps/web/playwright/booking/multiSelectQuestion.e2e.ts delete mode 100644 apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-address-question.e2e.ts delete mode 100644 apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-checkbox-group-question.e2e.ts delete mode 100644 apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-checkbox-question.e2e.ts delete mode 100644 apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-long-text-question.e2e.ts delete mode 100644 apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-multiple-emails-question.e2e.ts delete mode 100644 apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-number-question.e2e.ts delete mode 100644 apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-phone-question.e2e.ts delete mode 100644 apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-radio-group-question.e2e.ts delete mode 100644 apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-select-question.e2e.ts delete mode 100644 apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-short-text-question.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestione2e/phone-and-address-question.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestione2e/phone-and-checkbox-group-question.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestione2e/phone-and-checkbox-question.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestione2e/phone-and-long-text-question.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestione2e/phone-and-multiple-emails-question.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestione2e/phone-and-multiselect-question.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestione2e/phone-and-number-question.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestione2e/phone-and-radio-group-question.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestione2e/phone-and-select-question.e2e.ts delete mode 100644 apps/web/playwright/booking/phoneQuestione2e/phone-and-short-text-question.e2e.ts delete mode 100644 apps/web/playwright/booking/utils/bookingUtils.ts diff --git a/apps/web/playwright/booking/multiSelectQuestion.e2e.ts b/apps/web/playwright/booking/multiSelectQuestion.e2e.ts new file mode 100644 index 0000000000..b41a80dc76 --- /dev/null +++ b/apps/web/playwright/booking/multiSelectQuestion.e2e.ts @@ -0,0 +1,507 @@ +import { loginUser } from "../fixtures/regularBookings"; +import { test } from "../lib/fixtures"; + +test.describe("Booking With Multi Select 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 Multi Select Question and Address Question", () => { + test("Multi Select and Address required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Address question (both required)", + secondQuestion: "address", + options: bookingOptions, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + + test("Multi Select and Address not required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Address question (only multiselect required)", + secondQuestion: "address", + options: { ...bookingOptions, isRequired: false }, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + + test.describe("Booking With Multi Select Question and checkbox group Question", () => { + const bookingOptions = { hasPlaceholder: false, isRequired: true }; + test("Multi Select and checkbox group required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and checkbox group question (both required)", + secondQuestion: "checkbox", + options: bookingOptions, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + + test("Multi Select and checkbox group not required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and checkbox group question (only multiselect required)", + secondQuestion: "checkbox", + options: { ...bookingOptions, isRequired: false }, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + }); + + test.describe("Booking With Multi Select Question and checkbox Question", () => { + test("Multi Select and checkbox required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and checkbox question (both required)", + secondQuestion: "boolean", + options: bookingOptions, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + test("Multi Select and checkbox not required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and checkbox (only multiselect required)", + secondQuestion: "boolean", + options: { ...bookingOptions, isRequired: false }, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + }); + + test.describe("Booking With Multi Select Question and Long text Question", () => { + test("Multi Select and Long text required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Long Text question (both required)", + secondQuestion: "textarea", + options: bookingOptions, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + + test("Multi Select and Long text not required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Long Text question (only multiselect required)", + secondQuestion: "textarea", + options: { ...bookingOptions, isRequired: false }, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + }); + + test.describe("Booking With Multi Select Question and Multi email Question", () => { + const bookingOptions = { hasPlaceholder: true, isRequired: true }; + test("Multi Select and Multi email required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Multi Email question (both required)", + secondQuestion: "multiemail", + options: bookingOptions, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + + test("Multi Select and Multi email not required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Multi Email question (only multiselect required)", + secondQuestion: "multiemail", + options: { ...bookingOptions, isRequired: false }, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + }); + + test.describe("Booking With Multi Select Question and Phone Question", () => { + test("Multi Select and multiselect text required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Phone question (both required)", + secondQuestion: "phone", + options: bookingOptions, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + + test("Multi Select and multiselect text not required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Multi Select question (only multiselect required)", + secondQuestion: "multiselect", + options: { ...bookingOptions, isRequired: false }, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + }); + + test.describe("Booking With Multi Select Question and Number Question", () => { + test("Multi Select and Number required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Number question (both required)", + secondQuestion: "number", + options: bookingOptions, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + + test("Multi Select and Number not required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Number question (only multiselect required)", + secondQuestion: "number", + options: { ...bookingOptions, isRequired: false }, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + }); + + test.describe("Booking With Multi Select Question and Radio group Question", () => { + test("Multi Select and Radio group required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Radio question (both required)", + secondQuestion: "radio", + options: bookingOptions, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + + test("Multi Select and Radio group not required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Radio question (only multiselect required)", + secondQuestion: "radio", + options: { ...bookingOptions, isRequired: false }, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + }); + + test.describe("Booking With Multi Select Question and select Question", () => { + test("Multi Select and select required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Select question (both required)", + secondQuestion: "select", + options: bookingOptions, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + + test("Multi Select and select not required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Select question (only multiselect required)", + secondQuestion: "select", + options: { ...bookingOptions, isRequired: false }, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + }); + + test.describe("Booking With Multi Select Question and Short text question", () => { + const bookingOptions = { hasPlaceholder: true, isRequired: true }; + test("Multi Select and Short text required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Text question (both required)", + secondQuestion: "text", + options: bookingOptions, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + + test("Multi Select and Short text not required", async ({ bookingPage }) => { + await bookingPage.addQuestion( + "multiselect", + "multiselect-test", + "multiselect test", + true, + "multiselect 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: "multiselect", + fillText: "Test Multi Select question and Text question (only multiselect required)", + secondQuestion: "text", + options: { ...bookingOptions, isRequired: false }, + }); + await bookingPage.cancelAndRescheduleBooking(eventTypePage); + }); + }); + }); +}); diff --git a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-address-question.e2e.ts b/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-address-question.e2e.ts deleted file mode 100644 index fd5684353f..0000000000 --- a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-address-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Multi Select Question and Address Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Multi Select and Address required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "address", - "Test Multi Select question and Address question (both required)", - bookingOptions - ); - }); - - test("Multi Select and Address not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "address", - "Test Phone question and Address question (only multi select required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-checkbox-group-question.e2e.ts b/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-checkbox-group-question.e2e.ts deleted file mode 100644 index f28700d2f1..0000000000 --- a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-checkbox-group-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Multi Select Question and checkbox group Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Multi Select and checkbox group required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "checkbox", - "Test Multi Select question and checkbox group question (both required)", - bookingOptions - ); - }); - - test("Multi Select and checkbox group not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "checkbox", - "Test Multi Select question and checkbox group question (only multi select required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-checkbox-question.e2e.ts b/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-checkbox-question.e2e.ts deleted file mode 100644 index 85a149e60a..0000000000 --- a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-checkbox-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Multi Select Question and checkbox Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Multi Select and checkbox required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "boolean", - "Test Multi Select question and checkbox question (both required)", - bookingOptions - ); - }); - - test("Multi Select and checkbox not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "boolean", - "Test Multi Select question and checkbox question (only multi select required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-long-text-question.e2e.ts b/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-long-text-question.e2e.ts deleted file mode 100644 index 0eca7726d7..0000000000 --- a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-long-text-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Multi Select Question and Long text Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Multi Select and Long text required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "textarea", - "Test Multi Select question and Long text question (both required)", - bookingOptions - ); - }); - - test("Multi Select and Long text not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "textarea", - "Test Multi Select question and Long text question (only multi select required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-multiple-emails-question.e2e.ts b/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-multiple-emails-question.e2e.ts deleted file mode 100644 index 7d309df0e2..0000000000 --- a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-multiple-emails-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Multi Select Question and Multi email Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Multi Select and Multi email required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "multiemail", - "Test Multi Select question and Multi email question (both required)", - bookingOptions - ); - }); - - test("Multi Select and Multi email not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "multiemail", - "Test Multi Select question and Multi email question (only multi select required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-number-question.e2e.ts b/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-number-question.e2e.ts deleted file mode 100644 index ccfce0620a..0000000000 --- a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-number-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Multi Select Question and Number Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Multi Select and Number required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "number", - "Test Multi Select question and number question (both required)", - bookingOptions - ); - }); - - test("Multi Select and Number not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "number", - "Test Multi Select question and number question (only multi select required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-phone-question.e2e.ts b/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-phone-question.e2e.ts deleted file mode 100644 index 12f40ecaff..0000000000 --- a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-phone-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Multi Select Question and Phone Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Multi Select and multiselect text required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "phone", - "Test Multi Select question and phone question (both required)", - bookingOptions - ); - }); - - test("Multi Select and multiselect text not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "phone", - "Test Multi Select question and phone question (only multi select required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-radio-group-question.e2e.ts b/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-radio-group-question.e2e.ts deleted file mode 100644 index 3f0f8f9cde..0000000000 --- a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-radio-group-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Multi Select Question and Radio group Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Multi Select and Radio group required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "radio", - "Test Multi Select question and Radio group question (both required)", - bookingOptions - ); - }); - - test("Multi Select and Radio group not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "radio", - "Test Multi Select question and Radio group question (only multi select required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-select-question.e2e.ts b/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-select-question.e2e.ts deleted file mode 100644 index 7bb87c1204..0000000000 --- a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-select-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Multi Select Question and select Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Multi Select and select required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "select", - "Test Multi Select question and select question (both required)", - bookingOptions - ); - }); - - test("Multi Select and select not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "select", - "Test Multi Select question and select question (only multi select required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-short-text-question.e2e.ts b/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-short-text-question.e2e.ts deleted file mode 100644 index aca281c0bc..0000000000 --- a/apps/web/playwright/booking/multiSelectQuestione2e/multi-select-and-short-text-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Multi Select Question and Short text question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Multi Select and Short text required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "text", - "Test Multi Select question and Short Text question (both required)", - bookingOptions - ); - }); - - test("Multi Select and Short text not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "multiselect", - users, - "text", - "Test Multi Select question and Short Text question (only multi select required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestione2e/phone-and-address-question.e2e.ts b/apps/web/playwright/booking/phoneQuestione2e/phone-and-address-question.e2e.ts deleted file mode 100644 index 6e3977aa46..0000000000 --- a/apps/web/playwright/booking/phoneQuestione2e/phone-and-address-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Phone Question and Address Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Phone and Address required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "address", - "Test Phone question and Address question (both required)", - bookingOptions - ); - }); - - test("Phone and Address not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "address", - "Test Phone question and Address question (only Phone required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestione2e/phone-and-checkbox-group-question.e2e.ts b/apps/web/playwright/booking/phoneQuestione2e/phone-and-checkbox-group-question.e2e.ts deleted file mode 100644 index 11b09ee1a8..0000000000 --- a/apps/web/playwright/booking/phoneQuestione2e/phone-and-checkbox-group-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Phone Question and checkbox group Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Phone and checkbox group required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "checkbox", - "Test Phone question and checkbox group question (both required)", - bookingOptions - ); - }); - - test("Phone and checkbox group not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "checkbox", - "Test Phone question and checkbox group question (only phone required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestione2e/phone-and-checkbox-question.e2e.ts b/apps/web/playwright/booking/phoneQuestione2e/phone-and-checkbox-question.e2e.ts deleted file mode 100644 index 38d62b98c1..0000000000 --- a/apps/web/playwright/booking/phoneQuestione2e/phone-and-checkbox-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Phone Question and checkbox Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Phone and checkbox required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "boolean", - "Test Phone question and checkbox question (both required)", - bookingOptions - ); - }); - - test("Phone and checkbox not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "boolean", - "Test Phone question and checkbox question (only phone required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestione2e/phone-and-long-text-question.e2e.ts b/apps/web/playwright/booking/phoneQuestione2e/phone-and-long-text-question.e2e.ts deleted file mode 100644 index e2cd090b93..0000000000 --- a/apps/web/playwright/booking/phoneQuestione2e/phone-and-long-text-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Phone Question and Long text Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Phone and Long text required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "textarea", - "Test Phone question and Long text question (both required)", - bookingOptions - ); - }); - - test("Phone and Long text not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "textarea", - "Test Phone question and Long text question (only Phone required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestione2e/phone-and-multiple-emails-question.e2e.ts b/apps/web/playwright/booking/phoneQuestione2e/phone-and-multiple-emails-question.e2e.ts deleted file mode 100644 index 194b8c3536..0000000000 --- a/apps/web/playwright/booking/phoneQuestione2e/phone-and-multiple-emails-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Phone Question and Multi email Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Phone and Multi email required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "multiemail", - "Test Phone question and Multi email question (both required)", - bookingOptions - ); - }); - - test("Phone and Multi email not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "multiemail", - "Test Phone question and Multi email question (only phone required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestione2e/phone-and-multiselect-question.e2e.ts b/apps/web/playwright/booking/phoneQuestione2e/phone-and-multiselect-question.e2e.ts deleted file mode 100644 index e8a6edaf87..0000000000 --- a/apps/web/playwright/booking/phoneQuestione2e/phone-and-multiselect-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Phone Question and multiselect Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Phone and multiselect text required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "multiselect", - "Test Phone question and multiselect question (both required)", - bookingOptions - ); - }); - - test("Phone and multiselect text not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "multiselect", - "Test Phone question and multiselect question (only phone required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestione2e/phone-and-number-question.e2e.ts b/apps/web/playwright/booking/phoneQuestione2e/phone-and-number-question.e2e.ts deleted file mode 100644 index b35c727de8..0000000000 --- a/apps/web/playwright/booking/phoneQuestione2e/phone-and-number-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Phone Question and Number Question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Phone and Number required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "number", - "Test Phone question and number question (both required)", - bookingOptions - ); - }); - - test("Phone and Number not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "number", - "Test Phone question and number question (only phone required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestione2e/phone-and-radio-group-question.e2e.ts b/apps/web/playwright/booking/phoneQuestione2e/phone-and-radio-group-question.e2e.ts deleted file mode 100644 index e4ead7a230..0000000000 --- a/apps/web/playwright/booking/phoneQuestione2e/phone-and-radio-group-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Phone Question and Radio group Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Phone and Radio group required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "radio", - "Test Phone question and Radio group question (both required)", - bookingOptions - ); - }); - - test("Phone and Radio group not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "radio", - "Test Phone question and Radio group question (only phone required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestione2e/phone-and-select-question.e2e.ts b/apps/web/playwright/booking/phoneQuestione2e/phone-and-select-question.e2e.ts deleted file mode 100644 index c054c259e2..0000000000 --- a/apps/web/playwright/booking/phoneQuestione2e/phone-and-select-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Phone Question and select Question", () => { - const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Phone and select required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "select", - "Test Phone question and select question (both required)", - bookingOptions - ); - }); - - test("Phone and select not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "select", - "Test Phone question and select question (only phone required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/phoneQuestione2e/phone-and-short-text-question.e2e.ts b/apps/web/playwright/booking/phoneQuestione2e/phone-and-short-text-question.e2e.ts deleted file mode 100644 index 95e393d0c0..0000000000 --- a/apps/web/playwright/booking/phoneQuestione2e/phone-and-short-text-question.e2e.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { test } from "../../lib/fixtures"; -import { initialCommonSteps } from "../utils/bookingUtils"; - -test.describe("Booking With Phone Question and Short text question", () => { - const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Phone and Short text required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "text", - "Test Phone question and Short Text question (both required)", - bookingOptions - ); - }); - - test("Phone and Short text not required", async ({ page, users }) => { - await initialCommonSteps( - page, - "phone", - users, - "text", - "Test Phone question and Short Text question (only phone required)", - { ...bookingOptions, isRequired: false } - ); - }); -}); diff --git a/apps/web/playwright/booking/utils/bookingUtils.ts b/apps/web/playwright/booking/utils/bookingUtils.ts deleted file mode 100644 index cd556635fc..0000000000 --- a/apps/web/playwright/booking/utils/bookingUtils.ts +++ /dev/null @@ -1,250 +0,0 @@ -import { expect, type Page } from "@playwright/test"; - -import type { Fixtures } from "@calcom/web/playwright/lib/fixtures"; - -const EMAIL = "test@test.com"; -const EMAIL2 = "test2@test.com"; -const PHONE = "+55 (32) 983289947"; -const scheduleSuccessfullyText = "This meeting is scheduled"; -const reschedulePlaceholderText = "Let others know why you need to reschedule"; - -interface QuestionActions { - [key: string]: () => Promise; -} - -type BookingOptions = { - hasPlaceholder?: boolean; - isReschedule?: boolean; - isRequired?: boolean; -}; - -type customLocators = { - shouldChangeSelectLocator: boolean; - shouldUseLastRadioGroupLocator: boolean; - shouldUseFirstRadioGroupLocator: boolean; - shouldChangeMultiSelectLocator: boolean; -}; - -export const loginUser = async (page: Page, users: Fixtures["users"]) => { - const pro = await users.create({ name: "testuser" }); - await pro.apiLogin(); - await page.goto("/event-types"); -}; - -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.locator("form svg").nth(1).click(); - await eventTypePage.getByTestId("select-option-Option 1").click(); - } else { - await eventTypePage.locator("form svg").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.locator("form svg").nth(1).click(); - await eventTypePage.getByTestId("select-option-Option 1").click(); - } else { - await eventTypePage.locator("form svg").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](); - } -}; - -export const fillAndConfirmBooking = async ( - eventTypePage: Page, - placeholderText: string, - question: string, - fillText: string, - secondQuestion: string, - options: BookingOptions -) => { - 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"].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(); - const scheduleSuccessfullyPage = eventTypePage.getByText(scheduleSuccessfullyText); - await scheduleSuccessfullyPage.waitFor({ state: "visible" }); - await expect(scheduleSuccessfullyPage).toBeVisible(); -}; - -export const initialCommonSteps = async ( - bookingPage: Page, - question: string, - users: Fixtures["users"], - secondQuestion: string, - message: string, - options: BookingOptions -) => { - const firstQuestionHasPlaceholder = [ - "address", - "textarea", - "multiemail", - "number", - "text", - "phone", - ].includes(question); - - //Logs in a test user and navigates to the event types page. - loginUser(bookingPage, users); - - // Go to event type settings - await bookingPage.getByRole("link", { name: "30 min" }).click(); - - // Go to advanced tab - await bookingPage.getByTestId("vertical-tab-event_advanced_tab_title").click(); - - // Add first and second question and fill both - await bookingPage.getByTestId("add-field").click(); - await bookingPage.locator("#test-field-type > .bg-default > div > div:nth-child(2)").first().click(); - await bookingPage.getByTestId(`select-option-${question}`).click(); - await bookingPage.getByLabel("Identifier").dblclick(); - await bookingPage.getByLabel("Identifier").fill(`${question}-test`); - await bookingPage.getByLabel("Label").click(); - await bookingPage.getByLabel("Label").fill(`${question} test`); - - // Fill the placeholder if the question has one - if (firstQuestionHasPlaceholder) { - await bookingPage.getByLabel("Placeholder").click(); - await bookingPage.getByLabel("Placeholder").fill(`${question} test`); - } - await bookingPage.getByTestId("field-add-save").click(); - await bookingPage.getByTestId("add-field").click(); - await bookingPage.locator("#test-field-type > .bg-default > div > div:nth-child(2)").first().click(); - await bookingPage.getByTestId(`select-option-${secondQuestion}`).click(); - await bookingPage.getByLabel("Identifier").dblclick(); - await bookingPage.getByLabel("Identifier").fill(`${secondQuestion}-test`); - await bookingPage.getByLabel("Label").click(); - await bookingPage.getByLabel("Label").fill(`${secondQuestion} test`); - if (options.hasPlaceholder) { - await bookingPage.getByLabel("Placeholder").dblclick(); - await bookingPage.getByLabel("Placeholder").fill(`${secondQuestion} test`); - } - if (!options.isRequired) { - await bookingPage.getByRole("radio", { name: "No" }).click(); - } - await bookingPage.getByTestId("field-add-save").click(); - await expect(bookingPage.getByTestId(`field-${question}-test`)).toBeVisible(); - await expect(bookingPage.getByTestId(`field-${secondQuestion}-test`)).toBeVisible(); - await bookingPage.getByTestId("update-eventtype").click(); - - // Go to booking page - const eventtypePromise = bookingPage.waitForEvent("popup"); - await bookingPage.getByTestId("preview-button").click(); - const eventTypePage = await eventtypePromise; - - while (await bookingPage.getByRole("button", { name: "View next" }).isVisible()) { - await bookingPage.getByRole("button", { name: "View next" }).click(); - } - - await eventTypePage.getByTestId("time").first().click(); - fillAndConfirmBooking( - eventTypePage, - "Please share anything that will help prepare for our meeting.", - question, - message, - secondQuestion, - options - ); - - // Go to final steps - await rescheduleAndCancel(eventTypePage); -}; -const rescheduleAndCancel = async (eventTypePage: Page) => { - 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(); - - // Check if the rescheduled page is visible - await expect(eventTypePage.getByText(scheduleSuccessfullyText)).toBeVisible(); - await eventTypePage.getByTestId("cancel").click(); - await eventTypePage.getByTestId("cancel_reason").fill("Test cancel"); - await eventTypePage.getByTestId("confirm_cancel").click(); - - // Check if the cancelled page is visible - await expect(eventTypePage.getByTestId("cancelled-headline")).toBeVisible(); -};