Files
govoplan-core/webui/playwright.conformance.config.ts
T

48 lines
1.5 KiB
TypeScript

import { existsSync, readdirSync } from "node:fs";
import { homedir } from "node:os";
import { join } from "node:path";
import { chromium, defineConfig } from "@playwright/test";
function chromiumExecutable(): string | undefined {
const configured = process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH;
if (configured) return configured;
const managed = chromium.executablePath();
if (existsSync(managed)) return managed;
const roots = [
join(homedir(), ".cache", "ms-playwright"),
join(homedir(), ".var", "app", "com.vscodium.codium", "cache", "ms-playwright")
];
for (const root of roots) {
if (!existsSync(root)) continue;
const installations = readdirSync(root).filter((entry) => entry.startsWith("chromium-")).sort().reverse();
for (const installation of installations) {
const candidate = join(root, installation, "chrome-linux64", "chrome");
if (existsSync(candidate)) return candidate;
}
}
return undefined;
}
export default defineConfig({
testDir: "./conformance/tests",
snapshotPathTemplate: "{testDir}/snapshots/{arg}{ext}",
fullyParallel: false,
workers: 1,
reporter: "line",
use: {
baseURL: "http://127.0.0.1:4174",
browserName: "chromium",
colorScheme: "light",
locale: "de-DE",
reducedMotion: "reduce",
launchOptions: chromiumExecutable() ? { executablePath: chromiumExecutable() } : undefined
},
webServer: {
command: "npm run dev:conformance",
url: "http://127.0.0.1:4174",
reuseExistingServer: false,
timeout: 120_000
}
});