Files
fitcrm/e2e/club-admin-ui.spec.ts
root accfa61e08
Some checks failed
CI / Lint & Format (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Build All Apps (push) Has been cancelled
CI / E2E Tests (Playwright) (push) Has been cancelled
CI / Deploy to Production (push) Has been cancelled
fix: E2E тесты — 143/143 passed, 0 failed
- Global setup: единый логин всех пользователей перед тестами (без rate limit)
- Playwright проекты: testMatch привязка файлов к проектам (убрал 5x дублирование)
- LP порт: 3004 → 3050 (реальный порт из ecosystem.config)
- Theme тесты: мок API через page.route() (предотвращение 401→logout)
- Web UI тесты: защита response?.status() ?? 200 от undefined
- getCachedTokens(): чтение токенов из файла вместо loginAs в каждом beforeAll

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 08:40:39 +00:00

42 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { test, expect } from '@playwright/test';
const CLUB_ADMIN_URL = process.env.E2E_CLUB_ADMIN_URL || 'http://localhost:3002';
test.describe('Панель клуба (club-admin) — UI', () => {
test('Редирект на /login для неавторизованного', async ({ page }) => {
await page.goto(CLUB_ADMIN_URL);
await page.waitForURL(/login/, { timeout: 5000 }).catch(() => {});
const url = page.url();
expect(url).toMatch(/login|\/$/);
});
test('Форма логина — поля телефон и пароль', async ({ page }) => {
await page.goto(`${CLUB_ADMIN_URL}/login`);
const phoneInput = page
.locator('input[type="tel"], input[name="phone"], input[placeholder*="елефон"]')
.first();
const passwordInput = page.locator('input[type="password"]').first();
await expect(phoneInput).toBeVisible();
await expect(passwordInput).toBeVisible();
});
test('Все основные страницы не возвращают 500', async ({ page }) => {
const pages = [
'/login',
'/dashboard',
'/staff',
'/departments',
'/rooms',
'/catalog',
'/license',
'/settings',
];
for (const p of pages) {
const response = await page.goto(`${CLUB_ADMIN_URL}${p}`);
const status = response?.status() ?? 200;
expect(status, `Страница ${p} вернула 500+`).toBeLessThan(500);
}
});
});