mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 12:11:17 -05:00
31 lines
835 B
TypeScript
31 lines
835 B
TypeScript
/**
|
|
* 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;
|