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(tests): resolve Puppeteer navigation timeouts in settings-save and followup CI tests (#3624)

LearningCircuitc39f6030fdea
diff --git a/tests/ui_tests/test_followup_research_ci.js b/tests/ui_tests/test_followup_research_ci.js
index a75fbc21bd..463da1aa19 100644
--- a/tests/ui_tests/test_followup_research_ci.js
+++ b/tests/ui_tests/test_followup_research_ci.js
@@ -9,13 +9,31 @@
const { setupTest, teardownTest, TestResults, log, delay, navigateTo, withTimeout } = require('./test_lib');
+/**
+ * Navigate with a single retry on timeout.
+ *
+ * In CI the server can be slow after previous tests finished (heavy DB
+ * operations, template rendering). A one-shot retry avoids a cascade of
+ * "detached frame" failures that would otherwise mark every remaining
+ * sub-test as broken.
+ */
+async function navigateToWithRetry(page, url) {
+ try {
+ await navigateTo(page, url);
+ } catch (firstError) {
+ // Retry once after a short pause
+ await delay(2000);
+ await navigateTo(page, url);
+ }
+}
+
// ============================================================================
// Follow-up Research Tests
// ============================================================================
const FollowupResearchTests = {
async followupButtonOnResults(page, baseUrl) {
// First find a completed research
- await navigateTo(page, `${baseUrl}/history`);
+ await navigateToWithRetry(page, `${baseUrl}/history`);
const researchId = await page.evaluate(() => {
// Look for completed research with results link
@@ -34,7 +52,7 @@ const FollowupResearchTests = {
return { passed: null, skipped: true, message: 'No completed research found to test follow-up' };
}
- await navigateTo(page, `${baseUrl}/results/${researchId}`);
+ await navigateToWithRetry(page, `${baseUrl}/results/${researchId}`);
const result = await page.evaluate(() => {
const buttons = Array.from(document.querySelectorAll('button, a.btn, .btn'));
@@ -62,7 +80,7 @@ const FollowupResearchTests = {
async followupModalOpens(page, baseUrl) {
// Navigate to a results page
- await navigateTo(page, `${baseUrl}/history`);
+ await navigateToWithRetry(page, `${baseUrl}/history`);
const researchId = await page.evaluate(() => {
const link = document.querySelector('a[href*="/results/"]');
@@ -74,7 +92,7 @@ const FollowupResearchTests = {
return { passed: null, skipped: true, message: 'No completed research for follow-up modal test' };
}
- await navigateTo(page, `${baseUrl}/results/${researchId}`);
+ await navigateToWithRetry(page, `${baseUrl}/results/${researchId}`);
// Click follow-up button
const clicked = await page.evaluate(() => {
@@ -119,7 +137,7 @@ const FollowupResearchTests = {
},
async followupQueryPrefilled(page, baseUrl) {
- await navigateTo(page, `${baseUrl}/history`);
+ await navigateToWithRetry(page, `${baseUrl}/history`);
const researchId = await page.evaluate(() => {
const link = document.querySelector('a[href*="/results/"]');
@@ -131,7 +149,7 @@ const FollowupResearchTests = {
return { passed: null, skipped: true, message: 'No research for prefilled query test' };
}
- await navigateTo(page, `${baseUrl}/results/${researchId}`);
+ await navigateToWithRetry(page, `${baseUrl}/results/${researchId}`);
// Click follow-up button
await page.evaluate(() => {
@@ -180,7 +198,7 @@ const FollowupResearchTests = {
},
async followupSubmitButton(page, baseUrl) {
- await navigateTo(page, `${baseUrl}/history`);
+ await navigateToWithRetry(page, `${baseUrl}/history`);
const researchId = await page.evaluate(() => {
const link = document.querySelector('a[href*="/results/"]');
@@ -192,7 +210,7 @@ const FollowupResearchTests = {
return { passed: null, skipped: true, message: 'No research for submit button test' };
}
- await navigateTo(page, `${baseUrl}/results/${researchId}`);
+ await navigateToWithRetry(page, `${baseUrl}/results/${researchId}`);
// Open follow-up form
await page.evaluate(() => {
@@ -238,7 +256,7 @@ const FollowupResearchTests = {
},
async followupModeSelection(page, baseUrl) {
- await navigateTo(page, `${baseUrl}/history`);
+ await navigateToWithRetry(page, `${baseUrl}/history`);
const researchId = await page.evaluate(() => {
const link = document.querySelector('a[href*="/results/"]');
@@ -250,7 +268,7 @@ const FollowupResearchTests = {
return { passed: null, skipped: true, message: 'No research for mode selection test' };
}
- await navigateTo(page, `${baseUrl}/results/${researchId}`);
+ await navigateToWithRetry(page, `${baseUrl}/results/${researchId}`);
// Open follow-up form
await page.evaluate(() => {
@@ -315,7 +333,7 @@ const FollowupResearchTests = {
},
async followupLinksToOriginal(page, baseUrl) {
- await navigateTo(page, `${baseUrl}/history`);
+ await navigateToWithRetry(page, `${baseUrl}/history`);
const researchId = await page.evaluate(() => {
const link = document.querySelector('a[href*="/results/"]');
@@ -327,7 +345,7 @@ const FollowupResearchTests = {
return { passed: null, skipped: true, message: 'No research for original link test' };
}
- await navigateTo(page, `${baseUrl}/results/${researchId}`);
+ await navigateToWithRetry(page, `${baseUrl}/results/${researchId}`);
// Open follow-up form
await page.evaluate(() => {
@@ -447,6 +465,15 @@ async function main() {
}
} catch (error) {
results.add(category, name, false, `Error: ${error.message}`);
+ // If a test timed out, the page may be in a broken state (e.g.
+ // a pending navigation that partially completed). Navigate to
+ // about:blank so subsequent tests don't hit "detached frame"
+ // errors and can start fresh.
+ try {
+ await page.goto('about:blank', { timeout: 5000 });
+ } catch {
+ // Best-effort recovery — don't mask the original failure.
+ }
}
}
diff --git a/tests/ui_tests/test_settings_save.js b/tests/ui_tests/test_settings_save.js
index 3182283b08..4e510c7920 100644
--- a/tests/ui_tests/test_settings_save.js
+++ b/tests/ui_tests/test_settings_save.js
@@ -18,15 +18,12 @@
* Usage: node tests/ui_tests/test_settings_save.js
*/
-const puppeteer = require('puppeteer');
-const AuthHelper = require('./auth_helper');
-const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
+const { setupTest, teardownTest, navigateTo } = require('./test_lib');
async function testSettingsSave() {
- const browser = await puppeteer.launch(getPuppeteerLaunchOptions());
- const page = await browser.newPage();
- const baseUrl = 'http://127.0.0.1:5000';
- const authHelper = new AuthHelper(page, baseUrl);
+ const ctx = await setupTest({ authenticate: true });
+ const { browser, page } = ctx;
+ const baseUrl = ctx.config.baseUrl;
// Monitor console errors
page.on('console', msg => {
@@ -35,15 +32,8 @@ async function testSettingsSave() {
}
});
- // Monitor all network requests and responses
- await page.setRequestInterception(true);
- page.on('request', request => {
- if (request.url().includes('/settings/')) {
- console.log('→ REQUEST:', request.method(), request.url());
- }
- request.continue();
- });
-
+ // Monitor network responses (no request interception — it can hang
+ // page.goto in CI environments when set up before the first navigation).
page.on('response', response => {
if (response.url().includes('/settings/')) {
console.log('← RESPONSE:', response.status(), response.url());
@@ -57,11 +47,7 @@ async function testSettingsSave() {
try {
console.log('🔧 Testing settings save functionality...');
- await authHelper.ensureAuthenticatedWithTimeout();
- await page.goto('http://127.0.0.1:5000/settings/', {
- waitUntil: 'domcontentloaded',
- timeout: 30000
- });
+ await navigateTo(page, `${baseUrl}/settings/`);
// Wait for page to load completely
await page.waitForSelector('#save-all-btn, button[type="submit"]', { timeout: 15000 });
@@ -110,7 +96,7 @@ async function testSettingsSave() {
console.error('❌ Test error:', error);
failed = true;
} finally {
- await browser.close();
+ await teardownTest(ctx);
process.exit(failed ? 1 : 0);
}
}