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.

fix: Replace networkidle2 with domcontentloaded in all CI test files

LearningCircuitb4ecb59b6f65
diff --git a/tests/ui_tests/test_auth_flow.js b/tests/ui_tests/test_auth_flow.js
index 0ba3b0a2b0..ecb307d4b0 100644
--- a/tests/ui_tests/test_auth_flow.js
+++ b/tests/ui_tests/test_auth_flow.js
@@ -10,6 +10,10 @@ const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const fs = require('fs');
const path = require('path');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
async function testAuthFlow() {
const isCI = !!process.env.CI;
console.log(`🧪 Running authentication flow test (CI mode: ${isCI})`);
@@ -120,7 +124,7 @@ async function testAuthFlow() {
for (const pageInfo of protectedPages) {
await page.goto(`${baseUrl}${pageInfo.url}`, {
- waitUntil: 'networkidle2',
+ waitUntil: 'domcontentloaded',
timeout: 30000
});
diff --git a/tests/ui_tests/test_full_navigation.js b/tests/ui_tests/test_full_navigation.js
index e4b9b6c21e..cf8d9d2fde 100644
--- a/tests/ui_tests/test_full_navigation.js
+++ b/tests/ui_tests/test_full_navigation.js
@@ -11,6 +11,10 @@ const puppeteer = require('puppeteer');
const AuthHelper = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
// Check command line arguments
const runSearch = process.argv.includes('--search');
@@ -44,7 +48,7 @@ async function testFullNavigation() {
console.log(`\n🔍 Navigating to ${pageInfo.name} (${pageInfo.path})`);
await page.goto(`${baseUrl}${pageInfo.path}`, {
- waitUntil: 'networkidle2',
+ waitUntil: 'domcontentloaded',
timeout: 30000
});
@@ -68,7 +72,7 @@ async function testFullNavigation() {
// Navigate back to home
await page.goto(baseUrl, {
- waitUntil: 'networkidle2',
+ waitUntil: 'domcontentloaded',
timeout: 30000
});
@@ -126,7 +130,7 @@ async function testFullNavigation() {
console.log(`✅ Research request sent - Status: ${response.status()}`);
// Wait for redirect or progress page
- await page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 10000 });
+ await page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 10000 });
const currentUrl = page.url();
console.log(`📍 Redirected to: ${currentUrl}`);
diff --git a/tests/ui_tests/test_history_page.js b/tests/ui_tests/test_history_page.js
index b5d5ca3c68..4931910437 100644
--- a/tests/ui_tests/test_history_page.js
+++ b/tests/ui_tests/test_history_page.js
@@ -2,6 +2,10 @@ const puppeteer = require('puppeteer');
const AuthHelper = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
// Test configuration
const BASE_URL = 'http://127.0.0.1:5000';
@@ -37,7 +41,7 @@ async function createResearch(page, query, waitForCompletion = false) {
log(`🔬 Creating research: "${query}"`, 'info');
// Navigate to home/research page
- await page.goto(BASE_URL, { waitUntil: 'networkidle2' });
+ await page.goto(BASE_URL, { waitUntil: 'domcontentloaded' });
// Wait for the query input
await page.waitForSelector('#query', { timeout: 10000 });
@@ -140,7 +144,7 @@ async function testHistoryPage() {
// Navigate to history page
log('\n=== TESTING HISTORY PAGE ===', 'section');
- await page.goto(`${BASE_URL}/history`, { waitUntil: 'networkidle2' });
+ await page.goto(`${BASE_URL}/history`, { waitUntil: 'domcontentloaded' });
// Wait for history content to load
await page.waitForSelector('body', { timeout: 10000 });
diff --git a/tests/ui_tests/test_queue_simple.js b/tests/ui_tests/test_queue_simple.js
index 8d2ad6d275..0caecdd7ec 100644
--- a/tests/ui_tests/test_queue_simple.js
+++ b/tests/ui_tests/test_queue_simple.js
@@ -3,11 +3,15 @@ const { browserConfig } = require('./browser_config');
const AuthHelper = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
async function submitResearch(page, query, index) {
console.log(`\nSubmitting: "${query}"`);
// Navigate to home
- await page.goto('http://127.0.0.1:5000/', { waitUntil: 'networkidle2' });
+ await page.goto('http://127.0.0.1:5000/', { waitUntil: 'domcontentloaded' });
// Capture page state before submission
const pageInfo = await page.evaluate(() => {
diff --git a/tests/ui_tests/test_register_full_flow.js b/tests/ui_tests/test_register_full_flow.js
index 83c7c485b9..d84bdc8098 100644
--- a/tests/ui_tests/test_register_full_flow.js
+++ b/tests/ui_tests/test_register_full_flow.js
@@ -14,6 +14,10 @@ const { getPuppeteerLaunchOptions, takeScreenshot } = require('./puppeteer_confi
const fs = require('fs');
const path = require('path');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
async function testRegisterFullFlow() {
const isCI = !!process.env.CI;
console.log(`🧪 Running registration full flow test (CI mode: ${isCI})`);
@@ -51,7 +55,7 @@ async function testRegisterFullFlow() {
// Navigate to register page
console.log('📄 Navigating to registration page...');
await page.goto(`${baseUrl}/auth/register`, {
- waitUntil: 'networkidle2',
+ waitUntil: 'domcontentloaded',
timeout: 30000
});
@@ -215,7 +219,7 @@ async function testRegisterFullFlow() {
// Reload the page to reset form
await page.goto(`${baseUrl}/auth/register`, {
- waitUntil: 'networkidle2',
+ waitUntil: 'domcontentloaded',
timeout: 30000
});
diff --git a/tests/ui_tests/test_register_validation.js b/tests/ui_tests/test_register_validation.js
index 9d75090b50..6b7f083ce5 100644
--- a/tests/ui_tests/test_register_validation.js
+++ b/tests/ui_tests/test_register_validation.js
@@ -10,6 +10,10 @@ const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const fs = require('fs');
const path = require('path');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
async function testRegisterValidation() {
const isCI = !!process.env.CI;
console.log(`🧪 Running registration form validation test (CI mode: ${isCI})`);
@@ -39,7 +43,7 @@ async function testRegisterValidation() {
// Navigate to register page
console.log('📄 Navigating to registration page...');
await page.goto(`${baseUrl}/auth/register`, {
- waitUntil: 'networkidle2',
+ waitUntil: 'domcontentloaded',
timeout: 30000
});
diff --git a/tests/ui_tests/test_research_api.js b/tests/ui_tests/test_research_api.js
index 418ecda44e..d458ad8dca 100644
--- a/tests/ui_tests/test_research_api.js
+++ b/tests/ui_tests/test_research_api.js
@@ -7,6 +7,10 @@ const puppeteer = require('puppeteer');
const AuthHelper = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
async function testResearchAPI() {
const browser = await puppeteer.launch(getPuppeteerLaunchOptions());
@@ -27,7 +31,7 @@ async function testResearchAPI() {
// Go to home page to get CSRF token
await page.goto(baseUrl, {
- waitUntil: 'networkidle2',
+ waitUntil: 'domcontentloaded',
timeout: 30000
});
diff --git a/tests/ui_tests/test_research_cancellation.js b/tests/ui_tests/test_research_cancellation.js
index c968427858..b3b4844bcc 100644
--- a/tests/ui_tests/test_research_cancellation.js
+++ b/tests/ui_tests/test_research_cancellation.js
@@ -2,6 +2,10 @@ const puppeteer = require('puppeteer');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const AuthHelper = require('./auth_helper');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
// Test configuration
const BASE_URL = 'http://127.0.0.1:5000';
@@ -36,7 +40,7 @@ async function delay(ms) {
async function startResearch(page, query) {
log(`🔬 Starting research: "${query}"`, 'info');
- await page.goto(`${BASE_URL}/`, { waitUntil: 'networkidle2' });
+ await page.goto(`${BASE_URL}/`, { waitUntil: 'domcontentloaded' });
await page.waitForSelector('#query', { timeout: 10000 });
// Use longer iterations for cancellation test
@@ -109,7 +113,7 @@ async function testCancellation() {
await auth.ensureAuthenticated();
// Navigate to home page after authentication
- await page.goto(BASE_URL, { waitUntil: 'networkidle2', timeout: 10000 });
+ await page.goto(BASE_URL, { waitUntil: 'domcontentloaded', timeout: 10000 });
// Test 1: Cancel during early stage
log('\n=== TEST 1: EARLY CANCELLATION ===', 'section');
diff --git a/tests/ui_tests/test_research_form_validation.js b/tests/ui_tests/test_research_form_validation.js
index d8dd5aa686..e52050f598 100644
--- a/tests/ui_tests/test_research_form_validation.js
+++ b/tests/ui_tests/test_research_form_validation.js
@@ -11,6 +11,10 @@ const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const fs = require('fs');
const path = require('path');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
async function testResearchFormValidation() {
const isCI = !!process.env.CI;
console.log(`🧪 Running research form validation test (CI mode: ${isCI})`);
@@ -56,7 +60,7 @@ async function testResearchFormValidation() {
// Navigate to home page (research form)
console.log('📄 Navigating to research page...');
await page.goto(`${baseUrl}/`, {
- waitUntil: 'networkidle2',
+ waitUntil: 'domcontentloaded',
timeout: 30000
});
diff --git a/tests/ui_tests/test_research_simple.js b/tests/ui_tests/test_research_simple.js
index 41c561e02c..7662d0bfcd 100644
--- a/tests/ui_tests/test_research_simple.js
+++ b/tests/ui_tests/test_research_simple.js
@@ -8,6 +8,10 @@ const AuthHelper = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const { setupDefaultModel } = require('./model_helper');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
async function testSimpleResearch() {
const browser = await puppeteer.launch(getPuppeteerLaunchOptions());
@@ -42,7 +46,7 @@ async function testSimpleResearch() {
// Go to home
await page.goto(baseUrl, {
- waitUntil: 'networkidle2',
+ waitUntil: 'domcontentloaded',
timeout: 30000
});
@@ -113,7 +117,7 @@ async function testSimpleResearch() {
// Wait for response or navigation
await Promise.race([
- page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 10000 }).catch(() => null),
+ page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 10000 }).catch(() => null),
page.waitForResponse(response =>
response.url().includes('research') || response.url().includes('api'),
{ timeout: 10000 }
diff --git a/tests/ui_tests/test_research_submit.js b/tests/ui_tests/test_research_submit.js
index 4d9850a851..4bfc8c6804 100644
--- a/tests/ui_tests/test_research_submit.js
+++ b/tests/ui_tests/test_research_submit.js
@@ -12,6 +12,10 @@ const { setupDefaultModel } = require('./model_helper');
const fs = require('fs');
const path = require('path');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
(async () => {
let browser;
const isCI = !!process.env.CI;
@@ -47,7 +51,7 @@ const path = require('path');
await auth.ensureAuthenticated();
console.log('\n🏠 Navigating to home page...');
- await page.goto('http://127.0.0.1:5000/', { waitUntil: 'networkidle2' });
+ await page.goto('http://127.0.0.1:5000/', { waitUntil: 'domcontentloaded' });
// Set up model configuration
console.log('🔧 Configuring model...');
diff --git a/tests/ui_tests/test_settings_validation.js b/tests/ui_tests/test_settings_validation.js
index 1733083fcf..603e6ae0ce 100644
--- a/tests/ui_tests/test_settings_validation.js
+++ b/tests/ui_tests/test_settings_validation.js
@@ -11,6 +11,10 @@ const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
const fs = require('fs');
const path = require('path');
+// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()
+// because networkidle2 waits for no network activity for 500ms, but WebSocket
+// connections and background polling keep the network active, causing infinite hangs.
+// See: test_login_validation.js and auth_helper.js for detailed explanation.
async function testSettingsValidation() {
const isCI = !!process.env.CI;
const testTimer = new Timer('test_settings_validation');
@@ -58,7 +62,7 @@ async function testSettingsValidation() {
// Navigate to settings page
console.log('📄 Navigating to settings page...');
await page.goto(`${baseUrl}/settings/`, {
- waitUntil: 'networkidle2',
+ waitUntil: 'domcontentloaded',
timeout: 30000
});