This commit is contained in:
2026-01-14 01:10:01 +03:00
parent 24c5581d7b
commit 2ce092aa59
40 changed files with 2001 additions and 297 deletions

25
tests/e2e/auth.setup.ts Normal file
View File

@ -0,0 +1,25 @@
import { test as setup, expect } from '@playwright/test';
const authFile = 'playwright/.auth/user.json';
setup('authenticate', async ({ page }) => {
// Переходим на главную - редирект на Keycloak
await page.goto('/');
// Ждём страницу логина Keycloak
await page.waitForURL(/auth\.vigdorov\.ru/, { timeout: 10000 });
// Вводим креды
await page.getByRole('textbox', { name: 'Username or email' }).fill('testuser');
await page.getByRole('textbox', { name: 'Password' }).fill('0');
await page.getByRole('button', { name: 'Sign In' }).click();
// Ждём редирект обратно на приложение
await page.waitForURL('http://localhost:4000/', { timeout: 15000 });
// Ждём загрузки таблицы (значит авторизация прошла)
await page.waitForSelector('table', { timeout: 10000 });
// Сохраняем состояние авторизации
await page.context().storageState({ path: authFile });
});