refactor: ponytail audit

This commit is contained in:
Amruth Pillai
2026-07-27 20:26:16 +02:00
parent bb1fb3a7d6
commit 9110e86997
157 changed files with 1082 additions and 2177 deletions
+4 -15
View File
@@ -1,4 +1,4 @@
import type { BrowserContext, Page } from "@playwright/test";
import type { Page } from "@playwright/test";
import type { E2EAccount } from "./data";
import { test as base, expect } from "@playwright/test";
import { createAuthenticatedContext } from "./auth";
@@ -7,13 +7,11 @@ import { deleteE2EUser } from "./db";
type Fixtures = {
account: E2EAccount;
authContext: BrowserContext;
authPage: Page;
};
export const test = base.extend<Fixtures>({
account: async ({ baseURL }, use, testInfo) => {
void baseURL;
account: async ({ baseURL: _baseURL }, use, testInfo) => {
const account = createAccount(testInfo);
try {
@@ -22,25 +20,16 @@ export const test = base.extend<Fixtures>({
await deleteE2EUser(account);
}
},
authContext: async ({ browser, request, account }, use, testInfo) => {
authPage: async ({ browser, request, account }, use, testInfo) => {
const baseURL = String(testInfo.project.use.baseURL ?? "http://localhost:3000");
const context = await createAuthenticatedContext(browser, request, account, baseURL);
try {
await use(context);
await use(await context.newPage());
} finally {
await context.close();
}
},
authPage: async ({ authContext }, use) => {
const page = await authContext.newPage();
try {
await use(page);
} finally {
await page.close();
}
},
});
export { expect };