feat: app install flow followup (#15193)

Co-authored-by: Joe Au-Yeung <[email protected]>
Co-authored-by: Omar López <[email protected]>
Co-authored-by: Joe Au-Yeung <[email protected]>
This commit is contained in:
authored and GitHub committed 2024-07-08 19:15:57 +02:00
1 parent 7d8cb7d6bb
commit f1b4d7d9e0
57 files changed
+1471 -1224

No files matched your search

@@ -5,39 +5,41 @@ const ALL_APPS = ["fathom", "matomo", "plausible", "ga4", "gtm", "metapixel"];
test.describe.configure({ mode: "parallel" });
test.afterEach(({ users }) => users.deleteAll());
test.describe("Check analytics Apps ", () => {
test("Check analytics Apps by skipping the configure step", async ({ appsPage, page, users }) => {
const user = await users.create();
await user.apiLogin();
await page.goto("/apps/");
await appsPage.goToAppsCategory("analytics");
for (const app of ALL_APPS) {
await appsPage.installAppSkipConfigure(app);
await appsPage.goBackToAppsPage();
}
await page.goto("/event-types");
await appsPage.goToEventType("30 min");
await appsPage.goToAppsTab();
await appsPage.verifyAppsInfo(0);
for (const app of ALL_APPS) {
await appsPage.activeApp(app);
}
await appsPage.verifyAppsInfo(6);
test.describe("check analytics Apps", () => {
test.describe("check analytics apps by skipping the configure step", () => {
ALL_APPS.forEach((app) => {
test(`check analytics app: ${app} by skipping the configure step`, async ({
appsPage,
page,
users,
}) => {
const user = await users.create();
await user.apiLogin();
await page.goto("apps/categories/analytics");
await appsPage.installAnalyticsAppSkipConfigure(app);
await page.goto("/event-types");
await appsPage.goToEventType("30 min");
await appsPage.goToAppsTab();
await appsPage.verifyAppsInfo(0);
await appsPage.activeApp(app);
await appsPage.verifyAppsInfo(1);
});
});
});
test("Check analytics Apps using the new flow", async ({ appsPage, page, users }) => {
const user = await users.create();
await user.apiLogin();
const eventTypes = await user.getUserEventsAsOwner();
const eventTypesIds = eventTypes.map((item) => item.id);
for (const app of ALL_APPS) {
await page.goto("/apps/categories/analytics");
await appsPage.installApp(app, eventTypesIds);
}
for (const id of eventTypesIds) {
await appsPage.verifyAppsInfoNew(ALL_APPS, id);
}
test.describe("check analytics apps using the new flow", () => {
ALL_APPS.forEach((app) => {
test(`check analytics app: ${app}`, async ({ appsPage, page, users }) => {
const user = await users.create();
await user.apiLogin();
const eventTypes = await user.getUserEventsAsOwner();
const eventTypesIds = eventTypes.map((item) => item.id);
await page.goto("/apps/categories/analytics");
await appsPage.installAnalyticsApp(app, eventTypesIds);
for (const id of eventTypesIds) {
await appsPage.verifyAppsInfoNew(app, id);
}
});
});
});
});
@@ -0,0 +1,146 @@
import { test } from "../../lib/fixtures";
export type TApp = {
slug: string;
type: string;
organizerInputPlaceholder?: string;
label: string;
};
type TAllApps = {
[key: string]: TApp;
};
const ALL_APPS: TAllApps = {
around: {
slug: "around",
type: "integrations:around_video",
organizerInputPlaceholder: "https://www.around.co/rick",
label: "Around Video",
},
campfire: {
slug: "campfire",
type: "integrations:campfire_video",
organizerInputPlaceholder: "https://party.campfire.to/your-team",
label: "Campfire",
},
demodesk: {
slug: "demodesk",
type: "integrations:demodesk_video",
organizerInputPlaceholder: "https://demodesk.com/meet/mylink",
label: "Demodesk",
},
discord: {
slug: "discord",
type: "integrations:discord_video",
organizerInputPlaceholder: "https://discord.gg/420gg69",
label: "Discord",
},
eightxeight: {
slug: "eightxeight",
type: "integrations:eightxeight_video",
organizerInputPlaceholder: "https://8x8.vc/company",
label: "8x8",
},
"element-call": {
slug: "element-call",
type: "integrations:element-call_video",
organizerInputPlaceholder: "https://call.element.io/",
label: "Element Call",
},
facetime: {
slug: "facetime",
type: "integrations:facetime_video",
organizerInputPlaceholder: "https://facetime.apple.com/join=#v=1&p=zU9w7QzuEe",
label: "Facetime",
},
mirotalk: {
slug: "mirotalk",
type: "integrations:mirotalk_video",
organizerInputPlaceholder: "https://p2p.mirotalk.com/join/80085ShinyPhone",
label: "Mirotalk",
},
ping: {
slug: "ping",
type: "integrations:ping_video",
organizerInputPlaceholder: "https://www.ping.gg/call/theo",
label: "Ping.gg",
},
riverside: {
slug: "riverside",
type: "integrations:riverside_video",
organizerInputPlaceholder: "https://riverside.fm/studio/abc123",
label: "Riverside Video",
},
roam: {
slug: "roam",
type: "integrations:roam_video",
organizerInputPlaceholder: "https://ro.am/r/#/p/yHwFBQrRTMuptqKYo_wu8A/huzRiHnR-np4RGYKV-c0pQ",
label: "Roam",
},
salesroom: {
slug: "salesroom",
type: "integrations:salesroom_video",
organizerInputPlaceholder: "https://user.sr.chat",
label: "Salesroom",
},
sirius_video: {
slug: "sirius_video",
type: "integrations:sirius_video_video",
organizerInputPlaceholder: "https://sirius.video/sebastian",
label: "Sirius Video",
},
whereby: {
slug: "whereby",
type: "integrations:whereby_video",
label: "Whereby Video",
organizerInputPlaceholder: "https://www.whereby.com/cal",
},
};
const ALL_APPS_ARRAY: TApp[] = Object.values(ALL_APPS);
/**
* @todo add tests for
* shimmervideo
* sylapsvideo
* googlevideo
* huddle
* jelly
* jistivideo
* office365video
* mirotalk
* tandemvideo
* webex
* zoomvideo
*/
test.describe.configure({ mode: "parallel" });
test.afterEach(({ users }) => users.deleteAll());
test.describe("check non-oAuth link-based conferencing apps", () => {
ALL_APPS_ARRAY.forEach((app) => {
test(`check conferencing app: ${app.slug} by skipping the configure step`, async ({
appsPage,
page,
users,
}) => {
const user = await users.create();
await user.apiLogin();
await page.goto("apps/categories/conferencing");
await appsPage.installConferencingAppSkipConfigure(app.slug);
await appsPage.verifyConferencingApp(app);
});
});
});
test.describe("check non-oAuth link-based conferencing apps using the new flow", () => {
ALL_APPS_ARRAY.forEach((app) => {
test(`can add ${app.slug} app and book with it`, async ({ appsPage, page, users }) => {
const user = await users.create();
await user.apiLogin();
const eventTypes = await user.getUserEventsAsOwner();
const eventTypeIds = eventTypes.map((item) => item.id).filter((item, index) => index < 2);
await appsPage.installConferencingAppNewFlow(app, eventTypeIds);
await appsPage.verifyConferencingAppNew(app, eventTypeIds);
});
});
});
+11 -23
View File
@@ -6,7 +6,14 @@ import { randomString } from "@calcom/lib/random";
import { test } from "./lib/fixtures";
import { testBothFutureAndLegacyRoutes } from "./lib/future-legacy-routes";
import { bookTimeSlot, createNewEventType, selectFirstAvailableTimeSlotNextMonth } from "./lib/testUtils";
import {
bookTimeSlot,
createNewEventType,
gotoBookingPage,
gotoFirstEventType,
saveEventType,
selectFirstAvailableTimeSlotNextMonth,
} from "./lib/testUtils";
test.describe.configure({ mode: "parallel" });
@@ -335,11 +342,11 @@ testBothFutureAndLegacyRoutes.describe("Event Types tests", () => {
// Remove Both of the locations
const removeButtomId = "delete-locations.0.type";
await page.getByTestId(removeButtomId).click();
await page.getByTestId(removeButtomId).click();
await page.getByTestId(removeButtomId).nth(0).click();
await page.getByTestId(removeButtomId).nth(0).click();
// Add Multiple Organizer Phone Number options
await page.getByTestId("location-select").click();
await page.getByTestId("location-select").last().click();
await page.locator(`text="Organizer Phone Number"`).click();
const organizerPhoneNumberInputName = (idx: number) => `locations[${idx}].hostPhoneNumber`;
@@ -369,25 +376,6 @@ const selectAttendeePhoneNumber = async (page: Page) => {
await page.locator(`text=${locationOptionText}`).click();
};
async function gotoFirstEventType(page: 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\/.+/);
});
}
async function saveEventType(page: Page) {
await page.locator("[data-testid=update-eventtype]").click();
}
async function gotoBookingPage(page: Page) {
const previewLink = await page.locator("[data-testid=preview-button]").getAttribute("href");
await page.goto(previewLink ?? "");
}
/**
* Adds n+1 location to the event type
*/
+87 -30
View File
@@ -1,7 +1,13 @@
import { expect, type Page } from "@playwright/test";
import { appStoreMetadata } from "@calcom/app-store/appStoreMetaData";
import { shouldRedirectToAppOnboarding } from "@calcom/lib/apps/shouldRedirectToAppOnboarding";
import type { TApp } from "../apps/conferencing/conferencingApps.e2e";
import {
bookTimeSlot,
gotoBookingPage,
gotoFirstEventType,
saveEventType,
selectFirstAvailableTimeSlotNextMonth,
} from "../lib/testUtils";
export function createAppsFixture(page: Page) {
return {
@@ -9,39 +15,92 @@ export function createAppsFixture(page: Page) {
await page.getByTestId(`app-store-category-${category}`).nth(1).click();
await page.goto("apps/categories/analytics");
},
installAppSkipConfigure: async (app: string) => {
installAnalyticsAppSkipConfigure: async (app: string) => {
await page.getByTestId(`app-store-app-card-${app}`).click();
await page.getByTestId("install-app-button").click();
const appMetadata = appStoreMetadata[app as keyof typeof appStoreMetadata];
if (shouldRedirectToAppOnboarding(appMetadata)) {
await page.click('[data-testid="install-app-button-personal"]');
await page.waitForURL(`apps/installation/event-types?slug=${app}`);
await page.click('[data-testid="set-up-later"]');
}
await page.click('[data-testid="install-app-button-personal"]');
await page.waitForURL(`apps/installation/event-types?slug=${app}`);
await page.click('[data-testid="set-up-later"]');
},
installApp: async (app: string, eventTypeIds: number[]) => {
installAnalyticsApp: async (app: string, eventTypeIds: number[]) => {
await page.getByTestId(`app-store-app-card-${app}`).click();
(await page.waitForSelector('[data-testid="install-app-button"]')).click();
const appMetadata = appStoreMetadata[app as keyof typeof appStoreMetadata];
if (shouldRedirectToAppOnboarding(appMetadata)) {
await page.click('[data-testid="install-app-button-personal"]');
await page.waitForURL(`apps/installation/event-types?slug=${app}`);
await page.click('[data-testid="install-app-button-personal"]');
await page.waitForURL(`apps/installation/event-types?slug=${app}`);
for (const id of eventTypeIds) {
await page.click(`[data-testid="select-event-type-${id}"]`);
for (const id of eventTypeIds) {
await page.click(`[data-testid="select-event-type-${id}"]`);
}
await page.click(`[data-testid="save-event-types"]`);
// adding random-tracking-id to gtm-tracking-id-input because this field is required and the test fails without it
if (app === "gtm") {
await page.waitForLoadState("domcontentloaded");
for (let index = 0; index < eventTypeIds.length; index++) {
await page.getByTestId("gtm-tracking-id-input").nth(index).fill("random-tracking-id");
}
}
await page.click(`[data-testid="configure-step-save"]`);
await page.waitForURL("/event-types");
},
await page.click(`[data-testid="save-event-types"]`);
installConferencingAppSkipConfigure: async (app: string) => {
await page.getByTestId(`app-store-app-card-${app}`).click();
await page.getByTestId("install-app-button").click();
await page.waitForURL(`apps/installation/event-types?slug=${app}`);
await page.click('[data-testid="set-up-later"]');
},
verifyConferencingApp: async (app: TApp) => {
await page.goto("/event-types");
await gotoFirstEventType(page);
await page.getByTestId("location-select").last().click();
await page.getByTestId(`location-select-item-${app.type}`).click();
if (app.organizerInputPlaceholder) {
await page.getByTestId(`${app.type}-location-input`).fill(app.organizerInputPlaceholder);
}
await page.locator("[data-testid=display-location]").last().check();
await saveEventType(page);
await page.waitForLoadState("networkidle");
await gotoBookingPage(page);
await selectFirstAvailableTimeSlotNextMonth(page);
await bookTimeSlot(page);
await page.waitForLoadState("networkidle");
// adding random-tracking-id to gtm-tracking-id-input because this field is required and the test fails without it
if (app === "gtm") {
await page.waitForLoadState("domcontentloaded");
for (let index = 0; index < eventTypeIds.length; index++) {
await page.getByTestId("gtm-tracking-id-input").nth(index).fill("random-tracking-id");
}
}
await page.click(`[data-testid="configure-step-save"]`);
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
await expect(page.locator("[data-testid=where] ")).toContainText(app.label);
},
installConferencingAppNewFlow: async (app: TApp, eventTypeIds: number[]) => {
await page.goto("apps/categories/conferencing");
await page.getByTestId(`app-store-app-card-${app.slug}`).click();
await page.getByTestId("install-app-button").click();
await page.waitForURL(`apps/installation/event-types?slug=${app.slug}`);
for (const id of eventTypeIds) {
await page.click(`[data-testid="select-event-type-${id}"]`);
}
await page.click(`[data-testid="save-event-types"]`);
for (let eindex = 0; eindex < eventTypeIds.length; eindex++) {
if (!app.organizerInputPlaceholder) continue;
await page.getByTestId(`${app.type}-location-input`).nth(eindex).fill(app.organizerInputPlaceholder);
}
await page.click(`[data-testid="configure-step-save"]`);
await page.waitForURL("/event-types");
},
verifyConferencingAppNew: async (app: TApp, eventTypeIds: number[]) => {
for (const id of eventTypeIds) {
await page.goto(`/event-types/${id}`);
await page.waitForLoadState("networkidle");
await gotoBookingPage(page);
await selectFirstAvailableTimeSlotNextMonth(page);
await bookTimeSlot(page, { name: `Test Testson`, email: `[email protected]` });
await page.waitForLoadState("networkidle");
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
await expect(page.locator("[data-testid=where] ")).toContainText(app.label);
}
},
goBackToAppsPage: async () => {
@@ -57,14 +116,12 @@ export function createAppsFixture(page: Page) {
await page.locator(`[data-testid='${app}-app-switch']`).click();
},
verifyAppsInfo: async (activeApps: number) => {
await expect(page.locator(`text=6 apps, ${activeApps} active`)).toBeVisible();
await expect(page.locator(`text=1 apps, ${activeApps} active`)).toBeVisible();
},
verifyAppsInfoNew: async (apps: string[], eventTypeId: number) => {
verifyAppsInfoNew: async (app: string, eventTypeId: number) => {
await page.goto(`event-types/${eventTypeId}?tabName=apps`);
await page.waitForLoadState("domcontentloaded");
for (const app of apps) {
await expect(page.locator(`[data-testid='${app}-app-switch'][data-state="checked"]`)).toBeVisible();
}
await expect(page.locator(`[data-testid='${app}-app-switch'][data-state="checked"]`)).toBeVisible();
},
};
}
+19
View File
@@ -371,3 +371,22 @@ export async function doOnOrgDomain(
// When App directory is there, this is the 404 page text. We should work on fixing the 404 page as it changed due to app directory.
export const NotFoundPageTextAppDir = "This page does not exist.";
// export const NotFoundPageText = "ERROR 404";
export async function gotoFirstEventType(page: 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\/.+/);
});
}
export async function gotoBookingPage(page: Page) {
const previewLink = await page.locator("[data-testid=preview-button]").getAttribute("href");
await page.goto(previewLink ?? "");
}
export async function saveEventType(page: Page) {
await page.locator("[data-testid=update-eventtype]").click();
}
+1
View File
@@ -45,6 +45,7 @@ testBothFutureAndLegacyRoutes.describe("Teams - NonOrg", (routeVariant) => {
await user.apiLogin();
page.goto(`/settings/teams/${team.id}/onboard-members`);
await page.waitForLoadState("networkidle");
await test.step("Can add members", async () => {
// Click [data-testid="new-member-button"]