openreplay/frontend/tests/playwright/auth.setup.ts
Андрей Бабушкин 9fbe4a21e9 add playwright
2025-05-23 10:22:36 +02:00

26 lines
No EOL
934 B
TypeScript

import { authStateFile, testUseAuthState } from './helpers';
import { test } from '@playwright/test';
testUseAuthState();
test('authenticate', async ({ page }) => {
await page.goto('/');
try {
const url = page.url();
if (url.includes('login')) {
await page.locator('[data-test-id="login"]').click();
await page.locator('.ant-input-affix-wrapper').first().click();
await page.locator('[data-test-id="login"]').fill('andrei@openreplay.com');
await page.locator('[data-test-id="password"]').click();
await page.locator('[data-test-id="password"]').fill('Andrey123!');
await page.locator('[data-test-id="log-button"]').click();
}
await page.waitForSelector('h1:has-text("Sessions")', { timeout: 10000 });
} catch (e) {}
try {
await page.context().storageState({ path: authStateFile });
} catch {}
});