chore: Replace UI login with api login on e2e tests (#9344)

* Replace the ui login with api login

* test api login

* go to first page after login in some tests

---------

Co-authored-by: Keith Williams <[email protected]>
This commit is contained in:
Efraín RochínandKeith Williams authored and GitHub committed 2023-06-06 18:02:32 +00:00
1 parent dcf9d30382
commit 17d106cfda
25 files changed
+191 -107

No files matched your search

+2 -2
View File
@@ -9,7 +9,7 @@ test.afterEach(({ users }) => users.deleteAll());
test.describe("App Store - Authed", () => {
test("Browse apple-calendar and try to install", async ({ page, users }) => {
const pro = await users.create();
await pro.login();
await pro.apiLogin();
await page.goto("/apps/categories/calendar");
await page.click('[data-testid="app-store-app-card-apple-calendar"]');
await page.waitForURL("/apps/apple-calendar");
@@ -19,7 +19,7 @@ test.describe("App Store - Authed", () => {
test("Installed Apps - Navigation", async ({ page, users }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
await page.goto("/apps/installed");
await page.waitForSelector('[data-testid="connect-calendar-apps"]');
await page.click('[data-testid="vertical-tab-payment"]');
+51 -51
View File
@@ -3,7 +3,7 @@ import { test } from "../lib/fixtures";
test.describe("Can signup from a team invite", async () => {
test.beforeEach(async ({ users }) => {
const proUser = await users.create();
await proUser.login();
await proUser.apiLogin();
});
test.afterEach(async ({ users }) => users.deleteAll());
@@ -33,65 +33,65 @@ test.describe("Can signup from a team invite", async () => {
// Wait for the invite to be sent
/*await page.waitForSelector(`[data-testid="member-email"][data-email="${testUser.email}"]`);
const tokenObj = await prisma.verificationToken.findFirstOrThrow({
where: { identifier: testUser.email },
select: { token: true },
});
const tokenObj = await prisma.verificationToken.findFirstOrThrow({
where: { identifier: testUser.email },
select: { token: true },
});
if (!proUser.username) throw Error("Test username is null, can't continue");
if (!proUser.username) throw Error("Test username is null, can't continue");
// Open a new user window to accept the invite
const newPage = await browser.newPage();
await newPage.goto(`/auth/signup?token=${tokenObj.token}&callbackUrl=${WEBAPP_URL}/settings/teams`);
// Open a new user window to accept the invite
const newPage = await browser.newPage();
await newPage.goto(`/auth/signup?token=${tokenObj.token}&callbackUrl=${WEBAPP_URL}/settings/teams`);
// Fill in form
await newPage.fill('input[name="username"]', proUser.username); // Invalid username
await newPage.fill('input[name="email"]', testUser.email);
await newPage.fill('input[name="password"]', testUser.password);
await newPage.fill('input[name="passwordcheck"]', testUser.password);
await newPage.press('input[name="passwordcheck"]', "Enter"); // Press Enter to submit
// Fill in form
await newPage.fill('input[name="username"]', proUser.username); // Invalid username
await newPage.fill('input[name="email"]', testUser.email);
await newPage.fill('input[name="password"]', testUser.password);
await newPage.fill('input[name="passwordcheck"]', testUser.password);
await newPage.press('input[name="passwordcheck"]', "Enter"); // Press Enter to submit
await expect(newPage.locator('text="Username already taken"')).toBeVisible();
await expect(newPage.locator('text="Username already taken"')).toBeVisible();
// Email address is already registered
// TODO: Form errors don't disappear when corrected and resubmitted, so we need to refresh
await newPage.reload();
await newPage.fill('input[name="username"]', testUser.username);
await newPage.fill('input[name="email"]', `${proUser.username}@example.com`); // Taken email
await newPage.fill('input[name="password"]', testUser.password);
await newPage.fill('input[name="passwordcheck"]', testUser.password);
await newPage.press('input[name="passwordcheck"]', "Enter"); // Press Enter to submit
await expect(newPage.locator('text="Email address is already registered"')).toBeVisible();
// Email address is already registered
// TODO: Form errors don't disappear when corrected and resubmitted, so we need to refresh
await newPage.reload();
await newPage.fill('input[name="username"]', testUser.username);
await newPage.fill('input[name="email"]', `${proUser.username}@example.com`); // Taken email
await newPage.fill('input[name="password"]', testUser.password);
await newPage.fill('input[name="passwordcheck"]', testUser.password);
await newPage.press('input[name="passwordcheck"]', "Enter"); // Press Enter to submit
await expect(newPage.locator('text="Email address is already registered"')).toBeVisible();
// Successful signup
// TODO: Form errors don't disappear when corrected and resubmitted, so we need to refresh
await newPage.reload();
await newPage.fill('input[name="username"]', testUser.username);
await newPage.fill('input[name="email"]', testUser.email);
await newPage.fill('input[name="password"]', testUser.password);
await newPage.fill('input[name="passwordcheck"]', testUser.password);
await newPage.press('input[name="passwordcheck"]', "Enter"); // Press Enter to submit
await expect(newPage.locator(`[data-testid="login-form"]`)).toBeVisible();
// Successful signup
// TODO: Form errors don't disappear when corrected and resubmitted, so we need to refresh
await newPage.reload();
await newPage.fill('input[name="username"]', testUser.username);
await newPage.fill('input[name="email"]', testUser.email);
await newPage.fill('input[name="password"]', testUser.password);
await newPage.fill('input[name="passwordcheck"]', testUser.password);
await newPage.press('input[name="passwordcheck"]', "Enter"); // Press Enter to submit
await expect(newPage.locator(`[data-testid="login-form"]`)).toBeVisible();
// We don't need the new browser anymore
await newPage.close();
// We don't need the new browser anymore
await newPage.close();
const createdUser = await prisma.user.findUniqueOrThrow({
where: { email: testUser.email },
include: { teams: { include: { team: true } } },
});
const createdUser = await prisma.user.findUniqueOrThrow({
where: { email: testUser.email },
include: { teams: { include: { team: true } } },
});
console.log("createdUser", createdUser);
console.log("createdUser", createdUser);
// Check that the user was created
expect(createdUser).not.toBeNull();
expect(createdUser.username).toBe(testUser.username);
expect(createdUser.password).not.toBeNull();
expect(createdUser.emailVerified).not.toBeNull();
// Check that the user accepted the team invite
expect(createdUser.teams).toHaveLength(1);
expect(createdUser.teams[0].team.name).toBe(teamName);
expect(createdUser.teams[0].role).toBe("MEMBER");
expect(createdUser.teams[0].accepted).toBe(true);*/
// Check that the user was created
expect(createdUser).not.toBeNull();
expect(createdUser.username).toBe(testUser.username);
expect(createdUser.password).not.toBeNull();
expect(createdUser.emailVerified).not.toBeNull();
// Check that the user accepted the team invite
expect(createdUser.teams).toHaveLength(1);
expect(createdUser.teams[0].team.name).toBe(teamName);
expect(createdUser.teams[0].role).toBe("MEMBER");
expect(createdUser.teams[0].accepted).toBe(true);*/
});
});
@@ -8,12 +8,10 @@ test("Can delete user account", async ({ page, users }) => {
const user = await users.create({
username: "delete-me",
});
await user.login();
await user.apiLogin();
await page.goto(`/settings/my-account/profile`);
await page.waitForSelector("[data-testid=dashboard-shell]");
await page.goto(`/settings/my-account/profile`);
await page.waitForLoadState("networkidle");
await page.click("[data-testid=delete-account]");
expect(user.username).toBeTruthy();
@@ -18,7 +18,7 @@ test("Can reset forgotten password", async ({ page, users }) => {
// Press Enter
await Promise.all([
page.waitForURL((u) => u.pathname.startsWith("/auth/forgot-password/")),
page.waitForURL((u) => u.pathname.startsWith("/auth/forgot-password")),
page.press('input[name="email"]', "Enter"),
]);
+1 -1
View File
@@ -9,7 +9,7 @@ test.describe.configure({ mode: "parallel" });
test.describe("Availablity tests", () => {
test.beforeEach(async ({ page, users }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
await page.goto("/availability");
// We wait until loading is finished
await page.waitForSelector('[data-testid="schedules"]');
+3 -3
View File
@@ -78,7 +78,7 @@ testBothBookers.describe("pro user", () => {
const [eventType] = pro.eventTypes;
await bookings.create(pro.id, pro.username, eventType.id);
await pro.login();
await pro.apiLogin();
await page.goto("/bookings/upcoming");
await page.waitForSelector('[data-testid="bookings"]');
await page.locator('[data-testid="edit_booking"]').nth(0).click();
@@ -106,7 +106,7 @@ testBothBookers.describe("pro user", () => {
await expect(page.locator(`[data-testid="attendee-name-${testName}"]`)).toHaveText(testName);
const [pro] = users.get();
await pro.login();
await pro.apiLogin();
await page.goto("/bookings/upcoming");
await page.locator('[data-testid="cancel"]').first().click();
@@ -132,7 +132,7 @@ testBothBookers.describe("pro user", () => {
}) => {
await bookOptinEvent(page);
const [pro] = users.get();
await pro.login();
await pro.apiLogin();
await page.goto("/bookings/unconfirmed");
await Promise.all([
+17 -5
View File
@@ -14,6 +14,7 @@ import {
selectFirstAvailableTimeSlotNextMonth,
} from "./lib/testUtils";
test.describe.configure({ mode: "parallel" });
test.afterEach(({ users }) => users.deleteAll());
async function createUserWithSeatedEvent(users: Fixtures["users"]) {
@@ -50,17 +51,27 @@ async function createUserWithSeatedEventAndAttendees(
testBothBookers.describe("Booking with Seats", (bookerVariant) => {
test("User can create a seated event (2 seats as example)", async ({ users, page }) => {
const user = await users.create({ name: "Seated event" });
await user.login();
await user.apiLogin();
await page.goto("/event-types");
// We wait until loading is finished
await page.waitForSelector('[data-testid="event-types"]');
const eventTitle = "My 2-seated event";
await createNewSeatedEventType(page, { eventTitle });
await expect(page.locator(`text=${eventTitle} event type updated successfully`)).toBeVisible();
});
test("Multiple Attendees can book a seated event time slot", async ({ users, page }) => {
const slug = "my-2-seated-event";
const user = await users.create({
name: "Seated event user",
eventTypes: [
{ title: "My 2-seated event", slug, length: 60, seatsPerTimeSlot: 2, seatsShowAttendees: true },
{
title: "My 2-seated event",
slug,
length: 60,
seatsPerTimeSlot: 2,
seatsShowAttendees: true,
},
],
});
await page.goto(`/${user.username}/${slug}`);
@@ -93,6 +104,7 @@ testBothBookers.describe("Booking with Seats", (bookerVariant) => {
await expect(page.locator("[data-testid=success-page]")).toBeHidden();
});
});
// TODO: Make E2E test: Attendee #1 should be able to cancel his booking
// todo("Attendee #1 should be able to cancel his booking");
// TODO: Make E2E test: Attendee #1 should be able to reschedule his booking
@@ -222,7 +234,7 @@ testBothBookers.describe("Reschedule for booking with seats", () => {
{ name: "John First", email: "[email protected]", timeZone: "Europe/Berlin" },
{ name: "Jane Second", email: "[email protected]", timeZone: "Europe/Berlin" },
]);
await user.login();
await user.apiLogin();
const oldBooking = await prisma.booking.findFirst({
where: { uid: booking.uid },
@@ -328,7 +340,7 @@ testBothBookers.describe("Reschedule for booking with seats", () => {
{ name: "John First", email: "[email protected]", timeZone: "Europe/Berlin" },
{ name: "Jane Second", email: "[email protected]", timeZone: "Europe/Berlin" },
]);
await user.login();
await user.apiLogin();
const bookingAttendees = await prisma.attendee.findMany({
where: { bookingId: booking.id },
@@ -379,7 +391,7 @@ testBothBookers.describe("Reschedule for booking with seats", () => {
{ name: "John First", email: "[email protected]", timeZone: "Europe/Berlin" },
{ name: "Jane Second", email: "[email protected]", timeZone: "Europe/Berlin" },
]);
await user.login();
await user.apiLogin();
const bookingWithEventType = await prisma.booking.findFirst({
where: { uid: booking.uid },
select: {
+1 -1
View File
@@ -7,7 +7,7 @@ test.afterEach(({ users }) => users.deleteAll());
test.describe("Change Password Test", () => {
test("change password", async ({ page, users }) => {
const pro = await users.create();
await pro.login();
await pro.apiLogin();
// Go to http://localhost:3000/settings/security
await page.goto("/settings/security/password");
+2 -2
View File
@@ -26,7 +26,7 @@ test.describe("Change username on settings", () => {
test.fixme("User can change username", async ({ page, users, prisma }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
// Try to go homepage
await page.goto("/settings/my-account/profile");
// Change username from normal to normal
@@ -56,7 +56,7 @@ test.describe("Change username on settings", () => {
const user = await users.create();
await stripe.customers.create({ email: `${user?.username}@example.com` });
await user.login();
await user.apiLogin();
await page.goto("/settings/my-account/profile");
// Change username from normal to premium
@@ -14,7 +14,7 @@ test.afterEach(({ users }) => users.deleteAll());
// eslint-disable-next-line playwright/no-skipped-test
test.skip("dynamic booking", async ({ page, users }) => {
const pro = await users.create();
await pro.login();
await pro.apiLogin();
const free = await users.create({ username: "free" });
await page.goto(`/${pro.username}+${free.username}`);
@@ -47,7 +47,15 @@ async function expectToBeNavigatingToEmbedTypesDialog(
async function expectToBeNavigatingToEmbedCodeAndPreviewDialog(
page: Page,
{ embedUrl, embedType, basePage }: { embedUrl: string | null; embedType: string; basePage: string }
{
embedUrl,
embedType,
basePage,
}: {
embedUrl: string | null;
embedType: string;
basePage: string;
}
) {
if (!embedUrl) {
throw new Error("Couldn't find embedUrl");
@@ -89,7 +97,7 @@ test.afterEach(({ users }) => users.deleteAll());
test.describe("Embed Code Generator Tests", () => {
test.beforeEach(async ({ users }) => {
const pro = await users.create();
await pro.login();
await pro.apiLogin();
});
test.describe("Event Types Page", () => {
+1 -1
View File
@@ -13,7 +13,7 @@ test.describe("Event Types tests", () => {
testBothBookers.describe("user", (bookerVariant) => {
test.beforeEach(async ({ page, users }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
await page.goto("/event-types");
// We wait until loading is finished
await page.waitForSelector('[data-testid="event-types"]');
+31 -2
View File
@@ -262,13 +262,17 @@ const createUserFixture = (user: UserWithIncludes, page: Page) => {
// self is a reflective method that return the Prisma object that references this fixture.
const self = async () =>
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
(await prisma.user.findUnique({ where: { id: store.user.id }, include: { eventTypes: true } }))!;
(await prisma.user.findUnique({
where: { id: store.user.id },
include: { eventTypes: true },
}))!;
return {
id: user.id,
username: user.username,
eventTypes: user.eventTypes,
routingForms: user.routingForms,
self,
apiLogin: async () => apiLogin({ ...(await self()), password: user.username }, store.page),
login: async () => login({ ...(await self()), password: user.username }, store.page),
logout: async () => {
await page.goto("/auth/logout");
@@ -276,7 +280,10 @@ const createUserFixture = (user: UserWithIncludes, page: Page) => {
getPaymentCredential: async () => getPaymentCredential(store.page),
// ths is for developemnt only aimed to inject debugging messages in the metadata field of the user
debug: async (message: string | Record<string, JSONValue>) => {
await prisma.user.update({ where: { id: store.user.id }, data: { metadata: { debug: message } } });
await prisma.user.update({
where: { id: store.user.id },
data: { metadata: { debug: message } },
});
},
delete: async () => await prisma.user.delete({ where: { id: store.user.id } }),
};
@@ -342,6 +349,28 @@ export async function login(
await page.waitForLoadState("networkidle");
}
export async function apiLogin(
user: Pick<Prisma.User, "username"> & Partial<Pick<Prisma.User, "password" | "email">>,
page: Page
) {
const csrfToken = await page
.context()
.request.get("/api/auth/csrf")
.then((response) => response.json())
.then((json) => json.csrfToken);
const data = {
email: user.email ?? `${user.username}@example.com`,
password: user.password ?? user.username!,
callbackURL: "http://localhost:3000/",
redirect: "false",
json: "true",
csrfToken,
};
return page.context().request.post("/api/auth/callback/credentials", {
data,
});
}
export async function getPaymentCredential(page: Page) {
await page.goto("/apps/stripe");
+1 -1
View File
@@ -9,7 +9,7 @@ test.describe.configure({ mode: "parallel" });
test.fixme("hash my url", () => {
test.beforeEach(async ({ users }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
});
test.afterEach(async ({ users }) => {
await users.deleteAll();
@@ -24,7 +24,7 @@ test.describe("Stripe integration", () => {
test.describe("Stripe integration dashboard", () => {
test("Can add Stripe integration", async ({ page, users }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
await page.goto("/apps/installed");
await user.getPaymentCredential();
@@ -39,7 +39,7 @@ test.describe("Stripe integration", () => {
test("Can book a paid booking", async ({ page, users }) => {
const user = await users.create();
const eventType = user.eventTypes.find((e) => e.slug === "paid");
await user.login();
await user.apiLogin();
await page.goto("/apps/installed");
await user.getPaymentCredential();
+7 -7
View File
@@ -214,7 +214,7 @@ test.fixme("Integrations", () => {
test.describe("Zoom App", () => {
test("Can add integration", async ({ page, users }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
await addZoomIntegration({ page });
await page.waitForNavigation({
url: (url) => {
@@ -226,7 +226,7 @@ test.fixme("Integrations", () => {
test("can choose zoom as a location during booking", async ({ page, users }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
const eventType = await addLocationIntegrationToFirstEvent({ user });
await addZoomIntegration({ page });
await page.waitForNavigation({
@@ -241,7 +241,7 @@ test.fixme("Integrations", () => {
// POST https://api.zoom.us/v2/users/me/meetings
// Verify Header-> Authorization: "Bearer " + accessToken,
/**
* {
* {
topic: event.title,
type: 2, // Means that this is a scheduled meeting
start_time: event.startTime,
@@ -262,15 +262,15 @@ test.fixme("Integrations", () => {
approval_type: 2,
audio: "both",
auto_recording: "none",
enforce_login: false,
enforce_apiLogin: false,
registrants_email_notification: true,
},
};
*/
*/
});
test("Can disconnect from integration", async ({ page, users }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
await addZoomIntegration({ page });
await page.waitForNavigation({
url: (url) => {
@@ -299,7 +299,7 @@ test.fixme("Integrations", () => {
test.describe("Hubspot App", () => {
test("Can add integration", async ({ page, users }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
await addOauthBasedIntegration({
page,
slug: "hubspot",
+1 -1
View File
@@ -40,7 +40,7 @@ declare global {
* @see https://playwright.dev/docs/test-fixtures
*/
export const test = base.extend<Fixtures>({
users: async ({ page }, use, workerInfo) => {
users: async ({ page, context }, use, workerInfo) => {
const usersFixture = createUsersFixture(page, workerInfo);
await use(usersFixture);
},
+21
View File
@@ -0,0 +1,21 @@
import { expect } from "@playwright/test";
import { test } from "./lib/fixtures";
test.describe.configure({ mode: "parallel" });
test.afterEach(({ users }) => users.deleteAll());
test.describe("Login with api request", () => {
test("context request will share cookie storage with its browser context", async ({ page, users }) => {
const pro = await users.create();
await pro.apiLogin();
const contextCookies = await page.context().cookies();
const cookiesMap = new Map(contextCookies.map(({ name, value }) => [name, value]));
// The browser context will already contain all the cookies from the API response.
expect(cookiesMap.has("next-auth.csrf-token")).toBeTruthy();
expect(cookiesMap.has("next-auth.callback-url")).toBeTruthy();
expect(cookiesMap.has("next-auth.session-token")).toBeTruthy();
});
});
@@ -15,6 +15,7 @@ async function getLabelText(field: Locator) {
return await field.locator("label").first().locator("span").first().innerText();
}
test.describe.configure({ mode: "parallel" });
test.describe("Manage Booking Questions", () => {
test.afterEach(async ({ users }) => {
await users.deleteAll();
@@ -28,7 +29,7 @@ test.describe("Manage Booking Questions", () => {
}, testInfo) => {
// Considering there are many steps in it, it would need more than default test timeout
test.setTimeout(testInfo.timeout * 3);
const user = await createAndLoginUserWithEventTypes({ users });
const user = await createAndLoginUserWithEventTypes({ users, page });
const webhookReceiver = await addWebhook(user);
@@ -51,7 +52,7 @@ test.describe("Manage Booking Questions", () => {
}, testInfo) => {
// Considering there are many steps in it, it would need more than default test timeout
test.setTimeout(testInfo.timeout * 3);
const user = await createAndLoginUserWithEventTypes({ users });
const user = await createAndLoginUserWithEventTypes({ users, page });
const team = await prisma.team.findFirst({
where: {
members: {
@@ -247,6 +248,7 @@ async function bookTimeSlot({ page, name, email }: { page: Page; name: string; e
await page.fill('[name="email"]', email);
await page.press('[name="email"]', "Enter");
}
/**
* 'option' starts from 1
*/
@@ -358,11 +360,20 @@ async function toggleQuestionRequireStatusAndSave({
await saveEventType(page);
}
async function createAndLoginUserWithEventTypes({ users }: { users: ReturnType<typeof createUsersFixture> }) {
async function createAndLoginUserWithEventTypes({
users,
page,
}: {
users: ReturnType<typeof createUsersFixture>;
page: Page;
}) {
const user = await users.create(null, {
hasTeam: true,
});
await user.login();
await user.apiLogin();
await page.goto("/event-types");
// We wait until loading is finished
await page.waitForSelector('[data-testid="event-types"]');
return user;
}
@@ -11,7 +11,8 @@ test.describe("Managed Event Types tests", () => {
// Creating the member user of the team
const memberUser = await users.create();
// First we work with owner user, logging in
await adminUser.login();
await adminUser.apiLogin();
await page.goto("/event-types");
// Making sure page loads completely
await page.waitForLoadState("networkidle");
// Let's create a team
@@ -58,7 +59,9 @@ test.describe("Managed Event Types tests", () => {
// Now we need to accept the invitation as member and come back in as admin to
// assign the member in the managed event type
await adminUser.logout();
await memberUser.login();
await memberUser.apiLogin();
await page.goto("/event-types");
// We wait until loading is finished
await page.waitForSelector('[data-testid="event-types"]');
await page.goto("/teams");
await page.waitForLoadState("networkidle");
@@ -67,7 +70,8 @@ test.describe("Managed Event Types tests", () => {
await memberUser.logout();
// Coming back as team owner to assign member user to managed event
await adminUser.login();
await adminUser.apiLogin();
await page.goto("/event-types");
await page.waitForLoadState("networkidle");
await page.locator('[data-testid="event-types"] a[title="managed"]').click();
await page.locator('[data-testid="vertical-tab-assignment"]').click();
@@ -78,7 +82,8 @@ test.describe("Managed Event Types tests", () => {
await adminUser.logout();
// Coming back as member user to see if there is a managed event present after assignment
await memberUser.login();
await memberUser.apiLogin();
await page.goto("/event-types");
await page.waitForLoadState("networkidle");
await expect(page.locator('[data-testid="event-types"] a[title="managed"]')).toBeVisible();
});
+2 -2
View File
@@ -11,8 +11,8 @@ test.describe("Onboarding", () => {
test.describe("Onboarding v2", () => {
test("Onboarding Flow", async ({ page, users }) => {
const user = await users.create({ completedOnboarding: false, name: null });
await user.login();
await user.apiLogin();
await page.goto("/getting-started");
// tests whether the user makes it to /getting-started
// after login with completedOnboarding false
await page.waitForURL("/getting-started");
+5 -5
View File
@@ -25,7 +25,7 @@ testBothBookers.describe("Reschedule Tests", async () => {
status: BookingStatus.ACCEPTED,
});
await user.login();
await user.apiLogin();
await page.goto("/bookings/upcoming");
await page.locator('[data-testid="edit_booking"]').nth(0).click();
@@ -69,7 +69,7 @@ testBothBookers.describe("Reschedule Tests", async () => {
rescheduled: true,
});
await user.login();
await user.apiLogin();
await page.goto("/bookings/cancelled");
const requestRescheduleSentElement = page.locator('[data-testid="request_reschedule_sent"]').nth(1);
@@ -117,7 +117,7 @@ testBothBookers.describe("Reschedule Tests", async () => {
// 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.login();
await user.apiLogin();
await user.getPaymentCredential();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const eventType = user.eventTypes.find((e) => e.slug === "paid")!;
@@ -158,7 +158,7 @@ testBothBookers.describe("Reschedule Tests", async () => {
test("Paid rescheduling should go to success page", async ({ page, users, bookings, payments }) => {
const user = await users.create();
await user.login();
await user.apiLogin();
await user.getPaymentCredential();
await users.logout();
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -207,7 +207,7 @@ testBothBookers.describe("Reschedule Tests", async () => {
const booking = await bookings.create(user.id, user.username, eventType.id, {
status: BookingStatus.ACCEPTED,
});
await user.login();
await user.apiLogin();
await page.goto(`/${user.username}/${eventType.slug}?rescheduleUid=${booking.uid}`);
+1 -1
View File
@@ -12,7 +12,7 @@ test.describe("Teams", () => {
test("Can create teams via Wizard", async ({ page, users }) => {
const user = await users.create();
const inviteeEmail = `${user.username}[email protected]`;
await user.login();
await user.apiLogin();
await page.goto("/teams");
await test.step("Can create team", async () => {
+3 -3
View File
@@ -18,7 +18,7 @@ test.describe("BOOKING_CREATED", async () => {
const webhookReceiver = createHttpServer();
const user = await users.create();
const [eventType] = user.eventTypes;
await user.login();
await user.apiLogin();
await page.goto(`/settings/developer/webhooks`);
// --- add webhook
@@ -154,7 +154,7 @@ test.describe("BOOKING_REJECTED", async () => {
await bookOptinEvent(page);
// --- login as that user
await user.login();
await user.apiLogin();
await page.goto(`/settings/developer/webhooks`);
@@ -275,7 +275,7 @@ test.describe("BOOKING_REQUESTED", async () => {
const user = await users.create();
// --- login as that user
await user.login();
await user.apiLogin();
await page.goto(`/settings/developer/webhooks`);
+1 -1
View File
@@ -35,7 +35,7 @@ test.describe("Wipe my Cal App Test", () => {
);
await bookings.create(pro.id, pro.username, eventType.id, {});
await bookings.create(pro.id, pro.username, eventType.id, {});
await pro.login();
await pro.apiLogin();
await page.goto("/bookings/upcoming");
await expect(page.locator("data-testid=wipe-today-button")).toBeVisible();