~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: Improve authentication handling in tests for CI reliability
LearningCircuitfb62dcb0ee58
diff --git a/tests/api_tests_with_login/auth_helper.js b/tests/api_tests_with_login/auth_helper.jsindex 96b48cfae2..f9b27cf1a5 100644--- a/tests/api_tests_with_login/auth_helper.js+++ b/tests/api_tests_with_login/auth_helper.js@@ -34,28 +34,112 @@ async function authenticate(baseUrl, username, password, cookieFile) {await registerLink.click();await page.waitForNavigation({ waitUntil: 'networkidle0', timeout: 60000 });+ // Wait for registration form+ await page.waitForSelector('#username', { timeout: 5000 });+// Fill registration formawait page.type('#username', username);await page.type('#password', password);await page.type('#confirm_password', password);+ // Check for acknowledge checkbox+ const acknowledgeCheckbox = await page.$('input[name="acknowledge"]');+ if (acknowledgeCheckbox) {+ console.log('Clicking acknowledge checkbox...');+ await page.click('input[name="acknowledge"]');+ }+// Submitconsole.log('Submitting registration form...');- await page.click('button[type="submit"]');- await page.waitForNavigation({ waitUntil: 'networkidle0', timeout: 60000 });++ // Click and wait for navigation+ await Promise.all([+ page.click('button[type="submit"]'),+ page.waitForNavigation({ waitUntil: 'networkidle0', timeout: 60000 }).catch(e => {+ console.log('Navigation wait error:', e.message);+ // If navigation fails, wait a bit for the page to process+ return page.waitForTimeout(3000);+ })+ ]);++ // Check if we're still on the registration page+ const currentUrl = page.url();+ if (currentUrl.includes('/auth/register')) {+ // Check for errors+ const error = await page.$('.alert-danger, .error-message');+ if (error) {+ const errorText = await page.evaluate(el => el.textContent, error);+ if (errorText.includes('already exists')) {+ console.log('User already exists, will try login');+ // Don't throw, we'll try login next+ } else {+ throw new Error(`Registration failed: ${errorText}`);+ }+ } else {+ // Wait a bit more for redirect+ await page.waitForNavigation({ waitUntil: 'networkidle0', timeout: 30000 });+ }+ }console.log('Registration completed');} else {// Try login+ await page.waitForSelector('#username', { timeout: 5000 });await page.type('#username', username);await page.type('#password', password);console.log('Submitting login form...');- await page.click('button[type="submit"]');- await page.waitForNavigation({ waitUntil: 'networkidle0', timeout: 60000 });++ // Click and wait for navigation+ await Promise.all([+ page.click('button[type="submit"]'),+ page.waitForNavigation({ waitUntil: 'networkidle0', timeout: 60000 }).catch(e => {+ console.log('Navigation wait error:', e.message);+ return page.waitForTimeout(3000);+ })+ ]);console.log('Login completed');}// Get cookiesconst cookies = await page.cookies();+ console.log(`Got ${cookies.length} cookies`);++ // Log cookie names for debugging+ const cookieNames = cookies.map(c => c.name);+ console.log('Cookie names:', cookieNames.join(', '));++ // Try to get CSRF token from page meta tag if not in cookies+ let csrfToken = null;+ for (const cookie of cookies) {+ if (cookie.name === 'csrf_token') {+ csrfToken = cookie.value;+ break;+ }+ }++ if (!csrfToken) {+ console.log('CSRF token not found in cookies, checking page meta tag...');+ try {+ csrfToken = await page.evaluate(() => {+ const metaTag = document.querySelector('meta[name="csrf-token"]');+ return metaTag ? metaTag.getAttribute('content') : null;+ });+ if (csrfToken) {+ console.log('Found CSRF token in meta tag');+ // Add it as a cookie for compatibility+ cookies.push({+ name: 'csrf_token',+ value: csrfToken,+ domain: new URL(baseUrl).hostname,+ path: '/',+ httpOnly: false,+ secure: false,+ sameSite: 'Lax'+ });+ }+ } catch (e) {+ console.log('Could not get CSRF token from page:', e.message);+ }+ }// Save to filefs.writeFileSync(cookieFile, JSON.stringify(cookies, null, 2));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.pyindex dfdc8a6b45..cd6840225c 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@@ -28,6 +28,9 @@ def test_export_latex(auth_session, base_url):response = session.post(f"{base_url}/api/start_research", json=research_data)+ if response.status_code not in [200, 201, 202]:+ print(f"Error response: {response.status_code}")+ print(f"Response body: {response.text}")assert response.status_code in [200, 201, 202]research_id = response.json()["research_id"]