mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-08-23 14:52:18 +10:00
refactor: ponytail audit
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user