import { FullConfig } from '@playwright/test'; import { TestDataManager } from './utils/test-data-manager'; /** * Global Setup for E2E Tests * Runs once before all tests */ async function globalSetup(config: FullConfig) { console.log('🚀 Starting E2E Test Global Setup...'); // Initialize test data manager const testData = new TestDataManager(); await testData.init(); // Verify API is healthy try { const response = await fetch(`${process.env.API_BASE_URL || 'http://localhost:8000'}/health`); if (!response.ok) { throw new Error(`API health check failed: ${response.status}`); } console.log('✅ API is healthy'); } catch (error) { console.error('❌ API health check failed:', error); console.log('Make sure the application is running with: docker-compose up -d'); throw error; } // Create shared test data (admin user, test scenarios, etc.) console.log('📦 Setting up shared test data...'); // You can create shared test resources here that will be used across tests // For example, a shared admin user or common test scenarios console.log('✅ Global setup complete'); } export default globalSetup;