/** * Playwright Global Setup * * Runs once before all tests to prepare the test environment. */ import { FullConfig } from '@playwright/test'; import { setupAuthStates } from '../fixtures/auth'; import { cleanupTestData } from '../fixtures/database'; async function globalSetup(config: FullConfig) { console.log('๐Ÿš€ Starting global setup...'); try { // Clean up any leftover test data from previous runs console.log('๐Ÿงน Cleaning up leftover test data...'); await cleanupTestData(); // Setup authentication states for all user roles console.log('๐Ÿ” Setting up authentication states...'); await setupAuthStates(config); console.log('โœ… Global setup complete'); } catch (error) { console.error('โŒ Global setup failed:', error); throw error; } } export default globalSetup;