import { defineConfig } from "@playwright/test"; import { fileURLToPath } from "node:url"; const channel = process.env.PLAYWRIGHT_CHANNEL?.trim(); const executablePath = process.env.PLAYWRIGHT_EXECUTABLE_PATH?.trim(); const frontendRoot = fileURLToPath(new URL(".", import.meta.url)); const repositoryRoot = fileURLToPath(new URL("..", import.meta.url)); const simulationEnvironment = { ...process.env, SIMULATION_CAUSAL_EXECUTOR_V2: "1", SIMULATION_CAUSAL_COORDINATE_KERNEL: "1", SIMULATION_CAUSAL_DIRECT_SUM_ASSIGNMENTS: "1", SIMULATION_CAUSAL_DIRECT_EQUATION_READERS: "1", SIMULATION_CAUSAL_FAST_PATH: "1", SIMULATION_MECHANICAL_ATOL_MODE: "legacy", SIMULATION_ODE_JACOBIAN_MODE: "scipy", SIMULATIONAPP_PROPERTY_CACHE: "on", }; export default defineConfig({ testDir: "./tests/e2e", fullyParallel: false, workers: 1, timeout: 600_000, expect: { timeout: 15_000, }, outputDir: "test-results/live-mql8", use: { baseURL: "http://127.0.0.1:14173", ...(channel ? { channel } : {}), ...(executablePath ? { launchOptions: { executablePath } } : {}), headless: true, viewport: { width: 1440, height: 900 }, screenshot: "only-on-failure", trace: "on", }, webServer: [ { command: ".venv/bin/python -m uvicorn app.main:app --host 127.0.0.1 --port 18181", cwd: repositoryRoot, env: simulationEnvironment, url: "http://127.0.0.1:18181/api/components/catalog", reuseExistingServer: false, timeout: 120_000, gracefulShutdown: { signal: "SIGTERM", timeout: 10_000 }, }, { command: "node --input-type=module -e \"import { createServer } from 'vite'; import react from '@vitejs/plugin-react'; const server = await createServer({ configFile: false, root: process.cwd(), plugins: [react()], server: { host: '127.0.0.1', port: 14173, strictPort: true, proxy: { '/api': 'http://127.0.0.1:18181' } } }); await server.listen();\"", cwd: frontendRoot, url: "http://127.0.0.1:14173", reuseExistingServer: false, timeout: 120_000, gracefulShutdown: { signal: "SIGTERM", timeout: 10_000 }, }, ], });