2022-03-28 20:06:41 +00:00
|
|
|
import { test as base } from "@playwright/test";
|
|
|
|
|
2022-09-02 02:00:48 +00:00
|
|
|
import prisma from "@calcom/prisma";
|
|
|
|
|
2023-03-15 22:01:04 +00:00
|
|
|
import type { ExpectedUrlDetails } from "../../../../playwright.config";
|
2022-05-14 03:02:10 +00:00
|
|
|
import { createBookingsFixture } from "../fixtures/bookings";
|
2022-09-02 02:00:48 +00:00
|
|
|
import { createEmbedsFixture, createGetActionFiredDetails } from "../fixtures/embeds";
|
2022-05-14 03:02:10 +00:00
|
|
|
import { createPaymentsFixture } from "../fixtures/payments";
|
2022-09-02 02:00:48 +00:00
|
|
|
import { createServersFixture } from "../fixtures/servers";
|
2022-03-28 20:06:41 +00:00
|
|
|
import { createUsersFixture } from "../fixtures/users";
|
|
|
|
|
2022-09-02 19:00:41 +00:00
|
|
|
export interface Fixtures {
|
2022-04-06 15:13:09 +00:00
|
|
|
users: ReturnType<typeof createUsersFixture>;
|
2022-05-14 03:02:10 +00:00
|
|
|
bookings: ReturnType<typeof createBookingsFixture>;
|
|
|
|
payments: ReturnType<typeof createPaymentsFixture>;
|
2022-09-02 02:00:48 +00:00
|
|
|
addEmbedListeners: ReturnType<typeof createEmbedsFixture>;
|
|
|
|
getActionFiredDetails: ReturnType<typeof createGetActionFiredDetails>;
|
|
|
|
servers: ReturnType<typeof createServersFixture>;
|
|
|
|
prisma: typeof prisma;
|
2022-03-28 20:06:41 +00:00
|
|
|
}
|
|
|
|
|
2023-03-15 22:01:04 +00:00
|
|
|
declare global {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
|
|
namespace PlaywrightTest {
|
|
|
|
//FIXME: how to restrict it to Frame only
|
|
|
|
interface Matchers<R> {
|
|
|
|
toBeEmbedCalLink(
|
|
|
|
calNamespace: string,
|
|
|
|
// eslint-disable-next-line
|
|
|
|
getActionFiredDetails: (a: { calNamespace: string; actionType: string }) => Promise<any>,
|
|
|
|
expectedUrlDetails?: ExpectedUrlDetails
|
|
|
|
): Promise<R>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-14 03:02:10 +00:00
|
|
|
/**
|
|
|
|
* @see https://playwright.dev/docs/test-fixtures
|
|
|
|
*/
|
2022-03-28 20:06:41 +00:00
|
|
|
export const test = base.extend<Fixtures>({
|
2022-05-14 03:02:10 +00:00
|
|
|
users: async ({ page }, use, workerInfo) => {
|
|
|
|
const usersFixture = createUsersFixture(page, workerInfo);
|
2022-03-28 20:06:41 +00:00
|
|
|
await use(usersFixture);
|
|
|
|
},
|
2022-05-14 03:02:10 +00:00
|
|
|
bookings: async ({ page }, use) => {
|
|
|
|
const bookingsFixture = createBookingsFixture(page);
|
|
|
|
await use(bookingsFixture);
|
|
|
|
},
|
|
|
|
payments: async ({ page }, use) => {
|
|
|
|
const payemntsFixture = createPaymentsFixture(page);
|
|
|
|
await use(payemntsFixture);
|
|
|
|
},
|
2022-09-02 02:00:48 +00:00
|
|
|
addEmbedListeners: async ({ page }, use) => {
|
|
|
|
const embedsFixture = createEmbedsFixture(page);
|
|
|
|
await use(embedsFixture);
|
|
|
|
},
|
|
|
|
getActionFiredDetails: async ({ page }, use) => {
|
|
|
|
const getActionFiredDetailsFixture = createGetActionFiredDetails(page);
|
|
|
|
await use(getActionFiredDetailsFixture);
|
|
|
|
},
|
|
|
|
servers: async ({}, use) => {
|
|
|
|
const servers = createServersFixture();
|
|
|
|
await use(servers);
|
|
|
|
},
|
|
|
|
prisma: async ({}, use) => {
|
|
|
|
await use(prisma);
|
|
|
|
},
|
2022-03-28 20:06:41 +00:00
|
|
|
});
|