From 8359259cb68b91d4d509e84087af61582e383521 Mon Sep 17 00:00:00 2001 From: gitstart-calcom Date: Mon, 30 Oct 2023 18:45:12 +0000 Subject: [PATCH] FIx failing tests --- .../booking/radioGroupQuestion.e2e.ts | 18 +++++++++--------- .../web/playwright/fixtures/regularBookings.ts | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/apps/web/playwright/booking/radioGroupQuestion.e2e.ts b/apps/web/playwright/booking/radioGroupQuestion.e2e.ts index 57bb80e65e..6f6ef77e1a 100644 --- a/apps/web/playwright/booking/radioGroupQuestion.e2e.ts +++ b/apps/web/playwright/booking/radioGroupQuestion.e2e.ts @@ -315,10 +315,10 @@ test.describe("Booking With Radio Question and Each Other Question", () => { }); }); - test.describe("Booking With Radio Question and Radio group Question", () => { - test("Radio required and Radio group required", async ({ bookingPage }) => { - await bookingPage.addQuestion("radio", "radio-test", "radio test", true); + test.describe("Booking With Radio Question and Phone Question", () => { + test("Radio required and Phone required", async ({ bookingPage }) => { await bookingPage.addQuestion("radio", "radio-test", "radio 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); @@ -326,8 +326,8 @@ test.describe("Booking With Radio Question and Each Other Question", () => { eventTypePage, placeholderText: "Please share anything that will help prepare for our meeting.", question: "radio", - fillText: "Test Radio question and Radio question (both required)", - secondQuestion: "radio", + fillText: "Test Radio question and Phone question (both required)", + secondQuestion: "phone", options: bookingOptions, }); await bookingPage.rescheduleBooking(eventTypePage); @@ -336,9 +336,9 @@ test.describe("Booking With Radio Question and Each Other Question", () => { await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Radio and Radio group not required", async ({ bookingPage }) => { + test("Radio and Phone not required", async ({ bookingPage }) => { await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.addQuestion("radio", "radio-test", "radio test", false); + await bookingPage.addQuestion("phone", "phone-test", "phone test", false, "phone test"); await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); @@ -346,8 +346,8 @@ test.describe("Booking With Radio Question and Each Other Question", () => { eventTypePage, placeholderText: "Please share anything that will help prepare for our meeting.", question: "radio", - fillText: "Test Radio question and Radio question (only radio required)", - secondQuestion: "radio", + fillText: "Test Radio question and Phone question (only radio required)", + secondQuestion: "phone", options: { ...bookingOptions, isRequired: false }, }); await bookingPage.rescheduleBooking(eventTypePage); diff --git a/apps/web/playwright/fixtures/regularBookings.ts b/apps/web/playwright/fixtures/regularBookings.ts index 5bd9d80c3a..ecf00c7d48 100644 --- a/apps/web/playwright/fixtures/regularBookings.ts +++ b/apps/web/playwright/fixtures/regularBookings.ts @@ -170,6 +170,7 @@ export function createBookingPageFixture(page: Page) { selectFirstAvailableTime: async () => { await page.getByTestId("time").first().click(); }, + fillRescheduleReasonAndConfirm: async () => { await page.getByPlaceholder(reschedulePlaceholderText).click(); await page.getByPlaceholder(reschedulePlaceholderText).fill("Test reschedule"); @@ -194,6 +195,14 @@ 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(100); + 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) => { @@ -248,6 +257,14 @@ export function createBookingPageFixture(page: Page) { options.isRequired && (await fillQuestion(eventTypePage, secondQuestion, customLocators)); await eventTypePage.getByTestId(confirmButton).click(); + await eventTypePage.waitForTimeout(100); + 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();