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

/**
 * E2E smoke tests — run against a live stack (e.g. docker compose).
 * Default base URL: http://localhost:$FRONTEND_PORT (3000 if unset). Override with PLAYWRIGHT_BASE_URL.
 */
const defaultBase = `http://localhost:${process.env.FRONTEND_PORT?.trim() || '3000'}`;

export default defineConfig({
  testDir: 'e2e',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 1 : undefined,
  reporter: 'list',
  use: {
    baseURL: process.env.PLAYWRIGHT_BASE_URL ?? defaultBase,
    trace: 'on-first-retry',
    ...devices['Desktop Chrome'],
  },
});
