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

/**
 * Playwright configuration for Electron smoke tests
 * 
 * Purpose: Verify Electron app launches without runtime errors
 * Scope: App initialization, IPC channels, browser context isolation
 * 
 * Critical Detection:
 * - Node.js modules imported in renderer process
 * - Console errors during startup
 * - IPC channel communication failures
 */
export default defineConfig({
  testDir: './tests/smoke',
  testMatch: ['**/electron-build.smoke.test.ts'],
  
  // Serial execution, single worker for deterministic Electron testing
  fullyParallel: false,
  workers: 1,
  
  // Fail fast - stop on first error
  maxFailures: 1,
  
  // Timeout: Electron app should launch quickly
  timeout: 30_000,
  
  // Retain artifacts on failure for debugging
  use: {
    screenshot: 'only-on-failure',
    video: 'retain-on-failure',
    trace: 'retain-on-failure',
  },
  
  // Reporter: verbose for CI/local debugging
  reporter: [
    ['list'],
    ['html', { open: 'never' }]
  ],
  
  // No retry - smoke tests must pass on first run
  retries: 0,
});