// @ts-check const { defineConfig, devices } = require('@playwright/test'); const fs = require('fs'); // Point at a running instance. The app's docker container serves on :7890. const BASE_URL = process.env.BASE_URL || 'http://localhost:7890'; const SYSTEM_CHROMIUM = process.env.CHROMIUM_PATH || '/snap/bin/chromium'; const browserOptions = fs.existsSync(SYSTEM_CHROMIUM) ? { launchOptions: { executablePath: SYSTEM_CHROMIUM } } : {}; module.exports = defineConfig({ testDir: './tests', timeout: 60_000, expect: { timeout: 10_000 }, // The app talks to a single uvicorn backend — running tests concurrently overwhelms // it and makes navigation flaky, so keep it serial. fullyParallel: false, workers: 1, retries: process.env.CI ? 1 : 0, reporter: process.env.CI ? 'github' : 'list', use: { baseURL: BASE_URL, navigationTimeout: 45_000, actionTimeout: 15_000, trace: 'on-first-retry', screenshot: 'only-on-failure', }, projects: [ { name: 'desktop', use: { ...devices['Desktop Chrome'], ...browserOptions } }, // iPhone profile — guards the mobile-stability work { name: 'iphone', use: { ...devices['iPhone 13'], ...browserOptions } }, ], });