// Playwright config — runs smoke tests against the already-running PedScribe
// container (no dev server spin-up). Expects BASE_URL (default
// http://host.docker.internal:3552 when run via scripts/e2e.sh).
const { defineConfig, devices } = require('@playwright/test');

module.exports = defineConfig({
  testDir: './tests',
  timeout: 30_000,
  expect: { timeout: 5_000 },
  fullyParallel: false,
  retries: 0,
  workers: 1,
  reporter: [['list']],
  use: {
    baseURL: process.env.BASE_URL || 'http://host.docker.internal:3552',
    trace: 'retain-on-failure',
    screenshot: 'only-on-failure',
    actionTimeout: 5_000,
    navigationTimeout: 15_000,
  },
  projects: [
    { name: 'chromium', use: { ...devices['Desktop Chrome'] } },
    // Mobile pass — catches layout regressions at ~375 px (iPhone SE)
    { name: 'mobile-chrome', use: { ...devices['Pixel 5'] } },
  ],
});
