From f201266d69ff34056fb6bc54b59a676b936e3032 Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Wed, 3 Jan 2024 21:29:11 +0000 Subject: [PATCH] chore: [app-router-migration-7] Migrate `/teams` page (#12622) Co-authored-by: Dmytro Hryshyn Co-authored-by: zomars --- .env.example | 3 ++- apps/web/abTest/middlewareFactory.ts | 1 + apps/web/middleware.ts | 2 ++ apps/web/playwright/teams.e2e.ts | 29 ++++++++++++++++++++++++++++ turbo.json | 1 + 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index e15bdefcd9..3b7cf159e6 100644 --- a/.env.example +++ b/.env.example @@ -327,6 +327,7 @@ APP_ROUTER_SETTINGS_TEAMS_ENABLED=0 APP_ROUTER_GETTING_STARTED_STEP_ENABLED=0 APP_ROUTER_APPS_ENABLED=0 APP_ROUTER_VIDEO_ENABLED=0 +APP_ROUTER_TEAMS_ENABLED=0 # disable setry server source maps -SENTRY_DISABLE_SERVER_WEBPACK_PLUGIN=1 \ No newline at end of file +SENTRY_DISABLE_SERVER_WEBPACK_PLUGIN=1 diff --git a/apps/web/abTest/middlewareFactory.ts b/apps/web/abTest/middlewareFactory.ts index 7c2cf36832..ef5c93ebc7 100644 --- a/apps/web/abTest/middlewareFactory.ts +++ b/apps/web/abTest/middlewareFactory.ts @@ -17,6 +17,7 @@ const ROUTES: [URLPattern, boolean][] = [ ["/apps", process.env.APP_ROUTER_APPS_ENABLED === "1"] as const, ["/bookings/:status", process.env.APP_ROUTER_BOOKINGS_STATUS_ENABLED === "1"] as const, ["/video/:path*", process.env.APP_ROUTER_VIDEO_ENABLED === "1"] as const, + ["/teams", process.env.APP_ROUTER_TEAMS_ENABLED === "1"] as const, ].map(([pathname, enabled]) => [ new URLPattern({ pathname, diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts index c2025b14d7..213869dbfa 100644 --- a/apps/web/middleware.ts +++ b/apps/web/middleware.ts @@ -142,6 +142,8 @@ export const config = { "/future/bookings/:status/", "/video/:path*", "/future/video/:path*", + "/teams", + "/future/teams/", ], }; diff --git a/apps/web/playwright/teams.e2e.ts b/apps/web/playwright/teams.e2e.ts index 0491241e0b..51f1976a43 100644 --- a/apps/web/playwright/teams.e2e.ts +++ b/apps/web/playwright/teams.e2e.ts @@ -17,6 +17,35 @@ import { test.describe.configure({ mode: "parallel" }); +test.describe("Teams A/B tests", () => { + test("should point to the /future/teams page", async ({ page, users, context }) => { + await context.addCookies([ + { + name: "x-calcom-future-routes-override", + value: "1", + url: "http://localhost:3000", + }, + ]); + const user = await users.create(); + + await user.apiLogin(); + + await page.goto("/teams"); + + await page.waitForLoadState(); + + const dataNextJsRouter = await page.evaluate(() => + window.document.documentElement.getAttribute("data-nextjs-router") + ); + + expect(dataNextJsRouter).toEqual("app"); + + const locator = page.getByRole("heading", { name: "teams" }); + + await expect(locator).toBeVisible(); + }); +}); + test.describe("Teams - NonOrg", () => { test.afterEach(({ users }) => users.deleteAll()); diff --git a/turbo.json b/turbo.json index e7f0274141..dfd687535d 100644 --- a/turbo.json +++ b/turbo.json @@ -211,6 +211,7 @@ "APP_ROUTER_SETTINGS_TEAMS_ENABLED", "APP_ROUTER_WORKFLOWS_ENABLED", "APP_ROUTER_VIDEO_ENABLED", + "APP_ROUTER_TEAMS_ENABLED", "APP_USER_NAME", "BASECAMP3_CLIENT_ID", "BASECAMP3_CLIENT_SECRET",