Compare commits

...

26 Commits

Author SHA1 Message Date
GitStart-Cal.com 46ac2e225b
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2024-01-09 17:24:12 +05:45
GitStart-Cal.com f55817465c
refactor 2023-11-29 18:24:06 -03:00
GitStart-Cal.com a6a3ef840e
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-11-30 00:46:57 +05:45
gitstart-calcom b709b57b7d Refactor 2023-11-29 18:01:30 +00:00
gitstart-calcom c38d1d0926 Merge commit 'ea8437b4f7855e2e644b560ae4b9a104362222da' into teste2e-managedMultiSelectQuestion 2023-11-29 18:01:03 +00:00
GitStart-Cal.com 454a2faf61
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-11-29 23:42:23 +05:45
GitStart-Cal.com e05605aa0b
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-11-29 22:09:17 +05:45
GitStart-Cal.com f45c20e412
Delete apps/web/playwright/managedBooking/allQuestions.e2e.ts 2023-11-28 18:20:48 -03:00
gitstart-calcom 896f5748a9 Refactor 2023-11-28 20:50:01 +00:00
GitStart-Cal.com 4c0f53b204
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-11-29 01:25:07 +05:45
GitStart-Cal.com 2592e72dce
fix lint error 2023-11-23 15:45:14 -03:00
Morgan 306cea4b5d
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-11-03 18:25:19 +02:00
GitStart-Cal.com 07bb118d57
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-11-03 17:57:32 +05:45
GitStart-Cal.com 883b568615
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-11-03 05:50:17 +05:45
Peer Richelsen d18b64a289
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-11-02 19:35:44 +00:00
GitStart-Cal.com 246467ee6c
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-11-02 16:02:37 +05:45
GitStart-Cal.com dbd298f9a8
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-11-01 02:38:50 +05:45
GitStart-Cal.com 202c1f61a5
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-10-31 01:14:08 +05:45
GitStart-Cal.com 0d92b29754
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-10-30 20:52:09 +05:45
GitStart-Cal.com ee281bd961
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-10-30 14:25:44 +05:45
Udit Takkar e3fe065296
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-10-27 14:21:56 +05:30
GitStart-Cal.com d88e1e6697
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-10-26 13:43:36 +00:00
GitStart-Cal.com 0a76588345
Merge branch 'main' into teste2e-managedMultiSelectQuestion 2023-10-25 23:22:12 +00:00
gitstart-calcom 635140bd73 FIx failing tests 2023-10-25 23:21:03 +00:00
gitstart-calcom e1b29e3bd5 Merge commit 'c7b1e4dfa1d50514217572aa95130dbe82b4c3d9' into teste2e-managedMultiSelectQuestion 2023-10-25 23:20:26 +00:00
gitstart-calcom 7f7afe6c54 Add tests for managed event type 2023-10-25 21:39:28 +00:00
3 changed files with 216 additions and 21 deletions

View File

@ -91,7 +91,7 @@ test.describe("Booking With All Questions", () => {
} else {
await bookingPage.addQuestion(question, `${question}-test`, `${question} test`, false);
}
await bookingPage.checkField(question);
await bookingPage.checkField(question, { isOptional: true });
}
await bookingPage.updateEventType();

View File

@ -0,0 +1,79 @@
/* eslint-disable playwright/no-conditional-in-test */
import { test } from "../lib/fixtures";
test.describe("Managed Booking With All Questions", () => {
test.beforeEach(async ({ page, users, bookingPage }) => {
const teamEventTitle = "testevent";
const userFixture = await users.create({ name: "testuser" }, { hasTeam: true, teamEventTitle });
await userFixture.apiLogin();
await page.goto("/event-types");
await bookingPage.createTeamEventType("Test Managed Event Type", { isManagedType: true });
await bookingPage.goToTab("event_advanced_tab_title");
});
const allQuestions = [
"phone",
"address",
"checkbox",
"boolean",
"textarea",
"multiemail",
"multiselect",
"number",
"radio",
"select",
"text",
];
test("Selecting and filling all questions as required (Managed Event)", async ({ bookingPage }) => {
for (const question of allQuestions) {
if (
question !== "number" &&
question !== "select" &&
question !== "checkbox" &&
question !== "boolean" &&
question !== "multiselect" &&
question !== "radio"
) {
await bookingPage.addQuestion(
question,
`${question}-test`,
`${question} test`,
true,
`${question} test`
);
} else {
await bookingPage.addQuestion(question, `${question}-test`, `${question} test`, true);
}
await bookingPage.checkField(question);
}
await bookingPage.updateEventType({ shouldCheck: true, name: "Test Managed Event Type" });
});
test("Selecting and filling all questions as optional (Managed Event)", async ({ bookingPage }) => {
for (const question of allQuestions) {
if (
question !== "number" &&
question !== "select" &&
question !== "checkbox" &&
question !== "boolean" &&
question !== "multiselect" &&
question !== "radio"
) {
await bookingPage.addQuestion(
question,
`${question}-test`,
`${question} test`,
false,
`${question} test`
);
} else {
await bookingPage.addQuestion(question, `${question}-test`, `${question} test`, false);
}
await bookingPage.checkField(question, { isOptional: true });
}
await bookingPage.updateEventType({ shouldCheck: true, name: "Test Managed Event Type" });
});
});

View File

@ -1,6 +1,7 @@
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";
@ -20,6 +21,8 @@ type BookingOptions = {
isMultiSelect?: boolean;
};
type teamBookingtypes = { isManagedType?: boolean; isRoundRobinType?: boolean; isCollectiveType?: boolean };
interface QuestionActions {
[key: string]: () => Promise<void>;
}
@ -192,8 +195,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();
@ -238,8 +254,12 @@ export function createBookingPageFixture(page: Page) {
.getByRole("spinbutton")
.fill(maxEvents);
},
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");
@ -291,14 +311,6 @@ export function createBookingPageFixture(page: Page) {
await eventTypePage.getByPlaceholder(reschedulePlaceholderText).click();
await eventTypePage.getByPlaceholder(reschedulePlaceholderText).fill("Test reschedule");
await eventTypePage.getByTestId("confirm-reschedule-button").click();
await eventTypePage.waitForTimeout(400);
if (
await eventTypePage.getByRole("heading", { name: "Could not reschedule the meeting." }).isVisible()
) {
await eventTypePage.getByTestId("back").click();
await eventTypePage.getByTestId("time").last().click();
await eventTypePage.getByTestId("confirm-reschedule-button").click();
}
},
assertBookingRescheduled: async (page: Page) => {
@ -357,19 +369,17 @@ export function createBookingPageFixture(page: Page) {
options.isRequired && (await fillQuestion(eventTypePage, secondQuestion, customLocators));
await eventTypePage.getByTestId(confirmButton).click();
await eventTypePage.waitForTimeout(400);
if (await eventTypePage.getByRole("heading", { name: "Could not book the meeting." }).isVisible()) {
await eventTypePage.getByTestId("back").click();
await eventTypePage.getByTestId("time").last().click();
await fillQuestion(eventTypePage, question, customLocators);
options.isRequired && (await fillQuestion(eventTypePage, secondQuestion, customLocators));
await eventTypePage.getByTestId(confirmButton).click();
}
const scheduleSuccessfullyPage = eventTypePage.getByText(scheduleSuccessfullyText);
await scheduleSuccessfullyPage.waitFor({ state: "visible" });
await expect(scheduleSuccessfullyPage).toBeVisible();
},
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) => {
@ -387,5 +397,111 @@ 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"))("confirm_delete_event_type");
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();
},
};
}