import { defineConfig, devices } from '@playwright/test'

// Tier 3-H axe-core a11y config — separate from playwright.config.ts (visual
// regression) to keep concerns isolated:
//   - visual: testDir tests/visual/ — pixel-perfect snapshots, brittle to copy
//   - a11y: testDir tests/a11y/ — semantic accessibility, blockers only
//
// Both share the same dev server (port 5173). `reuseExistingServer` lets
// `pnpm test:a11y` and `pnpm test:visual` run back-to-back without restart.

export default defineConfig({
  testDir: 'tests/a11y',
  use: {
    baseURL: 'http://localhost:5173',
    viewport: { width: 1280, height: 900 },
  },
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
  ],
  webServer: {
    command: 'pnpm dev',
    url: 'http://localhost:5173',
    reuseExistingServer: true,
    timeout: 120_000,
  },
  testMatch: '**/*.spec.ts',
  // a11y suite shouldn't fail-fast across pages — one page's blocker shouldn't
  // mask others' issues
  fullyParallel: false,
  workers: 1,
})
