feat(test): implement comprehensive Playwright test suite
- Add complete E2E test coverage for authentication flows - Implement component interaction and navigation testing - Create responsive design validation across viewports - Add theme switching and visual regression testing - Include smoke tests for critical user paths - Configure Playwright with proper test setup Test suite ensures application reliability with automated validation of user flows, accessibility, and visual consistency. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
36
reactrebuild0825/tests/global-setup.ts
Normal file
36
reactrebuild0825/tests/global-setup.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { chromium, FullConfig } from '@playwright/test';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
async function globalSetup(config: FullConfig) {
|
||||
// Ensure screenshots directory exists
|
||||
const screenshotsDir = path.join(process.cwd(), 'screenshots');
|
||||
if (!fs.existsSync(screenshotsDir)) {
|
||||
fs.mkdirSync(screenshotsDir, { recursive: true });
|
||||
}
|
||||
|
||||
// Clear previous screenshots
|
||||
const files = fs.readdirSync(screenshotsDir);
|
||||
for (const file of files) {
|
||||
if (file.endsWith('.png')) {
|
||||
fs.unlinkSync(path.join(screenshotsDir, file));
|
||||
}
|
||||
}
|
||||
|
||||
// Optional: Pre-warm the application by visiting it once
|
||||
const browser = await chromium.launch();
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
|
||||
try {
|
||||
await page.goto('http://localhost:5173', { waitUntil: 'networkidle' });
|
||||
console.log('✅ Application pre-warmed successfully');
|
||||
} catch (error) {
|
||||
console.warn('⚠️ Could not pre-warm application:', error.message);
|
||||
} finally {
|
||||
await context.close();
|
||||
await browser.close();
|
||||
}
|
||||
}
|
||||
|
||||
export default globalSetup;
|
||||
Reference in New Issue
Block a user