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 detailed logging to debug authentication test failures

LearningCircuit0caabc0ca997
diff --git a/tests/ui_tests/auth_helper.js b/tests/ui_tests/auth_helper.js
index a614ed5f90..a97108e8eb 100644
--- a/tests/ui_tests/auth_helper.js
+++ b/tests/ui_tests/auth_helper.js
@@ -102,28 +102,79 @@ class AuthHelper {
// Navigate to login page only if not already there
const currentUrl = this.page.url();
+ console.log(` Current URL: ${currentUrl}`);
if (!currentUrl.includes('/auth/login')) {
+ console.log(` Navigating to login page...`);
await this.page.goto(`${this.baseUrl}/auth/login`, {
waitUntil: 'networkidle2',
timeout: 30000
});
+ console.log(` Arrived at: ${this.page.url()}`);
}
// Wait for login form
+ console.log(' Waiting for login form...');
await this.page.waitForSelector('input[name="username"]', { timeout: 5000 });
+ // Check what's on the page
+ const formAction = await this.page.$eval('form', form => form.action).catch(() => 'no form found');
+ console.log(` Form action: ${formAction}`);
+
+ const submitButton = await this.page.$eval('button[type="submit"]', btn => btn.textContent).catch(() => 'no submit button');
+ console.log(` Submit button text: ${submitButton}`);
+
// Fill in credentials
+ console.log(' Filling in credentials...');
await this.page.type('input[name="username"]', username);
await this.page.type('input[name="password"]', password);
+ // Check form values before submit
+ const usernameValue = await this.page.$eval('input[name="username"]', el => el.value);
+ console.log(` Username field value: ${usernameValue}`);
+
// Submit form
- await Promise.all([
- this.page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 60000 }), // 60 second timeout for slow database creation
- this.page.click('button[type="submit"]')
- ]);
+ console.log(' Submitting form...');
+ console.log(' Waiting for navigation after submit (timeout: 60s)...');
+
+ // Listen to console messages from the page
+ this.page.on('console', msg => console.log(' Browser console:', msg.text()));
+
+ // Listen to page errors
+ this.page.on('pageerror', error => console.log(' Page error:', error.message));
+
+ // Listen to response events
+ this.page.on('response', response => {
+ if (response.url().includes('/auth/login') && response.request().method() === 'POST') {
+ console.log(` Login POST response: ${response.status()} ${response.statusText()}`);
+ }
+ });
+
+ try {
+ await Promise.all([
+ this.page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 60000 }), // 60 second timeout for slow database creation
+ this.page.click('button[type="submit"]')
+ ]);
+ console.log(' Navigation completed');
+ } catch (navError) {
+ console.log(` Navigation error: ${navError.message}`);
+ console.log(` Current URL after error: ${this.page.url()}`);
+
+ // Check page content on error
+ const pageTitle = await this.page.title();
+ console.log(` Page title: ${pageTitle}`);
+
+ const alerts = await this.page.$$eval('.alert', alerts => alerts.map(a => a.textContent));
+ if (alerts.length > 0) {
+ console.log(` Alerts on page: ${JSON.stringify(alerts)}`);
+ }
+
+ throw navError;
+ }
// Check if login was successful
const finalUrl = this.page.url();
+ console.log(` Final URL: ${finalUrl}`);
+
if (finalUrl.includes('/auth/login')) {
// Still on login page - check for error
const error = await this.page.$('.alert-danger, .error-message');
@@ -298,7 +349,7 @@ class AuthHelper {
}
// Give it a moment for any redirects
- await this.page.waitForTimeout(1000);
+ await new Promise(resolve => setTimeout(resolve, 1000));
// Ensure we're on the login page or logged out
const currentUrl = this.page.url();
diff --git a/tests/ui_tests/test_api_key_integrated.js b/tests/ui_tests/test_api_key_integrated.js
index 6f2285373c..d36627a015 100644
--- a/tests/ui_tests/test_api_key_integrated.js
+++ b/tests/ui_tests/test_api_key_integrated.js
@@ -214,7 +214,7 @@ async function getCSRFToken(page) {
const llmTab = await page.$('a[href="#llm-parameters"], button:has-text("LLM Parameters")');
if (llmTab) {
await llmTab.click();
- await page.waitForTimeout(1000);
+ await new Promise(resolve => setTimeout(resolve, 1000));
}
// Find the API key input
@@ -252,7 +252,7 @@ async function getCSRFToken(page) {
if (saveButton) {
await saveButton.click();
log('Save button clicked', 'success');
- await page.waitForTimeout(2000);
+ await new Promise(resolve => setTimeout(resolve, 2000));
}
// Test 6: Verify persistence
@@ -302,7 +302,7 @@ async function getCSRFToken(page) {
const submitButton = await page.$('button[type="submit"]');
if (submitButton) {
await submitButton.click();
- await page.waitForTimeout(3000);
+ await new Promise(resolve => setTimeout(resolve, 3000));
// Check if research started successfully
const currentUrl = page.url();
diff --git a/tests/ui_tests/test_autocomplete_selection.js b/tests/ui_tests/test_autocomplete_selection.js
index d31099231d..9210903b20 100644
--- a/tests/ui_tests/test_autocomplete_selection.js
+++ b/tests/ui_tests/test_autocomplete_selection.js
@@ -72,7 +72,7 @@ async function runTests() {
await page.type('#model', searchText);
console.log(` Typed "${searchText}" to filter models`);
- await page.waitForTimeout(500);
+ await new Promise(resolve => setTimeout(resolve, 500));
// Check if dropdown is still visible
const dropdownVisible = await page.evaluate(() => {
@@ -92,7 +92,7 @@ async function runTests() {
const itemToClick = await page.evaluate(el => el.textContent, filteredItems[0]);
console.log(` Clicking on: "${itemToClick}"`);
await filteredItems[0].click();
- await page.waitForTimeout(500);
+ await new Promise(resolve => setTimeout(resolve, 500));
// Check the selected value
const selectedModel = await page.evaluate(() => document.getElementById('model').value);
@@ -160,7 +160,7 @@ async function runTests() {
await page.type('#search_engine', searchText);
console.log(` Typed "${searchText}" to filter search engines`);
- await page.waitForTimeout(500);
+ await new Promise(resolve => setTimeout(resolve, 500));
// Click the first filtered item
const filteredItems = await page.$$('#search-engine-dropdown-list .ldr-custom-dropdown-item');
@@ -168,7 +168,7 @@ async function runTests() {
const itemToClick = await page.evaluate(el => el.textContent, filteredItems[0]);
console.log(` Clicking on: "${itemToClick}"`);
await filteredItems[0].click();
- await page.waitForTimeout(500);
+ await new Promise(resolve => setTimeout(resolve, 500));
// Check the selected value
const selectedEngine = await page.evaluate(() => document.getElementById('search_engine').value);
@@ -234,7 +234,7 @@ async function runTests() {
// Press Enter to select
await page.keyboard.press('Enter');
- await page.waitForTimeout(500);
+ await new Promise(resolve => setTimeout(resolve, 500));
// Check the selected value
const selectedModel = await page.evaluate(() => document.getElementById('model').value);
@@ -282,11 +282,11 @@ async function runTests() {
await page.type('#model', searchText);
console.log(` Typed "${searchText}"`);
- await page.waitForTimeout(300);
+ await new Promise(resolve => setTimeout(resolve, 300));
// Press Enter without using arrow keys
await page.keyboard.press('Enter');
- await page.waitForTimeout(500);
+ await new Promise(resolve => setTimeout(resolve, 500));
// Check what was selected
const selectedValue = await page.evaluate(() => document.getElementById('model').value);
diff --git a/tests/ui_tests/test_context_overflow.js b/tests/ui_tests/test_context_overflow.js
index 087b0f9314..be1a55d132 100644
--- a/tests/ui_tests/test_context_overflow.js
+++ b/tests/ui_tests/test_context_overflow.js
@@ -190,7 +190,7 @@ describe('Context Overflow Dashboard Tests', () => {
await page.click(`[data-period="${period}"]`);
// Wait a moment for the request to start
- await page.waitForTimeout(500);
+ await new Promise(resolve => setTimeout(resolve, 500));
// Verify the button is now active
const isActive = await page.evaluate((p) => {
diff --git a/tests/ui_tests/test_metrics_thread_fix.js b/tests/ui_tests/test_metrics_thread_fix.js
index 8fa14e1c41..5aa959dc57 100644
--- a/tests/ui_tests/test_metrics_thread_fix.js
+++ b/tests/ui_tests/test_metrics_thread_fix.js
@@ -57,7 +57,7 @@ async function testMetricsThreadFix() {
console.log('✅ Research submitted');
// Wait a bit for the research to start
- await page.waitForTimeout(5000);
+ await new Promise(resolve => setTimeout(resolve, 5000));
// Navigate to metrics dashboard
console.log('📊 Navigating to metrics dashboard...');
@@ -72,7 +72,7 @@ async function testMetricsThreadFix() {
}
// Wait for metrics data to load
- await page.waitForTimeout(3000);
+ await new Promise(resolve => setTimeout(resolve, 3000));
// Check for any metrics data
const hasData = await page.evaluate(() => {
diff --git a/tests/ui_tests/test_research_searxng.js b/tests/ui_tests/test_research_searxng.js
index 56a78de61b..546e951efb 100644
--- a/tests/ui_tests/test_research_searxng.js
+++ b/tests/ui_tests/test_research_searxng.js
@@ -52,7 +52,7 @@ async function testResearchWithSearxng() {
await page.type('#query', RESEARCH_QUESTION);
// Wait for models to load
- await page.waitForTimeout(1000);
+ await new Promise(resolve => setTimeout(resolve, 1000));
// Select searxng as search engine
console.log('🔍 Selecting searxng search engine...');
@@ -99,7 +99,7 @@ async function testResearchWithSearxng() {
]);
// Wait a bit for research to start
- await page.waitForTimeout(3000);
+ await new Promise(resolve => setTimeout(resolve, 3000));
// Get research ID from URL or response
const currentUrl = page.url();