-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-app-load.js
More file actions
43 lines (36 loc) · 1.23 KB
/
test-app-load.js
File metadata and controls
43 lines (36 loc) · 1.23 KB
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
33
34
35
36
37
38
39
40
41
42
43
import { chromium } from 'playwright';
(async () => {
const browser = await chromium.launch({ headless: true });
const page = await browser.newPage();
// Listen for console errors
page.on('console', (msg) => {
if (msg.type() === 'error') {
console.error('Browser error:', msg.text());
}
});
// Listen for page errors
page.on('pageerror', (error) => {
console.error('Page error:', error.message);
});
try {
await page.goto('http://localhost:5173/', { waitUntil: 'networkidle' });
await page.waitForTimeout(2000); // Wait for app to initialize
// Check if app loaded successfully
const appElement = await page.$('#root');
if (appElement) {
console.log('✅ App loaded successfully');
// Check for React errors in the DOM
const errorBoundary = await page.$('.error-boundary-message');
if (errorBoundary) {
const errorText = await errorBoundary.textContent();
console.error('❌ Error boundary triggered:', errorText);
}
} else {
console.error('❌ App failed to load - no root element found');
}
} catch (error) {
console.error('❌ Failed to load app:', error);
} finally {
await browser.close();
}
})();