~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
test(ui): replace flake-prone delays, fix local-DX bug, correct stale CI comment (#3972)
LearningCircuit28b173225915
diff --git a/.github/workflows/responsive-ui-tests-enhanced.yml b/.github/workflows/responsive-ui-tests-enhanced.ymlindex c0e12ecee4..b712315fd1 100644--- a/.github/workflows/responsive-ui-tests-enhanced.yml+++ b/.github/workflows/responsive-ui-tests-enhanced.yml@@ -5,10 +5,12 @@ on:workflow_dispatch:# No concurrency group — intentionally omitted.-# This workflow triggers on both pull_request and workflow_call (from-# ci-gate.yml / release-gate.yml). A shared concurrency key would cause-# direct PR runs and workflow_call runs to cancel each other mid-flight.-# See #3554 (reverted in #3599) for context.+# This workflow runs only via workflow_call (from release.yml's+# responsive-test-gate) and workflow_dispatch. The pull_request trigger+# was deliberately removed in #2248 to reduce PR CI load on what is a+# heavy ~20-minute matrix build (mobile + desktop). A shared concurrency+# key here previously caused workflow_call invocations to cancel each+# other mid-flight; see #3554 (reverted in #3599) for that history.permissions:contents: readdiff --git a/tests/ui_tests/playwright/tests/untested-subpages.spec.js b/tests/ui_tests/playwright/tests/untested-subpages.spec.jsindex c9258a3f46..0c03469ce0 100644--- a/tests/ui_tests/playwright/tests/untested-subpages.spec.js+++ b/tests/ui_tests/playwright/tests/untested-subpages.spec.js@@ -42,7 +42,10 @@ test.describe('Benchmark Results Page', () => {pageErrors.push(error.message);});- // Navigate fresh to capture all errors+ // Navigate fresh to capture all errors. The describe-scoped beforeEach+ // also navigated to this URL — the in-flight history fetch from that+ // navigation can be aborted by this re-navigation and surface as a+ // benign `TypeError: Failed to fetch`. We filter it below.await page.goto('/benchmark/results');await page.waitForLoadState('domcontentloaded');@@ -51,6 +54,7 @@ test.describe('Benchmark Results Page', () => {!err.includes('favicon') &&!err.includes('404') &&!err.includes('Failed to load resource') &&+ !err.includes('Failed to fetch') && // benign navigation-abort race!err.includes("Can't find variable: Chart") &&!err.includes("Can't find variable: io"));diff --git a/tests/ui_tests/test_metrics_dashboard.js b/tests/ui_tests/test_metrics_dashboard.jsindex c23c3fa15e..0ce7393f85 100644--- a/tests/ui_tests/test_metrics_dashboard.js+++ b/tests/ui_tests/test_metrics_dashboard.js@@ -68,30 +68,33 @@ async function createResearch(page, query) {document.getElementById('query').value = q;}, query);+ // Wait for the start_research API response so we know submission completed+ // (passing or failing) before checking the URL — replaces a fixed 3s delay.+ const startResearchPromise = page.waitForResponse(+ (response) => response.url().includes('/api/start_research'),+ { timeout: 15000 }+ ).catch(() => null);+await page.click('#start-research-btn');- // Wait for research to complete- log('⏳ Waiting for research to complete...', 'info');- const startTime = Date.now();- const maxWaitTime = 120000;+ log('⏳ Waiting for research submission...', 'info');+ const response = await startResearchPromise;+ if (response) {+ log(`📥 start_research → ${response.status()}`, 'info');+ }- // In CI, don't wait for research to complete - just verify submission- await delay(3000);+ // Give the SPA a tiny moment to navigate; check URL right after.+ await page.waitForFunction(+ () => location.pathname.includes('/progress/') || location.pathname.includes('/research/'),+ { timeout: 5000 }+ ).catch(() => {});- try {- const currentUrl = page.url();- if (currentUrl.includes('/progress/') || currentUrl.includes('/research/')) {- log('✅ Research submitted successfully', 'success');- return;- }- } catch {- log('⚠️ Could not check research status', 'warning');+ const currentUrl = page.url();+ if (currentUrl.includes('/progress/') || currentUrl.includes('/research/')) {+ log('✅ Research submitted successfully', 'success');return;}-- if (Date.now() - startTime >= maxWaitTime) {- log('⚠️ Research timed out', 'warning');- }+ log('⚠️ Research did not navigate to progress/research page', 'warning');}async function testMetricsDashboard() {@@ -160,8 +163,15 @@ async function testMetricsDashboard() {log('📸 Screenshot saved: ./metrics-dashboard-test.png', 'info');}- // Wait for API calls to complete- await delay(3000);+ // Wait for the metrics API response (or a short ceiling) instead of+ // a fixed 3s delay. The metrics page issues several /api/metrics+ // calls on load; we only need to see one land before we assert.+ await page.waitForResponse(+ (response) => response.url().includes('/api/metrics'),+ { timeout: 10000 }+ ).catch(() => {+ log('ℹ️ No /api/metrics response within 10s — page may have no data yet', 'info');+ });// Check if metrics API was calledconst metricsApiCalls = apiCalls.filter(call => call.url.includes('/api/metrics'));@@ -285,9 +295,16 @@ async function testMetricsDashboard() {log('\n=== TESTING PERIOD SELECTOR ===', 'section');const periodSelector = await page.$('.period-selector, select[name="period"], #period-select');if (periodSelector) {- // Change period+ // Wait for the period change to trigger an API call carrying the+ // new period — replaces a fixed 2s delay. If nothing fires within+ // 5s, we fall through to the "may not be working" branch.+ const periodApiPromise = page.waitForResponse(+ (response) => response.url().includes('period=7d'),+ { timeout: 5000 }+ ).catch(() => null);+await page.select('.period-selector, select[name="period"], #period-select', '7d');- await delay(2000);+ await periodApiPromise;// Check if API was called with new periodconst recentApiCalls = apiCalls.filter(call =>@@ -329,9 +346,13 @@ async function testMetricsDashboard() {}}- // Go back to main metrics- await page.goto(`${BASE_URL}/metrics`);- await delay(2000);+ // Go back to main metrics; wait for the dashboard to actually render+ // (replaces a fixed 2s delay).+ await page.goto(`${BASE_URL}/metrics`, { waitUntil: 'domcontentloaded' });+ await page.waitForSelector(+ '.metrics-container, #metrics-dashboard, .container h1, [data-page="metrics"]',+ { timeout: 10000 }+ ).catch(() => {});// Test star reviews pageconst reviewsLink = await page.$('a[href*="/star-reviews"], a[href*="/reviews"]');@@ -348,8 +369,11 @@ async function testMetricsDashboard() {// Test rate limiting metricslog('\n=== TESTING RATE LIMITING METRICS ===', 'section');- await page.goto(`${BASE_URL}/metrics`);- await delay(2000);+ await page.goto(`${BASE_URL}/metrics`, { waitUntil: 'domcontentloaded' });+ await page.waitForSelector(+ '.metrics-container, #metrics-dashboard, .container h1, [data-page="metrics"]',+ { timeout: 10000 }+ ).catch(() => {});const rateLimitingData = await page.evaluate(() => {const elements = Array.from(document.querySelectorAll('*'));diff --git a/tests/ui_tests/test_responsive_ui_comprehensive.js b/tests/ui_tests/test_responsive_ui_comprehensive.jsindex 403011792b..8aa74cf97c 100644--- a/tests/ui_tests/test_responsive_ui_comprehensive.js+++ b/tests/ui_tests/test_responsive_ui_comprehensive.js@@ -64,6 +64,40 @@ class ResponsiveUITester {this.visualMode = process.env.VISUAL_MODE === 'true' || process.env.HEADLESS === 'false';}+ /**+ * Take a screenshot with a graceful fallback when the page exceeds+ * Puppeteer's fullPage screenshot ceiling (16384px tall on Chromium).+ *+ * The diagnostic screenshots in this test are nice-to-have, not the+ * test target — failing to capture a screenshot on an over-tall page+ * (Settings / Metrics on narrow mobile viewports) used to bubble up to+ * `testPage`'s catch block and mark the whole page as failed. This+ * helper preserves the fullPage attempt where possible and falls back+ * to a viewport-only screenshot on the documented "Page is too large"+ * protocol error so the run continues and the failure surface stays+ * about real responsive issues.+ */+ async safeScreenshot(opts) {+ try {+ await this.page.screenshot(opts);+ return true;+ } catch (error) {+ const msg = error && error.message ? error.message : String(error);+ if (msg.includes('Page is too large') || msg.includes('captureScreenshot')) {+ try {+ await this.page.screenshot({ ...opts, fullPage: false });+ console.log(` ℹ️ Page exceeded screenshot size limit; saved viewport-only fallback (${opts.path})`);+ return true;+ } catch (fallbackError) {+ console.log(` ⚠️ Screenshot fallback also failed: ${fallbackError.message}`);+ return false;+ }+ }+ console.log(` ⚠️ Screenshot failed: ${msg}`);+ return false;+ }+ }+async init() {console.log('Launching browser...');this.browser = await puppeteer.launch(getPuppeteerLaunchOptions());@@ -126,7 +160,7 @@ class ResponsiveUITester {// Take screenshot of the login pageif (!process.env.CI) {const screenshotPath = path.join(this.screenshotsDir, `login-page-${this.viewport}.png`);- await this.page.screenshot({+ await this.safeScreenshot({path: screenshotPath,fullPage: true});@@ -142,7 +176,7 @@ class ResponsiveUITester {console.log(` ⚠️ Login page has horizontal overflow at ${this.viewport}`);if (!process.env.CI) {const overflowScreenshotPath = path.join(this.screenshotsDir, `login-page-overflow-${this.viewport}.png`);- await this.page.screenshot({+ await this.safeScreenshot({path: overflowScreenshotPath,fullPage: true});@@ -179,7 +213,7 @@ class ResponsiveUITester {});const touchTargetScreenshotPath = path.join(this.screenshotsDir, `login-page-touch-targets-${this.viewport}.png`);- await this.page.screenshot({+ await this.safeScreenshot({path: touchTargetScreenshotPath,fullPage: true});@@ -200,7 +234,7 @@ class ResponsiveUITester {if (!process.env.CI) {const registerScreenshotPath = path.join(this.screenshotsDir, `register-page-${this.viewport}.png`);- await this.page.screenshot({+ await this.safeScreenshot({path: registerScreenshotPath,fullPage: true});@@ -258,7 +292,7 @@ class ResponsiveUITester {// Take screenshot if not in CIif (!process.env.CI) {const screenshotPath = path.join(this.screenshotsDir, `${pageInfo.name.toLowerCase()}-overflow.png`);- await this.page.screenshot({ path: screenshotPath, fullPage: true });+ await this.safeScreenshot({ path: screenshotPath, fullPage: true });console.log(` 📸 Screenshot saved: ${screenshotPath}`);}}@@ -278,7 +312,7 @@ class ResponsiveUITester {});});const screenshotPath = path.join(this.screenshotsDir, `${pageInfo.name.toLowerCase()}-overlaps.png`);- await this.page.screenshot({ path: screenshotPath, fullPage: true });+ await this.safeScreenshot({ path: screenshotPath, fullPage: true });console.log(` 📸 Screenshot saved: ${screenshotPath}`);}}@@ -314,7 +348,7 @@ class ResponsiveUITester {});});const screenshotPath = path.join(this.screenshotsDir, `${pageInfo.name.toLowerCase()}-small-text.png`);- await this.page.screenshot({ path: screenshotPath, fullPage: true });+ await this.safeScreenshot({ path: screenshotPath, fullPage: true });console.log(` 📸 Screenshot saved: ${screenshotPath}`);}}@@ -349,7 +383,7 @@ class ResponsiveUITester {});});const screenshotPath = path.join(this.screenshotsDir, `${pageInfo.name.toLowerCase()}-small-touch-targets.png`);- await this.page.screenshot({ path: screenshotPath, fullPage: true });+ await this.safeScreenshot({ path: screenshotPath, fullPage: true });console.log(` 📸 Screenshot saved: ${screenshotPath}`);}}@@ -361,7 +395,7 @@ class ResponsiveUITester {// Always capture screenshot for BenchmarkResults pageif (pageInfo.name === 'BenchmarkResults' && !process.env.CI) {const screenshotPath = path.join(this.screenshotsDir, `benchmarkresults-page.png`);- await this.page.screenshot({ path: screenshotPath, fullPage: true });+ await this.safeScreenshot({ path: screenshotPath, fullPage: true });console.log(` 📸 Screenshot saved: ${screenshotPath}`);}