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: add API poll after UI completion to fix E2E race condition (#2184)

LearningCircuit47376631e94e
diff --git a/tests/puppeteer/test_deep_functionality.js b/tests/puppeteer/test_deep_functionality.js
index f3d03c70a7..57b640f57c 100644
--- a/tests/puppeteer/test_deep_functionality.js
+++ b/tests/puppeteer/test_deep_functionality.js
@@ -366,6 +366,38 @@ describe('Deep Functionality Tests', function() {
}
}
+ // Poll the API to confirm database status is truly "completed"
+ // This bridges the gap between UI rendering and database commit timing
+ if (completed) {
+ const apiMaxWait = 30000;
+ const apiStart = Date.now();
+ let apiCompleted = false;
+
+ while (Date.now() - apiStart < apiMaxWait && !apiCompleted) {
+ const statusRes = await page.evaluate(async (baseUrl, id) => {
+ try {
+ const res = await fetch(`${baseUrl}/api/research/${id}`);
+ const data = await res.json();
+ return data.status;
+ } catch (e) {
+ return null;
+ }
+ }, BASE_URL, researchId);
+
+ if (statusRes === 'completed') {
+ apiCompleted = true;
+ console.log(' API confirmed research completed');
+ } else {
+ console.log(` Waiting for API status (currently: ${statusRes})`);
+ await delay(2000);
+ }
+ }
+
+ if (!apiCompleted) {
+ throw new Error('API did not confirm completion within 30s timeout');
+ }
+ }
+
await takeScreenshot(page, 'research-final-state');
const totalTime = Math.round((Date.now() - startTime) / 1000);