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

/**
 * Playwright configuration for API smoke tests
 *
 * Purpose: Test API endpoints directly without browser interaction
 * Scope: HTTP requests to API server, response validation, error handling
 */

export default defineConfig({
  testDir: './tests/e2e/api',
  testMatch: ['**/api-smoke.test.ts', '**/league-api.test.ts'],
  
  // Setup for authentication
  globalSetup: './tests/e2e/api/api-auth.setup.ts',
  
  // Serial execution for consistent results
  fullyParallel: false,
  workers: 1,
  
  // Timeout: API calls should be fast
  timeout: 30_000,
  
  // Base URL for the API
  use: {
    baseURL: process.env.API_BASE_URL || 'http://localhost:3101',
    // No default storage state - tests will specify which auth to use
    storageState: undefined,
  },
  
  // Reporter: verbose for debugging
  reporter: [
    ['list'],
    ['html', { open: 'never' }]
  ],
  
  // No retry - tests must pass on first run
  retries: 0,
  
  // No webServer - API should be running externally
  webServer: undefined,
  
  // No browser projects needed for API tests
  projects: [],
});