~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(ci): use real registration flow for UI test user setup
LearningCircuit121c5c97d5aa
diff --git a/.github/workflows/mobile-ui-tests.yml b/.github/workflows/mobile-ui-tests.ymlindex 8a3bad56cc..16066370cc 100644--- a/.github/workflows/mobile-ui-tests.yml+++ b/.github/workflows/mobile-ui-tests.yml@@ -71,13 +71,18 @@ jobs:echo "Created data directories for tests"- name: Start LDR server+ env:+ CI: true+ TEST_ENV: true+ FLASK_ENV: testing+ LDR_DATA_DIR: ${{ github.workspace }}/data+ DISABLE_RATE_LIMITING: true+ SECRET_KEY: test-secret-key-for-cirun: |- export LDR_DATA_DIR="$PWD/data"export PYTHONPATH="$PWD/src:$PYTHONPATH"- export DISABLE_RATE_LIMITING=trueecho "Starting server with LDR_DATA_DIR=$LDR_DATA_DIR"echo "Rate limiting disabled for CI tests"- LDR_DATA_DIR="$PWD/data" PYTHONPATH="$PWD/src:$PYTHONPATH" DISABLE_RATE_LIMITING=true pdm run python -m local_deep_research.web.app &+ pdm run python -m local_deep_research.web.app &SERVER_PID=$!echo "SERVER_PID=$SERVER_PID" >> "$GITHUB_ENV"@@ -97,6 +102,61 @@ jobs:exit 1fi+ - name: Register CI test user+ run: |+ # Register the shared CI test user via the real registration endpoint+ echo "Registering CI test user (test_admin)..."++ # Get CSRF token from registration page+ CSRF_TOKEN=$(curl -s http://127.0.0.1:5000/auth/register -c cookies.txt | grep -oP 'name="csrf_token" value="\K[^"]+' || echo "")++ if [ -n "$CSRF_TOKEN" ]; then+ REGISTER_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://127.0.0.1:5000/auth/register \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -b cookies.txt -c cookies.txt \+ -d "csrf_token=$CSRF_TOKEN&username=test_admin&password=testpass123&confirm_password=testpass123" \+ -o /dev/null)+ else+ REGISTER_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://127.0.0.1:5000/auth/register \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -c cookies.txt \+ -d "username=test_admin&password=testpass123&confirm_password=testpass123" \+ -o /dev/null)+ fi++ echo "Registration response code: $REGISTER_RESPONSE"+ if [ "$REGISTER_RESPONSE" = "302" ] || [ "$REGISTER_RESPONSE" = "200" ] || [ "$REGISTER_RESPONSE" = "400" ]; then+ echo "Registration completed (user may already exist, which is fine)"+ fi++ # Verify login works+ echo "Verifying login for test_admin..."+ LOGIN_CSRF=$(curl -s http://127.0.0.1:5000/auth/login -c cookies.txt | grep -oP 'name="csrf_token" value="\K[^"]+' || echo "")++ if [ -n "$LOGIN_CSRF" ]; then+ LOGIN_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://127.0.0.1:5000/auth/login \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -b cookies.txt -c cookies.txt \+ -d "csrf_token=$LOGIN_CSRF&username=test_admin&password=testpass123" \+ -o /dev/null)+ else+ LOGIN_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://127.0.0.1:5000/auth/login \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -c cookies.txt \+ -d "username=test_admin&password=testpass123" \+ -o /dev/null)+ fi++ echo "Login response code: $LOGIN_RESPONSE"+ if [ "$LOGIN_RESPONSE" = "302" ]; then+ echo "CI test user login verified successfully"+ else+ echo "Warning: Login returned $LOGIN_RESPONSE (may still work via UI)"+ fi++ rm -f cookies.txt+ echo "CI test user ready"+- name: Run Mobile Navigation Testsworking-directory: tests/ui_testsenv:diff --git a/.github/workflows/responsive-ui-tests-enhanced.yml b/.github/workflows/responsive-ui-tests-enhanced.ymlindex d2f4228927..689703a9ac 100644--- a/.github/workflows/responsive-ui-tests-enhanced.yml+++ b/.github/workflows/responsive-ui-tests-enhanced.yml@@ -105,43 +105,18 @@ jobs:- name: Set up test directoriesrun: |- mkdir -p src/data+ mkdir -p ${{ github.workspace }}/data/encrypted_databasesmkdir -p tests/ui_tests/screenshotsecho "Created data and screenshots directories for tests"- - name: Initialize database- run: |- cat > init_db.py << 'EOF'- import os- os.environ['FLASK_ENV'] = 'testing'- os.environ['SECRET_KEY'] = 'test-secret-key-for-ci'-- from local_deep_research.database.auth_db import init_auth_database, get_auth_db_session- from local_deep_research.database.models.auth import User- from local_deep_research.database.encrypted_db import db_manager-- # Initialize auth database- init_auth_database()-- # Create test user in auth database (no password stored)- session = get_auth_db_session()- user = User(username='test_admin')- session.add(user)- session.commit()- session.close()-- # Create user's encrypted database with password- engine = db_manager.create_user_database('test_admin', 'testpass123')- print('Database initialized successfully')- EOF- python init_db.py-- name: Start test serverenv:+ CI: trueFLASK_ENV: testingTEST_ENV: trueSECRET_KEY: test-secret-key-for-ciDISABLE_RATE_LIMITING: true+ LDR_DATA_DIR: ${{ github.workspace }}/datarun: |cd src# Start server and get its PID@@ -166,6 +141,61 @@ jobs:sleep 1done+ - name: Register CI test user+ run: |+ # Register the shared CI test user via the real registration endpoint+ echo "Registering CI test user (test_admin)..."++ # Get CSRF token from registration page+ CSRF_TOKEN=$(curl -s http://127.0.0.1:5000/auth/register -c cookies.txt | grep -oP 'name="csrf_token" value="\K[^"]+' || echo "")++ if [ -n "$CSRF_TOKEN" ]; then+ REGISTER_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://127.0.0.1:5000/auth/register \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -b cookies.txt -c cookies.txt \+ -d "csrf_token=$CSRF_TOKEN&username=test_admin&password=testpass123&confirm_password=testpass123" \+ -o /dev/null)+ else+ REGISTER_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://127.0.0.1:5000/auth/register \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -c cookies.txt \+ -d "username=test_admin&password=testpass123&confirm_password=testpass123" \+ -o /dev/null)+ fi++ echo "Registration response code: $REGISTER_RESPONSE"+ if [ "$REGISTER_RESPONSE" = "302" ] || [ "$REGISTER_RESPONSE" = "200" ] || [ "$REGISTER_RESPONSE" = "400" ]; then+ echo "Registration completed (user may already exist, which is fine)"+ fi++ # Verify login works+ echo "Verifying login for test_admin..."+ LOGIN_CSRF=$(curl -s http://127.0.0.1:5000/auth/login -c cookies.txt | grep -oP 'name="csrf_token" value="\K[^"]+' || echo "")++ if [ -n "$LOGIN_CSRF" ]; then+ LOGIN_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://127.0.0.1:5000/auth/login \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -b cookies.txt -c cookies.txt \+ -d "csrf_token=$LOGIN_CSRF&username=test_admin&password=testpass123" \+ -o /dev/null)+ else+ LOGIN_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://127.0.0.1:5000/auth/login \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -c cookies.txt \+ -d "username=test_admin&password=testpass123" \+ -o /dev/null)+ fi++ echo "Login response code: $LOGIN_RESPONSE"+ if [ "$LOGIN_RESPONSE" = "302" ]; then+ echo "CI test user login verified successfully"+ else+ echo "Warning: Login returned $LOGIN_RESPONSE (may still work via UI)"+ fi++ rm -f cookies.txt+ echo "CI test user ready"+- name: Run responsive UI tests - ${{ matrix.viewport }}id: run-testsworking-directory: tests/ui_testsdiff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex 199d96ee64..a2364b67fc 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -321,8 +321,12 @@ jobs:docker run -d \--name ldr-server \-p 5000:5000 \+ -e CI=true \+ -e TEST_ENV=true \+ -e FLASK_ENV=testing \-e LDR_USE_FALLBACK_LLM=true \-e DISABLE_RATE_LIMITING=true \+ -e SECRET_KEY=test-secret-key-for-ci \ldr-test ldr-web# Wait for server to be ready@@ -349,6 +353,61 @@ jobs:exit 1fi+ - name: Register CI test user+ run: |+ # Register the shared CI test user via the real registration endpoint+ echo "Registering CI test user (test_admin)..."++ # Get CSRF token from registration page+ CSRF_TOKEN=$(curl -s http://localhost:5000/auth/register -c cookies.txt | grep -oP 'name="csrf_token" value="\K[^"]+' || echo "")++ if [ -n "$CSRF_TOKEN" ]; then+ REGISTER_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://localhost:5000/auth/register \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -b cookies.txt -c cookies.txt \+ -d "csrf_token=$CSRF_TOKEN&username=test_admin&password=testpass123&confirm_password=testpass123" \+ -o /dev/null)+ else+ REGISTER_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://localhost:5000/auth/register \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -c cookies.txt \+ -d "username=test_admin&password=testpass123&confirm_password=testpass123" \+ -o /dev/null)+ fi++ echo "Registration response code: $REGISTER_RESPONSE"+ if [ "$REGISTER_RESPONSE" = "302" ] || [ "$REGISTER_RESPONSE" = "200" ] || [ "$REGISTER_RESPONSE" = "400" ]; then+ echo "Registration completed (user may already exist, which is fine)"+ fi++ # Verify login works+ echo "Verifying login for test_admin..."+ LOGIN_CSRF=$(curl -s http://localhost:5000/auth/login -c cookies.txt | grep -oP 'name="csrf_token" value="\K[^"]+' || echo "")++ if [ -n "$LOGIN_CSRF" ]; then+ LOGIN_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://localhost:5000/auth/login \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -b cookies.txt -c cookies.txt \+ -d "csrf_token=$LOGIN_CSRF&username=test_admin&password=testpass123" \+ -o /dev/null)+ else+ LOGIN_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://localhost:5000/auth/login \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -c cookies.txt \+ -d "username=test_admin&password=testpass123" \+ -o /dev/null)+ fi++ echo "Login response code: $LOGIN_RESPONSE"+ if [ "$LOGIN_RESPONSE" = "302" ]; then+ echo "CI test user login verified successfully"+ else+ echo "Warning: Login returned $LOGIN_RESPONSE (may still work via UI)"+ fi++ rm -f cookies.txt+ echo "CI test user ready"+- name: Run UI testsrun: |docker run --rm \diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.ymlindex 76f439c642..de8e3e7733 100644--- a/.github/workflows/ui-tests.yml+++ b/.github/workflows/ui-tests.yml@@ -84,14 +84,16 @@ jobs:echo "Created data and screenshots directories for tests"- name: Start application server+ env:+ CI: true+ TEST_ENV: true+ FLASK_ENV: testing+ LDR_USE_FALLBACK_LLM: true+ LDR_DATA_DIR: ${{ github.workspace }}/data+ DISABLE_RATE_LIMITING: true+ SECRET_KEY: test-secret-key-for-cirun: |- export CI=true- export LDR_USE_FALLBACK_LLM=true- export LDR_DATA_DIR=$PWD/dataexport PYTHONPATH=$PWD/src:$PYTHONPATH- # Disable rate limiting for UI tests - each test creates a new user- # and sequential tests would hit the rate limit- export DISABLE_RATE_LIMITING=trueecho "Starting web server with LDR_DATA_DIR=$LDR_DATA_DIR"pdm run python -m local_deep_research.web.app 2>&1 | tee server.log &echo $! > server.pid@@ -122,6 +124,66 @@ jobs:exit 1fi+ - name: Register CI test user+ run: |+ # Register the shared CI test user via the real registration endpoint+ # This tests the actual registration flow and creates the user for subsequent tests+ echo "Registering CI test user (test_admin)..."++ # Get CSRF token from registration page+ CSRF_TOKEN=$(curl -s http://localhost:5000/auth/register -c cookies.txt | grep -oP 'name="csrf_token" value="\K[^"]+' || echo "")++ if [ -n "$CSRF_TOKEN" ]; then+ # Register with CSRF token+ REGISTER_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://localhost:5000/auth/register \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -b cookies.txt -c cookies.txt \+ -d "csrf_token=$CSRF_TOKEN&username=test_admin&password=testpass123&confirm_password=testpass123" \+ -o /dev/null)+ else+ # Try without CSRF token (some configurations may not require it)+ REGISTER_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://localhost:5000/auth/register \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -c cookies.txt \+ -d "username=test_admin&password=testpass123&confirm_password=testpass123" \+ -o /dev/null)+ fi++ echo "Registration response code: $REGISTER_RESPONSE"++ # 302 = redirect (success), 200 = might have error message, 400 = user exists (ok)+ if [ "$REGISTER_RESPONSE" = "302" ] || [ "$REGISTER_RESPONSE" = "200" ] || [ "$REGISTER_RESPONSE" = "400" ]; then+ echo "Registration completed (user may already exist, which is fine)"+ fi++ # Verify login works+ echo "Verifying login for test_admin..."+ LOGIN_CSRF=$(curl -s http://localhost:5000/auth/login -c cookies.txt | grep -oP 'name="csrf_token" value="\K[^"]+' || echo "")++ if [ -n "$LOGIN_CSRF" ]; then+ LOGIN_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://localhost:5000/auth/login \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -b cookies.txt -c cookies.txt \+ -d "csrf_token=$LOGIN_CSRF&username=test_admin&password=testpass123" \+ -o /dev/null)+ else+ LOGIN_RESPONSE=$(curl -s -w "%{http_code}" -X POST http://localhost:5000/auth/login \+ -H "Content-Type: application/x-www-form-urlencoded" \+ -c cookies.txt \+ -d "username=test_admin&password=testpass123" \+ -o /dev/null)+ fi++ echo "Login response code: $LOGIN_RESPONSE"+ if [ "$LOGIN_RESPONSE" = "302" ]; then+ echo "CI test user login verified successfully"+ else+ echo "Warning: Login returned $LOGIN_RESPONSE (may still work via UI)"+ fi++ rm -f cookies.txt+ echo "CI test user ready"+- name: Run UI testsrun: |export LDR_USE_FALLBACK_LLM=true