mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 06:31:13 -05:00
feat: Implement Playwright testing setup
This commit is contained in:
30
tests/setup/global-setup.ts
Normal file
30
tests/setup/global-setup.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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;
|
||||
Reference in New Issue
Block a user