-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathtest-playwright.js
More file actions
32 lines (25 loc) · 822 Bytes
/
test-playwright.js
File metadata and controls
32 lines (25 loc) · 822 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env node
import { spawn } from 'child_process';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
console.log('🎭 Running Playwright tests...');
const playwrightProcess = spawn('npx', ['playwright', 'test'], {
cwd: __dirname,
stdio: 'inherit',
shell: true
});
playwrightProcess.on('close', (code) => {
if (code === 0) {
console.log('✅ Playwright tests completed successfully!');
console.log('📊 View HTML report: npx playwright show-report');
} else {
console.log(`❌ Playwright tests failed with code ${code}`);
}
process.exit(code);
});
playwrightProcess.on('error', (error) => {
console.error('❌ Failed to start Playwright:', error);
process.exit(1);
});