Compare commits

...

8 Commits

Author SHA1 Message Date
gitstart-calcom 748d4f35d0 add changes 2023-11-22 01:10:24 +00:00
gitstart-calcom da8d5126be add changes 2023-11-22 01:05:28 +00:00
gitstart-calcom f82e5f6071 add changes 2023-11-22 00:59:51 +00:00
gitstart-calcom 12567a8291 add changes 2023-11-21 21:58:04 +00:00
gitstart-calcom 88af859a41 add tests 2023-11-21 21:25:41 +00:00
gitstart-calcom b11a6030de test: create a collective event-type and book a meeting 2023-11-21 21:13:13 +00:00
gitstart-calcom 645b12c012 test: create a collective event-type and book a meeting 2023-11-21 21:06:24 +00:00
gitstart-calcom bd55df4e48 test: create a collective event-type and book a meeting 2023-11-21 21:00:14 +00:00
2 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,19 @@
import { loginUser } from "../../fixtures/regularBookings";
import { test } from "../../lib/fixtures";
test.describe("Create Collective Event Type and Create Booking", () => {
test("Create collective Event type and create booking", async ({ page, users, bookingPage }) => {
await loginUser(users);
await page.goto("/event-types");
await bookingPage.createTeam("Team example");
await bookingPage.createTeamEventType("test-collective", { isCollectiveType: true });
const eventTypePage = await bookingPage.previewEventType();
await bookingPage.selectTimeSlot(eventTypePage);
await bookingPage.fillAllQuestions(eventTypePage, [], { includeGuests: true });
await bookingPage.rescheduleBooking(eventTypePage);
await bookingPage.assertBookingRescheduled(eventTypePage);
await bookingPage.cancelBookingWithReason(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";
@ -17,8 +19,11 @@ type BookingOptions = {
isRequired?: boolean;
isAllRequired?: boolean;
isMultiSelect?: boolean;
includeGuests?: boolean;
};
type teamBookingtypes = { isManagedType?: boolean; isRoundRobinType?: boolean; isCollectiveType?: boolean };
interface QuestionActions {
[key: string]: () => Promise<void>;
}
@ -343,7 +348,14 @@ export function createBookingPageFixture(page: Page) {
},
fillAllQuestions: async (eventTypePage: Page, questions: string[], options: BookingOptions) => {
const confirmButton = options.isReschedule ? "confirm-reschedule-button" : "confirm-book-button";
await fillAllQuestions(eventTypePage, questions, options);
if (options?.includeGuests) {
await eventTypePage.getByTestId("add-guests").click();
await eventTypePage.getByPlaceholder("Email").fill("test@example.com");
}
await eventTypePage.getByTestId(confirmButton).click();
await eventTypePage.waitForTimeout(400);
if (await eventTypePage.getByRole("heading", { name: "Could not book the meeting." }).isVisible()) {
@ -356,5 +368,71 @@ 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();
},
};
}