~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: qualify research completion and reconnect on main (#7316)
LearningCircuit86e31f62b7d6
diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.ymlindex ca4e71bf72..0a1efff4c9 100644--- a/.github/workflows/docker-tests.yml+++ b/.github/workflows/docker-tests.yml@@ -858,7 +858,7 @@ jobs:# Run UI tests with Puppeteer#- # Runs as a 17-way matrix (one cell per shard). Each cell spins up its own+ # Runs as an 18-way matrix (one cell per shard). Each cell spins up its own# docker container and runs only the tests tagged with its shard in# tests/ui_tests/run_all_tests.js. Fresh per-cell DB bounds state leakage# across tests (see #5165 flake analysis).@@ -888,6 +888,7 @@ jobs:- auth-register- auth-pages- research-workflow+ - research-completion- research-form- research-metrics- settings-core@@ -1061,6 +1062,18 @@ jobs:fiecho "::group::Start application server"+ SERVER_OPTIONS=()+ SERVER_COMMAND=(ldr-web)+ if [ "${SHARD}" = "research-completion" ]; then+ # Only this release shard serves the real ASGI app with its+ # model/search egress replaced by deterministic test stubs.+ SERVER_OPTIONS=(+ -e LDR_RESEARCH_SMOKE_DIR=/data/research-smoke+ -v "${GITHUB_WORKSPACE}/tests/ui_tests/research_completion_server.py":/app/tests/ui_tests/research_completion_server.py:ro+ -w /app+ )+ SERVER_COMMAND=(python tests/ui_tests/research_completion_server.py)+ fidocker run -d \--name ldr-server \-p 5000:5000 \@@ -1073,7 +1086,8 @@ jobs:-e LDR_DATA_DIR=/data \-e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \-e LDR_TEST_MODE=1 \- "${TEST_IMAGE}" ldr-web+ "${SERVER_OPTIONS[@]}" \+ "${TEST_IMAGE}" "${SERVER_COMMAND[@]}"# --max-time bounds total request time; --connect-timeout bounds# TCP handshake. Without these, a hung connection would silently@@ -1127,6 +1141,7 @@ jobs:-e LDR_DATA_DIR=/data \-e LDR_DB_CONFIG_KDF_ITERATIONS=1000 \-e LDR_TEST_MODE=1 \+ -e LDR_RESEARCH_SMOKE_DIR=/data/research-smoke \--network host \-w /app/tests/ui_tests \"${TEST_IMAGE}" \diff --git a/tests/ui_tests/research_completion_server.py b/tests/ui_tests/research_completion_server.pynew file mode 100644index 0000000000..a31305c364--- /dev/null+++ b/tests/ui_tests/research_completion_server.py@@ -0,0 +1,105 @@+"""Run the real ASGI app with only model and search egress stubbed for UI CI.++The browser test creates ``release/<research_id>`` after it has subscribed or+enabled polling. The model writes ``entered/<research_id>`` and waits, so the+worker cannot finish before the browser has observed the transport state.+This module is executed only by the release browser shard, never by ldr-web.+"""++from __future__ import annotations++import os+import time+import uuid+from pathlib import Path++import uvicorn+from langchain_core.language_models import BaseChatModel+from langchain_core.messages import AIMessage+from langchain_core.outputs import ChatGeneration, ChatResult++from local_deep_research.llm import register_llm+from local_deep_research.utilities.thread_context import get_search_context+from local_deep_research.web.fastapi_app import app+from local_deep_research.web_search_engines.engines.search_engine_wikipedia import (+ WikipediaSearchEngine,+)+++SMOKE_DIR = Path(os.environ["LDR_RESEARCH_SMOKE_DIR"])+ENTERED = SMOKE_DIR / "entered"+RELEASE = SMOKE_DIR / "release"+ANSWER = "RELEASEBROWSERSYNTHESISMARKER"+SOURCE_URL = "https://research-smoke.invalid/source"+++class _GatedChatModel(BaseChatModel):+ @property+ def _llm_type(self) -> str:+ return "release-browser-stub"++ def _generate(self, messages, stop=None, run_manager=None, **kwargs):+ context = get_search_context() or {}+ research_id = str(uuid.UUID(str(context["research_id"])))+ (ENTERED / research_id).touch()++ deadline = time.monotonic() + 90+ while not (RELEASE / research_id).exists():+ if time.monotonic() >= deadline:+ raise TimeoutError(+ f"browser did not release research {research_id}"+ )+ time.sleep(0.05) # allow: unmarked-sleep -- test-only gate++ return ChatResult(+ generations=[ChatGeneration(message=AIMessage(content=ANSWER))]+ )+++def _make_llm(model_name=None, temperature=None, settings_snapshot=None):+ return _GatedChatModel()+++def _previews(self, query):+ return [+ {+ "id": "release-browser-source",+ "title": "Release Browser Source",+ "link": SOURCE_URL,+ "snippet": "RELEASEBROWSERSEARCHMARKER",+ }+ ]+++def _full_content(self, relevant_items):+ return [+ dict(+ item,+ content="RELEASEBROWSERSEARCHMARKER body",+ full_content="RELEASEBROWSERSEARCHMARKER body",+ )+ for item in relevant_items+ ]+++def main() -> None:+ ENTERED.mkdir(parents=True, exist_ok=True)+ RELEASE.mkdir(parents=True, exist_ok=True)+ # fastapi_app has already imported llm_config and discovered built-ins.+ # Override only the test server's Ollama boundary; the browser still+ # selects the normal Ollama provider and submits through production code.+ register_llm("ollama", _make_llm)+ WikipediaSearchEngine._get_previews = _previews+ WikipediaSearchEngine._get_full_content = _full_content+ uvicorn.run(+ app,+ host="0.0.0.0",+ port=5000,+ workers=1,+ server_header=False,+ access_log=False,+ )+++if __name__ == "__main__":+ main()diff --git a/tests/ui_tests/research_form_engine_helper.js b/tests/ui_tests/research_form_engine_helper.jsnew file mode 100644index 0000000000..83e0146991--- /dev/null+++ b/tests/ui_tests/research_form_engine_helper.js@@ -0,0 +1,43 @@+/** Select an engine CI can submit under the guarded egress policy. */+async function selectPublicArxivEngine(page, timeout = 20000) {+ await page.waitForSelector('#policy_egress_scope', { timeout });+ const currentScope = await page.$eval('#policy_egress_scope', (el) => el.value);+ if (currentScope !== 'public_only') {+ const responsePromise = page.waitForResponse((response) => {+ if (response.request().method() !== 'GET') return false;+ const url = new URL(response.url());+ return url.pathname.endsWith('/settings/api/available-search-engines') &&+ url.searchParams.get('egress_scope') === 'public_only';+ }, { timeout });+ await page.select('#policy_egress_scope', 'public_only');+ const response = await responsePromise;+ if (!response.ok()) throw new Error(`Public engine list returned HTTP ${response.status()}`);+ }++ await page.waitForFunction(+ () => !document.getElementById('search_engine')?.parentNode?.classList.contains('ldr-loading'),+ { timeout },+ );++ const selector = '#search-engine-dropdown-list [data-value="arxiv"]';+ const deadline = Date.now() + timeout;+ while (Date.now() < deadline) {+ await page.click('#search_engine');+ const ready = await page.waitForFunction((query) => {+ const option = document.querySelector(query);+ return option && !option.classList.contains('ldr-custom-dropdown-item--disabled');+ }, { timeout: 1000 }, selector).then(() => true).catch(() => false);+ if (ready) break;+ }+ const option = await page.$(selector);+ if (!option || !(await option.evaluate((el) => !el.classList.contains('ldr-custom-dropdown-item--disabled')))) {+ throw new Error('arxiv was not selectable under Public only scope');+ }+ await option.click();+ await page.waitForFunction(+ () => document.getElementById('search_engine_hidden')?.value === 'arxiv',+ { timeout },+ );+}++module.exports = { selectPublicArxivEngine };diff --git a/tests/ui_tests/run_all_tests.js b/tests/ui_tests/run_all_tests.jsindex 743a7e716e..42d6a7c6b8 100644--- a/tests/ui_tests/run_all_tests.js+++ b/tests/ui_tests/run_all_tests.js@@ -11,6 +11,7 @@* node tests/ui_tests/run_all_tests.js --shard=auth-login # run one shard** Valid shards: auth-login, auth-register, auth-pages, research-workflow,+ * research-completion,* research-form, research-metrics, settings-core, settings-pages,* library, history-news, mobile, api-crud, error-benchmark, accessibility,* chat-core, chat-lifecycle, link-analytics@@ -19,7 +20,7 @@// Keep in sync with `strategy.matrix.shard` in .github/workflows/docker-tests.yml.// A mismatch would cause silent test misrouting.//-// Shard design (17 shards, ~4 tests each):+// Shard design (18 shards, ~4 tests each):// Each shard runs in its own Docker container with a dedicated server.// Keeping shards small prevents cascade failures when one test stresses// the server (e.g., encrypted DB creation in auth-register).@@ -28,6 +29,7 @@ const VALID_SHARDS = ['auth-register', // registration (isolated — heavy SQLCipher DB creation)'auth-pages', // page browsing, navigation, comprehensive auth'research-workflow', // core research lifecycle+ 'research-completion', // deterministic real-worker browser qualification'research-form', // research form interactions + results'research-metrics', // metrics charts, dashboard, progress'settings-core', // settings page, errors, save, interactions@@ -210,6 +212,16 @@ const tests = [description: 'Tests cancel/terminate lifecycle (button → SUSPENDED, idempotency, queued branch, not-found). Seeds rows, no LLM needed.'},+ // =====================================================================+ // Shard: research-completion (1 test)+ // =====================================================================+ {+ name: 'Research completion and reconnect release smoke',+ file: 'test_research_completion_reconnect_ci.js',+ shard: 'research-completion',+ description: 'Real form and worker, Socket.IO completion after reconnect, and HTTP polling fallback'+ },+// =====================================================================// Shard: research-form (4 tests)// =====================================================================diff --git a/tests/ui_tests/test_history_page.js b/tests/ui_tests/test_history_page.jsindex 9da36f090a..871c5e369e 100644--- a/tests/ui_tests/test_history_page.js+++ b/tests/ui_tests/test_history_page.js@@ -1,6 +1,7 @@const puppeteer = require('puppeteer');const AuthHelper = require('./auth_helper');const { getPuppeteerLaunchOptions } = require('./puppeteer_config');+const { selectPublicArxivEngine } = require('./research_form_engine_helper');// NAVIGATION NOTE: Using 'domcontentloaded' instead of 'networkidle2' for page.goto()// because networkidle2 waits for no network activity for 500ms, but WebSocket@@ -45,19 +46,16 @@ async function createResearch(page, query, waitForCompletion = false) {// Wait for the query inputawait page.waitForSelector('#query', { timeout: 10000 });+ await selectPublicArxivEngine(page);// Clear and type queryawait page.click('#query', { clickCount: 3 });await page.type('#query', query);// Submit the research- const submitButton = await page.$('button[type="submit"]');- if (submitButton) {- await submitButton.click();- } else {- // Try pressing Enter- await page.keyboard.press('Enter');- }+ const submitButton = await page.$('#research-form #start-research-btn');+ if (!submitButton) throw new Error('Research submit button not found');+ await submitButton.click();// Wait for navigation or status updateawait delay(3000);diff --git a/tests/ui_tests/test_research_completion_reconnect_ci.js b/tests/ui_tests/test_research_completion_reconnect_ci.jsnew file mode 100644index 0000000000..327e6e9d27--- /dev/null+++ b/tests/ui_tests/test_research_completion_reconnect_ci.js@@ -0,0 +1,256 @@+#!/usr/bin/env node+/** A real-browser release smoke with deterministic model/search boundaries.+ *+ * The test server pauses the real worker at its first model invocation for+ * each research id. This lets the browser subscribe, reconnect, or switch to+ * HTTP polling before the worker can finish. No research result or transport+ * event is inserted by this test.+ */++const assert = require('node:assert/strict');+const fs = require('node:fs');+const path = require('node:path');+const puppeteer = require('puppeteer');+const AuthHelper = require('./auth_helper');+const { getPuppeteerLaunchOptions } = require('./puppeteer_config');++const BASE_URL = process.env.LDR_BASE_URL || 'http://127.0.0.1:5000';+const SMOKE_DIR = process.env.LDR_RESEARCH_SMOKE_DIR;+const ANSWER = 'RELEASEBROWSERSYNTHESISMARKER';+const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;+const TIMEOUT = 90000;++async function waitForFile(file) {+ const deadline = Date.now() + TIMEOUT;+ while (Date.now() < deadline) {+ if (fs.existsSync(file)) return;+ await new Promise(resolve => setTimeout(resolve, 100));+ }+ throw new Error(`Worker did not enter the gated model for ${path.basename(file)}`);+}++async function submitFromForm(page, query) {+ await page.goto(`${BASE_URL}/`, { waitUntil: 'domcontentloaded' });+ await page.waitForSelector('#start-research-btn');+ await page.waitForFunction(() => document.querySelectorAll('#model_provider option').length > 1);+ await page.type('#query', query);++ // The model and engine catalogs refresh asynchronously. Keep the test+ // choices in their actual form controls through the click, then verify+ // the production client sent those choices in the captured POST body.+ await page.evaluate(() => {+ const apply = () => {+ const model = document.querySelector('#model_hidden');+ const visibleModel = document.querySelector('#model');+ const engine = document.querySelector('#search_engine_hidden');+ if (model && model.value !== 'llama3.2:3b') {+ model.value = 'llama3.2:3b';+ if (visibleModel) visibleModel.value = 'llama3.2:3b';+ model.dispatchEvent(new Event('change', { bubbles: true }));+ }+ if (engine) engine.value = 'wikipedia';+ const strategy = document.querySelector('#strategy');+ if (strategy) strategy.value = 'source-based';+ const iterations = document.querySelector('#iterations');+ if (iterations) iterations.value = '1';+ const questions = document.querySelector('#questions_per_iteration');+ if (questions) questions.value = '1';+ };+ apply();+ window.__releaseFormGuard = setInterval(apply, 100);+ });+ await page.waitForFunction(() =>+ document.querySelector('#model_hidden')?.value === 'llama3.2:3b' &&+ document.querySelector('#search_engine_hidden')?.value === 'wikipedia' &&+ document.querySelector('#model_provider')?.value.toLowerCase() === 'ollama'+ );+ let stableModelChecks = 0;+ for (let attempt = 0; attempt < 60 && stableModelChecks < 5; attempt++) {+ const value = await page.$eval('#model_hidden', input => input.value);+ stableModelChecks = value === 'llama3.2:3b' ? stableModelChecks + 1 : 0;+ await new Promise(resolve => setTimeout(resolve, 150));+ }+ assert.equal(stableModelChecks, 5, 'the model field must settle before the real click');++ const responsePromise = page.waitForResponse(+ response => response.url().endsWith('/api/start_research'),+ { timeout: 20000 }+ );+ await page.click('#start-research-btn');+ let response;+ try {+ response = await responsePromise;+ } catch (error) {+ const state = await page.evaluate(() => ({+ url: location.href,+ query: document.querySelector('#query')?.value,+ model: document.querySelector('#model_hidden')?.value,+ provider: document.querySelector('#model_provider')?.value,+ engine: document.querySelector('#search_engine_hidden')?.value,+ mode: document.querySelector('input[name="research_mode"]:checked')?.value,+ buttonDisabled: document.querySelector('#start-research-btn')?.disabled,+ researchError: document.querySelector('#research-error-alert')?.textContent?.trim(),+ inlineErrors: [...document.querySelectorAll('.ldr-field-error, .error-message')]+ .map(node => node.textContent.trim()).filter(Boolean).slice(0, 5),+ }));+ throw new Error(`The real form sent no research POST: ${JSON.stringify(state)}`, { cause: error });+ }+ assert.equal(response.status(), 200, 'real research submit must be accepted');+ assert.ok(response.request().headers()['x-csrftoken'], 'the form must carry its CSRF token');+ const sent = JSON.parse(response.request().postData());+ assert.equal(sent.query, query);+ assert.equal(sent.model_provider.toLowerCase(), 'ollama');+ assert.equal(sent.model, 'llama3.2:3b');+ assert.equal(sent.search_engine, 'wikipedia');+ assert.equal(sent.strategy, 'source-based');+ assert.equal(sent.iterations, 1);+ assert.equal(sent.questions_per_iteration, 1);++ await page.waitForFunction(() => window.location.pathname.startsWith('/progress/'));+ const researchId = new URL(page.url()).pathname.split('/').pop();+ assert.match(researchId, UUID_RE, 'the app must redirect to the new research id');+ await waitForFile(path.join(SMOKE_DIR, 'entered', researchId));+ await page.waitForFunction(() => window.socket && window.socket.isConnected());+ return researchId;+}++async function waitForCompletionUI(page) {+ await page.waitForFunction(() => {+ const button = document.querySelector('#view-results-btn');+ const bar = document.querySelector('.ldr-progress-bar[role="progressbar"]');+ return button && getComputedStyle(button).display !== 'none'+ && bar && bar.getAttribute('aria-valuenow') === '100';+ }, { timeout: TIMEOUT });+}++async function assertCompleted(page, researchId) {+ await waitForCompletionUI(page);+ const status = await page.evaluate(async id => {+ const response = await fetch(`/api/research/${id}/status`, { credentials: 'same-origin' });+ return { code: response.status, data: await response.json() };+ }, researchId);+ assert.equal(status.code, 200);+ assert.equal(status.data.status, 'completed', JSON.stringify(status.data));+ assert.equal(status.data.progress, 100);+ const resultUrl = await page.$eval('#view-results-btn', button => button.href);+ assert.ok(resultUrl.endsWith(`/results/${researchId}`), resultUrl);+ const response = await page.goto(resultUrl, { waitUntil: 'domcontentloaded' });+ assert.equal(response.status(), 200);+ await page.waitForFunction(marker => document.body.textContent.includes(marker), {}, ANSWER);+}++async function run() {+ assert.ok(SMOKE_DIR, 'LDR_RESEARCH_SMOKE_DIR is required');+ const browser = await puppeteer.launch(getPuppeteerLaunchOptions());+ const page = await browser.newPage();+ page.on('pageerror', error => console.error('PAGE ERROR:', error.message));+ page.setDefaultTimeout(TIMEOUT);+ page.setDefaultNavigationTimeout(TIMEOUT);++ try {+ const auth = new AuthHelper(page, BASE_URL);+ await auth.ensureAuthenticatedWithTimeout();+ const authed = auth.getPage();+ authed.setDefaultTimeout(TIMEOUT);++ const socketId = await submitFromForm(authed, `Release socket ${Date.now()}`);+ await authed.evaluate(id => {+ window.__releaseSocketFrames = [];+ window.__releaseSubscriptionAck = false;+ window.__releaseSubscriptionError = null;+ const instance = window.socket.getSocketInstance();+ instance.on('subscribe_error', data => { window.__releaseSubscriptionError = data; });+ const emit = instance.emit.bind(instance);+ instance.emit = (event, ...args) => {+ if (event === 'subscribe_to_research' && args[0]?.research_id === id) {+ // Add an ACK to the production client's own resubscribe+ // emit. Do not submit an extra event from the test: the+ // ACK proves the server finished installing the room.+ return emit(event, ...args, () => { window.__releaseSubscriptionAck = true; });+ }+ return emit(event, ...args);+ };+ instance.disconnect();+ }, socketId);+ await authed.waitForFunction(() => window.socket.isUsingPolling());+ await authed.evaluate(() => window.socket.getSocketInstance().connect());+ await authed.waitForFunction(() => window.socket.isConnected() && !window.socket.isUsingPolling());+ await authed.waitForFunction(() => window.__releaseSubscriptionAck || window.__releaseSubscriptionError);+ const subscriptionError = await authed.evaluate(() => window.__releaseSubscriptionError);+ assert.equal(subscriptionError, null, JSON.stringify(subscriptionError));+ // Production resubscribe calls socket.off(event) before installing+ // its handler, so attach this passive observer only after that path+ // has finished and its server-side ACK has arrived.+ await authed.evaluate(id => {+ window.socket.getSocketInstance().on(+ `research_progress_${id}`,+ data => window.__releaseSocketFrames.push(data)+ );+ }, socketId);+ fs.writeFileSync(path.join(SMOKE_DIR, 'release', socketId), 'release\n');+ try {+ await authed.waitForFunction(() => window.__releaseSocketFrames.some(frame => frame.phase === 'complete'),+ { timeout: 15000 });+ } catch (error) {+ const observed = await authed.evaluate(async id => {+ const response = await fetch(`/api/research/${id}/status`);+ const status = await response.json();+ return {+ frames: window.__releaseSocketFrames.map(frame => ({+ phase: frame.phase, status: frame.status, progress: frame.progress,+ })),+ connected: window.socket.isConnected(),+ polling: window.socket.isUsingPolling(),+ subscriptionAck: window.__releaseSubscriptionAck,+ subscriptionError: window.__releaseSubscriptionError,+ status: status.status,+ progress: status.progress,+ buttonDisplay: getComputedStyle(document.querySelector('#view-results-btn')).display,+ };+ }, socketId);+ throw new Error(`No terminal Socket.IO frame after reconnect: ${JSON.stringify(observed)}`, { cause: error });+ }+ const frames = await authed.evaluate(() => window.__releaseSocketFrames);+ assert.ok(frames.some(frame => frame.phase === 'complete' && frame.progress === 100),+ `no terminal Socket.IO frame after reconnect: ${JSON.stringify(frames)}`);+ assert.ok(frames.some(frame => frame.progress != null && frame.progress < 100),+ `no nonterminal Socket.IO progress frame after reconnect: ${JSON.stringify(frames)}`);+ assert.ok(frames.every(frame => frame.progress == null ||+ (typeof frame.progress === 'number' && Number.isFinite(frame.progress) &&+ frame.progress >= 0 && frame.progress <= 100)), JSON.stringify(frames));+ await assertCompleted(authed, socketId);+ console.log('PASS: real form + CSRF, reconnect, Socket.IO completion, report');++ const pollingId = await submitFromForm(authed, `Release polling ${Date.now()}`);+ await authed.evaluate(() => window.socket.getSocketInstance().disconnect());+ await authed.waitForFunction(() => window.socket.isUsingPolling() && !window.socket.isConnected());+ // Keep the model gate closed until a real fallback GET has completed.+ // This proves polling started; the later terminal UI must come from a+ // subsequent GET because the Socket.IO transport stays disconnected.+ const firstPoll = await authed.waitForResponse(+ response => response.url().endsWith(`/api/research/${pollingId}/status`)+ && response.request().method() === 'GET',+ { timeout: 10000 }+ );+ assert.equal((await firstPoll.json()).status, 'in_progress');+ fs.writeFileSync(path.join(SMOKE_DIR, 'release', pollingId), 'release\n');+ await waitForCompletionUI(authed);+ await assertCompleted(authed, pollingId);+ console.log('PASS: disconnected Socket.IO falls back to HTTP polling and completes');+ } finally {+ // A browser assertion failure must not leave the worker waiting on a+ // gate while the test server shuts down.+ const enteredDir = path.join(SMOKE_DIR, 'entered');+ if (fs.existsSync(enteredDir)) {+ for (const id of fs.readdirSync(enteredDir)) {+ if (UUID_RE.test(id)) fs.writeFileSync(path.join(SMOKE_DIR, 'release', id), 'release\n');+ }+ }+ await browser.close();+ }+}++run().catch(error => {+ console.error(error);+ process.exitCode = 1;+});diff --git a/tests/ui_tests/test_research_submit_flow_ci.js b/tests/ui_tests/test_research_submit_flow_ci.jsindex b648644202..d5e84c874e 100644--- a/tests/ui_tests/test_research_submit_flow_ci.js+++ b/tests/ui_tests/test_research_submit_flow_ci.js@@ -138,6 +138,7 @@const puppeteer = require('puppeteer');const AuthHelper = require('./auth_helper');const { getPuppeteerLaunchOptions } = require('./puppeteer_config');+const { selectPublicArxivEngine } = require('./research_form_engine_helper');const { capture, captureOnFailure, screenshotsEnabled } = require('./screenshot_helper');const BASE_URL = process.env.LDR_BASE_URL || 'http://127.0.0.1:5000';@@ -228,6 +229,7 @@ async function submitResearchViaRealForm(page, query) {);await page.type('#query', query);+ await selectPublicArxivEngine(page);const modelResult = await setModelFieldRobustly(page, TEST_MODEL);if (!modelResult.stable) {diff --git a/tests/ui_tests/test_research_workflow.js b/tests/ui_tests/test_research_workflow.jsindex 7a4447d35e..0cc5bc099c 100644--- a/tests/ui_tests/test_research_workflow.js+++ b/tests/ui_tests/test_research_workflow.js@@ -8,6 +8,7 @@ const puppeteer = require('puppeteer');const AuthHelper = require('./auth_helper');const { getPuppeteerLaunchOptions } = require('./puppeteer_config');const { setupDefaultModel } = require('./model_helper');+const { selectPublicArxivEngine } = require('./research_form_engine_helper');const fs = require('fs');const path = require('path');@@ -140,7 +141,8 @@ async function testResearchWorkflow() {try {await page.goto(`${BASE_URL}/`, { waitUntil: 'domcontentloaded' });- // Configure model+ await selectPublicArxivEngine(page);+ // Configure model after the scope change settles.await setupDefaultModel(page);// Enter query@@ -155,7 +157,7 @@ async function testResearchWorkflow() {}// Try to submit- const submitButton = await page.$('button[type="submit"]');+ const submitButton = await page.$('#research-form #start-research-btn');if (submitButton) {// Click and wait for responsetry {