Files
pchelpmaster/playwright.config.ts
T
kamaskandClaude Opus 5.5 82e097f876 test(e2e): add playwright e2e stand with test pocketbase and axe checks
- playwright.config.ts: test PocketBase (port 8190) and ng serve (port 4300)
  as webServers, SIGTERM shutdown so the stand removes its temp dir
- fixtures: user via open registration, api SDK client, signedInPage with pb_auth cookie
- expectNoA11yViolations runs all axe rules (WCAG and best-practice)
- render home route on the server; main and h1 placeholder in app shell
- config tests for playwright.config.ts in test:lint; docs updated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:12:04 +03:00

36 lines
1.4 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
import { E2E_APP_URL, E2E_PB_PORT, E2E_PB_URL } from './tests/e2e/urls';
const ci = !!process.env['CI'];
// Стенд e2e: временный PocketBase и `ng serve` (SSR + dev-прокси /pb) на отдельных портах.
export default defineConfig({
testDir: 'tests/e2e',
testMatch: '**/*.e2e.ts',
outputDir: 'test-results',
retries: ci ? 1 : 0,
use: {
baseURL: E2E_APP_URL,
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
webServer: [
{
command: `node tests/support/serve-test-pocketbase.ts ${E2E_PB_PORT}`,
url: `${E2E_PB_URL}/api/health`,
reuseExistingServer: !ci,
// По умолчанию Playwright шлёт SIGKILL: стенд не успел бы удалить временную папку.
// Таймаут больше STOP_TIMEOUT_MS стенда (5 с), чтобы он успел добить PocketBase и убрать папку.
gracefulShutdown: { signal: 'SIGTERM', timeout: 10_000 },
},
{
command: `pnpm ng serve --port ${new URL(E2E_APP_URL).port}`,
url: E2E_APP_URL,
env: { PB_URL: E2E_PB_URL },
reuseExistingServer: !ci,
timeout: 180_000,
},
],
});