fix: display organizer location after booking (#12088)
Co-authored-by: Hariom Balhara <[email protected]>
This commit is contained in:
1 parent
63f2f6edba
commit
621f7639ff
5 files changed
+132
-14
No files matched your search
@@ -254,6 +254,87 @@ test.describe("Event Types tests", () => {
|
||||
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||
await expect(page.locator("[data-testid=where]")).toHaveText(/Cal Video/);
|
||||
});
|
||||
|
||||
test("can add single organizer address location without display location public option", async ({
|
||||
page,
|
||||
}) => {
|
||||
const $eventTypes = page.locator("[data-testid=event-types] > li a");
|
||||
const firstEventTypeElement = $eventTypes.first();
|
||||
await firstEventTypeElement.click();
|
||||
await page.waitForURL((url) => {
|
||||
return !!url.pathname.match(/\/event-types\/.+/);
|
||||
});
|
||||
|
||||
const locationAddress = "New Delhi";
|
||||
|
||||
await fillLocation(page, locationAddress, 0, false);
|
||||
await page.locator("[data-testid=update-eventtype]").click();
|
||||
|
||||
await page.goto("/event-types");
|
||||
|
||||
const previewLink = await page
|
||||
.locator("[data-testid=preview-link-button]")
|
||||
.first()
|
||||
.getAttribute("href");
|
||||
|
||||
await page.goto(previewLink ?? "");
|
||||
await selectFirstAvailableTimeSlotNextMonth(page);
|
||||
await bookTimeSlot(page);
|
||||
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
|
||||
await expect(page.locator(`[data-testid="where"]`)).toHaveText(locationAddress);
|
||||
});
|
||||
|
||||
test("can select 'display on booking page' option when multiple organizer input type are present", async ({
|
||||
page,
|
||||
}) => {
|
||||
await gotoFirstEventType(page);
|
||||
|
||||
await page.locator("#location-select").click();
|
||||
await page.locator(`text="Link meeting"`).click();
|
||||
|
||||
const locationInputName = (idx: number) => `locations[${idx}].link`;
|
||||
|
||||
const testUrl1 = "https://cal.ai/";
|
||||
await page.locator(`input[name="${locationInputName(0)}"]`).fill(testUrl1);
|
||||
await page.locator("[data-testid=display-location]").last().check();
|
||||
await checkDisplayLocation(page);
|
||||
await unCheckDisplayLocation(page);
|
||||
|
||||
await page.locator("[data-testid=add-location]").click();
|
||||
|
||||
const testUrl2 = "https://cal.com/ai";
|
||||
await page.locator(`text="Link meeting"`).last().click();
|
||||
await page.locator(`input[name="${locationInputName(1)}"]`).waitFor();
|
||||
await page.locator(`input[name="${locationInputName(1)}"]`).fill(testUrl2);
|
||||
await checkDisplayLocation(page);
|
||||
await unCheckDisplayLocation(page);
|
||||
|
||||
// Remove Both of the locations
|
||||
const removeButtomId = "delete-locations.0.type";
|
||||
await page.getByTestId(removeButtomId).click();
|
||||
await page.getByTestId(removeButtomId).click();
|
||||
|
||||
// Add Multiple Organizer Phone Number options
|
||||
await page.locator("#location-select").click();
|
||||
await page.locator(`text="Organizer Phone Number"`).click();
|
||||
|
||||
const organizerPhoneNumberInputName = (idx: number) => `locations[${idx}].hostPhoneNumber`;
|
||||
|
||||
const testPhoneInputValue1 = "9199999999";
|
||||
await page.locator(`input[name="${organizerPhoneNumberInputName(0)}"]`).waitFor();
|
||||
await page.locator(`input[name="${organizerPhoneNumberInputName(0)}"]`).fill(testPhoneInputValue1);
|
||||
await page.locator("[data-testid=display-location]").last().check();
|
||||
await checkDisplayLocation(page);
|
||||
await unCheckDisplayLocation(page);
|
||||
await page.locator("[data-testid=add-location]").click();
|
||||
|
||||
const testPhoneInputValue2 = "9188888888";
|
||||
await page.locator(`text="Organizer Phone Number"`).last().click();
|
||||
await page.locator(`input[name="${organizerPhoneNumberInputName(1)}"]`).waitFor();
|
||||
await page.locator(`input[name="${organizerPhoneNumberInputName(1)}"]`).fill(testPhoneInputValue2);
|
||||
await checkDisplayLocation(page);
|
||||
await unCheckDisplayLocation(page);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -293,7 +374,7 @@ async function addAnotherLocation(page: Page, locationOptionText: string) {
|
||||
await page.locator(`text="${locationOptionText}"`).click();
|
||||
}
|
||||
|
||||
const fillLocation = async (page: Page, inputText: string, index: number) => {
|
||||
const fillLocation = async (page: Page, inputText: string, index: number, selectDisplayLocation = true) => {
|
||||
// Except the first location, dropdown automatically opens when adding another location
|
||||
if (index == 0) {
|
||||
await page.locator("#location-select").last().click();
|
||||
@@ -303,5 +384,17 @@ const fillLocation = async (page: Page, inputText: string, index: number) => {
|
||||
const locationInputName = `locations[${index}].address`;
|
||||
await page.locator(`input[name="${locationInputName}"]`).waitFor();
|
||||
await page.locator(`input[name="locations[${index}].address"]`).fill(inputText);
|
||||
if (selectDisplayLocation) {
|
||||
await page.locator("[data-testid=display-location]").last().check();
|
||||
}
|
||||
};
|
||||
|
||||
const checkDisplayLocation = async (page: Page) => {
|
||||
await page.locator("[data-testid=display-location]").last().check();
|
||||
await expect(page.locator("[data-testid=display-location]").last()).toBeChecked();
|
||||
};
|
||||
|
||||
const unCheckDisplayLocation = async (page: Page) => {
|
||||
await page.locator("[data-testid=display-location]").last().uncheck();
|
||||
await expect(page.locator("[data-testid=display-location]").last()).toBeChecked({ checked: false });
|
||||
};
|
||||
Reference in new issue
Block a user