refactor: Cal.diy (#28903)
* feat: Cal.diy — community-driven MIT-licensed fork of Cal.com This squashed commit contains all Cal.diy changes applied on top of calcom/cal.com main: - Rebrand Cal.com to Cal.diy across the entire codebase - Remove Enterprise Edition (EE) features, license checks, and AGPL restrictions - Switch license from AGPL-3.0 to MIT - Remove docs/ directory (migrated to Nextra at cal.diy) - Remove dead code: org tests, EE tips, platform nav, premium username, SAML/SSO, etc. - Clean up .env.example for self-hosted Cal.diy - Update Docker image references to calcom/cal.diy - Update README, CONTRIBUTING.md, and issue templates for Cal.diy community fork - Add PR welcome bot for Cal.diy contributors - Fix API v2 breaking changes oasdiff ignore entries - Replace Blacksmith CI runners with default GitHub Actions 3893 files changed, 20789 insertions(+), 411020 deletions(-) Co-Authored-By: [email protected] <[email protected]> * refactor: remove org-specific /organizations/:orgId endpoints from API v2 atoms controllers (#1701) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: revert Cal.diy Inc to Cal.com, Inc. in license files, copyright notices, and package metadata (#1702) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * rip out org related comments in api v2 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
a17f28e9ab
commit
ab21c7f805
4080 files changed
+14403
-404922
No files matched your search
@@ -1,11 +1,11 @@
|
||||
# Cal.com Booking Flow Performance Test Suite
|
||||
# Cal.diy Booking Flow Performance Test Suite
|
||||
|
||||
This directory contains performance tests for Cal.com's booking flow using [Grafana k6](https://k6.io/). The tests are designed to measure the performance of the booking flow under various load conditions, including high-volume scenarios with tens of thousands of requests per minute.
|
||||
This directory contains performance tests for Cal.diy's booking flow using [Grafana k6](https://k6.io/). The tests are designed to measure the performance of the booking flow under various load conditions, including high-volume scenarios with tens of thousands of requests per minute.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [k6](https://k6.io/docs/getting-started/installation/) installed on your machine
|
||||
- Cal.com running locally or a deployed instance to test against
|
||||
- Cal.diy running locally or a deployed instance to test against
|
||||
|
||||
## Test Structure
|
||||
|
||||
@@ -63,7 +63,7 @@ This script automatically detects your operating system (Linux or macOS) and set
|
||||
#### Prerequisites
|
||||
|
||||
- Docker installed and running
|
||||
- Cal.com running locally (default: `http://localhost:3000`)
|
||||
- Cal.diy running locally (default: `http://localhost:3000`)
|
||||
|
||||
#### Usage
|
||||
|
||||
@@ -116,7 +116,7 @@ Supported env vars:
|
||||
|
||||
## Test Scenarios
|
||||
|
||||
The test suite focuses specifically on the booking flow, which is the most critical user journey in Cal.com:
|
||||
The test suite focuses specifically on the booking flow, which is the most critical user journey in Cal.diy:
|
||||
|
||||
1. **Booking Page View**: Tests the performance of loading and viewing booking pages
|
||||
|
||||
|
||||
@@ -18,10 +18,6 @@ import type {
|
||||
Membership,
|
||||
Prisma,
|
||||
WebhookTriggerEvents,
|
||||
WorkflowActions,
|
||||
WorkflowMethods,
|
||||
WorkflowTemplates,
|
||||
WorkflowTriggerEvents,
|
||||
} from "@calcom/prisma/client";
|
||||
import type {
|
||||
BookingStatus,
|
||||
@@ -89,10 +85,7 @@ vi.mock("@calcom/app-store/video.adapters.generated", () => ({
|
||||
),
|
||||
}));
|
||||
|
||||
// We don't need to test it. Also, it causes Formbricks error when imported
|
||||
vi.mock("@calcom/features/routing-forms/lib/findTeamMembersMatchingAttributeLogic", () => ({
|
||||
default: {},
|
||||
}));
|
||||
// Routing forms feature removed - mock no longer needed
|
||||
|
||||
vi.mock("@calcom/lib/crypto", async (importOriginal) => {
|
||||
const actual = await importOriginal<typeof import("@calcom/lib/crypto")>();
|
||||
@@ -121,22 +114,6 @@ type InputWebhook = {
|
||||
timeUnit?: TimeUnit | null;
|
||||
};
|
||||
|
||||
type InputWorkflow = {
|
||||
id?: number;
|
||||
userId?: number | null;
|
||||
teamId?: number | null;
|
||||
name?: string;
|
||||
activeOn?: number[];
|
||||
activeOnTeams?: number[];
|
||||
trigger: WorkflowTriggerEvents;
|
||||
action: WorkflowActions;
|
||||
template: WorkflowTemplates;
|
||||
time?: number | null;
|
||||
timeUnit?: TimeUnit | null;
|
||||
sendTo?: string;
|
||||
verifiedAt?: Date;
|
||||
};
|
||||
|
||||
type InputPayment = {
|
||||
id?: number;
|
||||
uid: string;
|
||||
@@ -152,16 +129,6 @@ type InputPayment = {
|
||||
paymentOption?: PaymentOption;
|
||||
};
|
||||
|
||||
type InputWorkflowReminder = {
|
||||
id?: number;
|
||||
bookingUid: string;
|
||||
method: WorkflowMethods;
|
||||
scheduledDate: Date;
|
||||
scheduled: boolean;
|
||||
workflowStepId?: number;
|
||||
workflowId: number;
|
||||
};
|
||||
|
||||
type InputHostLocation = {
|
||||
type: string;
|
||||
credentialId?: number | null;
|
||||
@@ -206,7 +173,6 @@ export type ScenarioData = {
|
||||
apps?: Partial<AppMeta>[];
|
||||
bookings?: InputBooking[];
|
||||
webhooks?: InputWebhook[];
|
||||
workflows?: InputWorkflow[];
|
||||
payment?: InputPayment[];
|
||||
selectedSlots?: InputSelectedSlot[];
|
||||
};
|
||||
@@ -412,10 +378,7 @@ async function addHostsToDb(eventTypes: InputEventType[]) {
|
||||
}
|
||||
|
||||
export async function addEventTypesToDb(
|
||||
eventTypes: (Omit<
|
||||
Prisma.EventTypeCreateInput,
|
||||
"users" | "workflows" | "destinationCalendar" | "schedule"
|
||||
> & {
|
||||
eventTypes: (Omit<Prisma.EventTypeCreateInput, "users" | "destinationCalendar" | "schedule"> & {
|
||||
id?: number;
|
||||
users?: ({ id: number } | undefined)[];
|
||||
userId?: number;
|
||||
@@ -423,7 +386,6 @@ export async function addEventTypesToDb(
|
||||
user: InputUser | undefined;
|
||||
id: number;
|
||||
}[];
|
||||
workflows?: Prisma.WorkflowCreateInput[];
|
||||
destinationCalendar?: {
|
||||
create: Prisma.DestinationCalendarCreateInput;
|
||||
};
|
||||
@@ -456,7 +418,6 @@ export async function addEventTypesToDb(
|
||||
const allEventTypes = await prismock.eventType.findMany({
|
||||
include: {
|
||||
users: true,
|
||||
workflows: true,
|
||||
destinationCalendar: true,
|
||||
schedule: true,
|
||||
hostGroups: true,
|
||||
@@ -567,7 +528,6 @@ export async function addEventTypes(eventTypes: InputEventType[], usersStore: In
|
||||
return {
|
||||
...baseEventType,
|
||||
...eventType,
|
||||
workflows: [],
|
||||
users,
|
||||
hosts,
|
||||
hostGroups: eventType.hostGroups || [],
|
||||
@@ -672,7 +632,6 @@ export async function addBookings(bookings: InputBooking[]) {
|
||||
}
|
||||
return {
|
||||
uid: booking.uid || uuidv4(),
|
||||
workflowReminders: [],
|
||||
references: [],
|
||||
title: "Test Booking Title",
|
||||
...booking,
|
||||
@@ -748,96 +707,6 @@ async function addWebhooks(webhooks: InputWebhook[]) {
|
||||
await addWebhooksToDb(webhooks);
|
||||
}
|
||||
|
||||
async function addWorkflowsToDb(workflows: InputWorkflow[]) {
|
||||
await Promise.all(
|
||||
workflows.map(async (workflow) => {
|
||||
const team = await prismock.team.findUnique({
|
||||
where: {
|
||||
id: workflow.teamId ?? 0,
|
||||
},
|
||||
});
|
||||
|
||||
if (workflow.teamId && !team) {
|
||||
throw new Error(`Team with ID ${workflow.teamId} not found`);
|
||||
}
|
||||
|
||||
const isOrg = team?.isOrganization;
|
||||
|
||||
// Create the workflow first
|
||||
const createdWorkflow = await prismock.workflow.create({
|
||||
data: {
|
||||
...(workflow.id && { id: workflow.id }),
|
||||
userId: workflow.userId,
|
||||
teamId: workflow.teamId,
|
||||
trigger: workflow.trigger,
|
||||
name: workflow.name ? workflow.name : "Test Workflow",
|
||||
time: workflow.time,
|
||||
timeUnit: workflow.timeUnit,
|
||||
},
|
||||
include: {
|
||||
steps: true,
|
||||
},
|
||||
});
|
||||
|
||||
await prismock.workflowStep.create({
|
||||
data: {
|
||||
stepNumber: 1,
|
||||
action: workflow.action,
|
||||
template: workflow.template,
|
||||
numberVerificationPending: false,
|
||||
includeCalendarEvent: false,
|
||||
sendTo: workflow.sendTo,
|
||||
workflow: {
|
||||
connect: {
|
||||
id: createdWorkflow.id,
|
||||
},
|
||||
},
|
||||
verifiedAt: workflow?.verifiedAt ?? new Date(),
|
||||
},
|
||||
});
|
||||
|
||||
//activate event types and teams on workflows
|
||||
if (isOrg && workflow.activeOnTeams) {
|
||||
await Promise.all(
|
||||
workflow.activeOnTeams.map((id) =>
|
||||
prismock.workflowsOnTeams.create({
|
||||
data: {
|
||||
workflowId: createdWorkflow.id,
|
||||
teamId: id,
|
||||
},
|
||||
})
|
||||
)
|
||||
);
|
||||
} else if (workflow.activeOn) {
|
||||
await Promise.all(
|
||||
workflow.activeOn.map((id) =>
|
||||
prismock.workflowsOnEventTypes.create({
|
||||
data: {
|
||||
workflowId: createdWorkflow.id,
|
||||
eventTypeId: id,
|
||||
},
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
async function addWorkflows(workflows: InputWorkflow[]) {
|
||||
log.silly("TestData: Creating Workflows", safeStringify(workflows));
|
||||
|
||||
return await addWorkflowsToDb(workflows);
|
||||
}
|
||||
|
||||
export async function addWorkflowReminders(workflowReminders: InputWorkflowReminder[]) {
|
||||
log.silly("TestData: Creating Workflow Reminders", safeStringify(workflowReminders));
|
||||
|
||||
return await prismock.workflowReminder.createMany({
|
||||
data: workflowReminders,
|
||||
});
|
||||
}
|
||||
|
||||
export async function addUsersToDb(users: InputUser[]) {
|
||||
log.silly("TestData: Creating Users", JSON.stringify(users));
|
||||
await prismock.user.createMany({
|
||||
@@ -1058,7 +927,6 @@ export async function createBookingScenario(data: ScenarioData) {
|
||||
// mockBusyCalendarTimes([]);
|
||||
await addWebhooks(data.webhooks || []);
|
||||
// addPaymentMock();
|
||||
const workflows = await addWorkflows(data.workflows || []);
|
||||
await addPaymentToDb(data.payment || []);
|
||||
|
||||
if (data.selectedSlots) {
|
||||
@@ -1067,7 +935,6 @@ export async function createBookingScenario(data: ScenarioData) {
|
||||
|
||||
return {
|
||||
eventTypes,
|
||||
workflows,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1640,7 +1507,6 @@ export function getScenarioData(
|
||||
apps = [],
|
||||
users: _users,
|
||||
webhooks,
|
||||
workflows,
|
||||
bookings,
|
||||
payment,
|
||||
}: {
|
||||
@@ -1650,7 +1516,6 @@ export function getScenarioData(
|
||||
users?: ScenarioData["users"];
|
||||
usersApartFromOrganizer?: ScenarioData["users"];
|
||||
webhooks?: ScenarioData["webhooks"];
|
||||
workflows?: ScenarioData["workflows"];
|
||||
bookings?: ScenarioData["bookings"];
|
||||
payment?: ScenarioData["payment"];
|
||||
},
|
||||
@@ -1714,7 +1579,6 @@ export function getScenarioData(
|
||||
apps: [...apps],
|
||||
webhooks,
|
||||
bookings: bookings || [],
|
||||
workflows,
|
||||
payment,
|
||||
} satisfies ScenarioData;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { expect, vi } from "vitest";
|
||||
import "vitest-fetch-mock";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { WEBSITE_URL } from "@calcom/lib/constants";
|
||||
import { WEBAPP_URL, WEBSITE_URL } from "@calcom/lib/constants";
|
||||
import logger from "@calcom/lib/logger";
|
||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||
import type {
|
||||
@@ -477,7 +477,7 @@ export function expectSuccessfulBookingCreationEmails({
|
||||
destinationEmail?: string;
|
||||
calendarType?: string;
|
||||
}) {
|
||||
const bookingUrlOrigin = booking.urlOrigin || WEBSITE_URL;
|
||||
const bookingUrlOrigin = booking.urlOrigin || WEBAPP_URL;
|
||||
expect(emails).toHaveEmail(
|
||||
{
|
||||
titleTag: "confirmed_event_type_subject",
|
||||
@@ -902,7 +902,7 @@ export function expectBookingRequestRescheduledEmails({
|
||||
booking: { uid: string; urlOrigin?: string };
|
||||
bookNewTimePath: string;
|
||||
}) {
|
||||
const bookingUrlOrigin = booking.urlOrigin || WEBSITE_URL;
|
||||
const bookingUrlOrigin = booking.urlOrigin || WEBAPP_URL;
|
||||
|
||||
expect(emails).toHaveEmail(
|
||||
{
|
||||
@@ -939,15 +939,7 @@ export function expectBookingRequestRescheduledEmails({
|
||||
);
|
||||
}
|
||||
|
||||
export function expectBookingRequestedWebhookToHaveBeenFired({
|
||||
booker,
|
||||
location,
|
||||
subscriberUrl,
|
||||
paidEvent,
|
||||
eventType,
|
||||
isEmailHidden = false,
|
||||
isAttendeePhoneNumberHidden = false,
|
||||
}: {
|
||||
export function expectBookingRequestedWebhookToHaveBeenFired(_args: {
|
||||
organizer: { email: string; name: string };
|
||||
booker: { email: string; name: string; attendeePhoneNumber?: string };
|
||||
subscriberUrl: string;
|
||||
@@ -957,72 +949,8 @@ export function expectBookingRequestedWebhookToHaveBeenFired({
|
||||
isEmailHidden?: boolean;
|
||||
isAttendeePhoneNumberHidden?: boolean;
|
||||
}) {
|
||||
// There is an inconsistency in the way we send the data to the webhook for paid events and unpaid events. Fix that and then remove this if statement.
|
||||
if (!paidEvent) {
|
||||
expectWebhookToHaveBeenCalledWith(subscriberUrl, {
|
||||
triggerEvent: "BOOKING_REQUESTED",
|
||||
payload: {
|
||||
eventTitle: eventType.title,
|
||||
eventDescription: eventType.description,
|
||||
metadata: {
|
||||
// In a Pending Booking Request, we don't send the video call url
|
||||
},
|
||||
responses: {
|
||||
name: {
|
||||
label: "your_name",
|
||||
value: booker.name,
|
||||
isHidden: false,
|
||||
},
|
||||
email: {
|
||||
label: "email_address",
|
||||
value: booker.email,
|
||||
isHidden: isEmailHidden,
|
||||
},
|
||||
...(booker.attendeePhoneNumber
|
||||
? {
|
||||
attendeePhoneNumber: {
|
||||
label: "phone_number",
|
||||
value: booker.attendeePhoneNumber,
|
||||
isHidden: isAttendeePhoneNumberHidden,
|
||||
},
|
||||
}
|
||||
: null),
|
||||
location: {
|
||||
label: "location",
|
||||
value: { optionValue: "", value: location },
|
||||
isHidden: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
} else {
|
||||
expectWebhookToHaveBeenCalledWith(subscriberUrl, {
|
||||
triggerEvent: "BOOKING_REQUESTED",
|
||||
payload: {
|
||||
eventTitle: eventType.title,
|
||||
eventDescription: eventType.description,
|
||||
metadata: {
|
||||
// In a Pending Booking Request, we don't send the video call url
|
||||
},
|
||||
responses: {
|
||||
name: { label: "name", value: booker.name },
|
||||
email: { label: "email", value: booker.email },
|
||||
...(booker.attendeePhoneNumber
|
||||
? {
|
||||
attendeePhoneNumber: {
|
||||
label: "phone_number",
|
||||
value: booker.attendeePhoneNumber,
|
||||
},
|
||||
}
|
||||
: null),
|
||||
location: {
|
||||
label: "location",
|
||||
value: { optionValue: "", value: location },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
// BOOKING_REQUESTED webhooks are now queued via the webhook producer (deps.webhookProducer.queueBookingRequestedWebhook)
|
||||
// instead of sent inline via HTTP. The producer is tested separately in webhook-producer-booking-requested.test.ts.
|
||||
}
|
||||
|
||||
export function expectBookingCreatedWebhookToHaveBeenFired({
|
||||
|
||||
@@ -31,7 +31,6 @@ export const getSampleUserInSession = () => ({
|
||||
darkBrandColor: "#fafafa",
|
||||
metadata: null,
|
||||
role: UserPermissionRole.USER,
|
||||
disableImpersonation: false,
|
||||
organizationId: null,
|
||||
theme: "",
|
||||
appTheme: "",
|
||||
|
||||
Reference in new issue
Block a user