Compare commits
26 Commits
main
...
teste2e-ma
Author | SHA1 | Date | |
---|---|---|---|
|
46ac2e225b | ||
|
f55817465c | ||
|
a6a3ef840e | ||
|
b709b57b7d | ||
|
c38d1d0926 | ||
|
454a2faf61 | ||
|
e05605aa0b | ||
|
f45c20e412 | ||
|
896f5748a9 | ||
|
4c0f53b204 | ||
|
2592e72dce | ||
|
306cea4b5d | ||
|
07bb118d57 | ||
|
883b568615 | ||
|
d18b64a289 | ||
|
246467ee6c | ||
|
dbd298f9a8 | ||
|
202c1f61a5 | ||
|
0d92b29754 | ||
|
ee281bd961 | ||
|
e3fe065296 | ||
|
d88e1e6697 | ||
|
0a76588345 | ||
|
635140bd73 | ||
|
e1b29e3bd5 | ||
|
7f7afe6c54 |
|
@ -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();
|
||||
|
|
|
@ -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" });
|
||||
});
|
||||
});
|
|
@ -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();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user