Compare commits

...

3 Commits

Author SHA1 Message Date
GitStart-Cal.com c9ebcd701e
Merge branch 'main' into teste2e-checkboxQuestionCollective 2023-11-22 02:58:45 +05:45
GitStart-Cal.com 1494e1b982
Update collectiveCheckboxGroup.e2e.ts 2023-11-21 18:13:14 -03:00
gitstart-calcom fa6c750a15 add changes 2023-11-20 21:51:59 +00:00
2 changed files with 614 additions and 4 deletions

View File

@ -0,0 +1,467 @@
import { test } from "../../../lib/fixtures";
import { localize } from "../../../lib/testUtils";
test.describe("Booking With Checkbox 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 Question and Address Question", () => {
test("Checkbox required and Address required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 and Address not required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 Question and checkbox group Question", () => {
test("Checkbox required and checkbox group required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", true);
await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true);
await bookingPage.updateEventType();
const eventTypePage = await bookingPage.previewEventType();
await bookingPage.selectTimeSlot(eventTypePage);
await bookingPage.fillAndConfirmBooking({
eventTypePage,
placeholderText: placedolder,
question: "boolean",
fillText: "Test checkbox 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("Checkbox and checkbox group not required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", true);
await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", false);
await bookingPage.updateEventType();
const eventTypePage = await bookingPage.previewEventType();
await bookingPage.selectTimeSlot(eventTypePage);
await bookingPage.fillAndConfirmBooking({
eventTypePage,
placeholderText: placedolder,
question: "boolean",
fillText: "Test checkbox question and checkbox group question (only checkbox 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 checkbox Question and Phone Question", () => {
test("Checkbox required and checkbox required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 and checkbox not required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 Question and Long text Question", () => {
test("Checkbox required and Long text required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 and Long text not required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 Question and Multi email Question", () => {
test("Checkbox required and Multi email required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 and Multi email not required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 Question and multiselect Question", () => {
test("Checkbox required and multiselect text required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 and multiselect text not required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 Question and Number Question", () => {
test("Checkbox required and Number required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 and Number not required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 Question and Radio group Question", () => {
test("Checkbox required and Radio group required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 and Radio group not required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 Question and select Question", () => {
test("Checkbox required and select required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 and select not required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 Question and Short text question", () => {
test("Checkbox required and Short text required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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 and Short text not required", async ({ bookingPage }) => {
const placedolder = (await localize("en"))("share_additional_notes");
await bookingPage.addQuestion("boolean", "boolean-test", "boolean 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: placedolder,
question: "boolean",
fillText: "Test checkbox 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);
});
});
});
});

View File

@ -1,7 +1,9 @@
import { expect, type Page } from "@playwright/test";
import dayjs from "@calcom/dayjs";
import { randomString } from "@calcom/lib/random";
import { localize } from "../lib/testUtils";
import type { createUsersFixture } from "./users";
const reschedulePlaceholderText = "Let others know why you need to reschedule";
@ -19,6 +21,8 @@ type BookingOptions = {
isMultiSelect?: boolean;
};
type teamBookingtypes = { isManagedType?: boolean; isRoundRobinType?: boolean; isCollectiveType?: boolean };
interface QuestionActions {
[key: string]: () => Promise<void>;
}
@ -190,8 +194,21 @@ const goToNextMonthIfNoAvailabilities = async (eventTypePage: Page) => {
export function createBookingPageFixture(page: Page) {
return {
goToEventType: async (eventType: string) => {
await page.getByRole("link", { name: eventType }).click();
goToEventType: async (
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) => {
await page.getByTestId(`vertical-tab-${tabName}`).click();
@ -219,8 +236,12 @@ export function createBookingPageFixture(page: Page) {
}
await page.getByTestId("field-add-save").click();
},
updateEventType: async () => {
updateEventType: async (options?: { shouldCheck: boolean; name: string }) => {
await page.getByTestId("update-eventtype").click();
options?.shouldCheck &&
(await expect(
page.getByRole("button", { name: `${options?.name} event type updated successfully` })
).toBeVisible());
},
previewEventType: async () => {
const eventtypePromise = page.waitForEvent("popup");
@ -338,7 +359,13 @@ export function createBookingPageFixture(page: Page) {
await scheduleSuccessfullyPage.waitFor({ state: "visible" });
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();
},
fillAllQuestions: async (eventTypePage: Page, questions: string[], options: BookingOptions) => {
@ -356,5 +383,121 @@ export function createBookingPageFixture(page: Page) {
await scheduleSuccessfullyPage.waitFor({ state: "visible" });
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();
},
};
}