diff --git a/apps/web/playwright/change-username.e2e.ts b/apps/web/playwright/change-username.e2e.ts index e88335dc8b..56809bd55c 100644 --- a/apps/web/playwright/change-username.e2e.ts +++ b/apps/web/playwright/change-username.e2e.ts @@ -7,15 +7,10 @@ import { MembershipRole } from "@calcom/prisma/enums"; import { moveUserToOrg } from "@lib/orgMigration"; import { test } from "./lib/fixtures"; +import { IS_STRIPE_ENABLED } from "./lib/testUtils"; test.describe.configure({ mode: "parallel" }); -const IS_STRIPE_ENABLED = !!( - process.env.STRIPE_CLIENT_ID && - process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY && - process.env.STRIPE_PRIVATE_KEY -); - const IS_SELF_HOSTED = !( new URL(WEBAPP_URL).hostname.endsWith(".cal.dev") || !!new URL(WEBAPP_URL).hostname.endsWith(".cal.com") ); diff --git a/apps/web/playwright/integrations-stripe.e2e.ts b/apps/web/playwright/integrations-stripe.e2e.ts index c527e85202..e5bbae4910 100644 --- a/apps/web/playwright/integrations-stripe.e2e.ts +++ b/apps/web/playwright/integrations-stripe.e2e.ts @@ -7,19 +7,11 @@ import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils"; import { test, todo } from "./lib/fixtures"; import type { Fixtures } from "./lib/fixtures"; -import { selectFirstAvailableTimeSlotNextMonth } from "./lib/testUtils"; +import { IS_STRIPE_ENABLED, selectFirstAvailableTimeSlotNextMonth } from "./lib/testUtils"; test.describe.configure({ mode: "parallel" }); test.afterEach(({ users }) => users.deleteAll()); -const IS_STRIPE_ENABLED = !!( - process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY && - process.env.STRIPE_CLIENT_ID && - process.env.STRIPE_PRIVATE_KEY && - process.env.PAYMENT_FEE_FIXED && - process.env.PAYMENT_FEE_PERCENTAGE -); - test.describe("Stripe integration skip true", () => { // eslint-disable-next-line playwright/no-skipped-test test.skip(!IS_STRIPE_ENABLED, "It should only run if Stripe is installed"); diff --git a/apps/web/playwright/lib/testUtils.ts b/apps/web/playwright/lib/testUtils.ts index 503eb59e4b..ba859fd6d9 100644 --- a/apps/web/playwright/lib/testUtils.ts +++ b/apps/web/playwright/lib/testUtils.ts @@ -26,6 +26,14 @@ export const testName = "Test Testson"; export const teamEventTitle = "Team Event - 30min"; export const teamEventSlug = "team-event-30min"; +export const IS_STRIPE_ENABLED = !!( + process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY && + process.env.STRIPE_CLIENT_ID && + process.env.STRIPE_PRIVATE_KEY && + process.env.PAYMENT_FEE_FIXED && + process.env.PAYMENT_FEE_PERCENTAGE +); + export function createHttpServer(opts: { requestHandler?: RequestHandler } = {}) { const { requestHandler = ({ res }) => { diff --git a/apps/web/playwright/reschedule.e2e.ts b/apps/web/playwright/reschedule.e2e.ts index caad1dbf72..85f3cb906a 100644 --- a/apps/web/playwright/reschedule.e2e.ts +++ b/apps/web/playwright/reschedule.e2e.ts @@ -12,14 +12,9 @@ import { bookTimeSlot, doOnOrgDomain, goToUrlWithErrorHandling, + IS_STRIPE_ENABLED, } from "./lib/testUtils"; -const IS_STRIPE_ENABLED = !!( - process.env.STRIPE_CLIENT_ID && - process.env.NEXT_PUBLIC_STRIPE_PUBLIC_KEY && - process.env.STRIPE_PRIVATE_KEY -); - test.describe.configure({ mode: "parallel" }); test.afterEach(({ users }) => users.deleteAll()); @@ -164,6 +159,9 @@ test.describe("Reschedule Tests", async () => { }); test("Paid rescheduling should go to success page", async ({ page, users, bookings, payments }) => { + // eslint-disable-next-line playwright/no-skipped-test + test.skip(!IS_STRIPE_ENABLED, "Skipped as Stripe is not installed"); + const user = await users.create(); await user.apiLogin(); await user.installStripePersonal({ skip: true });