mirror of
https://github.com/hanzoai/computer.git
synced 2026-09-30 20:55:46 +00:00
Playwright was waiting for port 3003 but Vite serves on 3690. Also .gitignore excluded tests/ so CI had zero test files. - Fix baseURL and webServer.url to port 3690 in playwright.config.ts - Increase webServer timeout to 180s for CI - Track test spec files (ignore only tests/screenshots/) - Fix hardcoded port 3003 URLs in all test files
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import { test } from '@playwright/test';
|
|
|
|
test('check console errors', async ({ page }) => {
|
|
// Collect all console messages
|
|
const consoleMessages: string[] = [];
|
|
|
|
page.on('console', msg => {
|
|
const type = msg.type();
|
|
const text = msg.text();
|
|
consoleMessages.push(`[${type}] ${text}`);
|
|
console.log(`Console [${type}]: ${text}`);
|
|
});
|
|
|
|
page.on('pageerror', error => {
|
|
console.log('Page error:', error.message);
|
|
consoleMessages.push(`[ERROR] ${error.message}`);
|
|
});
|
|
|
|
// Navigate to the page
|
|
console.log('Navigating to http://localhost:3690/signin');
|
|
const response = await page.goto('http://localhost:3690/signin', {
|
|
waitUntil: 'domcontentloaded'
|
|
});
|
|
|
|
console.log('Response status:', response?.status());
|
|
|
|
// Wait a bit for any async errors
|
|
await page.waitForTimeout(2000);
|
|
|
|
// Check if React root exists
|
|
const hasRoot = await page.evaluate(() => {
|
|
return document.getElementById('root') !== null;
|
|
});
|
|
console.log('Has root element:', hasRoot);
|
|
|
|
// Check if React is loaded
|
|
const hasReact = await page.evaluate(() => {
|
|
return typeof (window as any).React !== 'undefined';
|
|
});
|
|
console.log('React loaded:', hasReact);
|
|
|
|
// Get the HTML content
|
|
const html = await page.content();
|
|
console.log('HTML length:', html.length);
|
|
|
|
// Check for any script errors in the page
|
|
const errors = await page.evaluate(() => {
|
|
return (window as any).__errors || [];
|
|
});
|
|
|
|
if (errors.length > 0) {
|
|
console.log('Script errors:', errors);
|
|
}
|
|
|
|
console.log('\n=== All Console Messages ===');
|
|
consoleMessages.forEach(msg => console.log(msg));
|
|
}); |