Compare commits

...

11 Commits

Author SHA1 Message Date
gitstart-calcom 9a75db06ca add changes 2024-01-12 00:00:07 +00:00
gitstart-calcom 842f754d3a Merge commit '9c1e1d7312d028de93983f896dd08fe5c3a3ab6b' into teste2e-bookCollective 2024-01-11 23:59:40 +00:00
GitStart-Cal.com e1949e7c35
Merge branch 'main' into teste2e-bookCollective 2024-01-10 07:50:43 +05:45
GitStart-Cal.com d2f7f98ffc
Merge branch 'main' into teste2e-bookCollective 2024-01-09 17:35:13 +05:45
gitstart-calcom 99285079c7 add localize / refactor 2023-11-28 19:38:45 +00:00
gitstart-calcom 717e60b9dc Merge commit 'f19a1926b452bb6934d7887bbad3a42f9b7f5344' into teste2e-bookCollective 2023-11-28 19:38:17 +00:00
gitstart-calcom 8c9f4feac3 refactor 2023-11-28 17:49:37 +00:00
gitstart-calcom da3b51c974 Merge commit '20f17903b9efef194d6846616bab4e67d5fc1a59' into teste2e-bookCollective 2023-11-28 17:49:08 +00:00
GitStart-Cal.com ce0586d560
Merge branch 'main' into teste2e-bookCollective 2023-11-28 19:26:40 +05:45
Keith Williams 1a74403f25
Merge branch 'main' into teste2e-bookCollective 2023-11-28 09:45:01 -03:00
gitstart-calcom e7a3b7cc02 Add tests for book a collective meeting 2023-11-27 22:53:14 +00:00
5 changed files with 206 additions and 48 deletions

View File

@ -0,0 +1,63 @@
import { randomString } from "@calcom/lib/random";
import { loginUser } from "../../fixtures/regularBookings";
import { test } from "../../lib/fixtures";
import { localize } from "../../lib/testUtils";
test.describe("Create a Team, a Collective Event Type and Book a Meeting", () => {
test.beforeEach(async ({ page, users }) => {
await loginUser(users);
await page.goto("/event-types");
});
test("Create Collective Event type and Book a Meeting", async ({ bookingPage }) => {
const teamName = `Team example-${randomString(3)}`;
const backToBookingsText = (await localize("en"))("back_to_bookings");
await bookingPage.createTeam(teamName);
await bookingPage.createTeamEventType("test-collective", { isCollectiveType: true });
const eventTypePage = await bookingPage.previewEventType();
await bookingPage.selectTimeSlot(eventTypePage);
await bookingPage.confirmBooking(eventTypePage);
await bookingPage.goToPage(backToBookingsText, eventTypePage);
await bookingPage.assertLabelWithCorrectTeamName(eventTypePage, teamName);
await bookingPage.assertBookingWithCorrectTitleAndDescription(eventTypePage, {
profileName: "testuser",
bookingName: "test-collective",
teamName: teamName,
});
await bookingPage.clickOnBooking(eventTypePage, teamName);
await bookingPage.rescheduleBooking(eventTypePage);
await bookingPage.assertBookingRescheduled(eventTypePage);
await bookingPage.cancelBookingWithReason(eventTypePage);
await bookingPage.assertBookingCanceled(eventTypePage);
});
test("Create Collective Event type and Book a Meeting (with added guest)", async ({ bookingPage }) => {
const teamName = `Team example-${randomString(3)}`;
const backToBookingsText = (await localize("en"))("back_to_bookings");
await bookingPage.createTeam(teamName);
await bookingPage.createTeamEventType("test-collective", { isCollectiveType: true });
const eventTypePage = await bookingPage.previewEventType();
await bookingPage.selectTimeSlot(eventTypePage);
await bookingPage.addGuests(eventTypePage, { guests: ["test@example.com"] });
await bookingPage.confirmBooking(eventTypePage);
await bookingPage.goToPage(backToBookingsText, eventTypePage);
await bookingPage.assertLabelWithCorrectTeamName(eventTypePage, teamName);
await bookingPage.assertBookingWithCorrectTitleAndDescription(eventTypePage, {
profileName: "testuser",
bookingName: "test-collective",
teamName: teamName,
aditionalGuestEmail: "test@example.com",
});
await bookingPage.clickOnBooking(eventTypePage, teamName);
await bookingPage.rescheduleBooking(eventTypePage);
await bookingPage.assertBookingRescheduled(eventTypePage);
await bookingPage.cancelBookingWithReason(eventTypePage);
await bookingPage.assertBookingCanceled(eventTypePage);
});
});

View File

@ -9,48 +9,50 @@ test.describe("Booking With Long Text Question and Each Other Question", () => {
await page.goto("/event-types");
});
test("Long Text and Address required", async ({ bookingPage }) => {
await bookingPage.goToEventType("30 min");
await bookingPage.goToTab("event_advanced_tab_title");
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: "Please share anything that will help prepare for our meeting.",
question: "textarea",
fillText: "Test Long Text question and Address question (both required)",
secondQuestion: "address",
options: bookingOptions,
test.describe("Booking With Long Text Question and Address Question", () => {
test("Long Text and Address required", async ({ bookingPage }) => {
await bookingPage.goToEventType("30 min");
await bookingPage.goToTab("event_advanced_tab_title");
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: "Please share anything that will help prepare for our meeting.",
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);
});
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 }) => {
await bookingPage.goToEventType("30 min");
await bookingPage.goToTab("event_advanced_tab_title");
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: "Please share anything that will help prepare for our meeting.",
question: "textarea",
fillText: "Test Long Text question and Address question (only Long Text required)",
secondQuestion: "address",
options: { ...bookingOptions, isRequired: false },
test("Long Text required and Address not required", async ({ bookingPage }) => {
await bookingPage.goToEventType("30 min");
await bookingPage.goToTab("event_advanced_tab_title");
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: "Please share anything that will help prepare for our meeting.",
question: "textarea",
fillText: "Test Long Text question and Address question (only Long Text required)",
secondQuestion: "address",
options: { ...bookingOptions, isRequired: false },
});
await bookingPage.rescheduleBooking(eventTypePage);
await bookingPage.assertBookingRescheduled(eventTypePage);
await bookingPage.cancelBooking(eventTypePage);
await bookingPage.assertBookingCanceled(eventTypePage);
});
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", () => {

View File

@ -24,6 +24,8 @@ interface QuestionActions {
[key: string]: () => Promise<void>;
}
type teamBookingtypes = { isManagedType?: boolean; isRoundRobinType?: boolean; isCollectiveType?: boolean };
type customLocators = {
shouldChangeSelectLocator: boolean;
shouldUseLastRadioGroupLocator: boolean;
@ -195,6 +197,9 @@ export function createBookingPageFixture(page: Page) {
goToEventType: async (eventType: string) => {
await page.getByRole("link", { name: eventType }).click();
},
goToPage: async (pageName: string, page: Page) => {
await page.getByRole("link", { name: pageName }).click();
},
goToTab: async (tabName: string) => {
await page.getByTestId(`vertical-tab-${tabName}`).click();
},
@ -376,16 +381,103 @@ export function createBookingPageFixture(page: Page) {
const confirmButton = options.isReschedule ? "confirm-reschedule-button" : "confirm-book-button";
await fillAllQuestions(eventTypePage, questions, options);
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 fillAllQuestions(eventTypePage, questions, options);
await eventTypePage.getByTestId(confirmButton).click();
}
const scheduleSuccessfullyPage = eventTypePage.getByText(scheduleSuccessfullyText);
await scheduleSuccessfullyPage.waitFor({ state: "visible" });
await expect(scheduleSuccessfullyPage).toBeVisible();
},
addGuests: async (eventTypePage: Page, options: { guests: string[] }) => {
await eventTypePage.getByTestId("add-guests").click();
for (const guest of options.guests) {
await eventTypePage.getByPlaceholder("Email").fill(guest);
}
},
createTeam: async (name: string) => {
await page.getByTestId("teams-test").click();
await page.getByTestId("new-team-btn").click();
await page.getByPlaceholder("Acme Inc.").click();
await page.getByPlaceholder("Acme Inc.").fill(name);
await page.getByTestId("continue-button").click();
await page.getByTestId("publish-button").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();
},
assertLabelWithCorrectTeamName: async (page: Page, teamName: string) => {
await expect(page.getByRole("link", { name: teamName }).first()).toBeVisible();
},
assertBookingWithCorrectTitleAndDescription: async (
page: Page,
options: { profileName: string; bookingName: string; teamName: string; aditionalGuestEmail?: string }
) => {
options.aditionalGuestEmail
? await expect(
page.getByRole("link", {
name: `${options.bookingName} between ${options.teamName} and ${options.profileName} You , ${options.profileName} and ${options.aditionalGuestEmail}`,
})
).toBeVisible()
: await expect(
page.getByRole("link", {
name: `${options.bookingName} between ${options.teamName} and ${options.profileName} You and ${options.profileName}`,
})
).toBeVisible();
},
confirmBooking: async (page?: Page) => {
await page?.getByTestId("confirm-book-button").click();
},
clickOnBooking: async (page: Page, teamName: string) => {
await page.getByRole("link", { name: teamName }).first().click();
},
};
}

View File

@ -157,7 +157,8 @@ export const CreateANewTeamForm = () => {
color="primary"
EndIcon={ArrowRight}
type="submit"
className="w-full justify-center">
className="w-full justify-center"
data-testid="continue-button">
{t(flag.submitLabel)}
</Button>
</div>

View File

@ -736,7 +736,7 @@ const NavigationItem: React.FC<{
/>
)}
{isLocaleReady ? (
<span className="hidden w-full justify-between lg:flex">
<span className="hidden w-full justify-between lg:flex" data-testid={`${item.name}-test`}>
<div className="flex">{t(item.name)}</div>
{item.badge && item.badge}
</span>