~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(tests): contain error_handling sub-test failures with timeout + recovery (#3629)
LearningCircuit50904e4d0a86
diff --git a/tests/ui_tests/test_error_handling_ci.js b/tests/ui_tests/test_error_handling_ci.jsindex ba35a9af05..7362b08478 100644--- a/tests/ui_tests/test_error_handling_ci.js+++ b/tests/ui_tests/test_error_handling_ci.js@@ -9,12 +9,29 @@const { setupTest, teardownTest, TestResults, log, delay, navigateTo, withTimeout } = require('./test_lib');+/**+ * Navigate with a single retry on timeout.+ *+ * Used for deliberately-bad URLs (404 probes) where a slow CI server can+ * push the first goto past its 60s timeout. Without the retry, a single+ * stuck navigation consumes the suite's wall-clock budget and triggers the+ * SIGTERM that detaches the page for every subsequent sub-test.+ */+async function navigateToWithRetry(page, url) {+ try {+ return await navigateTo(page, url);+ } catch (firstError) {+ await delay(2000);+ return await navigateTo(page, url);+ }+}+// ============================================================================// 404 Error Handling Tests// ============================================================================const Error404Tests = {async nonExistentPageShows404(page, baseUrl) {- const response = await navigateTo(page, `${baseUrl}/nonexistent-page-12345`);+ const response = await navigateToWithRetry(page, `${baseUrl}/nonexistent-page-12345`);const result = await page.evaluate(() => {const bodyText = document.body.textContent?.toLowerCase() || '';@@ -38,7 +55,7 @@ const Error404Tests = {},async invalidResearchIdHandled(page, baseUrl) {- const response = await navigateTo(page, `${baseUrl}/results/invalid-research-id-12345`);+ const response = await navigateToWithRetry(page, `${baseUrl}/results/invalid-research-id-12345`);const result = await page.evaluate(() => {const bodyText = document.body.textContent?.toLowerCase() || '';@@ -484,16 +501,43 @@ async function main() {const { page } = ctx;const { baseUrl } = ctx.config;+ // Per-sub-test timeout + about:blank recovery on failure.+ //+ // The suite has a wall-clock budget enforced externally (300s in CI). If+ // any single sub-test hangs past that budget the runner SIGTERMs the+ // process and every remaining sub-test cascades into "detached frame"+ // errors. A per-sub-test timeout caps each call well below the suite+ // budget; resetting to about:blank on failure prevents a half-loaded+ // page from breaking the next test.+ const subTestTimeout = ctx.config.isCI ? 60000 : 30000;+ async function run(category, name, testFn) {+ try {+ const result = await withTimeout(testFn(), subTestTimeout, `${category}/${name}`);+ if (result && result.skipped) {+ results.skip(category, name, result.message);+ } else {+ results.add(category, name, result.passed, result.message || '');+ }+ } catch (error) {+ results.add(category, name, false, `Error: ${error.message}`);+ try {+ await page.goto('about:blank', { timeout: 5000 });+ } catch {+ // Best-effort recovery — don't mask the original failure.+ }+ }+ }+try {// 404 Error Testslog.section('404 Errors');- await results.run('404', 'Non-existent Page Shows 404', () => Error404Tests.nonExistentPageShows404(page, baseUrl), { page });- await results.run('404', 'Invalid Research ID Handled', () => Error404Tests.invalidResearchIdHandled(page, baseUrl), { page });- await results.run('404', 'Invalid Document ID Handled', () => Error404Tests.invalidDocumentIdHandled(page, baseUrl), { page });+ await run('404', 'Non-existent Page Shows 404', () => Error404Tests.nonExistentPageShows404(page, baseUrl));+ await run('404', 'Invalid Research ID Handled', () => Error404Tests.invalidResearchIdHandled(page, baseUrl));+ await run('404', 'Invalid Document ID Handled', () => Error404Tests.invalidDocumentIdHandled(page, baseUrl));// 401 Authentication Testslog.section('401 Authentication');- await results.run('401', 'Unauthenticated Redirects To Login', () => Error401Tests.unauthenticatedRedirectsToLogin(page, baseUrl), { page });+ await run('401', 'Unauthenticated Redirects To Login', () => Error401Tests.unauthenticatedRedirectsToLogin(page, baseUrl));// After 401 test cleared cookies, re-authenticate on a fresh login page.// We avoid waitForNavigation here — if login fails (CSRF, wrong password),@@ -544,12 +588,7 @@ async function main() {}if (reAuthOk) {- const apiAuthResult = await Error401Tests.apiUnauthorizedReturns401(page, baseUrl);- if (apiAuthResult.skipped) {- results.skip('401', 'API Unauthorized Returns 401', apiAuthResult.message);- } else {- results.add('401', 'API Unauthorized Returns 401', apiAuthResult.passed, apiAuthResult.message);- }+ await run('401', 'API Unauthorized Returns 401', () => Error401Tests.apiUnauthorizedReturns401(page, baseUrl));} else {results.skip('401', 'API Unauthorized Returns 401', 'Skipped — re-authentication timed out');}@@ -571,14 +610,8 @@ async function main() {// API Error Tests (require authenticated session)log.section('API Errors');if (reAuthOk) {- const missingParamsResult = await ApiErrorTests.apiMissingParamsReturns400(page, baseUrl);- if (missingParamsResult.skipped) {- results.skip('API', 'API Missing Params Returns 400', missingParamsResult.message);- } else {- results.add('API', 'API Missing Params Returns 400', missingParamsResult.passed, missingParamsResult.message);- }-- await results.run('API', 'API Invalid ID Returns 404', () => ApiErrorTests.apiInvalidIdReturns404(page, baseUrl), { page });+ await run('API', 'API Missing Params Returns 400', () => ApiErrorTests.apiMissingParamsReturns400(page, baseUrl));+ await run('API', 'API Invalid ID Returns 404', () => ApiErrorTests.apiInvalidIdReturns404(page, baseUrl));} else {results.skip('API', 'API Missing Params Returns 400', 'Skipped — could not re-authenticate after 401 tests');results.skip('API', 'API Invalid ID Returns 404', 'Skipped — could not re-authenticate after 401 tests');@@ -587,19 +620,8 @@ async function main() {// Rate Limiting Tests (require authenticated session)log.section('Rate Limiting');if (reAuthOk) {- const rateLimitWarningResult = await RateLimitTests.rateLimitingWarningDisplays(page, baseUrl);- if (rateLimitWarningResult.skipped) {- results.skip('RateLimit', 'Rate Limiting Warning Displays', rateLimitWarningResult.message);- } else {- results.add('RateLimit', 'Rate Limiting Warning Displays', rateLimitWarningResult.passed, rateLimitWarningResult.message);- }-- const rateLimitStatusResult = await RateLimitTests.rateLimitingStatusEndpoint(page, baseUrl);- if (rateLimitStatusResult.skipped) {- results.skip('RateLimit', 'Rate Limiting Status Endpoint', rateLimitStatusResult.message);- } else {- results.add('RateLimit', 'Rate Limiting Status Endpoint', rateLimitStatusResult.passed, rateLimitStatusResult.message);- }+ await run('RateLimit', 'Rate Limiting Warning Displays', () => RateLimitTests.rateLimitingWarningDisplays(page, baseUrl));+ await run('RateLimit', 'Rate Limiting Status Endpoint', () => RateLimitTests.rateLimitingStatusEndpoint(page, baseUrl));} else {results.skip('RateLimit', 'Rate Limiting Warning Displays', 'Skipped — could not re-authenticate after 401 tests');results.skip('RateLimit', 'Rate Limiting Status Endpoint', 'Skipped — could not re-authenticate after 401 tests');@@ -607,26 +629,9 @@ async function main() {// Form Validation Testslog.section('Form Validation');- const emptyQueryResult = await FormValidationTests.emptyQueryShowsError(page, baseUrl);- if (emptyQueryResult.skipped) {- results.skip('Validation', 'Empty Query Shows Error', emptyQueryResult.message);- } else {- results.add('Validation', 'Empty Query Shows Error', emptyQueryResult.passed, emptyQueryResult.message);- }-- const invalidSettingsResult = await FormValidationTests.invalidSettingsShowsError(page, baseUrl);- if (invalidSettingsResult.skipped) {- results.skip('Validation', 'Invalid Settings Shows Error', invalidSettingsResult.message);- } else {- results.add('Validation', 'Invalid Settings Shows Error', invalidSettingsResult.passed, invalidSettingsResult.message);- }-- const requiredFieldsResult = await FormValidationTests.requiredFieldsMarked(page, baseUrl);- if (requiredFieldsResult.skipped) {- results.skip('Validation', 'Required Fields Marked', requiredFieldsResult.message);- } else {- results.add('Validation', 'Required Fields Marked', requiredFieldsResult.passed, requiredFieldsResult.message);- }+ await run('Validation', 'Empty Query Shows Error', () => FormValidationTests.emptyQueryShowsError(page, baseUrl));+ await run('Validation', 'Invalid Settings Shows Error', () => FormValidationTests.invalidSettingsShowsError(page, baseUrl));+ await run('Validation', 'Required Fields Marked', () => FormValidationTests.requiredFieldsMarked(page, baseUrl));} catch (error) {log.error(`Fatal error: ${error.message}`);