test: cleanup & revived old skipped e2e tests (#26597)

This commit is contained in:
Anik Dhabal Babu authored and GitHub committed 2026-01-09 04:32:42 +00:00
1 parent 4c336fba92
commit 3cb59b7874
7 files changed
+1 -817

No files matched your search

-68
View File
@@ -1,68 +0,0 @@
import { expect } from "@playwright/test";
import { test } from "./lib/fixtures";
import { installAppleCalendar } from "./lib/testUtils";
// Skipped due to flakiness: navigation to the App Store often exceeds the test timeout locally because of slow performance. Will be re-enabled once performance improvements are made.
test.skip();
test.describe.configure({ mode: "parallel" });
test.afterEach(({ users }) => users.deleteAll());
test.describe("App Store - Authed", () => {
test("should render /apps page", async ({ page, users, context }) => {
const user = await users.create();
await user.apiLogin();
await page.goto("/apps/");
await page.waitForLoadState();
const locator = page.getByRole("heading", { name: "App Store" });
await expect(locator).toBeVisible();
});
test("Browse apple-calendar and try to install", async ({ page, users }) => {
const pro = await users.create();
await pro.apiLogin();
await installAppleCalendar(page);
await expect(page.locator(`text=Connect to Apple Server`)).toBeVisible();
});
test("Can add Google calendar from the app store", async ({ page, users }) => {
const user = await users.create();
await user.apiLogin();
await page.goto("/apps/google-calendar");
await page.getByTestId("install-app-button").click();
await page.waitForNavigation();
await expect(page.url()).toContain("accounts.google.com");
});
test("Installed Apps - Navigation", async ({ page, users }) => {
const user = await users.create();
await user.apiLogin();
await page.goto("/apps/installed");
await page.waitForSelector('[data-testid="connect-calendar-apps"]');
await page.click('[data-testid="vertical-tab-payment"]');
await page.waitForSelector('[data-testid="connect-payment-apps"]');
await page.click('[data-testid="vertical-tab-automation"]');
await page.waitForSelector('[data-testid="connect-automation-apps"]');
});
});
test.describe("App Store - Unauthed", () => {
test("Browse apple-calendar and try to install", async ({ page }) => {
await installAppleCalendar(page);
await expect(page.locator(`[data-testid="login-form"]`)).toBeVisible();
});
});
-35
View File
@@ -1,35 +0,0 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { expect } from "@playwright/test";
import { test } from "./lib/fixtures";
import { installAppleCalendar } from "./lib/testUtils";
test.describe.configure({ mode: "parallel" });
test.afterEach(({ users }) => users.deleteAll());
const APPLE_CALENDAR_EMAIL = process.env.E2E_TEST_APPLE_CALENDAR_EMAIL!;
const APPLE_CALENDAR_PASSWORD = process.env.E2E_TEST_APPLE_CALENDAR_PASSWORD!;
const SHOULD_SKIP_TESTS = !APPLE_CALENDAR_EMAIL || !APPLE_CALENDAR_PASSWORD;
test.describe("Apple Calendar", () => {
// eslint-disable-next-line playwright/no-skipped-test
test.skip(SHOULD_SKIP_TESTS, "Skipping due to missing the testing credentials");
test("Should be able to install and login on Apple Calendar", async ({ page, users }) => {
const user = await users.create();
await user.apiLogin();
await installAppleCalendar(page);
await expect(page.locator('[data-testid="apple-calendar-form"]')).toBeVisible();
await page.fill('[data-testid="apple-calendar-email"]', APPLE_CALENDAR_EMAIL);
await page.fill('[data-testid="apple-calendar-password"]', APPLE_CALENDAR_PASSWORD);
await page.click('[data-testid="apple-calendar-login-button"]');
await expect(page.getByText("Apple Calendar")).toBeVisible();
await expect(page.getByText(APPLE_CALENDAR_EMAIL)).toBeVisible();
});
});
@@ -1,501 +0,0 @@
import { expect } from "@playwright/test";
import { eventTypeMetaDataSchemaWithTypedApps } from "@calcom/app-store/zod-utils";
import prisma from "@calcom/prisma";
import type { EventType } from "@calcom/prisma/client";
import { SchedulingType } from "@calcom/prisma/enums";
import { test, todo } from "./lib/fixtures";
import type { Fixtures } from "./lib/fixtures";
import { confirmReschedule, IS_STRIPE_ENABLED, selectFirstAvailableTimeSlotNextMonth } from "./lib/testUtils";
test.describe.configure({ mode: "parallel" });
test.afterEach(({ users }) => users.deleteAll());
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");
test.describe("Stripe integration dashboard", () => {
test("Can add Stripe integration", async ({ page, users }) => {
const user = await users.create();
await user.apiLogin();
await user.installStripePersonal({ skip: true });
await expect(page.locator(`h3:has-text("Stripe")`)).toBeVisible();
await page.getByRole("list").getByRole("button").click();
await expect(page.getByRole("button", { name: "Remove App" })).toBeVisible();
});
});
test("when enabling Stripe, credentialId is included", async ({ page, users }) => {
const user = await users.create();
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: true });
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.setupEventWithPrice(eventType, "stripe");
// Need to wait for the DB to be updated with the metadata
await page.waitForResponse((res) => res.url().includes("update") && res.status() === 200);
// Check event type metadata to see if credentialId is included
const eventTypeMetadata = await prisma.eventType.findFirst({
where: {
id: eventType.id,
},
select: {
metadata: true,
},
});
const metadata = eventTypeMetaDataSchemaWithTypedApps.parse(eventTypeMetadata?.metadata);
const stripeAppMetadata = metadata?.apps?.stripe;
expect(stripeAppMetadata).toHaveProperty("credentialId");
expect(typeof stripeAppMetadata?.credentialId).toBe("number");
});
test("when enabling Stripe, team credentialId is included", async ({ page, users }) => {
const ownerObj = { username: "pro-user", name: "pro-user" };
const teamMatesObj = [
{ name: "teammate-1" },
{ name: "teammate-2" },
{ name: "teammate-3" },
{ name: "teammate-4" },
];
const owner = await users.create(ownerObj, {
hasTeam: true,
teammates: teamMatesObj,
schedulingType: SchedulingType.COLLECTIVE,
});
await owner.apiLogin();
const { team } = await owner.getFirstTeamMembership();
const teamEvent = await owner.getFirstTeamEvent(team.id);
await owner.installStripeTeam({ skip: true, teamId: team.id });
await owner.setupEventWithPrice(teamEvent, "stripe");
// Need to wait for the DB to be updated with the metadata
await page.waitForResponse((res) => res.url().includes("update") && res.status() === 200);
// Check event type metadata to see if credentialId is included
const eventTypeMetadata = await prisma.eventType.findFirst({
where: {
id: teamEvent.id,
},
select: {
metadata: true,
},
});
const metadata = eventTypeMetaDataSchemaWithTypedApps.parse(eventTypeMetadata?.metadata);
const stripeAppMetadata = metadata?.apps?.stripe;
expect(stripeAppMetadata).toHaveProperty("credentialId");
expect(typeof stripeAppMetadata?.credentialId).toBe("number");
});
test("Can book a paid booking", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: true });
await user.setupEventWithPrice(eventType, "stripe");
await user.bookAndPayEvent(eventType);
// success
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
});
test("Pending payment booking should not be confirmed by default", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: true });
await user.setupEventWithPrice(eventType, "stripe");
// booking process without payment
await page.goto(`${user.username}/${eventType?.slug}`);
await selectFirstAvailableTimeSlotNextMonth(page);
// --- fill form
await page.fill('[name="name"]', "Stripe Stripeson");
await page.fill('[name="email"]', "test@example.com");
await Promise.all([page.waitForURL("/payment/*"), page.press('[name="email"]', "Enter")]);
await page.goto(`/bookings/upcoming`);
await expect(page.getByText("Unconfirmed")).toBeVisible();
await expect(page.getByText("Pending payment").last()).toBeVisible();
});
test("Paid booking should be able to be rescheduled", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: true });
await user.setupEventWithPrice(eventType, "stripe");
await user.bookAndPayEvent(eventType);
// Rescheduling the event
await Promise.all([page.waitForURL("/booking/*"), page.click('[data-testid="reschedule-link"]')]);
await selectFirstAvailableTimeSlotNextMonth(page);
await Promise.all([
page.waitForURL("/payment/*"),
page.click('[data-testid="confirm-reschedule-button"]'),
]);
await user.makePaymentUsingStripe();
});
test("Paid booking should be able to be cancelled", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: true });
await user.setupEventWithPrice(eventType, "stripe");
await user.bookAndPayEvent(eventType);
await page.click('[data-testid="cancel"]');
await page.click('[data-testid="confirm_cancel"]');
await expect(page.locator('[data-testid="cancelled-headline"]').first()).toBeVisible();
});
test.describe("When event is paid and confirmed", () => {
let user: Awaited<ReturnType<Fixtures["users"]["create"]>>;
let eventType: EventType;
test.beforeEach(async ({ page, users }) => {
user = await users.create();
eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: true });
await user.setupEventWithPrice(eventType, "stripe");
await user.bookAndPayEvent(eventType);
await user.confirmPendingPayment();
});
test("Payment should confirm pending payment booking", async ({ page, users }) => {
await page.goto("/bookings/upcoming");
const paidBadge = page.locator('[data-testid="paid_badge"]').first();
await expect(paidBadge).toBeVisible();
expect(await paidBadge.innerText()).toBe("Paid");
});
test("Paid and confirmed booking should be able to be rescheduled", async ({ page, users }) => {
await Promise.all([page.waitForURL("/booking/*"), page.click('[data-testid="reschedule-link"]')]);
await selectFirstAvailableTimeSlotNextMonth(page);
await page.click('[data-testid="confirm-reschedule-button"]');
await expect(page.getByText("This meeting is scheduled")).toBeVisible();
});
todo("Payment should trigger a BOOKING_PAID webhook");
});
test.describe("Change stripe presented currency", () => {
test("Should be able to change currency", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await user.installStripePersonal({ skip: true });
// Edit currency inside event type page
await page.goto(`/event-types/${eventType?.id}?tabName=apps`);
// Enable Stripe
await page.locator("#event-type-form").getByRole("switch").click();
// Set price
await page.getByTestId("stripe-price-input").fill("200");
// Select currency in dropdown
await page.getByTestId("stripe-currency-select").click();
await page.getByTestId("stripe-currency-input").fill("mexi");
await page.getByTestId("select-option-mxn").click();
await page.getByTestId("update-eventtype").click();
// Book event
await page.goto(`${user.username}/${eventType?.slug}`);
// Confirm MXN currency it's displayed use expect
await expect(page.getByText("MX$200.00")).toBeVisible();
await selectFirstAvailableTimeSlotNextMonth(page);
// Confirm again in book form page
await expect(page.getByText("MX$200.00")).toBeVisible();
// --- fill form
await page.fill('[name="name"]', "Stripe Stripeson");
await page.fill('[name="email"]', "stripe@example.com");
// Confirm booking
await page.click('[data-testid="confirm-book-button"]');
// wait for url to be payment
await page.waitForURL("/payment/*");
// Confirm again in book form page
await expect(page.getByText("MX$200.00")).toBeVisible();
});
});
});
test.describe("Stripe integration with the new app install flow skip false", () => {
// eslint-disable-next-line playwright/no-skipped-test
test.skip(!IS_STRIPE_ENABLED, "It should only run if Stripe is installed");
test("when enabling Stripe, credentialId is included skip false", async ({ page, users }) => {
const user = await users.create();
await user.apiLogin();
await page.goto("/apps/installed");
const eventTypes = await user.getUserEventsAsOwner();
const eventTypeIds = eventTypes.map((item) => item.id);
// await installStripe(page, "personal", false, eventTypeIds);
await user.installStripePersonal({ skip: false, eventTypeIds });
const eventTypeMetadatas = await prisma.eventType.findMany({
where: {
id: {
in: eventTypeIds,
},
},
select: {
metadata: true,
},
});
for (const eventTypeMetadata of eventTypeMetadatas) {
const metadata = eventTypeMetaDataSchemaWithTypedApps.parse(eventTypeMetadata?.metadata);
const stripeAppMetadata = metadata?.apps?.stripe;
expect(stripeAppMetadata).toHaveProperty("credentialId");
expect(typeof stripeAppMetadata?.credentialId).toBe("number");
}
});
test("when enabling Stripe, team credentialId is included skip false", async ({ page, users }) => {
const ownerObj = { username: "pro-user", name: "pro-user" };
const teamMatesObj = [
{ name: "teammate-1" },
{ name: "teammate-2" },
{ name: "teammate-3" },
{ name: "teammate-4" },
];
const owner = await users.create(ownerObj, {
hasTeam: true,
teammates: teamMatesObj,
schedulingType: SchedulingType.COLLECTIVE,
});
await owner.apiLogin();
const { team } = await owner.getFirstTeamMembership();
const teamEvent = await owner.getFirstTeamEvent(team.id);
await owner.installStripeTeam({ skip: false, teamId: team.id, eventTypeIds: [teamEvent.id] });
// Check event type metadata to see if credentialId is included
const eventTypeMetadata = await prisma.eventType.findFirst({
where: {
id: teamEvent.id,
},
select: {
metadata: true,
},
});
const metadata = eventTypeMetaDataSchemaWithTypedApps.parse(eventTypeMetadata?.metadata);
const stripeAppMetadata = metadata?.apps?.stripe;
expect(stripeAppMetadata).toHaveProperty("credentialId");
expect(typeof stripeAppMetadata?.credentialId).toBe("number");
});
test("Can book a paid booking skip false", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: false, eventTypeIds: [eventType.id] });
await user.bookAndPayEvent(eventType);
// success
await expect(page.locator("[data-testid=success-page]")).toBeVisible();
});
test("Pending payment booking should not be confirmed by default skip false", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: false, eventTypeIds: [eventType.id] });
// booking process without payment
await page.goto(`${user.username}/${eventType?.slug}`);
await selectFirstAvailableTimeSlotNextMonth(page);
// --- fill form
await page.fill('[name="name"]', "Stripe Stripeson");
await page.fill('[name="email"]', "test@example.com");
await Promise.all([page.waitForURL("/payment/*"), page.press('[name="email"]', "Enter")]);
await page.goto(`/bookings/upcoming`);
await expect(page.getByText("Unconfirmed")).toBeVisible();
await expect(page.getByText("Pending payment").last()).toBeVisible();
});
test("Paid booking should be able to be rescheduled skip false", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: false, eventTypeIds: [eventType.id] });
await user.bookAndPayEvent(eventType);
// Rescheduling the event
await Promise.all([page.waitForURL("/booking/*"), page.click('[data-testid="reschedule-link"]')]);
await selectFirstAvailableTimeSlotNextMonth(page);
await Promise.all([
page.waitForURL("/payment/*"),
page.click('[data-testid="confirm-reschedule-button"]'),
]);
await user.makePaymentUsingStripe();
});
test("Paid booking should be able to be cancelled skip false", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: false, eventTypeIds: [eventType.id] });
await user.bookAndPayEvent(eventType);
await page.click('[data-testid="cancel"]');
await page.click('[data-testid="confirm_cancel"]');
await expect(page.locator('[data-testid="cancelled-headline"]').first()).toBeVisible();
});
test.describe("When event is paid and confirmed skip false", () => {
let user: Awaited<ReturnType<Fixtures["users"]["create"]>>;
let eventType: EventType;
test.beforeEach(async ({ page, users }) => {
user = await users.create();
eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/installed");
await user.installStripePersonal({ skip: false, eventTypeIds: [eventType.id] });
await user.bookAndPayEvent(eventType);
await user.confirmPendingPayment();
});
test("Payment should confirm pending payment booking skip false", async ({ page, users }) => {
await page.goto("/bookings/upcoming");
const paidBadge = page.locator('[data-testid="paid_badge"]').first();
await expect(paidBadge).toBeVisible();
expect(await paidBadge.innerText()).toBe("Paid");
});
test("Paid and confirmed booking should be able to be rescheduled skip false", async ({
page,
users,
}) => {
await Promise.all([page.waitForURL("/booking/*"), page.click('[data-testid="reschedule-link"]')]);
await selectFirstAvailableTimeSlotNextMonth(page);
await confirmReschedule(page);
await expect(page.getByText("This meeting is scheduled")).toBeVisible();
});
todo("Payment should trigger a BOOKING_PAID webhook");
});
test.describe("Change stripe presented currency skip false", () => {
test("Should be able to change currency skip false", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid") as EventType;
await user.apiLogin();
await page.goto("/apps/stripe");
/** We start the Stripe flow */
await page.click('[data-testid="install-app-button"]');
await page.click('[data-testid="install-app-button-personal"]');
await page.waitForURL("https://connect.stripe.com/oauth/v2/authorize?*");
/** We skip filling Stripe forms (testing mode only) */
await page.click('[id="skip-account-app"]');
await page.waitForURL(`apps/installation/event-types?slug=stripe`);
await page.click(`[data-testid="select-event-type-${eventType.id}"]`);
await page.click(`[data-testid="save-event-types"]`);
await page.locator('[data-testid="stripe-price-input"]').fill(`200`);
// Select currency in dropdown
await page.getByTestId("stripe-currency-select").click();
await page.getByTestId("stripe-currency-input").fill("mexi");
await page.getByTestId("select-option-mxn").click();
await page.click(`[data-testid="configure-step-save"]`);
await page.waitForURL(`event-types`);
// Book event
await page.goto(`${user.username}/${eventType?.slug}`);
// Confirm MXN currency it's displayed use expect
await expect(page.getByText("MX$200.00")).toBeVisible();
await selectFirstAvailableTimeSlotNextMonth(page);
// Confirm again in book form page
await expect(page.getByText("MX$200.00")).toBeVisible();
// --- fill form
await page.fill('[name="name"]', "Stripe Stripeson");
await page.fill('[name="email"]', "stripe@example.com");
// Confirm booking
await page.click('[data-testid="confirm-book-button"]');
// wait for url to be payment
await page.waitForURL("/payment/*");
// Confirm again in book form page
await expect(page.getByText("MX$200.00")).toBeVisible();
});
});
});
-71
View File
@@ -1,71 +0,0 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
import { test } from "./lib/fixtures";
const SAML_DATABASE_URL = process.env.SAML_DATABASE_URL!;
const SAML_ADMINS = process.env.SAML_ADMINS!;
const SAML_ADMIN_EMAIL = process.env.E2E_TEST_SAML_ADMIN_EMAIL!;
const SAML_ADMIN_PASSWORD = process.env.E2E_TEST_SAML_ADMIN_PASSWORD!;
const OIDC_CLIENT_ID = process.env.E2E_TEST_OIDC_CLIENT_ID!;
const OIDC_CLIENT_SECRET = process.env.E2E_TEST_OIDC_CLIENT_SECRET!;
const OIDC_PROVIDER_DOMAIN = process.env.E2E_TEST_OIDC_PROVIDER_DOMAIN!;
const OIDC_USER_EMAIL = process.env.E2E_TEST_OIDC_USER_EMAIL!;
const OIDC_USER_PASSWORD = process.env.E2E_TEST_OIDC_USER_PASSWORD!;
const SHOULD_SKIP_TESTS =
!SAML_DATABASE_URL ||
!SAML_ADMINS ||
!SAML_ADMIN_EMAIL ||
!SAML_ADMIN_PASSWORD ||
!OIDC_CLIENT_ID ||
!OIDC_CLIENT_SECRET ||
!OIDC_PROVIDER_DOMAIN ||
!OIDC_USER_EMAIL ||
!OIDC_USER_PASSWORD;
test.afterEach(({ users }) => users.deleteAll());
// TODO: Cleanup the OIDC connection after the tests with fixtures
test.describe("OIDC", () => {
// eslint-disable-next-line playwright/no-skipped-test
test.skip(SHOULD_SKIP_TESTS, "Skipping due to missing the testing variables");
test("Setup with SAML admin and login", async ({ page, users }) => {
// Add the admin user provided in the environment variables to the db
const samlAdminUser = await users.create({ email: SAML_ADMIN_EMAIL, password: SAML_ADMIN_PASSWORD });
await samlAdminUser.apiLogin();
await test.step("Connect with OIDC Provider", async () => {
await page.goto("/settings/security/sso");
await page.click('[data-testid="sso-oidc-configure"]');
await page.fill('[data-testid="sso-oidc-client-id"]', OIDC_CLIENT_ID);
await page.fill('[data-testid="sso-oidc-client-secret"]', OIDC_CLIENT_SECRET);
await page.fill(
'[data-testid="sso-oidc-well-known-url"]',
`https://${OIDC_PROVIDER_DOMAIN}/.well-known/openid-configuration`
);
await page.click('[data-testid="sso-oidc-save"]');
await page.waitForSelector('[data-testid="toast-success"]');
});
// Logout the SAML Admin
await samlAdminUser.logout();
await test.step("Login using the OIDC provider", async () => {
// Login a user using the OIDC provider.
// The credentials are handled by the provider, so we don't need to create a user in the db.
await page.goto("/auth/login");
await page.click('[data-testid="samlAndOidc"]');
// Redirected outide of the app, the user would be redirected to the OIDC provider.
await page.waitForURL(/https:\/\/[^/]+\/oauth2\/v1\/authorize\?.*/);
await page.getByRole("textbox", { name: "Username" }).fill(OIDC_USER_EMAIL);
await page.getByRole("textbox", { name: "Password" }).fill(OIDC_USER_PASSWORD);
await page.getByRole("button", { name: "Sign in" }).click();
// The user is redirected back to the app.
await page.waitForURL("getting-started", { waitUntil: "load" });
});
// Logout the user.
await page.goto("/auth/logout");
await test.step("Disconnect OIDC Provider", async () => {
samlAdminUser.apiLogin();
await page.goto("/settings/security/sso", { waitUntil: "load" });
await page.getByTestId("delete-oidc-sso-connection").click();
await page.getByRole("button", { name: "Yes, delete OIDC configuration" }).click();
await page.waitForSelector('[data-testid="toast-success"]');
});
});
});
-92
View File
@@ -12,8 +12,6 @@ import {
bookTimeSlot,
confirmReschedule,
doOnOrgDomain,
goToUrlWithErrorHandling,
IS_STRIPE_ENABLED,
selectFirstAvailableTimeSlotNextMonth,
submitAndWaitForResponse,
} from "./lib/testUtils";
@@ -167,96 +165,6 @@ test.describe("Reschedule Tests", async () => {
});
});
test("Unpaid rescheduling should go to payment 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 });
const eventType = user.eventTypes.find((e) => e.slug === "paid")!;
const booking = await bookings.create(user.id, user.username, eventType.id, {
rescheduled: true,
status: BookingStatus.ACCEPTED,
paid: false,
});
await prisma.eventType.update({
where: {
id: eventType.id,
},
data: {
metadata: {
apps: {
stripe: {
price: 20000,
enabled: true,
currency: "usd",
},
},
},
},
});
await payments.create(booking.id);
await page.goto(`/reschedule/${booking.uid}`);
await selectFirstAvailableTimeSlotNextMonth(page);
await confirmReschedule(page);
await page.waitForURL((url) => {
return url.pathname.indexOf("/payment") > -1;
});
await expect(page).toHaveURL(/.*payment/);
});
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 });
await users.logout();
const eventType = user.eventTypes.find((e) => e.slug === "paid")!;
const booking = await bookings.create(user.id, user.username, eventType.id, {
rescheduled: true,
status: BookingStatus.ACCEPTED,
paid: true,
});
await payments.create(booking.id);
await page.goto(`/reschedule/${booking?.uid}`);
await selectFirstAvailableTimeSlotNextMonth(page);
await confirmReschedule(page);
await expect(page).toHaveURL(/.*booking/);
});
test("Opt in event should be PENDING when rescheduled by USER", async ({ page, users, bookings }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "opt-in")!;
const booking = await bookings.create(user.id, user.username, eventType.id, {
status: BookingStatus.ACCEPTED,
});
await page.goto(`/reschedule/${booking.uid}`);
await selectFirstAvailableTimeSlotNextMonth(page);
await confirmReschedule(page);
await expect(page).toHaveURL(/.*booking/);
const newBooking = await prisma.booking.findFirstOrThrow({ where: { fromReschedule: booking?.uid } });
expect(newBooking).not.toBeNull();
expect(newBooking.status).toBe(BookingStatus.PENDING);
});
test("Opt in event should be ACCEPTED when rescheduled by OWNER", async ({ page, users, bookings }) => {
const user = await users.create();
-13
View File
@@ -67,18 +67,5 @@ test.describe("SAML tests", () => {
await checkbox.uncheck();
await expect(submitButton).toBeEnabled();
});
test("Submit button should be disabled with a premium username", async ({ page }) => {
// eslint-disable-next-line playwright/no-skipped-test
test.skip(!IS_PREMIUM_USERNAME_ENABLED, "Only run on Cal.com");
// Fill form
await page.locator('input[name="username"]').fill("pro");
await page.locator('input[name="email"]').fill("pro@example.com");
// Submit form
const submitButton = page.getByTestId("saml-submit-button");
await expect(submitButton).toBeDisabled();
});
});
});
+1 -37
View File
@@ -195,43 +195,6 @@ test.describe("Email Signup Flow Test", async () => {
await prisma.user.delete({ where: { id: existingUser.id } });
await prisma.team.delete({ where: { id: org.id } });
});
test("Premium Username Flow - creates stripe checkout", async ({ page, users, prisma }) => {
// eslint-disable-next-line playwright/no-skipped-test
test.skip(!IS_PREMIUM_USERNAME_ENABLED, "Only run on Cal.com");
const userToCreate = users.buildForSignup({
username: "rock",
password: "Password99!",
});
// Ensure the premium username is available
await prisma.user.deleteMany({ where: { username: "rock" } });
// Signup with premium username name
await page.goto("/signup");
await preventFlakyTest(page);
const continueWithEmailButton = page.getByTestId("continue-with-email-button");
await expect(continueWithEmailButton).toBeVisible();
await continueWithEmailButton.click();
// Fill form
await page.locator('input[name="username"]').fill("rock");
await page.locator('input[name="email"]').fill(userToCreate.email);
await page.locator('input[name="password"]').fill(userToCreate.password);
// Submit form
const submitButton = page.getByTestId("signup-submit-button");
await submitButton.click();
// Check that stripe checkout is present
const expectedUrl = "https://checkout.stripe.com";
await page.waitForURL((url) => url.href.startsWith(expectedUrl));
const url = page.url();
// Check that the URL matches the expected URL
expect(url).toContain(expectedUrl);
// TODO: complete the stripe checkout flow
});
test("Signup with valid (non premium) username", async ({ page, users }) => {
const userToCreate = users.buildForSignup({
username: "rick-jones",
@@ -263,6 +226,7 @@ test.describe("Email Signup Flow Test", async () => {
// Verify that the username is the same as the one provided and isn't accidentally changed to email derived username - That happens only for organization member signup
expect(dbUser?.username).toBe(userToCreate.username);
});
test("Signup fields prefilled with query params", async ({ page, users: _users }) => {
const signupUrlWithParams = "/signup?username=rick-jones&email=rick-jones%40example.com";
await page.goto(signupUrlWithParams);