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: Fix CI test failures with improved logging and Chrome detection

LearningCircuitd06f8df6b30a
diff --git a/tests/api_tests_with_login/pytest_tests/test_export_formats.py b/tests/api_tests_with_login/pytest_tests/test_export_formats.py
index cd6840225c..41be9f924f 100644
--- a/tests/api_tests_with_login/pytest_tests/test_export_formats.py
+++ b/tests/api_tests_with_login/pytest_tests/test_export_formats.py
@@ -39,8 +39,8 @@ def test_export_latex(auth_session, base_url):
time.sleep(10) # Give it time to generate some content
# Try to export as LaTeX
- export_response = session.get(
- f"{base_url}/research/{research_id}/export/latex"
+ export_response = session.post(
+ f"{base_url}/api/v1/research/{research_id}/export/latex"
)
# Check response
@@ -175,8 +175,8 @@ def test_export_empty_research(auth_session, base_url):
fake_research_id = "00000000-0000-0000-0000-000000000000"
# Try LaTeX export
- latex_response = session.get(
- f"{base_url}/research/{fake_research_id}/export/latex"
+ latex_response = session.post(
+ f"{base_url}/api/v1/research/{fake_research_id}/export/latex"
)
assert latex_response.status_code in [404, 500], (
f"Expected error for non-existent research, got {latex_response.status_code}"
@@ -215,8 +215,8 @@ def test_export_quarto(auth_session, base_url):
time.sleep(10)
# Try to export as Quarto
- export_response = session.get(
- f"{base_url}/research/{research_id}/export/quarto"
+ export_response = session.post(
+ f"{base_url}/api/v1/research/{research_id}/export/quarto"
)
# Check response
@@ -262,8 +262,8 @@ def test_export_ris(auth_session, base_url):
time.sleep(10)
# Try to export as RIS
- export_response = session.get(
- f"{base_url}/research/{research_id}/export/ris"
+ export_response = session.post(
+ f"{base_url}/api/v1/research/{research_id}/export/ris"
)
# Check response
diff --git a/tests/ui_tests/puppeteer_config.js b/tests/ui_tests/puppeteer_config.js
index b1628457d4..b7da7913c0 100644
--- a/tests/ui_tests/puppeteer_config.js
+++ b/tests/ui_tests/puppeteer_config.js
@@ -18,31 +18,70 @@ function getPuppeteerLaunchOptions(additionalOptions = {}) {
// In Docker/CI environments, explicitly skip Chrome download and use system Chrome/Chromium
if (process.env.CI || process.env.DOCKER_ENV) {
+ console.log('🔍 Detecting Chrome/Chromium in CI/Docker environment...');
+ console.log(`Environment: CI=${process.env.CI}, DOCKER_ENV=${process.env.DOCKER_ENV}`);
+
// Try to use Playwright's Chromium if available
const possiblePaths = [
'/root/.cache/ms-playwright/chromium-*/chrome-linux/chrome',
'/ms-playwright/chromium-*/chrome-linux/chrome',
'/usr/lib/chromium/chromium',
'/usr/bin/chromium-browser',
- '/usr/bin/chromium'
+ '/usr/bin/chromium',
+ '/usr/bin/google-chrome',
+ '/usr/bin/google-chrome-stable'
];
const { execSync } = require('child_process');
- for (const pathPattern of possiblePaths) {
- try {
- const chromiumPath = execSync(`ls ${pathPattern} 2>/dev/null | head -1`, { encoding: 'utf8' }).trim();
- if (chromiumPath && chromiumPath.length > 0) {
- console.log(`Using Chromium at: ${chromiumPath}`);
- defaultOptions.executablePath = chromiumPath;
- break;
+ const fs = require('fs');
+
+ console.log('📂 Searching for Chrome/Chromium binaries...');
+
+ // First, try to find Playwright's chromium using a more reliable method
+ try {
+ console.log('Looking for Playwright\'s Chromium...');
+ const playwrightPath = execSync('find /root/.cache/ms-playwright -name chrome -type f 2>/dev/null | head -1', { encoding: 'utf8' }).trim();
+ if (playwrightPath && fs.existsSync(playwrightPath)) {
+ console.log(`✅ Found Playwright's Chromium at: ${playwrightPath}`);
+ defaultOptions.executablePath = playwrightPath;
+ } else {
+ console.log('⚠️ Playwright\'s Chromium not found in cache');
+ }
+ } catch (e) {
+ console.log('⚠️ Could not search for Playwright\'s Chromium:', e.message);
+
+ // Fall back to checking specific paths
+ console.log('🔍 Checking standard Chrome/Chromium paths...');
+ for (const pathPattern of possiblePaths) {
+ console.log(` Checking: ${pathPattern}`);
+ try {
+ const chromiumPath = execSync(`ls ${pathPattern} 2>/dev/null | head -1`, { encoding: 'utf8' }).trim();
+ if (chromiumPath && chromiumPath.length > 0 && fs.existsSync(chromiumPath)) {
+ console.log(` ✅ Found Chromium at: ${chromiumPath}`);
+ defaultOptions.executablePath = chromiumPath;
+ break;
+ } else {
+ console.log(` ❌ Not found or not accessible`);
+ }
+ } catch (e) {
+ console.log(` ❌ Error checking path: ${e.message}`);
}
- } catch (e) {
- // Continue to next path
}
}
if (!defaultOptions.executablePath) {
- console.warn('Could not find Chromium/Chrome binary, Puppeteer will try to use its own');
+ console.warn('⚠️ Could not find Chrome/Chromium binary, Puppeteer will try to use its own');
+ console.warn('Available environment variables:', Object.keys(process.env).filter(k => k.includes('CHROME') || k.includes('PUPPETEER')));
+
+ // In CI, we should fail fast rather than hanging
+ if (process.env.CI) {
+ console.error('❌ ERROR: Chrome/Chromium binary required for CI tests');
+ console.error('Please ensure Playwright is installed with: playwright install --with-deps chromium');
+ console.error('Or set PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=false to use Puppeteer\'s bundled Chrome');
+ process.exit(1);
+ }
+ } else {
+ console.log(`🚀 Will launch Puppeteer with executable: ${defaultOptions.executablePath}`);
}
}
diff --git a/tests/ui_tests/run_all_tests.js b/tests/ui_tests/run_all_tests.js
index d62bca61f3..55264ac7c2 100644
--- a/tests/ui_tests/run_all_tests.js
+++ b/tests/ui_tests/run_all_tests.js
@@ -62,34 +62,65 @@ const tests = [
async function runTest(test) {
return new Promise((resolve) => {
+ const startTime = Date.now();
console.log(`\n📋 Running: ${test.name}`);
console.log(`📄 Description: ${test.description}`);
console.log(`🔧 File: ${test.file}`);
+ console.log(`⏰ Started at: ${new Date().toISOString()}`);
console.log('─'.repeat(60));
const testProcess = spawn('node', [test.file], {
cwd: path.join(__dirname),
- stdio: 'inherit'
+ stdio: 'inherit',
+ env: { ...process.env, NODE_OPTIONS: '--max-old-space-size=4096' }
});
+ console.log(`🆔 Process PID: ${testProcess.pid}`);
+
+ // Add timeout for individual tests (60 seconds)
+ const timeout = setTimeout(() => {
+ const elapsed = Math.round((Date.now() - startTime) / 1000);
+ console.log(`\n⏱️ Test timeout: ${test.name} exceeded 60 seconds (${elapsed}s elapsed)`);
+ console.log(`🔪 Sending SIGTERM to PID ${testProcess.pid}...`);
+ testProcess.kill('SIGTERM');
+ setTimeout(() => {
+ if (!testProcess.killed) {
+ console.log(`🔫 Process still alive, sending SIGKILL to PID ${testProcess.pid}...`);
+ testProcess.kill('SIGKILL');
+ }
+ }, 5000);
+ }, 60000);
+
testProcess.on('close', (code) => {
+ clearTimeout(timeout);
+ const elapsed = Math.round((Date.now() - startTime) / 1000);
const success = code === 0;
console.log('─'.repeat(60));
- console.log(`${success ? '✅' : '❌'} ${test.name}: ${success ? 'PASSED' : 'FAILED'}\n`);
+ console.log(`${success ? '✅' : '❌'} ${test.name}: ${success ? 'PASSED' : 'FAILED'} (${elapsed}s)`);
+ if (code !== 0 && code !== null) {
+ console.log(` Exit code: ${code}`);
+ }
+ console.log('');
resolve({
name: test.name,
success,
- code
+ code,
+ duration: elapsed
});
});
testProcess.on('error', (error) => {
+ clearTimeout(timeout);
+ const elapsed = Math.round((Date.now() - startTime) / 1000);
console.log('─'.repeat(60));
- console.log(`❌ ${test.name}: ERROR - ${error.message}\n`);
+ console.log(`❌ ${test.name}: ERROR - ${error.message} (${elapsed}s)`);
+ console.log(` Error details: ${JSON.stringify(error)}`);
+ console.log('');
resolve({
name: test.name,
success: false,
- error: error.message
+ error: error.message,
+ duration: elapsed
});
});
});
@@ -115,10 +146,12 @@ async function runAllTests() {
const passed = results.filter(r => r.success).length;
const failed = results.filter(r => !r.success).length;
+ const totalDuration = results.reduce((sum, r) => sum + (r.duration || 0), 0);
results.forEach(result => {
const status = result.success ? '✅ PASS' : '❌ FAIL';
- console.log(`${status} ${result.name}`);
+ const duration = result.duration ? ` (${result.duration}s)` : '';
+ console.log(`${status} ${result.name}${duration}`);
if (result.error) {
console.log(` Error: ${result.error}`);
}
@@ -128,6 +161,7 @@ async function runAllTests() {
console.log(`📈 Total Tests: ${results.length}`);
console.log(`✅ Passed: ${passed}`);
console.log(`❌ Failed: ${failed}`);
+ console.log(`⏱️ Total Duration: ${totalDuration}s`);
console.log(`📊 Success Rate: ${Math.round((passed / results.length) * 100)}%`);
if (failed === 0) {