Skip to content

Commit

Permalink
manual: add ab test redirect, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjORbj committed Dec 1, 2023
1 parent 7a4a24e commit af5ef2a
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,4 @@ E2E_TEST_OIDC_USER_PASSWORD=
AB_TEST_BUCKET_PROBABILITY=50
# whether we redirect to the future/event-types from event-types or not
APP_ROUTER_EVENT_TYPES_ENABLED=1
APP_ROUTER_TEAMS_ENABLED=1
1 change: 1 addition & 0 deletions apps/web/abTest/middlewareFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import z from "zod";

const ROUTES: [URLPattern, boolean][] = [
["/event-types", process.env.APP_ROUTER_EVENT_TYPES_ENABLED === "1"] as const,
["/teams", process.env.APP_ROUTER_TEAMS_ENABLED === "1"] as const,
].map(([pathname, enabled]) => [
new URLPattern({
pathname,
Expand Down
2 changes: 2 additions & 0 deletions apps/web/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ export const config = {
"/apps/routing_forms/:path*",
"/event-types",
"/future/event-types/",
"/teams",
"/future/teams/",
],
};

Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"test-codegen": "yarn playwright codegen http://localhost:3000",
"type-check": "tsc --pretty --noEmit",
"type-check:ci": "tsc-absolute --pretty --noEmit",
"build": "next build",
"build": "CI=1 NODE_OPTIONS=\"--max-old-space-size=8192\" next build",
"start": "next start",
"lint": "eslint . --ignore-path .gitignore",
"lint:fix": "eslint . --ext .ts,.js,.tsx,.jsx --fix",
Expand Down
29 changes: 29 additions & 0 deletions apps/web/playwright/teams.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,35 @@ import { bookTimeSlot, selectFirstAvailableTimeSlotNextMonth, testName, todo } f

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());
test("Can create teams via Wizard", async ({ page, users }) => {
Expand Down
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
"ANALYZE",
"API_KEY_PREFIX",
"APP_ROUTER_EVENT_TYPES_ENABLED",
"APP_ROUTER_TEAMS_ENABLED",
"APP_USER_NAME",
"BASECAMP3_CLIENT_ID",
"BASECAMP3_CLIENT_SECRET",
Expand Down

0 comments on commit af5ef2a

Please sign in to comment.