Files
calendar/apps/web/playwright/lib/future-legacy-routes.ts
T
zomars 83a187bf11 Revert "fix: temp renamed app dir to prevent OOM"
This reverts commit 0d3baee593.

Revert "fix: temp renamed app dir to prevent OOM"

This reverts commit 0d3baee593.

Revert "fix: temp renamed app dir to prevent OOM"

This reverts commit 0d3baee593.

Revert "fix: temp renamed app dir to prevent OOM"

This reverts commit 0d3baee593.
2023-12-19 12:26:52 -07:00

34 lines
1.3 KiB
TypeScript

import { test } from "./fixtures";
export type RouteVariant = "future" | "legacy";
const routeVariants = ["future", "legacy"];
/**
* Small wrapper around test.describe().
* When using testbothFutureLegacyRoutes.describe() instead of test.describe(), this will run the specified
* tests twice. One with the pages route, and one with the new app dir "future" route. It will also add the route variant
* name to the test name for easier debugging.
* Finally it also adds a parameter routeVariant to your testBothFutureAndLegacyRoutes.describe() callback, which
* can be used to do any conditional rendering in the test for a specific route variant (should be as little
* as possible).
*
* See apps/web/playwright/event-types.e2e.ts for an example.
*/
export const testBothFutureAndLegacyRoutes = {
describe: (testName: string, testFn: (routeVariant: RouteVariant) => void) => {
routeVariants.forEach((routeVariant) => {
test.describe(`${testName} -- ${routeVariant}`, () => {
if (routeVariant === "future") {
test.beforeEach(({ context }) => {
context.addCookies([
{ name: "x-calcom-future-routes-override", value: "1", url: "http://localhost:3000" },
]);
});
}
testFn(routeVariant as RouteVariant);
});
});
},
};