Files
git.stella-ops.org/src/Web/StellaOps.Web/playwright.config.ts
2026-02-12 10:27:23 +02:00

35 lines
1.1 KiB
TypeScript

import { defineConfig } from '@playwright/test';
// Prefer the same offline-friendly Chromium resolution as Karma/unit tests.
// Falls back to Playwright-managed installs when not available.
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { resolveChromeBinary } = require('./scripts/chrome-path');
const port = process.env.PLAYWRIGHT_PORT
? Number.parseInt(process.env.PLAYWRIGHT_PORT, 10)
: 4400;
const baseURL = process.env.PLAYWRIGHT_BASE_URL ?? `https://127.0.0.1:${port}`;
const chromiumExecutable = resolveChromeBinary(__dirname) as string | null;
export default defineConfig({
testDir: 'tests/e2e',
timeout: 30_000,
retries: process.env.CI ? 1 : 0,
use: {
baseURL,
ignoreHTTPSErrors: true,
trace: 'retain-on-failure',
...(chromiumExecutable ? { launchOptions: { executablePath: chromiumExecutable } } : {}),
},
webServer: {
command: 'npm run serve:test',
reuseExistingServer: !process.env.CI,
url: baseURL,
ignoreHTTPSErrors: true,
stdout: 'ignore',
stderr: 'ignore',
timeout: 120_000,
},
});