openreplay/frontend/tests/playwright/helpers.ts
Андрей Бабушкин 487fc85a04 add e2e test
2025-05-23 15:12:47 +02:00

18 lines
No EOL
509 B
TypeScript

import { mkdirSync } from "fs";
import { exists } from "i18next";
import { dirname } from "path";
import { test } from "@playwright/test";
export const authStateFile = 'tests/playwright/auth-state.json';
mkdirSync(dirname(authStateFile), { recursive: true });
export function testUseAuthState() {
if (exists(authStateFile)) {
test.use({ storageState: authStateFile });
}
test.afterEach(async ({ page }) => {
await page.context().storageState({ path: authStateFile });
})
}