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 CI UI tests by adding real registration step to workflows

LearningCircuit9a817d985c5c
diff --git a/.github/workflows/mobile-ui-tests.yml b/.github/workflows/mobile-ui-tests.yml
index 16066370cc..1a96c53905 100644
--- a/.github/workflows/mobile-ui-tests.yml
+++ b/.github/workflows/mobile-ui-tests.yml
@@ -103,59 +103,7 @@ jobs:
fi
- 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"
+ run: ./scripts/ci/register_test_user.sh http://127.0.0.1:5000
- name: Run Mobile Navigation Tests
working-directory: tests/ui_tests
diff --git a/.github/workflows/responsive-ui-tests-enhanced.yml b/.github/workflows/responsive-ui-tests-enhanced.yml
index 689703a9ac..e6fdc50bea 100644
--- a/.github/workflows/responsive-ui-tests-enhanced.yml
+++ b/.github/workflows/responsive-ui-tests-enhanced.yml
@@ -142,59 +142,7 @@ jobs:
done
- 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"
+ run: ./scripts/ci/register_test_user.sh http://127.0.0.1:5000
- name: Run responsive UI tests - ${{ matrix.viewport }}
id: run-tests
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index a2364b67fc..b70ed3396d 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -354,59 +354,7 @@ jobs:
fi
- 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"
+ run: ./scripts/ci/register_test_user.sh http://localhost:5000
- name: Run UI tests
run: |
diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml
index de8e3e7733..9157720884 100644
--- a/.github/workflows/ui-tests.yml
+++ b/.github/workflows/ui-tests.yml
@@ -125,64 +125,7 @@ jobs:
fi
- 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"
+ run: ./scripts/ci/register_test_user.sh http://localhost:5000
- name: Run UI tests
run: |
diff --git a/.gitleaks.toml b/.gitleaks.toml
index 9031ca7c5e..d00f468518 100644
--- a/.gitleaks.toml
+++ b/.gitleaks.toml
@@ -104,6 +104,8 @@ paths = [
'''docs/NOTIFICATION_FLOW\.md$''',
# UI test files contain test credentials (intentional for testing)
'''tests/ui_tests/.*\.js$''',
+ # CI scripts contain test credentials (intentional for testing)
+ '''scripts/ci/.*\.sh$''',
# Web routes use api_key/password parameter names (not actual secrets)
'''src/local_deep_research/web/routes/.*\.py$''',
'''src/local_deep_research/web/services/.*\.py$''',
diff --git a/scripts/ci/register_test_user.sh b/scripts/ci/register_test_user.sh
new file mode 100755
index 0000000000..319acf8ea2
--- /dev/null
+++ b/scripts/ci/register_test_user.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+# Register CI test user via the real registration endpoint
+#
+# This script registers the shared test_admin user for CI tests.
+# It uses the actual /auth/register endpoint to test the real registration flow.
+#
+# Usage: ./scripts/ci/register_test_user.sh [base_url]
+# base_url: Server URL (default: http://localhost:5000)
+#
+# Environment:
+# CI_TEST_USERNAME: Username to register (default: test_admin)
+# CI_TEST_PASSWORD: Password to use (default: testpass123) # pragma: allowlist secret
+
+set -e
+
+BASE_URL="${1:-http://localhost:5000}"
+USERNAME="${CI_TEST_USERNAME:-test_admin}"
+PASSWORD="${CI_TEST_PASSWORD:-testpass123}" # pragma: allowlist secret
+
+echo "Registering CI test user ($USERNAME) at $BASE_URL..."
+
+# Get CSRF token from registration page
+CSRF_TOKEN=$(curl -s "$BASE_URL/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 "$BASE_URL/auth/register" \
+ -H "Content-Type: application/x-www-form-urlencoded" \
+ -b cookies.txt -c cookies.txt \
+ -d "csrf_token=$CSRF_TOKEN&username=$USERNAME&password=$PASSWORD&confirm_password=$PASSWORD" \
+ -o /dev/null)
+else
+ REGISTER_RESPONSE=$(curl -s -w "%{http_code}" -X POST "$BASE_URL/auth/register" \
+ -H "Content-Type: application/x-www-form-urlencoded" \
+ -c cookies.txt \
+ -d "username=$USERNAME&password=$PASSWORD&confirm_password=$PASSWORD" \
+ -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)"
+else
+ echo "Warning: Unexpected registration response: $REGISTER_RESPONSE"
+fi
+
+# Verify login works
+echo "Verifying login for $USERNAME..."
+LOGIN_CSRF=$(curl -s "$BASE_URL/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 "$BASE_URL/auth/login" \
+ -H "Content-Type: application/x-www-form-urlencoded" \
+ -b cookies.txt -c cookies.txt \
+ -d "csrf_token=$LOGIN_CSRF&username=$USERNAME&password=$PASSWORD" \
+ -o /dev/null)
+else
+ LOGIN_RESPONSE=$(curl -s -w "%{http_code}" -X POST "$BASE_URL/auth/login" \
+ -H "Content-Type: application/x-www-form-urlencoded" \
+ -c cookies.txt \
+ -d "username=$USERNAME&password=$PASSWORD" \
+ -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"