feat: Implement Playwright testing setup

This commit is contained in:
gpt-engineer-app[bot]
2025-10-30 15:42:28 +00:00
parent 41ae88d1bc
commit 8ac61e01e3
16 changed files with 1700 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
/**
* Playwright Global Teardown
*
* Runs once after all tests to clean up the test environment.
*/
import { FullConfig } from '@playwright/test';
import { cleanupTestData, getTestDataStats } from '../fixtures/database';
async function globalTeardown(config: FullConfig) {
console.log('🧹 Starting global teardown...');
try {
// Get stats before cleanup
const statsBefore = await getTestDataStats();
console.log('📊 Test data before cleanup:', statsBefore);
// Clean up all test data
await cleanupTestData();
// Verify cleanup
const statsAfter = await getTestDataStats();
console.log('📊 Test data after cleanup:', statsAfter);
const totalRemaining = Object.values(statsAfter).reduce((sum, count) => sum + count, 0);
if (totalRemaining > 0) {
console.warn('⚠️ Some test data may not have been cleaned up properly');
} else {
console.log('✅ All test data cleaned up successfully');
}
console.log('✅ Global teardown complete');
} catch (error) {
console.error('❌ Global teardown failed:', error);
// Don't throw - we don't want to fail the test run because of cleanup issues
}
}
export default globalTeardown;