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: Use ensureAuthenticated with fallback to registration

LearningCircuitfb54516ff938
diff --git a/tests/ui_tests/auth_helper.js b/tests/ui_tests/auth_helper.js
index b5d00208c0..f35aa2ce6a 100644
--- a/tests/ui_tests/auth_helper.js
+++ b/tests/ui_tests/auth_helper.js
@@ -589,6 +589,7 @@ class AuthHelper {
timer.lap('login status checked');
// In CI, first try the pre-created CI test user (much faster than registration!)
+ // Note: This only works if the workflow properly created the user with password hash
if (this.isCI) {
console.log('\n🚀 CI mode: Trying pre-created test user first (fast path)...');
try {
@@ -598,8 +599,9 @@ class AuthHelper {
return true;
} catch (ciLoginError) {
console.log(`⚠️ CI test user login failed: ${ciLoginError.message}`);
- console.log(' Falling back to registration...');
- timer.lap('CI user login failed');
+ console.log(' This is expected if workflow doesn\'t pre-create user properly.');
+ console.log(' Falling back to registration (slower but reliable)...');
+ timer.lap('CI user login failed, falling back to registration');
}
}
diff --git a/tests/ui_tests/test_change_password_validation.js b/tests/ui_tests/test_change_password_validation.js
index 02299862cb..e748783886 100644
--- a/tests/ui_tests/test_change_password_validation.js
+++ b/tests/ui_tests/test_change_password_validation.js
@@ -41,13 +41,9 @@ async function testChangePasswordValidation() {
let testsPassed = 0;
let testsFailed = 0;
- // In CI, use the pre-created test user; locally, create a new one
- const testUser = isCI ? {
- username: CI_TEST_USER.username,
- password: CI_TEST_USER.password
- } : {
- username: `chgpwd_${Date.now()}`,
- password: 'OldPass123!'
+ // Test user credentials - ensureAuthenticated will use CI_TEST_USER or register with DEFAULT_TEST_USER password
+ const testUser = {
+ password: isCI ? CI_TEST_USER.password : 'T3st!Secure#2024$LDR' // DEFAULT_TEST_USER.password
};
console.log('🧪 Starting change password validation tests...\n');
@@ -58,16 +54,9 @@ async function testChangePasswordValidation() {
const authHelper = new AuthHelper(page, baseUrl);
try {
- if (isCI) {
- // In CI, just login with pre-created user (fast!)
- console.log(` Using CI test user: ${testUser.username}`);
- await authHelper.login(testUser.username, testUser.password);
- console.log('✅ Logged in with CI test user\n');
- } else {
- // Locally, register a new user
- await authHelper.register(testUser.username, testUser.password);
- console.log('✅ Test user registered successfully\n');
- }
+ // Use ensureAuthenticated which tries CI user first, then falls back to registration
+ await authHelper.ensureAuthenticated();
+ console.log('✅ Authenticated\n');
} catch (authError) {
console.log(`⚠️ Could not authenticate: ${authError.message}`);
console.log(' Skipping change password tests - requires authenticated user\n');
diff --git a/tests/ui_tests/test_concurrent_limit.js b/tests/ui_tests/test_concurrent_limit.js
index 705d852d35..dc12487210 100644
--- a/tests/ui_tests/test_concurrent_limit.js
+++ b/tests/ui_tests/test_concurrent_limit.js
@@ -103,23 +103,10 @@ async function submitResearchBatch(page, queries) {
const page = await browser.newPage();
try {
- // Authenticate (CI uses pre-created user for speed)
+ // Authenticate (tries CI user first, falls back to registration)
const auth = new AuthHelper(page);
-
- if (isCI) {
- console.log(`1. Using CI test user: ${CI_TEST_USER.username}`);
- await auth.login(CI_TEST_USER.username, CI_TEST_USER.password);
- } else {
- const username = 'conctest_' + Date.now();
- const password = 'T3st!Secure#2024$LDR';
- console.log('1. Creating user:', username);
- await auth.register(username, password);
-
- const isLoggedIn = await auth.isLoggedIn();
- if (!isLoggedIn) {
- await auth.login(username, password);
- }
- }
+ console.log('1. Authenticating...');
+ await auth.ensureAuthenticated();
console.log('\n2. Testing concurrent research limit...\n');
diff --git a/tests/ui_tests/test_export_functionality.js b/tests/ui_tests/test_export_functionality.js
index 5fd327d1ac..7efb6085bd 100644
--- a/tests/ui_tests/test_export_functionality.js
+++ b/tests/ui_tests/test_export_functionality.js
@@ -207,17 +207,11 @@ async function testExportFunctionality() {
});
try {
- // Setup - authenticate (CI uses pre-created user for speed)
+ // Setup - authenticate (tries CI user first, falls back to registration)
const auth = new AuthHelper(page);
- if (isCI) {
- log(`🔐 Logging in with CI test user: ${TEST_USER}`, 'info');
- await auth.login(TEST_USER, TEST_PASSWORD);
- log('✅ Login successful', 'success');
- } else {
- log('📝 Registering new user...', 'info');
- await auth.register(TEST_USER, TEST_PASSWORD);
- log('✅ Registration successful', 'success');
- }
+ log('🔐 Authenticating...', 'info');
+ await auth.ensureAuthenticated();
+ log('✅ Authenticated', 'success');
await configureExportSettings(page);
await createResearchAndWait(page);
diff --git a/tests/ui_tests/test_research_form_validation.js b/tests/ui_tests/test_research_form_validation.js
index 453a376bab..d8dd5aa686 100644
--- a/tests/ui_tests/test_research_form_validation.js
+++ b/tests/ui_tests/test_research_form_validation.js
@@ -43,14 +43,9 @@ async function testResearchFormValidation() {
const authHelper = new AuthHelper(page, baseUrl);
try {
- if (isCI) {
- console.log(` Using CI test user: ${CI_TEST_USER.username}`);
- await authHelper.login(CI_TEST_USER.username, CI_TEST_USER.password);
- console.log('✅ Logged in with CI test user\n');
- } else {
- await authHelper.ensureAuthenticated();
- console.log('✅ Authenticated\n');
- }
+ // Use ensureAuthenticated which tries CI user first, then falls back to registration
+ await authHelper.ensureAuthenticated();
+ console.log('✅ Authenticated\n');
} catch (authError) {
console.log(`⚠️ Could not authenticate: ${authError.message}`);
console.log('❌ Cannot authenticate - skipping research form tests');
diff --git a/tests/ui_tests/test_research_submit.js b/tests/ui_tests/test_research_submit.js
index dd9794cba1..4d9850a851 100644
--- a/tests/ui_tests/test_research_submit.js
+++ b/tests/ui_tests/test_research_submit.js
@@ -41,17 +41,10 @@ const path = require('path');
});
}
- // Authenticate (CI uses pre-created user for speed)
+ // Authenticate (tries CI user first, falls back to registration)
const auth = new AuthHelper(page);
- if (isCI) {
- console.log(`🔐 Using CI test user: ${CI_TEST_USER.username}`);
- await auth.login(CI_TEST_USER.username, CI_TEST_USER.password);
- } else {
- const username = 'simple_' + Date.now();
- const password = 'TestPass123!';
- console.log('🔐 Creating user:', username);
- await auth.register(username, password);
- }
+ console.log('🔐 Authenticating...');
+ await auth.ensureAuthenticated();
console.log('\n🏠 Navigating to home page...');
await page.goto('http://127.0.0.1:5000/', { waitUntil: 'networkidle2' });
diff --git a/tests/ui_tests/test_settings_validation.js b/tests/ui_tests/test_settings_validation.js
index efa74821ee..1733083fcf 100644
--- a/tests/ui_tests/test_settings_validation.js
+++ b/tests/ui_tests/test_settings_validation.js
@@ -44,16 +44,9 @@ async function testSettingsValidation() {
const authHelper = new AuthHelper(page, baseUrl);
try {
- if (isCI) {
- // In CI, just login with pre-created user (fast!)
- console.log(` Using CI test user: ${CI_TEST_USER.username}`);
- await authHelper.login(CI_TEST_USER.username, CI_TEST_USER.password);
- console.log('✅ Logged in with CI test user\n');
- } else {
- // Locally, use ensureAuthenticated which will register if needed
- await authHelper.ensureAuthenticated();
- console.log('✅ Authenticated\n');
- }
+ // Use ensureAuthenticated which tries CI user first, then falls back to registration
+ await authHelper.ensureAuthenticated();
+ console.log('✅ Authenticated\n');
} catch (authError) {
console.log(`⚠️ Could not authenticate: ${authError.message}`);
console.log('❌ Cannot authenticate - skipping settings tests');