Compare commits
4 Commits
main
...
10-26-chor
Author | SHA1 | Date | |
---|---|---|---|
|
88125851dd | ||
|
7b6ca4b844 | ||
|
4f9e890bdb | ||
|
a19c5b4af0 |
|
@ -1,7 +1,5 @@
|
||||||
import { expect } from "@playwright/test";
|
import { expect } from "@playwright/test";
|
||||||
|
|
||||||
import dayjs from "@calcom/dayjs";
|
|
||||||
|
|
||||||
import { test } from "./lib/fixtures";
|
import { test } from "./lib/fixtures";
|
||||||
|
|
||||||
test.describe.configure({ mode: "parallel" });
|
test.describe.configure({ mode: "parallel" });
|
||||||
|
@ -19,7 +17,7 @@ test.describe("Availablity tests", () => {
|
||||||
await users.deleteAll();
|
await users.deleteAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Date Overrides", async ({ page }) => {
|
test("Date Overrides", async ({ page, dayjs }) => {
|
||||||
await test.step("Can add a date override", async () => {
|
await test.step("Can add a date override", async () => {
|
||||||
await page.locator('[data-testid="schedules"] > li a').click();
|
await page.locator('[data-testid="schedules"] > li a').click();
|
||||||
await page.locator('[data-testid="add-override"]').click();
|
await page.locator('[data-testid="add-override"]').click();
|
||||||
|
|
|
@ -3,18 +3,17 @@ import type { Booking, Prisma } from "@prisma/client";
|
||||||
import short from "short-uuid";
|
import short from "short-uuid";
|
||||||
import { v5 as uuidv5 } from "uuid";
|
import { v5 as uuidv5 } from "uuid";
|
||||||
|
|
||||||
import _dayjs from "@calcom/dayjs";
|
|
||||||
import { prisma } from "@calcom/prisma";
|
import { prisma } from "@calcom/prisma";
|
||||||
|
|
||||||
|
import type { Fixtures } from "../lib/fixtures";
|
||||||
|
|
||||||
const translator = short();
|
const translator = short();
|
||||||
|
|
||||||
type BookingFixture = ReturnType<typeof createBookingFixture>;
|
type BookingFixture = ReturnType<typeof createBookingFixture>;
|
||||||
|
|
||||||
// We default all dayjs calls to use Europe/London timezone
|
|
||||||
const dayjs = (...args: Parameters<typeof _dayjs>) => _dayjs(...args).tz("Europe/London");
|
|
||||||
|
|
||||||
// creates a user fixture instance and stores the collection
|
// creates a user fixture instance and stores the collection
|
||||||
export const createBookingsFixture = (page: Page) => {
|
export const createBookingsFixture = (args: { page: Page; dayjs: Fixtures["dayjs"] }) => {
|
||||||
|
const { page, dayjs } = args;
|
||||||
const store = { bookings: [], page } as { bookings: BookingFixture[]; page: typeof page };
|
const store = { bookings: [], page } as { bookings: BookingFixture[]; page: typeof page };
|
||||||
return {
|
return {
|
||||||
create: async (
|
create: async (
|
||||||
|
|
|
@ -3,6 +3,8 @@ import { test as base } from "@playwright/test";
|
||||||
import type { API } from "mailhog";
|
import type { API } from "mailhog";
|
||||||
import mailhog from "mailhog";
|
import mailhog from "mailhog";
|
||||||
|
|
||||||
|
import type { Dayjs } from "@calcom/dayjs";
|
||||||
|
import _dayjs from "@calcom/dayjs";
|
||||||
import { IS_MAILHOG_ENABLED } from "@calcom/lib/constants";
|
import { IS_MAILHOG_ENABLED } from "@calcom/lib/constants";
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
|
|
||||||
|
@ -28,6 +30,7 @@ export interface Fixtures {
|
||||||
emails?: API;
|
emails?: API;
|
||||||
routingForms: ReturnType<typeof createRoutingFormsFixture>;
|
routingForms: ReturnType<typeof createRoutingFormsFixture>;
|
||||||
bookingPage: ReturnType<typeof createBookingPageFixture>;
|
bookingPage: ReturnType<typeof createBookingPageFixture>;
|
||||||
|
dayjs: (...args: Parameters<typeof _dayjs>) => Dayjs;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
@ -58,8 +61,8 @@ export const test = base.extend<Fixtures>({
|
||||||
const usersFixture = createUsersFixture(page, emails, workerInfo);
|
const usersFixture = createUsersFixture(page, emails, workerInfo);
|
||||||
await use(usersFixture);
|
await use(usersFixture);
|
||||||
},
|
},
|
||||||
bookings: async ({ page }, use) => {
|
bookings: async ({ page, dayjs }, use) => {
|
||||||
const bookingsFixture = createBookingsFixture(page);
|
const bookingsFixture = createBookingsFixture({ page, dayjs });
|
||||||
await use(bookingsFixture);
|
await use(bookingsFixture);
|
||||||
},
|
},
|
||||||
payments: async ({ page }, use) => {
|
payments: async ({ page }, use) => {
|
||||||
|
@ -92,4 +95,9 @@ export const test = base.extend<Fixtures>({
|
||||||
const bookingPage = createBookingPageFixture(page);
|
const bookingPage = createBookingPageFixture(page);
|
||||||
await use(bookingPage);
|
await use(bookingPage);
|
||||||
},
|
},
|
||||||
|
dayjs: async ({ timezoneId }, use) => {
|
||||||
|
// We default all dayjs calls to use the browser configured timezone
|
||||||
|
const dayjs = (...args: Parameters<typeof _dayjs>) => _dayjs(...args).tz(timezoneId);
|
||||||
|
await use(dayjs);
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { expect } from "@playwright/test";
|
import { expect } from "@playwright/test";
|
||||||
|
|
||||||
import dayjs from "@calcom/dayjs";
|
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
import { BookingStatus } from "@calcom/prisma/enums";
|
import { BookingStatus } from "@calcom/prisma/enums";
|
||||||
|
|
||||||
|
@ -245,6 +244,7 @@ test.describe("Reschedule Tests", async () => {
|
||||||
page,
|
page,
|
||||||
users,
|
users,
|
||||||
bookings,
|
bookings,
|
||||||
|
dayjs,
|
||||||
}) => {
|
}) => {
|
||||||
const user = await users.create();
|
const user = await users.create();
|
||||||
const eventType = user.eventTypes[0];
|
const eventType = user.eventTypes[0];
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { expect } from "@playwright/test";
|
import { expect } from "@playwright/test";
|
||||||
|
|
||||||
import _dayjs from "@calcom/dayjs";
|
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
|
|
||||||
import { test } from "./lib/fixtures";
|
import { test } from "./lib/fixtures";
|
||||||
|
@ -9,14 +8,12 @@ test.describe.configure({ mode: "parallel" });
|
||||||
|
|
||||||
test.afterEach(({ users }) => users.deleteAll());
|
test.afterEach(({ users }) => users.deleteAll());
|
||||||
|
|
||||||
// We default all dayjs calls to use Europe/London timezone
|
|
||||||
const dayjs = (...args: Parameters<typeof _dayjs>) => _dayjs(...args).tz("Europe/London");
|
|
||||||
|
|
||||||
test.describe("Wipe my Cal App Test", () => {
|
test.describe("Wipe my Cal App Test", () => {
|
||||||
test("Browse upcoming bookings and validate button shows and triggering wipe my cal button", async ({
|
test("Browse upcoming bookings and validate button shows and triggering wipe my cal button", async ({
|
||||||
page,
|
page,
|
||||||
users,
|
users,
|
||||||
bookings,
|
bookings,
|
||||||
|
dayjs,
|
||||||
}) => {
|
}) => {
|
||||||
const pro = await users.create();
|
const pro = await users.create();
|
||||||
const [eventType] = pro.eventTypes;
|
const [eventType] = pro.eventTypes;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { expect } from "@playwright/test";
|
import { expect } from "@playwright/test";
|
||||||
|
|
||||||
import dayjs from "@calcom/dayjs";
|
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
import { WorkflowMethods } from "@calcom/prisma/enums";
|
import { WorkflowMethods } from "@calcom/prisma/enums";
|
||||||
|
|
||||||
|
@ -14,7 +13,7 @@ test.describe("Workflow tests", () => {
|
||||||
// Fixme: This test is failing because the listing isn't immediately updated after the workflow is created
|
// Fixme: This test is failing because the listing isn't immediately updated after the workflow is created
|
||||||
test.fixme(
|
test.fixme(
|
||||||
"Create default reminder workflow & trigger when event type is booked",
|
"Create default reminder workflow & trigger when event type is booked",
|
||||||
async ({ page, users }) => {
|
async ({ page, users, dayjs }) => {
|
||||||
const user = await users.create();
|
const user = await users.create();
|
||||||
const [eventType] = user.eventTypes;
|
const [eventType] = user.eventTypes;
|
||||||
await user.apiLogin();
|
await user.apiLogin();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user