2025-09-20 12:47:10 -07:00
|
|
|
import { expect as baseExpect, test as baseTest } from "@playwright/test";
|
|
|
|
|
import { getUnixTime } from "date-fns";
|
|
|
|
|
import { createAuthenticatedContext, type UserContext } from "./helpers";
|
2025-04-22 18:55:17 -07:00
|
|
|
|
2025-09-20 12:47:10 -07:00
|
|
|
type Fixtures = {
|
2025-04-22 18:55:17 -07:00
|
|
|
adaContext: UserContext;
|
|
|
|
|
babbageContext: UserContext;
|
2025-04-25 23:40:15 -07:00
|
|
|
curieContext: UserContext;
|
2025-09-20 12:47:10 -07:00
|
|
|
};
|
2025-04-22 18:55:17 -07:00
|
|
|
|
2025-09-20 12:47:10 -07:00
|
|
|
export const test = baseTest.extend<object, Fixtures>({
|
2025-04-22 18:55:17 -07:00
|
|
|
adaContext: [
|
2025-04-25 23:40:15 -07:00
|
|
|
async ({ browser }, use, workerInfo) => {
|
2025-04-22 18:55:17 -07:00
|
|
|
const ada = await createAuthenticatedContext({
|
|
|
|
|
browser,
|
2025-04-25 23:40:15 -07:00
|
|
|
name: `ada-${workerInfo.workerIndex}-${getUnixTime(new Date())}`,
|
2025-04-22 18:55:17 -07:00
|
|
|
});
|
2025-04-25 23:40:15 -07:00
|
|
|
|
2025-04-22 18:55:17 -07:00
|
|
|
await use(ada);
|
|
|
|
|
await ada.context.close();
|
|
|
|
|
},
|
2025-09-20 12:47:10 -07:00
|
|
|
{ scope: "worker" },
|
2025-04-22 18:55:17 -07:00
|
|
|
],
|
|
|
|
|
babbageContext: [
|
2025-04-25 23:40:15 -07:00
|
|
|
async ({ browser }, use, workerInfo) => {
|
2025-04-22 18:55:17 -07:00
|
|
|
const babbage = await createAuthenticatedContext({
|
|
|
|
|
browser,
|
2025-04-25 23:40:15 -07:00
|
|
|
name: `babbage-${workerInfo.workerIndex}-${getUnixTime(new Date())}`,
|
2025-04-22 18:55:17 -07:00
|
|
|
});
|
2025-04-25 23:40:15 -07:00
|
|
|
|
2025-04-22 18:55:17 -07:00
|
|
|
await use(babbage);
|
|
|
|
|
await babbage.context.close();
|
|
|
|
|
},
|
2025-09-20 12:47:10 -07:00
|
|
|
{ scope: "worker" },
|
2025-04-22 18:55:17 -07:00
|
|
|
],
|
2025-04-25 23:40:15 -07:00
|
|
|
curieContext: [
|
|
|
|
|
async ({ browser }, use, workerInfo) => {
|
|
|
|
|
const curie = await createAuthenticatedContext({
|
|
|
|
|
browser,
|
|
|
|
|
name: `curie-${workerInfo.workerIndex}-${getUnixTime(new Date())}`,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await use(curie);
|
|
|
|
|
await curie.context.close();
|
|
|
|
|
},
|
2025-09-20 12:47:10 -07:00
|
|
|
{ scope: "worker" },
|
2025-04-25 23:40:15 -07:00
|
|
|
],
|
2025-04-22 18:55:17 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const expect = baseExpect;
|