Add tests
This commit is contained in:
commit
e549c88ce2
|
@ -0,0 +1,488 @@
|
||||||
|
import { test } from "../../../lib/fixtures";
|
||||||
|
import { localize } from "../../../lib/testUtils";
|
||||||
|
|
||||||
|
test.describe("Booking With Checkbox Group Question and Each Other Question", () => {
|
||||||
|
const bookingOptions = { hasPlaceholder: true, isRequired: true };
|
||||||
|
|
||||||
|
test.beforeEach(async ({ users, page, bookingPage }) => {
|
||||||
|
const teamEventTitle = "testevent";
|
||||||
|
const userFixture = await users.create({ name: "testuser" }, { hasTeam: true, teamEventTitle });
|
||||||
|
await userFixture.apiLogin();
|
||||||
|
|
||||||
|
await page.goto("/event-types");
|
||||||
|
await bookingPage.goToEventType(teamEventTitle);
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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 }) => {
|
||||||
|
const placeholder = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: placeholder,
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,488 @@
|
||||||
|
import { test } from "../../../lib/fixtures";
|
||||||
|
import { localize } from "../../../lib/testUtils";
|
||||||
|
|
||||||
|
test.describe("Booking With Long Text Question and Each Other Question", () => {
|
||||||
|
const bookingOptions = { hasPlaceholder: true, isRequired: true };
|
||||||
|
|
||||||
|
test.beforeEach(async ({ users, page, bookingPage }) => {
|
||||||
|
const teamEventTitle = "testevent";
|
||||||
|
const userFixture = await users.create({ name: "testuser" }, { hasTeam: true, teamEventTitle });
|
||||||
|
await userFixture.apiLogin();
|
||||||
|
|
||||||
|
await page.goto("/event-types");
|
||||||
|
await bookingPage.goToEventType(teamEventTitle);
|
||||||
|
await bookingPage.goToTab("event_advanced_tab_title");
|
||||||
|
});
|
||||||
|
|
||||||
|
test.describe("Booking With Long Text Question and Address Question", () => {
|
||||||
|
test("Long Text and Address required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
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 }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Address question (only textarea 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 }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
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 }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and checkbox group question (only textarea 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 }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text 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("Long Text required and checkbox not required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and checkbox (only textarea 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 Long text Question", () => {
|
||||||
|
test("Long Text and Phone required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Long Text 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 Long text not required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Long Text question (only textarea 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 Long Text Question and Multi email Question", () => {
|
||||||
|
const bookingOptions = { hasPlaceholder: true, isRequired: true };
|
||||||
|
test("Long Text and Multi email required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text 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("Long Text required and Multi email not required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Multi Email question (only textarea 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 Long Text Question and multiselect Question", () => {
|
||||||
|
test("Long Text and multiselect text required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Multi Long Text 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 }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Multi Long Text question (only textarea 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 Long Text Question and Number Question", () => {
|
||||||
|
test("Long Text and Number required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea 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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text 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("Long Text required and Number not required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea 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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Number question (only textarea 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 Long Text Question and Radio group Question", () => {
|
||||||
|
test("Long Text and Radio group required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text 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("Long Text required and Radio group not required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Radio question (only textarea 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 Long Text Question and Phone Question", () => {
|
||||||
|
test("Long Text and phone required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Long Text 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 }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Long Text question (only textarea 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 Long Text Question and Short text question", () => {
|
||||||
|
test("Long Text and Short text required", async ({ bookingPage }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
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 }) => {
|
||||||
|
const shareText = (await localize("en"))("share_additional_notes");
|
||||||
|
|
||||||
|
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: shareText,
|
||||||
|
question: "textarea",
|
||||||
|
fillText: "Test Long Text question and Text question (only textarea required)",
|
||||||
|
secondQuestion: "text",
|
||||||
|
options: { ...bookingOptions, isRequired: false },
|
||||||
|
});
|
||||||
|
await bookingPage.rescheduleBooking(eventTypePage);
|
||||||
|
await bookingPage.assertBookingRescheduled(eventTypePage);
|
||||||
|
await bookingPage.cancelBooking(eventTypePage);
|
||||||
|
await bookingPage.assertBookingCanceled(eventTypePage);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -1,7 +1,9 @@
|
||||||
import { expect, type Page } from "@playwright/test";
|
import { expect, type Page } from "@playwright/test";
|
||||||
|
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
|
import { randomString } from "@calcom/lib/random";
|
||||||
|
|
||||||
|
import { localize } from "../lib/testUtils";
|
||||||
import type { createUsersFixture } from "./users";
|
import type { createUsersFixture } from "./users";
|
||||||
|
|
||||||
const reschedulePlaceholderText = "Let others know why you need to reschedule";
|
const reschedulePlaceholderText = "Let others know why you need to reschedule";
|
||||||
|
@ -19,6 +21,8 @@ type BookingOptions = {
|
||||||
isMultiSelect?: boolean;
|
isMultiSelect?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type teamBookingtypes = { isManagedType?: boolean; isRoundRobinType?: boolean; isCollectiveType?: boolean };
|
||||||
|
|
||||||
interface QuestionActions {
|
interface QuestionActions {
|
||||||
[key: string]: () => Promise<void>;
|
[key: string]: () => Promise<void>;
|
||||||
}
|
}
|
||||||
|
@ -190,8 +194,21 @@ const goToNextMonthIfNoAvailabilities = async (eventTypePage: Page) => {
|
||||||
|
|
||||||
export function createBookingPageFixture(page: Page) {
|
export function createBookingPageFixture(page: Page) {
|
||||||
return {
|
return {
|
||||||
goToEventType: async (eventType: string) => {
|
goToEventType: async (
|
||||||
await page.getByRole("link", { name: eventType }).click();
|
eventType: string,
|
||||||
|
options?: {
|
||||||
|
clickOnFirst?: boolean;
|
||||||
|
clickOnLast?: boolean;
|
||||||
|
}
|
||||||
|
) => {
|
||||||
|
if (options?.clickOnFirst) {
|
||||||
|
await page.getByRole("link", { name: eventType }).first().click();
|
||||||
|
}
|
||||||
|
if (options?.clickOnLast) {
|
||||||
|
await page.getByRole("link", { name: eventType }).last().click();
|
||||||
|
} else {
|
||||||
|
await page.getByRole("link", { name: eventType }).click();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
goToTab: async (tabName: string) => {
|
goToTab: async (tabName: string) => {
|
||||||
await page.getByTestId(`vertical-tab-${tabName}`).click();
|
await page.getByTestId(`vertical-tab-${tabName}`).click();
|
||||||
|
@ -219,8 +236,12 @@ export function createBookingPageFixture(page: Page) {
|
||||||
}
|
}
|
||||||
await page.getByTestId("field-add-save").click();
|
await page.getByTestId("field-add-save").click();
|
||||||
},
|
},
|
||||||
updateEventType: async () => {
|
updateEventType: async (options?: { shouldCheck: boolean; name: string }) => {
|
||||||
await page.getByTestId("update-eventtype").click();
|
await page.getByTestId("update-eventtype").click();
|
||||||
|
options?.shouldCheck &&
|
||||||
|
(await expect(
|
||||||
|
page.getByRole("button", { name: `${options?.name} event type updated successfully` })
|
||||||
|
).toBeVisible());
|
||||||
},
|
},
|
||||||
previewEventType: async () => {
|
previewEventType: async () => {
|
||||||
const eventtypePromise = page.waitForEvent("popup");
|
const eventtypePromise = page.waitForEvent("popup");
|
||||||
|
@ -338,7 +359,13 @@ export function createBookingPageFixture(page: Page) {
|
||||||
await scheduleSuccessfullyPage.waitFor({ state: "visible" });
|
await scheduleSuccessfullyPage.waitFor({ state: "visible" });
|
||||||
await expect(scheduleSuccessfullyPage).toBeVisible();
|
await expect(scheduleSuccessfullyPage).toBeVisible();
|
||||||
},
|
},
|
||||||
checkField: async (question: string) => {
|
|
||||||
|
checkField: async (question: string, options?: { isOptional: boolean }) => {
|
||||||
|
if (options?.isOptional) {
|
||||||
|
await expect(page.getByTestId(`field-${question}-test`).getByText("Optional")).toBeVisible();
|
||||||
|
} else {
|
||||||
|
await expect(page.getByTestId(`field-${question}-test`).getByText("Required")).toBeVisible();
|
||||||
|
}
|
||||||
await expect(page.getByTestId(`field-${question}-test`)).toBeVisible();
|
await expect(page.getByTestId(`field-${question}-test`)).toBeVisible();
|
||||||
},
|
},
|
||||||
fillAllQuestions: async (eventTypePage: Page, questions: string[], options: BookingOptions) => {
|
fillAllQuestions: async (eventTypePage: Page, questions: string[], options: BookingOptions) => {
|
||||||
|
@ -356,5 +383,121 @@ export function createBookingPageFixture(page: Page) {
|
||||||
await scheduleSuccessfullyPage.waitFor({ state: "visible" });
|
await scheduleSuccessfullyPage.waitFor({ state: "visible" });
|
||||||
await expect(scheduleSuccessfullyPage).toBeVisible();
|
await expect(scheduleSuccessfullyPage).toBeVisible();
|
||||||
},
|
},
|
||||||
|
createTeam: async (name: string) => {
|
||||||
|
const teamsText = (await localize("en"))("teams");
|
||||||
|
const continueText = (await localize("en"))("continue");
|
||||||
|
const publishTeamText = (await localize("en"))("team_publish");
|
||||||
|
|
||||||
|
await page.getByRole("link", { name: teamsText }).click();
|
||||||
|
await page.getByTestId("new-team-btn").click();
|
||||||
|
await page.getByPlaceholder("Acme Inc.").click();
|
||||||
|
await page.getByPlaceholder("Acme Inc.").fill(`${name}-${randomString(3)}`);
|
||||||
|
await page.getByRole("button", { name: continueText }).click();
|
||||||
|
await page.getByRole("button", { name: publishTeamText }).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");
|
||||||
|
|
||||||
|
await page.getByRole("button", { name: continueText }).click();
|
||||||
|
await expect(page.getByRole("button", { name: "event type created successfully" })).toBeVisible();
|
||||||
|
await page.getByTestId("update-eventtype").click();
|
||||||
|
},
|
||||||
|
removeManagedEventType: async () => {
|
||||||
|
await page
|
||||||
|
.locator("header")
|
||||||
|
.filter({ hasText: "Test Managed Event TypeSave" })
|
||||||
|
.getByRole("button")
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
|
||||||
|
// Check if the correct messages is showed in the dialog
|
||||||
|
const deleteManagedEventTypeDescription = (await localize("en"))(
|
||||||
|
"delete_managed_event_type_description"
|
||||||
|
);
|
||||||
|
const confirmDeleteEventTypeText = (await localize("en"))("deleteManagedEventTypeDescription");
|
||||||
|
await expect(page.getByText(deleteManagedEventTypeDescription)).toBeVisible();
|
||||||
|
await page.getByRole("button", { name: confirmDeleteEventTypeText }).click();
|
||||||
|
|
||||||
|
// Check if the correct image is showed when there is no event type
|
||||||
|
await expect(page.getByTestId("empty-screen")).toBeVisible();
|
||||||
|
},
|
||||||
|
assertManagedEventTypeDeleted: async () => {
|
||||||
|
const eventTypeDeletedText = (await localize("en"))("event_type_deleted_successfully");
|
||||||
|
await expect(page.getByRole("button", { name: eventTypeDeletedText })).toBeVisible();
|
||||||
|
},
|
||||||
|
deleteTeam: async () => {
|
||||||
|
const teamsText = (await localize("en"))("teams");
|
||||||
|
const teamLogoText = (await localize("en"))("team_logo");
|
||||||
|
const disbandTeamText = (await localize("en"))("disband_team");
|
||||||
|
const confirmDisbandTeamText = (await localize("en"))("confirm_disband_team");
|
||||||
|
await page.getByRole("link", { name: teamsText }).click();
|
||||||
|
await page.getByRole("link", { name: `${teamLogoText} Test Team` }).click();
|
||||||
|
await page.getByRole("button", { name: disbandTeamText }).click();
|
||||||
|
await page.getByRole("button", { name: confirmDisbandTeamText }).click();
|
||||||
|
|
||||||
|
// Check if the correct image is showed when there is no team
|
||||||
|
await expect(page.getByRole("img", { name: "Cal.com is better with teams" })).toBeVisible();
|
||||||
|
},
|
||||||
|
assertTeamDeleted: async () => {
|
||||||
|
const teamDisbandedText = (await localize("en"))("your_team_disbanded_successfully");
|
||||||
|
await expect(page.getByRole("button", { name: teamDisbandedText })).toBeVisible();
|
||||||
|
},
|
||||||
|
removeQuestion: async (question: string) => {
|
||||||
|
await page.getByTestId(`field-${question}-test`).getByTestId("delete-field").click();
|
||||||
|
},
|
||||||
|
editQuestion: async (question: string, options?: { shouldBeRequired: boolean }) => {
|
||||||
|
await page.getByTestId(`field-${question}-test`).getByTestId("edit-field-action").click();
|
||||||
|
options?.shouldBeRequired
|
||||||
|
? await page.getByRole("radio", { name: "Yes" }).click()
|
||||||
|
: await page.getByRole("radio", { name: "No" }).click();
|
||||||
|
await page.getByTestId("field-add-save").click();
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,6 +217,7 @@ export const FormBuilder = function FormBuilder({
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
removeField(index);
|
removeField(index);
|
||||||
}}
|
}}
|
||||||
|
data-testid="delete-field"
|
||||||
StartIcon={Trash2}
|
StartIcon={Trash2}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user