// @ts-check
const { defineConfig, devices } = require('@playwright/test');

module.exports = defineConfig({
  testDir: './tests',
  fullyParallel: false, // Run tests sequentially for consistent measurements
  forbidOnly: !!process.env.CI,
  retries: 0,
  workers: 1,
  reporter: 'html',
  use: {
    trace: 'on-first-retry',
    screenshot: 'on',
    video: 'retain-on-failure'
  },
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'] },
    },
  ],
  webServer: [
    {
      command: 'echo "Sites should already be running on 3000 and 1999"',
      url: 'http://localhost:1999',
      reuseExistingServer: true,
      timeout: 5000,
    },
    {
      url: 'http://localhost:3000',
      reuseExistingServer: true,
      timeout: 5000,
    }
  ],
});
