Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

test: reduce verbose console output in Puppeteer UI tests (#2137)

LearningCircuit4a2b988c853e
diff --git a/tests/ui_tests/DEBUG_research_submit_debug.js b/tests/ui_tests/DEBUG_research_submit_debug.js
index eb6837f6bd..2bee2b5789 100644
--- a/tests/ui_tests/DEBUG_research_submit_debug.js
+++ b/tests/ui_tests/DEBUG_research_submit_debug.js
@@ -37,15 +37,10 @@ async function testResearchSubmitDebug() {
// Set viewport
await page.setViewport({ width: 1280, height: 800 });
- // Enable console logging
+ // Log browser console errors
page.on('console', msg => {
- const type = msg.type();
- if (type === 'error') {
- console.log('❌ PAGE ERROR:', msg.text());
- } else if (type === 'warning') {
- console.log('⚠️ PAGE WARNING:', msg.text());
- } else {
- console.log('📝 PAGE LOG:', msg.text());
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
}
});
diff --git a/tests/ui_tests/NO_CI_executes_research_research_fixed_model.js b/tests/ui_tests/NO_CI_executes_research_research_fixed_model.js
index 9155e9afc5..3c8946b06d 100644
--- a/tests/ui_tests/NO_CI_executes_research_research_fixed_model.js
+++ b/tests/ui_tests/NO_CI_executes_research_research_fixed_model.js
@@ -16,9 +16,11 @@ async function testResearchFixed() {
console.log('🔬 Fixed Research Test\n');
- // Log console messages
+ // Log console errors
page.on('console', msg => {
- console.log(`[Browser] ${msg.text()}`);
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
try {
diff --git a/tests/ui_tests/auth_helper.js b/tests/ui_tests/auth_helper.js
index 51caa019c5..432e612a62 100644
--- a/tests/ui_tests/auth_helper.js
+++ b/tests/ui_tests/auth_helper.js
@@ -22,7 +22,6 @@ class Timer {
? now - this.laps[this.laps.length - 1].timestamp
: elapsed;
this.laps.push({ description, elapsed, lapTime, timestamp: now });
- console.log(` ⏱️ [${this.label}] ${description}: +${lapTime}ms (total: ${elapsed}ms)`);
return elapsed;
}
@@ -135,8 +134,6 @@ class AuthHelper {
const http = require('http');
const startTime = Date.now();
- console.log(` Waiting for server to become ready (max ${maxWaitMs/1000}s)...`);
-
while (Date.now() - startTime < maxWaitMs) {
try {
const ok = await new Promise((resolve) => {
@@ -149,13 +146,10 @@ class AuthHelper {
});
if (ok) {
- console.log(` ✅ Server is ready`);
return true;
}
-
- console.log(` Server not ready yet...`);
} catch (e) {
- console.log(` Server check error: ${e.message}`);
+ // ignore - will retry
}
await this._delay(checkIntervalMs);
@@ -178,9 +172,6 @@ class AuthHelper {
const maxRetries = this.isCI ? AUTH_CONFIG.ci.maxNavigationRetries : 1;
const timeout = AUTH_CONFIG.timeouts.navigation;
- console.log(` Navigating to ${path}...`);
- console.log(` Config: waitUntil=${waitUntil}, timeout=${timeout}ms, maxRetries=${maxRetries}`);
-
let arrivedUrl = '';
let lastError = null;
@@ -194,7 +185,6 @@ class AuthHelper {
timer.lap(`attempt ${attempt} navigation complete`);
arrivedUrl = this.page.url();
- console.log(` Attempt ${attempt}/${maxRetries}: Arrived at: ${arrivedUrl}`);
// Check if we arrived at expected page
if (arrivedUrl.includes(expectedPathSegment)) {
@@ -203,29 +193,25 @@ class AuthHelper {
// If redirected somewhere else (like home when logged in), that's also OK
if (!arrivedUrl.includes('/auth/')) {
- console.log(` Redirected outside auth pages - may already be logged in`);
return arrivedUrl;
}
// If we didn't get where we wanted, retry
if (attempt < maxRetries) {
- console.log(` Not on expected page, waiting before retry...`);
await this._delay(AUTH_CONFIG.delays.retryNavigation);
}
} catch (navError) {
lastError = navError;
- console.log(` Navigation attempt ${attempt} failed: ${navError.message}`);
// If the frame is detached, create a fresh page and retry
if (navError.message.includes('detached') || navError.message.includes('destroyed')) {
- console.log(' Frame detached - creating fresh page...');
try {
const browser = this.page.browser();
const newPage = await browser.newPage();
try { await this.page.close(); } catch (e) { /* already broken */ }
this.page = newPage;
} catch (e) {
- console.log(` Could not create fresh page: ${e.message}`);
+ // Could not create fresh page
}
}
@@ -237,7 +223,6 @@ class AuthHelper {
// If we got a URL but it wasn't what we expected, return it anyway
if (arrivedUrl) {
- console.log(` Warning: Ended up at ${arrivedUrl} instead of ${expectedPathSegment}`);
return arrivedUrl;
}
@@ -250,12 +235,9 @@ class AuthHelper {
*/
async isLoggedIn() {
try {
- // Check if we're on a page that requires auth
const url = this.page.url();
- console.log('Checking login status at URL:', url);
if (url.includes(AUTH_CONFIG.paths.login)) {
- console.log('On login page - not logged in');
return false;
}
@@ -271,7 +253,6 @@ class AuthHelper {
try {
const element = await this.page.$(selector);
if (element) {
- console.log(`Found logout element with selector: ${selector}`);
return true;
}
} catch (e) {
@@ -282,21 +263,17 @@ class AuthHelper {
// Check if we can access protected pages
const currentUrl = this.page.url();
if (currentUrl.includes('/settings') || currentUrl.includes('/metrics') || currentUrl.includes('/history')) {
- console.log('On protected page - logged in');
return true;
}
// If we're on the home page, check for research form
const researchForm = await this.page.$('form[action*="research"], #query, button[type="submit"]');
if (researchForm) {
- console.log('Found research form - likely logged in');
return true;
}
- console.log('No login indicators found');
return false;
} catch (error) {
- console.log('Error checking login status:', error.message);
return false;
}
}
@@ -318,26 +295,13 @@ class AuthHelper {
// Always navigate to login page to ensure fresh CSRF token
// (After logout, the page may have a stale token from the previous session)
- const currentUrl = this.page.url();
- console.log(` Current URL: ${currentUrl}`);
await this._navigateToAuthPage(AUTH_CONFIG.paths.login, AUTH_CONFIG.paths.login);
timer.lap('navigated to login page');
// Wait for login form
- console.log(' Waiting for login form...');
await this.page.waitForSelector('input[name="username"]', { timeout: AUTH_CONFIG.timeouts.formSelector });
timer.lap('login form ready');
- // Check what's on the page
- const formAction = await this.page.$eval('form', form => form.action).catch(() => 'no form found');
- console.log(` Form action: ${formAction}`);
-
- const submitButton = await this.page.$eval('button[type="submit"]', btn => btn.textContent).catch(() => 'no submit button');
- console.log(` Submit button text: ${submitButton}`);
-
- // Fill in credentials
- console.log(' Filling in credentials...');
-
// Clear fields first to ensure clean state
await this.page.$eval('input[name="username"]', el => el.value = '');
await this.page.$eval('input[name="password"]', el => el.value = '');
@@ -347,29 +311,9 @@ class AuthHelper {
await this.page.type('input[name="password"]', password);
timer.lap('credentials filled');
- // Check form values before submit
- const usernameValue = await this.page.$eval('input[name="username"]', el => el.value);
- const passwordValue = await this.page.$eval('input[name="password"]', el => el.value);
- console.log(` Username field value: ${usernameValue}`);
- console.log(` Password field has value: ${passwordValue.length > 0 ? 'yes' : 'no'} (length: ${passwordValue.length})`);
-
- // Submit form
- console.log(' Submitting form...');
- console.log(' Waiting for navigation after submit (timeout: 60s)...');
-
- // Listen to console messages from the page
- this.page.on('console', msg => console.log(' Browser console:', msg.text()));
-
// Listen to page errors
this.page.on('pageerror', error => console.log(' Page error:', error.message));
- // Listen to response events
- this.page.on('response', response => {
- if (response.url().includes('/auth/login') && response.request().method() === 'POST') {
- console.log(` Login POST response: ${response.status()} ${response.statusText()}`);
- }
- });
-
try {
// In CI, use a simpler and faster approach
// NOTE: Previous implementation used a polling loop that called page.evaluate()
@@ -377,7 +321,6 @@ class AuthHelper {
// would hang, causing 5+ minute delays ("URL check timeout" x30).
// This simpler Promise.all approach completes in seconds.
if (this.isCI) {
- console.log(' Using CI-specific login approach');
timer.lap('starting CI login');
// Use Promise.all with waitForNavigation - the standard Puppeteer approach
@@ -391,23 +334,19 @@ class AuthHelper {
this.page.click('button[type="submit"]')
]);
timer.lap('navigation complete after submit');
- console.log(' ✅ Navigation completed');
} catch (navError) {
timer.lap(`navigation error: ${navError.message.substring(0, 50)}`);
- console.log(` Navigation error: ${navError.message}`);
// Check if we actually succeeded despite the error
const currentUrl = this.page.url();
- console.log(` Current URL: ${currentUrl}`);
if (!currentUrl.includes(AUTH_CONFIG.paths.login)) {
- console.log(' ✅ Actually redirected successfully');
+ // Actually redirected successfully
} else {
// Check for session cookie - login may have worked
const cookies = await this.page.cookies();
const sessionCookie = cookies.find(c => c.name === 'session');
if (sessionCookie) {
- console.log(' Session cookie exists, navigating to home');
// NOTE: Using configured navigation timeout instead of hardcoded 15s
// because CI runners can be slow and 15s often isn't enough
await this.page.goto(this.baseUrl, {
@@ -428,7 +367,6 @@ class AuthHelper {
}
timer.lap('CI login complete');
- console.log(' Navigation completed');
} else {
// Non-CI logic - use domcontentloaded instead of networkidle2 to avoid WebSocket/polling timeouts
await Promise.all([
@@ -438,48 +376,25 @@ class AuthHelper {
}),
this.page.click('button[type="submit"]')
]);
- console.log(' Navigation completed');
}
} catch (navError) {
timer.lap(`navigation error: ${navError.message.substring(0, 40)}`);
- console.log(` Navigation error: ${navError.message}`);
- console.log(` Current URL after error: ${this.page.url()}`);
-
- // Check page content on error
- const pageTitle = await this.page.title();
- console.log(` Page title: ${pageTitle}`);
-
- const alerts = await this.page.$$eval('.alert', alerts => alerts.map(a => a.textContent));
- if (alerts.length > 0) {
- console.log(` Alerts on page: ${JSON.stringify(alerts)}`);
- }
-
timer.summary();
throw navError;
}
// Check if login was successful
const finalUrl = this.page.url();
- console.log(` Final URL: ${finalUrl}`);
if (finalUrl.includes(AUTH_CONFIG.paths.login)) {
// Still on login page - check for error
const error = await this.page.$('.alert-danger, .error-message, .alert');
if (error) {
const errorText = await this.page.evaluate(el => el.textContent, error);
- console.log(` Error message on page: ${errorText.trim()}`);
timer.summary();
throw new Error(`Login failed: ${errorText.trim()}`);
}
- // Check form validation errors
- const validationErrors = await this.page.$$eval('.invalid-feedback, .help-block', els =>
- els.map(el => el.textContent.trim()).filter(text => text.length > 0)
- );
- if (validationErrors.length > 0) {
- console.log(` Validation errors: ${JSON.stringify(validationErrors)}`);
- }
-
timer.summary();
throw new Error('Login failed - still on login page');
}
@@ -495,8 +410,6 @@ class AuthHelper {
async register(username = DEFAULT_TEST_USER.username, password = DEFAULT_TEST_USER.password) {
const timer = new Timer('register');
console.log(`📝 Attempting registration for ${username}...`);
- console.log(` Submit timeout: ${AUTH_CONFIG.timeouts.submitNavigation}ms (${(AUTH_CONFIG.timeouts.submitNavigation/1000/60).toFixed(1)} min)`);
-
// Navigate to registration page using the helper
const arrivedUrl = await this._navigateToAuthPage(AUTH_CONFIG.paths.register, AUTH_CONFIG.paths.register);
timer.lap('navigation complete');
@@ -507,12 +420,8 @@ class AuthHelper {
}
// Wait for registration form
- console.log(' Waiting for registration form...');
await this.page.waitForSelector('input[name="username"]', { timeout: AUTH_CONFIG.timeouts.formSelector });
timer.lap('form ready');
-
- // Fill in registration form
- console.log(' Filling registration form...');
await this.page.type('input[name="username"]', username);
await this.page.type('input[name="password"]', password);
await this.page.type('input[name="confirm_password"]', password);
@@ -527,16 +436,12 @@ class AuthHelper {
// Submit form - use CI-specific approach with waitForNavigation + retries
if (this.isCI) {
- console.log(' Using CI-specific registration approach');
-
// In CI, registration can take 2+ minutes due to encrypted DB creation.
// The page.evaluate() approach doesn't work because the page is unresponsive
// during server processing. Instead, we use waitForNavigation with retries.
let registrationSucceeded = false;
- // First attempt: click and wait for navigation with a long timeout
- console.log(' Submitting form and waiting for server response...');
try {
await Promise.all([
this.page.waitForNavigation({
@@ -547,27 +452,21 @@ class AuthHelper {
]);
const currentUrl = this.page.url();
- console.log(` Navigation completed. URL: ${currentUrl}`);
if (!currentUrl.includes(AUTH_CONFIG.paths.register)) {
registrationSucceeded = true;
}
} catch (navError) {
- console.log(` Navigation error: ${navError.message}`);
-
// Handle frame detachment (page was replaced)
if (navError.message.includes('detached') || navError.message.includes('destroyed')) {
- console.log(' Frame was replaced - registration likely succeeded');
await this._delay(AUTH_CONFIG.delays.afterRegistration);
// The current page's frame is broken - get a fresh page from the browser
try {
const browser = this.page.browser();
const newPage = await browser.newPage();
- // Close the broken page to free resources
try { await this.page.close(); } catch (e) { /* already broken */ }
this.page = newPage;
- console.log(' Created fresh page after frame detachment');
await this.page.goto(this.baseUrl, {
waitUntil: AUTH_CONFIG.ci.waitUntil,
@@ -575,7 +474,7 @@ class AuthHelper {
});
registrationSucceeded = true;
} catch (gotoError) {
- console.log(` Could not navigate to home: ${gotoError.message}`);
+ // Could not navigate to home after frame detachment
}
}
// For timeout errors, fall through to session verification below
@@ -583,14 +482,10 @@ class AuthHelper {
// If navigation didn't clearly succeed, verify via session with retries
if (!registrationSucceeded) {
- console.log(' Verifying registration via session...');
-
// Ensure we have a working page (may have been replaced above)
try {
- // Test if page is usable
await this.page.url();
} catch (e) {
- console.log(' Page is broken, creating fresh page for verification...');
const browser = this.page.browser();
try { await this.page.close(); } catch (closeErr) { /* already broken */ }
this.page = await browser.newPage();
@@ -603,8 +498,6 @@ class AuthHelper {
if (serverReady) {
// Try to navigate and verify session
for (let retryAttempt = 1; retryAttempt <= 3; retryAttempt++) {
- console.log(` Session verification attempt ${retryAttempt}/3...`);
-
try {
await this.page.goto(this.baseUrl, {
waitUntil: AUTH_CONFIG.ci.waitUntil,
@@ -612,19 +505,15 @@ class AuthHelper {
});
const homeUrl = this.page.url();
- console.log(` After navigation to home: ${homeUrl}`);
if (!homeUrl.includes('/auth/login') && !homeUrl.includes('/auth/register')) {
- // Check for logout button as proof of login
const logoutBtn = await this.page.$('#logout-form, a[href*="logout"], .logout');
if (logoutBtn) {
- console.log(' ✅ Found logout button - registration succeeded');
registrationSucceeded = true;
break;
}
}
} catch (sessionError) {
- console.log(` Session check attempt ${retryAttempt} failed: ${sessionError.message}`);
if (retryAttempt < 3) {
await this._delay(10000); // Wait 10s before retry
}
@@ -661,33 +550,20 @@ class AuthHelper {
}
// Non-CI logic - use waitForNavigation
- console.log(' Submitting registration form...');
- console.log(' ⚠️ This may take 1-3 minutes in CI (database creation + settings import)');
try {
- // Set up progress logging for long operations
- const progressInterval = setInterval(() => {
- const elapsed = timer.elapsed();
- console.log(` ⏳ Still waiting for registration... (${(elapsed/1000).toFixed(0)}s elapsed)`);
- }, 15000); // Log every 15 seconds
-
- try {
- await Promise.all([
- this.page.waitForNavigation({
- waitUntil: 'domcontentloaded',
- timeout: AUTH_CONFIG.timeouts.submitNavigation
- }),
- this.page.click('button[type="submit"]')
- ]);
- } finally {
- clearInterval(progressInterval);
- }
+ await Promise.all([
+ this.page.waitForNavigation({
+ waitUntil: 'domcontentloaded',
+ timeout: AUTH_CONFIG.timeouts.submitNavigation
+ }),
+ this.page.click('button[type="submit"]')
+ ]);
timer.lap('form submitted + navigation complete');
} catch (navError) {
timer.lap(`submit error: ${navError.message.substring(0, 50)}`);
// Handle frame detachment errors
if (navError.message.includes('detached')) {
- console.log(' Navigation error (frame detached):', navError.message);
// Wait for registration to complete server-side
await this._delay(AUTH_CONFIG.delays.afterRegistration);
timer.lap('post-registration delay complete');
@@ -698,7 +574,6 @@ class AuthHelper {
const newPage = await browser.newPage();
try { await this.page.close(); } catch (e) { /* already broken */ }
this.page = newPage;
- console.log(' Created fresh page after frame detachment');
await this.page.goto(this.baseUrl, {
waitUntil: 'domcontentloaded',
@@ -706,7 +581,7 @@ class AuthHelper {
});
timer.lap('navigated to home');
} catch (gotoError) {
- console.log(' Could not navigate after registration:', gotoError.message);
+ // Could not navigate after registration
}
timer.summary();
@@ -780,7 +655,6 @@ class AuthHelper {
// This allows incremental migration - workflows with init_test_database.py
// get the speed benefit, while others still work via registration fallback.
if (this.isCI) {
- console.log('\n🚀 CI mode: Trying pre-created test user first (fast path)...');
try {
await this.login(CI_TEST_USER.username, CI_TEST_USER.password);
console.log('✅ Logged in with CI test user');
@@ -788,38 +662,26 @@ class AuthHelper {
return true;
} catch (ciLoginError) {
// Fall back to registration (slower but reliable)
- console.log(`⚠️ CI test user login failed: ${ciLoginError.message}`);
- console.log(' Falling back to registration (slower but reliable)...');
- // Continue to registration logic below
}
}
// Generate random username if not provided
if (!username) {
username = generateRandomUsername();
- console.log(`🎲 Using random username: ${username}`);
}
let lastError;
for (let attempt = 1; attempt <= retries; attempt++) {
- console.log(`\n🔄 Authentication attempt ${attempt}/${retries}`);
-
try {
- // Try to register first (more reliable for fresh test runs)
- console.log(` Trying registration for ${username}...`);
return await this.register(username, password);
} catch (registerError) {
- console.log(`⚠️ Registration failed: ${registerError.message}`);
-
// If user already exists, try login
if (registerError.message.includes('already exists') ||
registerError.message.includes('still on registration page')) {
try {
- console.log(` User may exist, trying login...`);
return await this.login(username, password);
} catch (loginError) {
lastError = loginError;
- console.log(`⚠️ Login also failed: ${loginError.message}`);
}
} else {
lastError = registerError;
@@ -830,7 +692,6 @@ class AuthHelper {
(lastError.message.includes('timeout') ||
lastError.message.includes('net::') ||
lastError.message.includes('Navigation'))) {
- console.log(`⚠️ Network/timeout error, waiting before retry...`);
await this._delay(AUTH_CONFIG.delays.beforeRetry);
continue;
}
@@ -857,35 +718,27 @@ class AuthHelper {
// Try to find and submit the logout form directly (more reliable than clicking link)
const logoutForm = await this.page.$('#logout-form');
if (logoutForm) {
- console.log(' Found logout form, submitting directly...');
await Promise.all([
this.page.waitForNavigation({
waitUntil: 'networkidle2',
timeout: AUTH_CONFIG.timeouts.logout
- }).catch(() => {
- console.log(' Navigation wait timed out, checking URL...');
- }),
+ }).catch(() => {}),
this.page.evaluate(() => {
document.getElementById('logout-form').submit();
})
]);
} else {
- // Fallback: look for logout link/button and click it
const logoutLink = await this.page.$('a.logout-btn');
if (logoutLink) {
- console.log(' Found logout link, clicking...');
await Promise.all([
this.page.waitForNavigation({
waitUntil: 'networkidle2',
timeout: AUTH_CONFIG.timeouts.logout
- }).catch(() => {
- console.log(' Navigation wait timed out, checking URL...');
- }),
+ }).catch(() => {}),
this.page.click('a.logout-btn')
]);
} else {
// Last resort: navigate directly to logout URL
- console.log(` No logout form/button found, navigating directly to ${AUTH_CONFIG.paths.logout}...`);
await this.page.goto(`${this.page.url().split('/').slice(0, 3).join('/')}${AUTH_CONFIG.paths.logout}`, {
waitUntil: 'networkidle2',
timeout: AUTH_CONFIG.timeouts.logout
@@ -896,11 +749,7 @@ class AuthHelper {
// Give it a moment for any redirects
await this._delay(AUTH_CONFIG.delays.afterLogout);
- // Ensure we're on the login page or logged out
const currentUrl = this.page.url();
- console.log(` Current URL after logout: ${currentUrl}`);
-
- // Check if we're logged out by looking for login form
const loginForm = await this.page.$('form[action*="login"], input[name="username"]');
if (loginForm || currentUrl.includes(AUTH_CONFIG.paths.login)) {
console.log('✅ Logged out successfully');
@@ -912,15 +761,14 @@ class AuthHelper {
}).catch(() => {});
const finalUrl = this.page.url();
- if (finalUrl.includes(AUTH_CONFIG.paths.login)) {
- console.log('✅ Logged out successfully (verified via protected page)');
- } else {
+ if (!finalUrl.includes(AUTH_CONFIG.paths.login)) {
console.log(`Warning: May not be fully logged out. Current URL: ${finalUrl}`);
+ } else {
+ console.log('✅ Logged out successfully');
}
}
} catch (error) {
console.log(`⚠️ Logout error: ${error.message}`);
- // Continue anyway - we'll verify logout status
}
}
}
@@ -1014,29 +862,9 @@ async function safeClick(page, selectorOrElement, options = {}) {
}
}
-/**
- * Log the current auth configuration for debugging
- */
-function logAuthConfig() {
- const isCI = !!process.env.CI;
- console.log('\n📋 Auth Configuration:');
- console.log(` Environment: ${isCI ? 'CI' : 'Local'}`);
- console.log(' Timeouts:');
- console.log(` - navigation: ${AUTH_CONFIG.timeouts.navigation}ms (${(AUTH_CONFIG.timeouts.navigation/1000).toFixed(0)}s)`);
- console.log(` - formSelector: ${AUTH_CONFIG.timeouts.formSelector}ms (${(AUTH_CONFIG.timeouts.formSelector/1000).toFixed(0)}s)`);
- console.log(` - submitNavigation: ${AUTH_CONFIG.timeouts.submitNavigation}ms (${(AUTH_CONFIG.timeouts.submitNavigation/1000/60).toFixed(1)}min)`);
- console.log(` - urlCheck: ${AUTH_CONFIG.timeouts.urlCheck}ms`);
- console.log(' CI settings:');
- console.log(` - waitUntil: ${AUTH_CONFIG.ci.waitUntil}`);
- console.log(` - maxLoginAttempts: ${AUTH_CONFIG.ci.maxLoginAttempts}`);
- console.log(` - maxNavigationRetries: ${AUTH_CONFIG.ci.maxNavigationRetries}`);
- console.log('');
-}
-
module.exports = AuthHelper;
module.exports.safeClick = safeClick;
module.exports.AUTH_CONFIG = AUTH_CONFIG;
module.exports.Timer = Timer;
-module.exports.logAuthConfig = logAuthConfig;
module.exports.CI_TEST_USER = CI_TEST_USER;
module.exports.DEFAULT_TEST_USER = DEFAULT_TEST_USER;
diff --git a/tests/ui_tests/news/test_scheduler_activity.js b/tests/ui_tests/news/test_scheduler_activity.js
index fa23855fce..2da09b2880 100644
--- a/tests/ui_tests/news/test_scheduler_activity.js
+++ b/tests/ui_tests/news/test_scheduler_activity.js
@@ -18,10 +18,10 @@ describe('News Scheduler Activity Test', function() {
});
page = await browser.newPage();
- // Enable console logging from the page
+ // Log browser console errors
page.on('console', msg => {
- if (msg.type() === 'log' || msg.type() === 'info') {
- console.log('[Browser]:', msg.text());
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
}
});
diff --git a/tests/ui_tests/run_all_tests.js b/tests/ui_tests/run_all_tests.js
index 130efbffd8..448be8599a 100644
--- a/tests/ui_tests/run_all_tests.js
+++ b/tests/ui_tests/run_all_tests.js
@@ -314,11 +314,7 @@ const tests = [
async function runTest(test) {
return new Promise((resolve) => {
const startTime = Date.now();
- console.log(`\n📋 Running: ${test.name}`);
- console.log(`📄 Description: ${test.description}`);
- console.log(`🔧 File: ${test.file}`);
- console.log(`⏰ Started at: ${new Date().toISOString()}`);
- console.log('─'.repeat(60));
+ console.log(`\nRunning: ${test.name}`);
const testProcess = spawn('node', [test.file], {
cwd: path.join(__dirname),
@@ -326,8 +322,6 @@ async function runTest(test) {
env: { ...process.env, NODE_OPTIONS: '--max-old-space-size=4096' }
});
- console.log(`🆔 Process PID: ${testProcess.pid}`);
-
// Add timeout for individual tests
// 300 seconds in CI to handle slow registration/auth tests.
// In Docker, new user registration creates encrypted SQLCipher databases
@@ -353,12 +347,10 @@ async function runTest(test) {
clearTimeout(timeout);
const elapsed = Math.round((Date.now() - startTime) / 1000);
const success = code === 0;
- console.log('─'.repeat(60));
console.log(`${success ? '✅' : '❌'} ${test.name}: ${success ? 'PASSED' : 'FAILED'} (${elapsed}s)`);
if (code !== 0 && code !== null) {
console.log(` Exit code: ${code}`);
}
- console.log('');
resolve({
name: test.name,
success,
@@ -370,10 +362,7 @@ async function runTest(test) {
testProcess.on('error', (error) => {
clearTimeout(timeout);
const elapsed = Math.round((Date.now() - startTime) / 1000);
- console.log('─'.repeat(60));
console.log(`❌ ${test.name}: ERROR - ${error.message} (${elapsed}s)`);
- console.log(` Error details: ${JSON.stringify(error)}`);
- console.log('');
resolve({
name: test.name,
success: false,
@@ -385,10 +374,7 @@ async function runTest(test) {
}
async function runAllTests() {
- console.log('🚀 Starting UI Test Suite');
- console.log('=' .repeat(60));
- console.log('📍 Make sure the web server is running on http://127.0.0.1:5000');
- console.log('🕐 Starting tests...\n');
+ console.log('Starting UI Test Suite\n');
const results = [];
@@ -401,9 +387,7 @@ async function runAllTests() {
}
// Print summary
- console.log('\n' + '=' .repeat(60));
- console.log('📊 TEST SUMMARY');
- console.log('=' .repeat(60));
+ console.log('\nTEST SUMMARY');
const passed = results.filter(r => r.success).length;
const failed = results.filter(r => !r.success).length;
@@ -418,17 +402,12 @@ async function runAllTests() {
}
});
- console.log('─'.repeat(60));
- console.log(`📈 Total Tests: ${results.length}`);
- console.log(`✅ Passed: ${passed}`);
- console.log(`❌ Failed: ${failed}`);
- console.log(`⏱️ Total Duration: ${totalDuration}s`);
- console.log(`📊 Success Rate: ${Math.round((passed / results.length) * 100)}%`);
+ console.log(`Total: ${results.length} | Passed: ${passed} | Failed: ${failed} | Duration: ${totalDuration}s | Rate: ${Math.round((passed / results.length) * 100)}%`);
if (failed === 0) {
- console.log('\n🎉 All tests passed!');
+ console.log('All tests passed!');
} else {
- console.log(`\n⚠️ ${failed} test(s) failed. Check the output above for details.`);
+ console.log(`${failed} test(s) failed.`);
}
process.exit(failed > 0 ? 1 : 0);
diff --git a/tests/ui_tests/test_api_key_comprehensive.js b/tests/ui_tests/test_api_key_comprehensive.js
index d9ad733dca..7086a1ad33 100644
--- a/tests/ui_tests/test_api_key_comprehensive.js
+++ b/tests/ui_tests/test_api_key_comprehensive.js
@@ -68,11 +68,10 @@ async function runComprehensiveApiKeyTest() {
page = await browser.newPage();
await page.setViewport({ width: 1920, height: 1080 });
- // Set up console logging
+ // Log browser console errors
page.on('console', msg => {
- const text = msg.text();
- if (text && !text.includes('Failed to load resource') && !text.includes('favicon')) {
- log(`Browser console: ${text}`, 'info');
+ if (msg.type() === 'error') {
+ log(`Browser console: ${msg.text()}`, 'error');
}
});
diff --git a/tests/ui_tests/test_api_key_enter_save.js b/tests/ui_tests/test_api_key_enter_save.js
index 10faf00ba2..549712adca 100644
--- a/tests/ui_tests/test_api_key_enter_save.js
+++ b/tests/ui_tests/test_api_key_enter_save.js
@@ -44,11 +44,10 @@ function log(message, type = 'info') {
const page = await browser.newPage();
await page.setViewport({ width: 1920, height: 1080 });
- // Set up console logging
+ // Log browser console errors
page.on('console', msg => {
- const text = msg.text();
- if (!text.includes('Failed to load resource')) {
- log(`Browser console: ${text}`, 'info');
+ if (msg.type() === 'error') {
+ log(`Browser console: ${msg.text()}`, 'error');
}
});
diff --git a/tests/ui_tests/test_api_key_settings.js b/tests/ui_tests/test_api_key_settings.js
index 1b4aee78fa..c4729fb2a6 100644
--- a/tests/ui_tests/test_api_key_settings.js
+++ b/tests/ui_tests/test_api_key_settings.js
@@ -44,13 +44,10 @@ function log(message, type = 'info') {
const page = await browser.newPage();
await page.setViewport({ width: 1920, height: 1080 });
- // Set up console logging
+ // Log browser console errors
page.on('console', msg => {
- const text = msg.text();
- if (text.includes('ERROR') || text.includes('Failed')) {
- log(`Browser console: ${text}`, 'error');
- } else {
- log(`Browser console: ${text}`, 'info');
+ if (msg.type() === 'error') {
+ log(`Browser console: ${msg.text()}`, 'error');
}
});
diff --git a/tests/ui_tests/test_benchmark_settings.js b/tests/ui_tests/test_benchmark_settings.js
index e0f1e7c019..eafc46668e 100644
--- a/tests/ui_tests/test_benchmark_settings.js
+++ b/tests/ui_tests/test_benchmark_settings.js
@@ -104,16 +104,10 @@ async function keepSessionAlive(page) {
// Set viewport to ensure consistent rendering
await page.setViewport({ width: 1280, height: 800 });
- // Enable console logging from the page
+ // Log browser console errors
page.on('console', msg => {
- const type = msg.type();
- const text = msg.text();
- if (type === 'error') {
- logError(`Browser console: ${text}`);
- } else if (type === 'warning') {
- logWarning(`Browser console: ${text}`);
- } else {
- logInfo(`Browser console: ${text}`);
+ if (msg.type() === 'error') {
+ logError(`Browser console: ${msg.text()}`);
}
});
diff --git a/tests/ui_tests/test_change_password_validation.js b/tests/ui_tests/test_change_password_validation.js
index 67a936af1c..874f1876db 100644
--- a/tests/ui_tests/test_change_password_validation.js
+++ b/tests/ui_tests/test_change_password_validation.js
@@ -11,7 +11,7 @@
const puppeteer = require('puppeteer');
const AuthHelper = require('./auth_helper');
-const { logAuthConfig, Timer, CI_TEST_USER } = require('./auth_helper');
+const { Timer, CI_TEST_USER } = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const fs = require('fs');
const path = require('path');
@@ -20,8 +20,6 @@ async function testChangePasswordValidation() {
const isCI = !!process.env.CI;
const testTimer = new Timer('test_change_password_validation');
console.log(`🧪 Running change password validation test (CI mode: ${isCI})`);
- logAuthConfig();
-
// Create screenshots directory if it doesn't exist
const screenshotsDir = path.join(__dirname, 'screenshots');
if (!fs.existsSync(screenshotsDir)) {
diff --git a/tests/ui_tests/test_charts.js b/tests/ui_tests/test_charts.js
index 03a7463f37..aa4923bc17 100644
--- a/tests/ui_tests/test_charts.js
+++ b/tests/ui_tests/test_charts.js
@@ -17,11 +17,10 @@ async function testCharts() {
await dialog.dismiss();
});
- // Listen to console logs to see chart creation
+ // Listen to console errors
page.on('console', msg => {
- const text = msg.text();
- if (text.includes('chart') || text.includes('Chart') || text.includes('METRICS') || text.includes('displaying')) {
- console.log(`📝 ${text}`);
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
}
});
diff --git a/tests/ui_tests/test_checkbox_settings.js b/tests/ui_tests/test_checkbox_settings.js
index 96f78e1fb5..1f0c27d881 100644
--- a/tests/ui_tests/test_checkbox_settings.js
+++ b/tests/ui_tests/test_checkbox_settings.js
@@ -244,15 +244,10 @@ const waitForAjaxResponse = async (responses, timeout = TEST_CONFIG.TIMEOUTS.AJA
page = await browser.newPage(); // Assign to top-level variable
await page.setViewport({ width: 1920, height: 1080 });
- // Monitor console for logs and errors
+ // Monitor console errors
page.on('console', msg => {
- const text = msg.text();
if (msg.type() === 'error') {
- console.error(`[JS ERROR] ${text}`);
- } else if (text.includes('Checkbox handler initialized')) {
- console.log(`[JS LOG] ${text}`);
- } else if (text.includes('checkbox') || text.includes('hidden')) {
- console.log(`[RELEVANT JS] ${text}`);
+ console.log(` Browser error: ${msg.text()}`);
}
});
diff --git a/tests/ui_tests/test_context_overflow_standalone.js b/tests/ui_tests/test_context_overflow_standalone.js
index 8f2172c18b..161ac0cc34 100644
--- a/tests/ui_tests/test_context_overflow_standalone.js
+++ b/tests/ui_tests/test_context_overflow_standalone.js
@@ -32,16 +32,10 @@ async function testContextOverflow() {
page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
- // Enable console logging
+ // Log browser console errors
page.on('console', msg => {
- const type = msg.type();
- const text = msg.text();
- if (type === 'error') {
- console.log(' ❌ Browser console error:', text);
- } else if (type === 'warning') {
- console.log(' ⚠️ Browser console warning:', text);
- } else if (text.includes('loadContextData') || text.includes('displayContextData') || text.includes('Response')) {
- console.log(' 📝 Browser console:', text);
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
}
});
diff --git a/tests/ui_tests/test_export_functionality.js b/tests/ui_tests/test_export_functionality.js
index 85b2f53c5b..ea0fe895d5 100644
--- a/tests/ui_tests/test_export_functionality.js
+++ b/tests/ui_tests/test_export_functionality.js
@@ -2,7 +2,7 @@ const puppeteer = require('puppeteer');
const path = require('path');
const fs = require('fs');
const AuthHelper = require('./auth_helper');
-const { CI_TEST_USER, logAuthConfig } = require('./auth_helper');
+const { CI_TEST_USER } = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const { setupDefaultModel } = require('./model_helper');
diff --git a/tests/ui_tests/test_metrics_browser.js b/tests/ui_tests/test_metrics_browser.js
index c2d0e8ac7b..721aac47f4 100644
--- a/tests/ui_tests/test_metrics_browser.js
+++ b/tests/ui_tests/test_metrics_browser.js
@@ -16,11 +16,11 @@ async function testMetricsPage() {
// Create auth helper
const authHelper = new AuthHelper(page);
- // Listen to console logs from the page
+ // Listen to console errors
page.on('console', msg => {
- const type = msg.type();
- const text = msg.text();
- console.log(`📝 [${type.toUpperCase()}] ${text}`);
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
// Listen to JavaScript errors
diff --git a/tests/ui_tests/test_metrics_full_flow.js b/tests/ui_tests/test_metrics_full_flow.js
index 3b77cedd7f..48461eb6fc 100644
--- a/tests/ui_tests/test_metrics_full_flow.js
+++ b/tests/ui_tests/test_metrics_full_flow.js
@@ -307,13 +307,10 @@ async function testMetricsFullFlow() {
const page = await browser.newPage();
page.setDefaultTimeout(TIMEOUT);
- // Log console messages
+ // Log console errors
page.on('console', msg => {
- const type = msg.type();
- if (type === 'error') {
+ if (msg.type() === 'error') {
log(`Browser error: ${msg.text()}`, 'error');
- } else if (type === 'warning') {
- log(`Browser warning: ${msg.text()}`, 'warning');
}
});
diff --git a/tests/ui_tests/test_metrics_only.js b/tests/ui_tests/test_metrics_only.js
index 52f2066c20..c808b22da2 100644
--- a/tests/ui_tests/test_metrics_only.js
+++ b/tests/ui_tests/test_metrics_only.js
@@ -16,12 +16,10 @@ async function testMetricsPage() {
const baseUrl = 'http://127.0.0.1:5000';
const authHelper = new AuthHelper(page, baseUrl);
- // Listen to console logs
+ // Listen to console errors
page.on('console', msg => {
- const type = msg.type();
- const text = msg.text();
- if (text.includes('METRICS SCRIPT') || text.includes('tokens') || text.includes('displaying')) {
- console.log(`📝 [${type.toUpperCase()}] ${text}`);
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
}
});
diff --git a/tests/ui_tests/test_metrics_with_llm.js b/tests/ui_tests/test_metrics_with_llm.js
index b43d723724..6fb8b2912e 100644
--- a/tests/ui_tests/test_metrics_with_llm.js
+++ b/tests/ui_tests/test_metrics_with_llm.js
@@ -9,9 +9,11 @@ const { setupDefaultModel } = require('./model_helper');
const page = await browser.newPage();
- // Log console messages
+ // Log console errors
page.on('console', msg => {
- console.log(`[${msg.type()}] ${msg.text()}`);
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
try {
diff --git a/tests/ui_tests/test_news_breaking_table.js b/tests/ui_tests/test_news_breaking_table.js
index f60e4cf7f2..f85c3eb48d 100644
--- a/tests/ui_tests/test_news_breaking_table.js
+++ b/tests/ui_tests/test_news_breaking_table.js
@@ -32,9 +32,11 @@ async function testNewsBreakingTable() {
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
- // Enable console logging
+ // Log browser console errors
page.on('console', msg => {
- console.log(`BROWSER LOG [${msg.type()}]:`, msg.text());
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
// Log network errors
diff --git a/tests/ui_tests/test_news_subscription_form.js b/tests/ui_tests/test_news_subscription_form.js
index b12412b6ed..4d672cfe3a 100644
--- a/tests/ui_tests/test_news_subscription_form.js
+++ b/tests/ui_tests/test_news_subscription_form.js
@@ -24,9 +24,11 @@ async function testNewsSubscriptionForm() {
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
- // Enable console logging
+ // Log browser console errors
page.on('console', msg => {
- console.log(`BROWSER LOG [${msg.type()}]:`, msg.text());
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
// Log network errors
diff --git a/tests/ui_tests/test_pages_browser.js b/tests/ui_tests/test_pages_browser.js
index da4713baed..2c642b6faf 100644
--- a/tests/ui_tests/test_pages_browser.js
+++ b/tests/ui_tests/test_pages_browser.js
@@ -24,11 +24,11 @@ class BrowserTester {
this.page = await this.browser.newPage();
this.authHelper = new AuthHelper(this.page, this.baseUrl);
- // Listen to console logs from the page
+ // Listen to console errors
this.page.on('console', msg => {
- const type = msg.type();
- const text = msg.text();
- console.log(`📝 [${type.toUpperCase()}] ${text}`);
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
// Listen to JavaScript errors
diff --git a/tests/ui_tests/test_research_form_validation.js b/tests/ui_tests/test_research_form_validation.js
index e52050f598..c5aa6c0295 100644
--- a/tests/ui_tests/test_research_form_validation.js
+++ b/tests/ui_tests/test_research_form_validation.js
@@ -6,7 +6,7 @@
const puppeteer = require('puppeteer');
const AuthHelper = require('./auth_helper');
-const { CI_TEST_USER, logAuthConfig } = require('./auth_helper');
+const { CI_TEST_USER } = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const fs = require('fs');
const path = require('path');
@@ -18,8 +18,6 @@ const path = require('path');
async function testResearchFormValidation() {
const isCI = !!process.env.CI;
console.log(`🧪 Running research form validation test (CI mode: ${isCI})`);
- logAuthConfig();
-
// Create screenshots directory if it doesn't exist
const screenshotsDir = path.join(__dirname, 'screenshots');
if (!fs.existsSync(screenshotsDir)) {
diff --git a/tests/ui_tests/test_research_results.js b/tests/ui_tests/test_research_results.js
index 3ca7b599c4..10e1cab67b 100644
--- a/tests/ui_tests/test_research_results.js
+++ b/tests/ui_tests/test_research_results.js
@@ -21,11 +21,11 @@ async function testResearchResults() {
// Set default timeout for page operations
page.setDefaultTimeout(60000); // 60 seconds default timeout
- // Listen to console logs
+ // Listen to console errors
page.on('console', msg => {
- const type = msg.type();
- const text = msg.text();
- console.log(`📝 [${type.toUpperCase()}] ${text}`);
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
// Listen to JavaScript errors
diff --git a/tests/ui_tests/test_research_search_analysis.js b/tests/ui_tests/test_research_search_analysis.js
index f978f684ad..e3bb5e1c85 100644
--- a/tests/ui_tests/test_research_search_analysis.js
+++ b/tests/ui_tests/test_research_search_analysis.js
@@ -19,9 +19,11 @@ async function analyzeSearchFunctionality() {
const page = await browser.newPage();
const authHelper = new AuthHelper(page, BASE_URL);
- // Set up console logging
+ // Log browser console errors
page.on('console', msg => {
- console.log(`📝 [BROWSER ${msg.type().toUpperCase()}] ${msg.text()}`);
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
// Set up request logging
diff --git a/tests/ui_tests/test_research_submit.js b/tests/ui_tests/test_research_submit.js
index f74cd9ad91..3764424518 100644
--- a/tests/ui_tests/test_research_submit.js
+++ b/tests/ui_tests/test_research_submit.js
@@ -6,7 +6,7 @@
const puppeteer = require('puppeteer');
const AuthHelper = require('./auth_helper');
-const { CI_TEST_USER, logAuthConfig } = require('./auth_helper');
+const { CI_TEST_USER } = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const { setupDefaultModel } = require('./model_helper');
const fs = require('fs');
@@ -20,8 +20,6 @@ const path = require('path');
let browser;
const isCI = !!process.env.CI;
console.log(`🧪 Running research submit test (CI mode: ${isCI})`);
- logAuthConfig();
-
// Create screenshots directory
const screenshotsDir = path.join(__dirname, 'screenshots');
if (!fs.existsSync(screenshotsDir)) {
diff --git a/tests/ui_tests/test_settings_save.js b/tests/ui_tests/test_settings_save.js
index f1fc2e4fd7..4203dad96b 100644
--- a/tests/ui_tests/test_settings_save.js
+++ b/tests/ui_tests/test_settings_save.js
@@ -28,9 +28,11 @@ async function testSettingsSave() {
const baseUrl = 'http://127.0.0.1:5000';
const authHelper = new AuthHelper(page, baseUrl);
- // Monitor all console messages
+ // Monitor console errors
page.on('console', msg => {
- console.log(`[${msg.type().toUpperCase()}]`, msg.text());
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
// Monitor all network requests and responses
diff --git a/tests/ui_tests/test_settings_validation.js b/tests/ui_tests/test_settings_validation.js
index 603e6ae0ce..3f68255896 100644
--- a/tests/ui_tests/test_settings_validation.js
+++ b/tests/ui_tests/test_settings_validation.js
@@ -6,7 +6,7 @@
const puppeteer = require('puppeteer');
const AuthHelper = require('./auth_helper');
-const { logAuthConfig, Timer, CI_TEST_USER } = require('./auth_helper');
+const { Timer, CI_TEST_USER } = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const fs = require('fs');
const path = require('path');
@@ -19,8 +19,6 @@ async function testSettingsValidation() {
const isCI = !!process.env.CI;
const testTimer = new Timer('test_settings_validation');
console.log(`🧪 Running settings validation test (CI mode: ${isCI})`);
- logAuthConfig();
-
// Create screenshots directory if it doesn't exist
const screenshotsDir = path.join(__dirname, 'screenshots');
if (!fs.existsSync(screenshotsDir)) {
diff --git a/tests/ui_tests/test_simple_cost.js b/tests/ui_tests/test_simple_cost.js
index 666c7ebfc6..d42ef8f2c5 100644
--- a/tests/ui_tests/test_simple_cost.js
+++ b/tests/ui_tests/test_simple_cost.js
@@ -9,9 +9,11 @@ const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const baseUrl = 'http://127.0.0.1:5000';
const authHelper = new AuthHelper(page, baseUrl);
- // Monitor console
+ // Monitor console errors
page.on('console', msg => {
- console.log(`CONSOLE ${msg.type()}: ${msg.text()}`);
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
// Monitor network
diff --git a/tests/ui_tests/tests/news/test_subscription_form.js b/tests/ui_tests/tests/news/test_subscription_form.js
index 11439774a5..d5189fa1c2 100644
--- a/tests/ui_tests/tests/news/test_subscription_form.js
+++ b/tests/ui_tests/tests/news/test_subscription_form.js
@@ -38,9 +38,11 @@ describe('News Subscription Form Tests', () => {
// Set viewport
await page.setViewport({ width: 1280, height: 800 });
- // Enable console logging
+ // Log browser console errors
page.on('console', msg => {
- console.log(`BROWSER LOG [${msg.type()}]:`, msg.text());
+ if (msg.type() === 'error') {
+ console.log(` Browser error: ${msg.text()}`);
+ }
});
// Log network errors