feat(admin): Playwright E2E каркас — TESTIDS, login/shell/roles, CI mock. Refs EventHub/EventHubFrontAdmin#33 #34 #35
CI / test (push) Failing after 14m2s
CI / push-image (push) Has been skipped
CI / ci-done (push) Failing after 0s

This commit is contained in:
2026-07-14 22:18:34 +03:00
parent 2a32465050
commit 87c6b55e81
19 changed files with 493 additions and 1462 deletions
+29
View File
@@ -0,0 +1,29 @@
import { test, expect } from '@playwright/test';
import { installAdminApiMocks, MOCK_ADMIN } from '../mocks/adminApi';
test.describe('auth / login (mock)', () => {
test.beforeEach(async ({ page }) => {
await installAdminApiMocks(page);
});
test('успешный вход ведёт на dashboard', async ({ page }) => {
await page.goto('/login');
await expect(page.getByTestId('page-login')).toBeVisible();
await page.getByLabel(/email/i).fill(MOCK_ADMIN.email);
await page.getByLabel(/пароль|password/i).fill('e2e-pass');
await page.getByRole('button', { name: /войти|log in|sign in/i }).click();
await expect(page).toHaveURL(/\/dashboard/);
await expect(page.getByTestId('page-dashboard')).toBeVisible();
});
test('неверный пароль показывает ошибку', async ({ page }) => {
await page.goto('/login');
await page.getByLabel(/email/i).fill(MOCK_ADMIN.email);
await page.getByLabel(/пароль|password/i).fill('wrong');
await page.getByTestId('btn-login').click();
await expect(page.getByText(/неверный email или пароль|invalid/i)).toBeVisible();
await expect(page).toHaveURL(/\/login/);
});
});