rspace-online/e2e/fixtures/auth.fixture.ts

20 lines
526 B
TypeScript

/**
* Custom Playwright fixture that provides a page with a pre-injected
* mock EncryptID session in localStorage.
*/
import { test as base, type Page } from "@playwright/test";
import { sessionInjectionScript, type MockSessionOpts } from "./mock-session";
type AuthFixtures = {
authedPage: Page;
};
export const test = base.extend<AuthFixtures>({
authedPage: async ({ page }, use) => {
await page.addInitScript(sessionInjectionScript());
await use(page);
},
});
export { expect } from "@playwright/test";