diff --git a/apps/web/playwright/booking/collectiveEventType/questions/collectivePhoneQuestion.e2e.ts b/apps/web/playwright/booking/collectiveEventType/questions/collectivePhoneQuestion.e2e.ts index 5ecf1ab28b..3d5e69831b 100644 --- a/apps/web/playwright/booking/collectiveEventType/questions/collectivePhoneQuestion.e2e.ts +++ b/apps/web/playwright/booking/collectiveEventType/questions/collectivePhoneQuestion.e2e.ts @@ -1,22 +1,23 @@ -import { login } from "../../../fixtures/users"; import { test } from "../../../lib/fixtures"; import { localize } from "../../../lib/testUtils"; -test.beforeAll(async ({ page, bookingPage }) => { - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - await page.goto("/event-types"); - await bookingPage.createTeam("Test Team"); - await bookingPage.createTeamEventType("Test Collective Event Type", { isCollectiveType: true }); -}); - -test.describe("Booking With Phone Question and Each Other Question", async () => { +test.describe("Booking With Phone Question and Each Other Question", () => { const bookingOptions = { hasPlaceholder: true, isRequired: true }; + test.beforeEach(async ({ users, page, bookingPage }) => { + const teamEventTitle = "testevent"; + const userFixture = await users.create({ name: "testuser" }, { hasTeam: true, teamEventTitle }); + await userFixture.apiLogin(); + + await page.goto("/event-types"); + await bookingPage.goToEventType(teamEventTitle); + await bookingPage.goToTab("event_advanced_tab_title"); + }); + test.describe("Booking With Phone Question and Address Question", () => { test("Phone and Address required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await bookingPage.goToTab("event_advanced_tab_title"); await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); await bookingPage.addQuestion("address", "address-test", "address test", true, "address test"); await bookingPage.updateEventType(); @@ -36,17 +37,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Phone required and Address not required", async ({ page, bookingPage }) => { + test("Phone required and Address not required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.editQuestion("address", { shouldBeRequired: false }); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone 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({ @@ -66,18 +62,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => test.describe("Booking With Phone Question and checkbox group Question", () => { const bookingOptions = { hasPlaceholder: false, isRequired: true }; - test("Phone and checkbox group required", async ({ page, bookingPage }) => { + test("Phone and checkbox group required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.removeQuestion("address"); + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", true); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -94,17 +84,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Phone required and checkbox group not required", async ({ page, bookingPage }) => { + test("Phone required and checkbox group not required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.editQuestion("checkbox", { shouldBeRequired: false }); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); + await bookingPage.addQuestion("checkbox", "checkbox-test", "checkbox test", false); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -123,17 +108,11 @@ test.describe("Booking With Phone Question and Each Other Question", async () => }); test.describe("Booking With Phone Question and checkbox Question", () => { - test("Phone and checkbox required", async ({ page, bookingPage }) => { + test("Phone and checkbox required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.removeQuestion("checkbox"); + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", true); - await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); @@ -150,17 +129,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.cancelBooking(eventTypePage); await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Phone required and checkbox not required", async ({ page, bookingPage }) => { + test("Phone required and checkbox not required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.editQuestion("boolean", { shouldBeRequired: false }); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); + await bookingPage.addQuestion("boolean", "boolean-test", "boolean test", false); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -177,18 +151,13 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.assertBookingCanceled(eventTypePage); }); }); - test.describe("Booking With Phone Question and Long Question", () => { - test("Phone and long question required", async ({ page, bookingPage }) => { + + test.describe("Booking With Phone Question and Long text Question", () => { + test("Phone and Long text required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.removeQuestion("boolean"); - await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); + await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", true, "textarea test"); await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); @@ -196,7 +165,7 @@ test.describe("Booking With Phone Question and Each Other Question", async () => eventTypePage, placeholderText: placeholder, question: "phone", - fillText: "Test Phone question and long question question (both required)", + fillText: "Test Phone question and Long Text question (both required)", secondQuestion: "textarea", options: bookingOptions, }); @@ -205,24 +174,20 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.cancelBooking(eventTypePage); await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Phone required and long question not required", async ({ page, bookingPage }) => { + + test("Phone required and Long text not required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.editQuestion("textarea", { shouldBeRequired: false }); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); + await bookingPage.addQuestion("textarea", "textarea-test", "textarea test", false, "textarea test"); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ eventTypePage, placeholderText: placeholder, question: "phone", - fillText: "Test Phone question and long question (only phone required)", + fillText: "Test Phone question and Long Text question (only phone required)", secondQuestion: "textarea", options: { ...bookingOptions, isRequired: false }, }); @@ -235,15 +200,10 @@ test.describe("Booking With Phone Question and Each Other Question", async () => test.describe("Booking With Phone Question and Multi email Question", () => { const bookingOptions = { hasPlaceholder: true, isRequired: true }; - test("Phone and Multi email required", async ({ page, bookingPage }) => { + test("Phone and Multi email required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.removeQuestion("textarea"); + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); await bookingPage.addQuestion( "multiemail", "multiemail-test", @@ -251,7 +211,7 @@ test.describe("Booking With Phone Question and Each Other Question", async () => true, "multiemail test" ); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -268,17 +228,18 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Phone required and Multi email not required", async ({ page, bookingPage }) => { + test("Phone required and Multi email not required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.editQuestion("multiemail", { shouldBeRequired: false }); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); + await bookingPage.addQuestion( + "multiemail", + "multiemail-test", + "multiemail test", + false, + "multiemail test" + ); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -297,25 +258,19 @@ test.describe("Booking With Phone Question and Each Other Question", async () => }); test.describe("Booking With Phone Question and multiselect Question", () => { - test("Phone and multiselect text required", async ({ page, bookingPage }) => { + test("Phone and multiselect text required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.removeQuestion("multiemail"); + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", true); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ eventTypePage, placeholderText: placeholder, question: "phone", - fillText: "Test Phone question and Multi Phone question (both required)", + fillText: "Test Phone question and Multi Select question (both required)", secondQuestion: "multiselect", options: bookingOptions, }); @@ -325,24 +280,19 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Phone required and multiselect text not required", async ({ page, bookingPage }) => { + test("Phone required and multiselect text not required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.editQuestion("multiselect", { shouldBeRequired: false }); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); + await bookingPage.addQuestion("multiselect", "multiselect-test", "multiselect test", false); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ eventTypePage, placeholderText: placeholder, question: "phone", - fillText: "Test Phone question and Multi Phone question (only phone required)", + fillText: "Test Phone question and Multi Select question (only phone required)", secondQuestion: "multiselect", options: { ...bookingOptions, isRequired: false }, }); @@ -354,18 +304,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => }); test.describe("Booking With Phone Question and Number Question", () => { - test("Phone and Number required", async ({ page, bookingPage }) => { + test("Phone and Number required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.removeQuestion("multiselect"); + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); await bookingPage.addQuestion("number", "number-test", "number test", true, "number test"); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -382,17 +326,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Phone required and Number not required", async ({ page, bookingPage }) => { + test("Phone required and Number not required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.editQuestion("number", { shouldBeRequired: false }); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); + await bookingPage.addQuestion("number", "number-test", "number test", false, "number test"); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -411,18 +350,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => }); test.describe("Booking With Phone Question and Radio group Question", () => { - test("Phone and Radio group required", async ({ page, bookingPage }) => { + test("Phone and Radio group required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.removeQuestion("number"); + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); await bookingPage.addQuestion("radio", "radio-test", "radio test", true); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -439,17 +372,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Phone required and Radio group not required", async ({ page, bookingPage }) => { + test("Phone required and Radio group not required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.editQuestion("radio", { shouldBeRequired: false }); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); + await bookingPage.addQuestion("radio", "radio-test", "radio test", false); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -468,18 +396,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => }); test.describe("Booking With Phone Question and select Question", () => { - test("Phone and select required", async ({ page, bookingPage }) => { + test("Phone and select required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.removeQuestion("radio"); await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("select", "select-test", "select test", true, "select test"); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -496,17 +418,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Phone required and select not required", async ({ page, bookingPage }) => { + test("Phone required and select not required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.editQuestion("phone", { shouldBeRequired: false }); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); + await bookingPage.addQuestion("select", "select-test", "select test", false, "select test"); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -525,18 +442,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => }); test.describe("Booking With Phone Question and Short text question", () => { - test("Phone and Short text required", async ({ page, bookingPage }) => { + test("Phone and Short text required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.removeQuestion("phone"); + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); await bookingPage.addQuestion("text", "text-test", "text test", true, "text test"); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -553,17 +464,12 @@ test.describe("Booking With Phone Question and Each Other Question", async () => await bookingPage.assertBookingCanceled(eventTypePage); }); - test("Phone required and Short text not required", async ({ page, bookingPage }) => { + test("Phone required and Short text not required", async ({ bookingPage }) => { const placeholder = (await localize("en"))("share_additional_notes"); - await login({ username: "pro", email: "pro@example.com", password: "pro" }, page); - - await page.goto("/event-types"); - await bookingPage.goToEventType("Test Collective Event Type"); - await bookingPage.goToTab("event_advanced_tab_title"); - await bookingPage.editQuestion("text", { shouldBeRequired: false }); - await bookingPage.updateEventType({ shouldCheck: true, name: "Test Collective Event Type" }); - + await bookingPage.addQuestion("phone", "phone-test", "phone test", true, "phone test"); + await bookingPage.addQuestion("text", "text-test", "text test", false, "text test"); + await bookingPage.updateEventType(); const eventTypePage = await bookingPage.previewEventType(); await bookingPage.selectTimeSlot(eventTypePage); await bookingPage.fillAndConfirmBooking({ @@ -581,3 +487,4 @@ test.describe("Booking With Phone Question and Each Other Question", async () => }); }); }); +