~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
ci: consolidate 6 UI test workflows into docker-tests.yml (#2086)
LearningCircuit4c942cb5a8a6
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERSindex ba9988c4b5..9f31482172 100644--- a/.github/CODEOWNERS+++ b/.github/CODEOWNERS@@ -54,15 +54,10 @@# Test workflows (excluding security-tests.yml)/.github/workflows/tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti/.github/workflows/api-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti-/.github/workflows/critical-ui-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti-/.github/workflows/extended-ui-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti/.github/workflows/followup-research-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti/.github/workflows/infrastructure-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti/.github/workflows/library-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti/.github/workflows/llm-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti-/.github/workflows/metrics-analytics-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti-/.github/workflows/mobile-ui-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti-/.github/workflows/news-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti/.github/workflows/ui-tests.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpetti/.github/workflows/fuzz.yml @scottvr @tombii @prashant-sharma-cmd @shreydekate @LearningCircuit @hashedviking @djpettidiff --git a/.github/workflows/critical-ui-tests.yml b/.github/workflows/critical-ui-tests.ymldeleted file mode 100644index f762d86112..0000000000--- a/.github/workflows/critical-ui-tests.yml+++ /dev/null@@ -1,369 +0,0 @@-name: Critical UI Tests--on:- pull_request:- branches: [ main, dev, develop ]- workflow_dispatch:--permissions:- contents: read--# Cancel stale runs when a PR is updated — prevents resource contention-# from multiple simultaneous runs on the same PR-concurrency:- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}- cancel-in-progress: true--# Split into 3 parallel jobs to:-# 1. Run faster (parallel execution)-# 2. Isolate tests that create databases from those that don't-# 3. Avoid connection pool exhaustion by using fresh servers per job--jobs:- # Job 1: Form validation tests that don't need authentication- # Expected runtime: ~1-2 minutes- form-validation:- runs-on: ubuntu-latest- timeout-minutes: 5-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1- with:- egress-policy: audit-- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2- with:- persist-credentials: false-- - name: Set up PDM- uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4- with:- python-version: '3.11'- cache: true-- - name: Cache pip packages- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2- with:- path: ~/.cache/pip- key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}- restore-keys: |- ${{ runner.os }}-pip--- - name: Install system dependencies- run: |- sudo apt-get update- sudo apt-get install -y libsqlcipher-dev-- - name: Install Python dependencies- run: pdm sync -d-- - name: Set up Node.js- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'- cache: 'npm'- cache-dependency-path: tests/ui_tests/package.json-- - name: Set up test directories- run: mkdir -p "$PWD/data/encrypted_databases"-- - name: Initialize database- env:- TEST_ENV: true- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000" # Must match server setting for encryption compatibility- working-directory: ${{ github.workspace }}/src- run: |- # Use external script for maintainability (see scripts/ci/init_test_database.py)- pdm run python "${{ github.workspace }}/scripts/ci/init_test_database.py"-- - name: Start test server- env:- CI: true- FLASK_ENV: testing- TEST_ENV: true- DISABLE_RATE_LIMITING: true- SECRET_KEY: test-secret-key-for-ci- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000" # Reduce from 256000 for faster test user creation- working-directory: ${{ github.workspace }}/src- run: |- pdm run python -m local_deep_research.web.app > server.log 2>&1 &- for i in {1..30}; do- if curl -f http://127.0.0.1:5000 2>/dev/null; then- echo "Server is ready after $i seconds"- break- fi- sleep 1- done-- - name: Install Node.js dependencies- working-directory: ${{ github.workspace }}/tests/ui_tests- run: npm ci-- - name: Cache Puppeteer Chrome- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2- with:- path: ~/.cache/puppeteer- key: ${{ runner.os }}-puppeteer-${{ hashFiles('tests/ui_tests/package.json') }}-- - name: Install Puppeteer browser- run: npx puppeteer browsers install chrome-- - name: Create screenshots directory- run: mkdir -p tests/ui_tests/screenshots-- - name: Run form validation tests (no auth required)- env:- CI: true- HEADLESS: true- working-directory: ${{ github.workspace }}/tests/ui_tests- run: |- echo "Running registration form validation (no auth)..."- node test_register_validation.js-- - name: Upload artifacts on failure- if: failure()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: form-validation-artifacts- path: |- tests/ui_tests/screenshots/- src/server.log-- # Job 2: Authentication tests that create new users (slow due to encrypted DB creation)- # Expected runtime: ~5-10 minutes- auth-tests:- runs-on: ubuntu-latest- timeout-minutes: 20-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1- with:- egress-policy: audit-- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2- with:- persist-credentials: false-- - name: Set up PDM- uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4- with:- python-version: '3.11'- cache: true-- - name: Cache pip packages- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2- with:- path: ~/.cache/pip- key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}- restore-keys: |- ${{ runner.os }}-pip--- - name: Install system dependencies- run: |- sudo apt-get update- sudo apt-get install -y libsqlcipher-dev-- - name: Install Python dependencies- run: pdm sync -d-- - name: Set up Node.js- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'- cache: 'npm'- cache-dependency-path: tests/ui_tests/package.json-- - name: Set up test directories- run: mkdir -p "$PWD/data/encrypted_databases"-- - name: Initialize database- env:- TEST_ENV: true- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000"- working-directory: ${{ github.workspace }}/src- run: |- pdm run python "${{ github.workspace }}/scripts/ci/init_test_database.py"-- - name: Start test server- env:- CI: true- FLASK_ENV: testing- TEST_ENV: true- DISABLE_RATE_LIMITING: true- SECRET_KEY: test-secret-key-for-ci- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000" # Reduce from 256000 for faster test user creation- working-directory: ${{ github.workspace }}/src- run: |- pdm run python -m local_deep_research.web.app > server.log 2>&1 &- for i in {1..60}; do- if curl -f http://127.0.0.1:5000 2>/dev/null; then- echo "Server is ready after $i seconds"- break- fi- sleep 1- done-- - name: Install Node.js dependencies- working-directory: ${{ github.workspace }}/tests/ui_tests- run: npm ci-- - name: Cache Puppeteer Chrome- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2- with:- path: ~/.cache/puppeteer- key: ${{ runner.os }}-puppeteer-${{ hashFiles('tests/ui_tests/package.json') }}-- - name: Install Puppeteer browser- run: npx puppeteer browsers install chrome-- - name: Create screenshots directory- run: mkdir -p tests/ui_tests/screenshots-- - name: Run auth tests (creates users - slow due to encrypted DB)- env:- CI: true- HEADLESS: true- working-directory: ${{ github.workspace }}/tests/ui_tests- run: |- echo "Running auth flow test (creates user)..."- node test_auth_flow.js || exit 1-- echo "Running login validation test (creates user)..."- node test_login_validation.js || exit 1-- echo "Running registration full flow test..."- node test_register_full_flow.js || exit 1-- - name: Upload artifacts on failure- if: failure()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: auth-test-artifacts- path: |- tests/ui_tests/screenshots/- src/server.log-- # Job 3: Feature tests that use pre-created CI user (fast)- # Expected runtime: ~3-5 minutes- feature-tests:- runs-on: ubuntu-latest- timeout-minutes: 10-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1- with:- egress-policy: audit-- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2- with:- persist-credentials: false-- - name: Set up PDM- uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4- with:- python-version: '3.11'- cache: true-- - name: Cache pip packages- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2- with:- path: ~/.cache/pip- key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}- restore-keys: |- ${{ runner.os }}-pip--- - name: Install system dependencies- run: |- sudo apt-get update- sudo apt-get install -y libsqlcipher-dev-- - name: Install Python dependencies- run: pdm sync -d-- - name: Set up Node.js- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'- cache: 'npm'- cache-dependency-path: tests/ui_tests/package.json-- - name: Set up test directories- run: mkdir -p "$PWD/data/encrypted_databases"-- - name: Start test server- env:- CI: true- FLASK_ENV: testing- TEST_ENV: true- DISABLE_RATE_LIMITING: true- SECRET_KEY: test-secret-key-for-ci- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000" # Reduce from 256000 for faster test user creation- working-directory: ${{ github.workspace }}/src- run: |- pdm run python -m local_deep_research.web.app > server.log 2>&1 &- for i in {1..30}; do- if curl -f http://127.0.0.1:5000 2>/dev/null; then- echo "Server is ready after $i seconds"- break- fi- sleep 1- done-- - name: Install Node.js dependencies- working-directory: ${{ github.workspace }}/tests/ui_tests- run: npm ci-- - name: Cache Puppeteer Chrome- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2- with:- path: ~/.cache/puppeteer- key: ${{ runner.os }}-puppeteer-${{ hashFiles('tests/ui_tests/package.json') }}-- - name: Install Puppeteer browser- run: npx puppeteer browsers install chrome-- - name: Create screenshots directory- run: mkdir -p tests/ui_tests/screenshots-- - name: Register CI test user- working-directory: ${{ github.workspace }}/tests/ui_tests- run: node register_ci_user.js http://127.0.0.1:5000-- - name: Run feature tests (uses CI user - fast)- env:- CI: true- HEADLESS: true- working-directory: ${{ github.workspace }}/tests/ui_tests- run: |- # Note: Validation tests moved to extended-ui-tests.yml for faster critical path:- # - test_change_password_validation.js- # - test_settings_validation.js- # - test_research_form_validation.js-- echo "Running research submit test..."- node test_research_submit.js || exit 1-- # NOTE: test_research_simple.js removed - redundant with test_research_submit.js-- echo "Running export functionality test..."- node test_export_functionality.js || exit 1-- echo "Running concurrent limit test..."- node test_concurrent_limit.js || exit 1-- - name: Upload artifacts on failure- if: failure()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: feature-test-artifacts- path: |- tests/ui_tests/screenshots/- src/server.logdiff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.ymlindex 61c6d3edf2..01733222f0 100644--- a/.github/workflows/docker-tests.yml+++ b/.github/workflows/docker-tests.yml@@ -451,17 +451,33 @@ jobs:export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=truecd tests && npm ci+ - name: Initialize test database+ run: |+ mkdir -p "$PWD/ci-data"+ docker run --rm \+ -v "$PWD":/app \+ -v "$PWD/ci-data":/data \+ -e TEST_ENV=true \+ -e LDR_DATA_DIR=/data \+ -e LDR_DB_KDF_ITERATIONS=1000 \+ -w /app/src \+ ${{ env.TEST_IMAGE }} \+ python ../scripts/ci/init_test_database.py+- name: Start application server in Dockerrun: |docker run -d \--name ldr-server \-p 5000:5000 \+ -v "$PWD/ci-data":/data \-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 \+ -e LDR_DATA_DIR=/data \+ -e LDR_DB_KDF_ITERATIONS=1000 \${{ env.TEST_IMAGE }} ldr-web# Wait for server to be ready@@ -509,7 +525,7 @@ jobs:--network host \-w /app/tests/ui_tests \${{ env.TEST_IMAGE }} \- sh -c "xvfb-run -a -s '-screen 0 1920x1080x24' node run_all_tests.js || node run_all_tests.js"+ sh -c "xvfb-run -a -s '-screen 0 1920x1080x24' node run_all_tests.js"- name: Stop serverif: always()diff --git a/.github/workflows/extended-ui-tests.yml b/.github/workflows/extended-ui-tests.ymldeleted file mode 100644index 5b5206a85a..0000000000--- a/.github/workflows/extended-ui-tests.yml+++ /dev/null@@ -1,228 +0,0 @@-name: Extended UI Tests--on:- pull_request:- types: [opened, synchronize, reopened]- schedule:- # Run nightly at 2 AM UTC- - cron: '0 2 * * *'- workflow_dispatch:--permissions:- contents: read--jobs:- extended-ui-tests:- runs-on: ubuntu-latest- name: Extended UI Test Suite-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1- with:- egress-policy: audit-- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2-- with:- persist-credentials: false-- - name: Set up Python- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0- with:- python-version: '3.12'-- - name: Set up Node.js- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'- cache: 'npm'- cache-dependency-path: tests/ui_tests/package.json-- - name: Set up PDM- uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4- with:- python-version: '3.12'- cache: true-- - name: Install system dependencies- run: |- sudo apt-get update- sudo apt-get install -y libsqlcipher-dev xvfb-- - name: Install dependencies- run: |- pdm sync -d- cd tests/ui_tests && npm ci-- - name: Build frontend assets- run: |- npm ci- npm run build-- - name: Cache Puppeteer Chrome- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2- with:- path: ~/.cache/puppeteer- key: ${{ runner.os }}-puppeteer-${{ hashFiles('tests/ui_tests/package.json') }}-- - name: Install browser- run: |- npx puppeteer browsers install chrome-- - name: Setup directories- run: |- mkdir -p data/encrypted_databases- mkdir -p tests/ui_tests/screenshots- mkdir -p tests/ui_tests/results-- # Pre-create test_admin user to speed up tests (avoids slow registration).- # IMPORTANT: LDR_DATA_DIR and LDR_DB_KDF_ITERATIONS must match between this step and "Start server"!- # See scripts/ci/init_test_database.py for details.- - name: Initialize database with test user- env:- TEST_ENV: true- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000" # Must match server setting for encryption compatibility- run: |- # Use external script for maintainability- cd src- pdm run python ../scripts/ci/init_test_database.py-- - name: Start server- env:- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000" # Reduce from 256000 for faster test user creation- run: |- export CI=true- export LDR_USE_FALLBACK_LLM=true- export DISABLE_RATE_LIMITING=true- export PYTHONPATH="$PWD/src:$PYTHONPATH"- echo "Starting server with LDR_DATA_DIR=$LDR_DATA_DIR"- ls -la "$LDR_DATA_DIR/encrypted_databases/" || echo "No encrypted databases yet"- pdm run python -m local_deep_research.web.app &- echo $! > server.pid-- # Wait for server- for _ in {1..30}; do- if curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server ready"- break- fi- sleep 1- done-- - name: Register CI test user- working-directory: tests/ui_tests- run: node register_ci_user.js http://localhost:5000-- - name: Run critical UI tests- run: |- export DISPLAY=:99- cd tests/ui_tests-- # Create test runner for extended tests- cat > run_extended_tests.js << 'EOF'- const { spawn } = require('child_process');- const path = require('path');-- const tests = [- // Validation tests (moved from critical-ui-tests for faster critical path)- { name: 'Change Password Validation', file: 'test_change_password_validation.js' },- { name: 'Settings Validation', file: 'test_settings_validation.js' },- { name: 'Research Form Validation', file: 'test_research_form_validation.js' },-- // Critical flows not in main test suite- { name: 'Research Submit', file: 'test_research_submit.js' },- // Skipped: Research Cancellation has flaky 30s navigation timeouts in CI- { name: 'Export Functionality', file: 'test_export_functionality.js' },- { name: 'Concurrent Limit', file: 'test_concurrent_limit.js' },-- // Additional research tests- { name: 'Research Simple', file: 'test_research_simple.js' },- { name: 'Research Form', file: 'test_research_form.js' },- { name: 'Research API', file: 'test_research_api.js' },-- // History and navigation- { name: 'History Page', file: 'test_history_page.js' },- { name: 'Full Navigation', file: 'test_full_navigation.js' },-- // Advanced features- { name: 'Queue Simple', file: 'test_queue_simple.js' }- // Skipped: Direct Mode has flaky 30s navigation timeouts in CI- ];-- let passed = 0;- let failed = 0;-- async function runTest(test) {- console.log(`\nRunning: ${test.name}`);- return new Promise((resolve) => {- const testProcess = spawn('node', [test.file], {- stdio: 'inherit',- env: { ...process.env, HEADLESS: 'true' }- });-- const timeout = setTimeout(() => {- testProcess.kill();- console.log(`⏱️ ${test.name} timed out`);- failed++;- resolve();- }, 90000); // 90 second timeout per test-- testProcess.on('close', (code) => {- clearTimeout(timeout);- if (code === 0) {- console.log(`✅ ${test.name} passed`);- passed++;- } else {- console.log(`❌ ${test.name} failed`);- failed++;- }- resolve();- });- });- }-- async function runAll() {- console.log('Starting Extended UI Test Suite\n');-- for (const test of tests) {- // Check if file exists before trying to run- const fs = require('fs');- if (fs.existsSync(test.file)) {- await runTest(test);- } else {- console.log(`⚠️ Skipping ${test.name} - file not found`);- }- }-- console.log(`\n📊 Results: ${passed} passed, ${failed} failed`);- process.exit(failed > 0 ? 1 : 0);- }-- runAll();- EOF-- xvfb-run -a -s "-screen 0 1920x1080x24" node run_extended_tests.js-- - name: Upload screenshots- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: extended-ui-screenshots- path: tests/ui_tests/screenshots/-- - name: Upload test results- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: extended-ui-results- path: tests/ui_tests/results/-- - name: Stop server- if: always()- run: |- if [ -f server.pid ]; then- kill "$(cat server.pid)" || true- fidiff --git a/.github/workflows/library-ui-tests.yml b/.github/workflows/library-ui-tests.ymldeleted file mode 100644index 8a8344defd..0000000000--- a/.github/workflows/library-ui-tests.yml+++ /dev/null@@ -1,144 +0,0 @@-name: Library UI Tests--on:- pull_request:- branches: [ main, dev ]- workflow_dispatch:--permissions:- contents: read--jobs:- library-ui-tests:- runs-on: ubuntu-latest- name: Library UI Tests- timeout-minutes: 20-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1- with:- egress-policy: audit-- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2-- with:- persist-credentials: false-- - name: Set up Python- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0- with:- python-version: '3.12'-- - name: Set up Node.js- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'-- - name: Set up PDM- uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4- with:- python-version: '3.12'- cache: true-- - name: Install system dependencies for SQLCipher- run: |- sudo apt-get update- sudo apt-get install -y libsqlcipher-dev-- - name: Install Python dependencies- run: pdm sync -d-- - name: Install UI test dependencies- run: cd tests && npm ci-- - name: Install browser dependencies- run: npx puppeteer browsers install chrome-- - name: Setup test directories- run: |- mkdir -p data/encrypted_databases- mkdir -p tests/ui_tests/screenshots- echo "Created data and screenshots directories for tests"-- # Pre-create test_admin user to speed up tests (avoids slow registration).- # IMPORTANT: LDR_DATA_DIR and LDR_DB_KDF_ITERATIONS must match between this step and "Start application server"!- # See scripts/ci/init_test_database.py for details.- - name: Initialize database with test user- env:- TEST_ENV: true- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000"- run: |- cd src- pdm run python ../scripts/ci/init_test_database.py-- - name: Start application server- env:- CI: true- LDR_USE_FALLBACK_LLM: true- DISABLE_RATE_LIMITING: true- LDR_DATA_DIR: ${{ github.workspace }}/data- LDR_DB_KDF_ITERATIONS: "1000"- run: |- export PYTHONPATH=$PWD/src:$PYTHONPATH- echo "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-- - name: Wait for server to be ready- run: |- # Wait up to 60 seconds for server to start- for i in {1..60}; do- if curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server is ready after $i seconds"- break- fi- if ! kill -0 "$(cat server.pid)" 2>/dev/null; then- echo "Server process died!"- echo "Server log:"- cat server.log- exit 1- fi- echo "Waiting for server... ($i/60)"- sleep 1- done-- # Final check- if ! curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server failed to start after 60 seconds"- echo "Server log:"- cat server.log- exit 1- fi-- - name: Run library UI tests- run: |- export CI=true- export LDR_USE_FALLBACK_LLM=true- export DISPLAY=:99- cd tests/ui_tests && xvfb-run -a -s "-screen 0 1920x1080x24" node library/test_collections_page.js-- - name: Stop server- if: always()- run: |- if [ -f server.pid ]; then- kill "$(cat server.pid)" || true- rm server.pid- fi-- - name: Upload UI test screenshots- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: library-ui-test-screenshots- path: |- tests/screenshots/- tests/ui_tests/screenshots/-- - name: Upload server logs- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: library-ui-server-logs- path: server.logdiff --git a/.github/workflows/metrics-analytics-tests.yml b/.github/workflows/metrics-analytics-tests.ymldeleted file mode 100644index 46cd9b1669..0000000000--- a/.github/workflows/metrics-analytics-tests.yml+++ /dev/null@@ -1,190 +0,0 @@-name: Metrics & Analytics Tests--on:- pull_request:- types: [opened, synchronize, reopened]- schedule:- # Run weekly on Sundays at 1 AM UTC- - cron: '0 1 * * 0'- workflow_dispatch:--permissions:- contents: read--jobs:- metrics-analytics-tests:- runs-on: ubuntu-latest- name: Metrics & Analytics Test Suite-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1- with:- egress-policy: audit-- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2-- with:- persist-credentials: false-- - name: Set up Python- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0- with:- python-version: '3.12'-- - name: Set up Node.js- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'- cache: 'npm'- cache-dependency-path: tests/ui_tests/package.json-- - name: Set up PDM- uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4- with:- python-version: '3.12'- cache: true-- - name: Install system dependencies- run: |- sudo apt-get update- sudo apt-get install -y libsqlcipher-dev xvfb-- - name: Install dependencies- run: |- pdm sync -d- cd tests/ui_tests && npm ci-- - name: Cache Puppeteer Chrome- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2- with:- path: ~/.cache/puppeteer- key: ${{ runner.os }}-puppeteer-${{ hashFiles('tests/ui_tests/package.json') }}-- - name: Install browser- run: |- npx puppeteer browsers install chrome-- - name: Setup directories- run: |- mkdir -p data- mkdir -p tests/ui_tests/screenshots/metrics- mkdir -p tests/ui_tests/results/metrics-- - name: Start server- run: |- export CI=true- export LDR_USE_FALLBACK_LLM=true- export DISABLE_RATE_LIMITING=true- export PYTHONPATH=$PWD/src:$PYTHONPATH- pdm run python -m local_deep_research.web.app &- echo $! > server.pid-- # Wait for server- for _ in {1..30}; do- if curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server ready"- break- fi- sleep 1- done-- - name: Run metrics and analytics tests- run: |- export DISPLAY=:99- cd tests/ui_tests-- # Create test runner for metrics tests- cat > run_metrics_tests.js << 'EOF'- const { spawn } = require('child_process');-- const tests = [- // Star reviews analytics- { name: 'Star Reviews', file: 'test_star_reviews.js' }-- // TODO: Add these tests as they are implemented:- // { name: 'Metrics Dashboard', file: 'test_metrics_dashboard.js' },- // { name: 'Cost Analytics', file: 'test_cost_analytics.js' },- // { name: 'Metrics Verification', file: 'test_metrics_verification.js' },- // { name: 'Metrics Full Flow', file: 'test_metrics_full_flow.js' },- // { name: 'Metrics Display', file: 'test_metrics_display.js' },- // { name: 'Metrics Browser', file: 'test_metrics_browser.js' },- // { name: 'Metrics with LLM', file: 'test_metrics_with_llm.js' },- // { name: 'Simple Metrics', file: 'test_simple_metrics.js' },- // { name: 'Simple Cost', file: 'test_simple_cost.js' }- ];-- let passed = 0;- let failed = 0;-- async function runTest(test) {- console.log(`\n📊 Running: ${test.name}`);- return new Promise((resolve) => {- const testProcess = spawn('node', [test.file], {- stdio: 'inherit',- env: { ...process.env, HEADLESS: 'true' }- });-- const timeout = setTimeout(() => {- testProcess.kill();- console.log(`⏱️ ${test.name} timed out`);- failed++;- resolve();- }, 60000); // 60 second timeout per test-- testProcess.on('close', (code) => {- clearTimeout(timeout);- if (code === 0) {- console.log(`✅ ${test.name} passed`);- passed++;- } else {- console.log(`❌ ${test.name} failed`);- failed++;- }- resolve();- });- });- }-- async function runAll() {- console.log('Starting Metrics & Analytics Test Suite\n');-- for (const test of tests) {- // Check if file exists before trying to run- const fs = require('fs');- if (fs.existsSync(test.file)) {- await runTest(test);- } else {- console.log(`⚠️ Skipping ${test.name} - file not found`);- }- }-- console.log(`\n📈 Results: ${passed} passed, ${failed} failed`);- process.exit(failed > 0 ? 1 : 0);- }-- runAll();- EOF-- xvfb-run -a -s "-screen 0 1920x1080x24" node run_metrics_tests.js-- - name: Upload metrics screenshots- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: metrics-screenshots- path: tests/ui_tests/screenshots/metrics/-- - name: Upload metrics results- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: metrics-test-results- path: tests/ui_tests/results/metrics/-- - name: Stop server- if: always()- run: |- if [ -f server.pid ]; then- kill "$(cat server.pid)" || true- fidiff --git a/.github/workflows/mobile-ui-tests.yml b/.github/workflows/mobile-ui-tests.ymldeleted file mode 100644index 40ff7e09b0..0000000000--- a/.github/workflows/mobile-ui-tests.yml+++ /dev/null@@ -1,135 +0,0 @@-name: Mobile UI Tests--on:- pull_request:- branches: [ main, dev ]- paths:- - 'src/local_deep_research/web/static/css/**'- - 'src/local_deep_research/web/static/js/**'- - 'src/local_deep_research/web/templates/**'- - 'tests/ui_tests/**'- workflow_dispatch:--permissions: {} # Minimal top-level for OSSF Scorecard Token-Permissions--jobs:- mobile-ui-tests:- runs-on: ubuntu-latest- permissions:- contents: read- checks: write-- strategy:- matrix:- python-version: ['3.11', '3.12']-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1- with:- egress-policy: audit-- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2- with:- persist-credentials: false-- - name: Set up PDM- uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4- with:- python-version: ${{ matrix.python-version }}- version: 2.26.2- cache: true-- - name: Install Python dependencies- run: |- pdm install -d-- - name: Setup Node.js- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'- cache: 'npm'- cache-dependency-path: tests/ui_tests/package.json-- - name: Install Node dependencies- working-directory: tests/ui_tests- run: |- npm ci- npx puppeteer browsers install chrome-- - name: Setup test directories- run: |- mkdir -p data/encrypted_databases- 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-ci- run: |- export PYTHONPATH="$PWD/src:$PYTHONPATH"- echo "Starting server with LDR_DATA_DIR=$LDR_DATA_DIR"- echo "Rate limiting disabled for CI tests"- pdm run python -m local_deep_research.web.app &- SERVER_PID=$!- echo "SERVER_PID=$SERVER_PID" >> "$GITHUB_ENV"-- # Wait for server to be ready- for i in {1..30}; do- if curl -s http://127.0.0.1:5000 > /dev/null; then- echo "Server is ready"- break- fi- echo "Waiting for server... ($i/30)"- sleep 2- done-- # Verify server is running- if ! curl -s http://127.0.0.1:5000 > /dev/null; then- echo "Server failed to start"- exit 1- fi-- - name: Register CI test user- working-directory: tests/ui_tests- run: node register_ci_user.js http://127.0.0.1:5000-- - name: Run Mobile Navigation Tests- working-directory: tests/ui_tests- env:- HEADLESS: true- OUTPUT_FORMAT: junit- SCREENSHOT_ON_FAILURE: true- TEST_BASE_URL: http://127.0.0.1:5000- run: |- node mobile/test_mobile_navigation_ci.js-- - name: Upload test results- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: test-results-${{ matrix.python-version }}- path: |- tests/ui_tests/test-results.xml- tests/ui_tests/test-results.json- tests/ui_tests/test-failures/-- - name: Publish Test Results- if: always() && matrix.python-version == '3.12'- uses: EnricoMi/publish-unit-test-result-action@27d65e188ec43221b20d26de30f4892fad91df2f # v2.22.0- with:- files: tests/ui_tests/test-results.xml- check_name: Mobile UI Test Results- comment_mode: off-- - name: Stop server- if: always()- run: |- if [ -n "$SERVER_PID" ]; then- kill "$SERVER_PID" || true- fi- pkill -f "python -m local_deep_research.web.app" || truediff --git a/.github/workflows/news-tests.yml b/.github/workflows/news-tests.ymldeleted file mode 100644index 8b8cbb294e..0000000000--- a/.github/workflows/news-tests.yml+++ /dev/null@@ -1,117 +0,0 @@-name: News Feature Tests--on:- pull_request:- types: [opened, synchronize, reopened]- workflow_dispatch:--permissions:- contents: read--jobs:- news-tests:- runs-on: ubuntu-latest- name: News Feature Test Suite-- steps:- - name: Harden the runner (Audit all outbound calls)- uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1- with:- egress-policy: audit-- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2-- with:- persist-credentials: false-- - name: Set up Python- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0- with:- python-version: '3.12'-- - name: Set up Node.js- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version: '20'- cache: 'npm'- cache-dependency-path: tests/ui_tests/package.json-- - name: Set up PDM- uses: pdm-project/setup-pdm@94a823180e06fcde4ad29308721954a521c96ed0 # v4- with:- python-version: '3.12'- cache: true-- - name: Install system dependencies- run: |- sudo apt-get update- sudo apt-get install -y libsqlcipher-dev xvfb-- - name: Install dependencies- run: |- pdm sync -d- cd tests/ui_tests && npm ci-- - name: Cache Puppeteer Chrome- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2- with:- path: ~/.cache/puppeteer- key: ${{ runner.os }}-puppeteer-${{ hashFiles('tests/ui_tests/package.json') }}-- - name: Install browser- run: |- npx puppeteer browsers install chrome-- - name: Setup directories- run: |- mkdir -p data- mkdir -p tests/ui_tests/screenshots/news-- - name: Start server- run: |- export CI=true- export LDR_USE_FALLBACK_LLM=true- export DISABLE_RATE_LIMITING=true- export PYTHONPATH="$PWD"/src:$PYTHONPATH- pdm run python -m local_deep_research.web.app &- echo $! > server.pid-- # Wait for server- for _ in {1..30}; do- if curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server ready"- break- fi- sleep 1- done-- - name: Run news feature tests- run: |- export DISPLAY=:99- cd tests/ui_tests-- # Run all news-related tests- for test in test_news*.js; do- if [ -f "$test" ] && [[ ! "$test" == *"debug"* ]]; then- echo "Running $test..."- xvfb-run -a -s "-screen 0 1920x1080x24" node "$test" || true- fi- done-- - name: Run news API tests- run: |- pdm run pytest tests/news/ -v --tb=short || true-- - name: Upload news test screenshots- if: always()- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- name: news-test-screenshots- path: tests/ui_tests/screenshots/news/-- - name: Stop server- if: always()- run: |- if [ -f server.pid ]; then- kill "$(cat server.pid)" || true- fidiff --git a/docs/CI_CD_INFRASTRUCTURE.md b/docs/CI_CD_INFRASTRUCTURE.mdindex 5691ba2222..49fb5492e2 100644--- a/docs/CI_CD_INFRASTRUCTURE.md+++ b/docs/CI_CD_INFRASTRUCTURE.md@@ -82,14 +82,9 @@ pre-commit install-hooks| Workflow | Trigger | Purpose ||----------|---------|---------|-| `docker-tests.yml` | PR, push | Consolidated Docker tests: pytest + coverage, UI tests, LLM tests, infrastructure tests (single Docker build shared across all jobs) |+| `docker-tests.yml` | PR, push | Consolidated Docker tests: pytest + coverage, UI tests (51 Puppeteer tests), LLM tests, infrastructure tests (single Docker build shared across all jobs). Includes tests previously in critical-ui-tests, extended-ui-tests, metrics-analytics-tests, library-ui-tests, mobile-ui-tests, and news-tests workflows. || `api-tests.yml` | PR, push | API endpoint testing |-| `critical-ui-tests.yml` | PR, push | Essential UI flow tests |-| `extended-ui-tests.yml` | PR, push | Extended UI validation || `e2e-research-test.yml` | PR, push | End-to-end research flow |-| `library-ui-tests.yml` | PR, push | Research library UI tests |-| `news-tests.yml` | PR, push | News subscription tests |-| `metrics-analytics-tests.yml` | PR, push | Analytics tests || `followup-research-tests.yml` | PR, push | Follow-up research tests || `fuzz.yml` | Schedule | Fuzzing tests |@@ -130,7 +125,6 @@ pre-commit install-hooks| Workflow | Trigger | Purpose ||----------|---------|---------|| `responsive-ui-tests-enhanced.yml` | PR, push | Responsive design tests |-| `mobile-ui-tests.yml` | PR, push | Mobile viewport tests |### Build & Deploydiff --git a/tests/ui_tests/auth_helper.js b/tests/ui_tests/auth_helper.jsindex bbc0f9b1a4..51caa019c5 100644--- a/tests/ui_tests/auth_helper.js+++ b/tests/ui_tests/auth_helper.js@@ -110,6 +110,15 @@ class AuthHelper {this.isCI = !!process.env.CI;}+ /**+ * Get the current page reference.+ * The page may have been replaced if a detached frame error was recovered.+ * Tests should call this after ensureAuthenticated() to get the working page.+ */+ getPage() {+ return this.page;+ }+/*** Helper method for delays*/@@ -206,6 +215,20 @@ class AuthHelper {} catch (navError) {lastError = navError;console.log(` Navigation attempt ${attempt} failed: ${navError.message}`);++ // If the frame is detached, create a fresh page and retry+ if (navError.message.includes('detached') || navError.message.includes('destroyed')) {+ console.log(' Frame detached - creating fresh page...');+ try {+ const browser = this.page.browser();+ const newPage = await browser.newPage();+ try { await this.page.close(); } catch (e) { /* already broken */ }+ this.page = newPage;+ } catch (e) {+ console.log(` Could not create fresh page: ${e.message}`);+ }+ }+if (attempt < maxRetries) {await this._delay(AUTH_CONFIG.delays.retryNavigation);}@@ -537,8 +560,15 @@ class AuthHelper {console.log(' Frame was replaced - registration likely succeeded');await this._delay(AUTH_CONFIG.delays.afterRegistration);- // Navigate to home to verify+ // The current page's frame is broken - get a fresh page from the browsertry {+ const browser = this.page.browser();+ const newPage = await browser.newPage();+ // Close the broken page to free resources+ try { await this.page.close(); } catch (e) { /* already broken */ }+ this.page = newPage;+ console.log(' Created fresh page after frame detachment');+await this.page.goto(this.baseUrl, {waitUntil: AUTH_CONFIG.ci.waitUntil,timeout: AUTH_CONFIG.timeouts.formSelector@@ -555,6 +585,17 @@ class AuthHelper {if (!registrationSucceeded) {console.log(' Verifying registration via session...');+ // Ensure we have a working page (may have been replaced above)+ try {+ // Test if page is usable+ await this.page.url();+ } catch (e) {+ console.log(' Page is broken, creating fresh page for verification...');+ const browser = this.page.browser();+ try { await this.page.close(); } catch (closeErr) { /* already broken */ }+ this.page = await browser.newPage();+ }+// Wait for server to become ready (might be still processing)// In CI, registration can take 2+ minutes due to encrypted DB creationconst serverReady = await this._waitForServerReady(180000, 10000); // 3 min max, check every 10s@@ -651,8 +692,14 @@ class AuthHelper {await this._delay(AUTH_CONFIG.delays.afterRegistration);timer.lap('post-registration delay complete');- // Navigate back to home page after registration+ // The current page's frame is broken - get a fresh pagetry {+ const browser = this.page.browser();+ const newPage = await browser.newPage();+ try { await this.page.close(); } catch (e) { /* already broken */ }+ this.page = newPage;+ console.log(' Created fresh page after frame detachment');+await this.page.goto(this.baseUrl, {waitUntil: 'domcontentloaded',timeout: AUTH_CONFIG.timeouts.formSelectordiff --git a/tests/ui_tests/run_all_tests.js b/tests/ui_tests/run_all_tests.jsindex da36447ee1..130efbffd8 100644--- a/tests/ui_tests/run_all_tests.js+++ b/tests/ui_tests/run_all_tests.js@@ -10,8 +10,36 @@*/const { spawn } = require('child_process');+const http = require('http');const path = require('path');+/**+ * Wait for the server to be responsive before starting the next test.+ * Prevents cascade failures when a previous test stressed the server+ * (e.g., registration creating encrypted databases).+ */+async function waitForServer(maxWaitMs = 30000) {+ const startTime = Date.now();+ while (Date.now() - startTime < maxWaitMs) {+ try {+ const ok = await new Promise((resolve) => {+ const req = http.get('http://127.0.0.1:5000/api/v1/health', { timeout: 5000 }, (res) => {+ resolve(res.statusCode >= 200 && res.statusCode < 400);+ res.resume();+ });+ req.on('error', () => resolve(false));+ req.on('timeout', () => { req.destroy(); resolve(false); });+ });+ if (ok) return true;+ } catch (e) {+ // ignore+ }+ await new Promise(r => setTimeout(r, 2000));+ }+ console.log(`⚠️ Server did not respond within ${maxWaitMs/1000}s, proceeding anyway...`);+ return false;+}+const tests = [// Core tests{@@ -187,6 +215,99 @@ const tests = [name: 'Loading & Feedback CI Tests',file: 'test_loading_feedback_ci.js',description: 'Tests spinners, toasts, progress bars, hover states'+ },++ // Consolidated from critical-ui-tests.yml (validation & auth)+ {+ name: 'Register Validation Test',+ file: 'test_register_validation.js',+ description: 'Tests registration form validation without auth'+ },+ {+ name: 'Login Validation Test',+ file: 'test_login_validation.js',+ description: 'Tests login form validation'+ },+ {+ name: 'Register Full Flow Test',+ file: 'test_register_full_flow.js',+ description: 'Tests complete registration flow'+ },+ {+ name: 'Research Submit Test',+ file: 'test_research_submit.js',+ description: 'Tests research submission'+ },+ {+ name: 'Export Functionality Test',+ file: 'test_export_functionality.js',+ description: 'Tests export features'+ },+ {+ name: 'Concurrent Limit Test',+ file: 'test_concurrent_limit.js',+ description: 'Tests concurrent research limits'+ },++ // Consolidated from extended-ui-tests.yml (validation + features)+ {+ name: 'Change Password Validation Test',+ file: 'test_change_password_validation.js',+ description: 'Tests password change form validation'+ },+ {+ name: 'Settings Validation Test',+ file: 'test_settings_validation.js',+ description: 'Tests settings input validation'+ },+ {+ name: 'Research Form Validation Test',+ file: 'test_research_form_validation.js',+ description: 'Tests research form field validation'+ },+ {+ name: 'Research Simple Test',+ file: 'test_research_simple.js',+ description: 'Tests basic research flow'+ },+ {+ name: 'Research Form Test',+ file: 'test_research_form.js',+ description: 'Tests research form interactions'+ },+ {+ name: 'Research API Test',+ file: 'test_research_api.js',+ description: 'Tests research API endpoints via UI'+ },+ {+ name: 'History Page Test',+ file: 'test_history_page.js',+ description: 'Tests history page functionality'+ },+ {+ name: 'Full Navigation Test',+ file: 'test_full_navigation.js',+ description: 'Tests full app navigation flow'+ },+ {+ name: 'Queue Simple Test',+ file: 'test_queue_simple.js',+ description: 'Tests research queue functionality'+ },++ // Consolidated from mobile-ui-tests.yml+ {+ name: 'Mobile Navigation CI Test',+ file: 'mobile/test_mobile_navigation_ci.js',+ description: 'Tests mobile navigation patterns'+ },++ // Consolidated from library-ui-tests.yml+ {+ name: 'Library Collections Page Test',+ file: 'library/test_collections_page.js',+ description: 'Tests library collections page'}];@@ -208,10 +329,13 @@ async function runTest(test) {console.log(`🆔 Process PID: ${testProcess.pid}`);// Add timeout for individual tests- // 120 seconds in CI to handle slow registration/auth tests- // 60 seconds locally for faster feedback+ // 300 seconds in CI to handle slow registration/auth tests.+ // In Docker, new user registration creates encrypted SQLCipher databases+ // with key derivation + 58 tables + 500+ settings, which can take 60-120s.+ // Subsequent tests may also be slow while the server recovers.+ // 60 seconds locally for faster feedback.const isCI = !!process.env.CI;- const timeoutMs = isCI ? 120000 : 60000;+ const timeoutMs = isCI ? 300000 : 60000;const timeout = setTimeout(() => {const elapsed = Math.round((Date.now() - startTime) / 1000);console.log(`\n⏱️ Test timeout: ${test.name} exceeded ${timeoutMs/1000} seconds (${elapsed}s elapsed)`);@@ -269,6 +393,9 @@ async function runAllTests() {const results = [];for (const test of tests) {+ // Ensure server is responsive before starting each test.+ // Prevents cascade failures when a previous test stressed the server.+ await waitForServer();const result = await runTest(test);results.push(result);}diff --git a/tests/ui_tests/test_lib/test_utils.js b/tests/ui_tests/test_lib/test_utils.jsindex 2cf93eb275..36e6f650ac 100644--- a/tests/ui_tests/test_lib/test_utils.js+++ b/tests/ui_tests/test_lib/test_utils.js@@ -68,9 +68,11 @@ async function setupTest(options = {}) {}// Return context object+ // Use authHelper.getPage() because ensureAuthenticated() may have created+ // a fresh page if the original one hit a detached frame errorreturn {browser,- page,+ page: authHelper.getPage(),authHelper,config,viewports,diff --git a/tests/ui_tests/test_results_exports_ci.js b/tests/ui_tests/test_results_exports_ci.jsindex 4fd9310721..17c256ccbf 100644--- a/tests/ui_tests/test_results_exports_ci.js+++ b/tests/ui_tests/test_results_exports_ci.js@@ -14,7 +14,7 @@ const { setupTest, teardownTest, TestResults, log, delay } = require('./test_lib// Helper to find a completed research// ============================================================================async function findCompletedResearch(page, baseUrl) {- await page.goto(`${baseUrl}/history`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/history`, { waitUntil: 'domcontentloaded' });return await page.evaluate(() => {// Look for completed research with results link@@ -41,7 +41,7 @@ const ResultsPageTests = {return { passed: null, skipped: true, message: 'No completed research found to test results page' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {const hasContent = document.body.textContent.length > 100;@@ -69,7 +69,7 @@ const ResultsPageTests = {return { passed: null, skipped: true, message: 'No completed research for metadata test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {// Look for metadata elements@@ -103,7 +103,7 @@ const ResultsPageTests = {return { passed: null, skipped: true, message: 'No completed research for content test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {// Look for rendered markdown content@@ -150,7 +150,7 @@ const StarRatingTests = {return { passed: null, skipped: true, message: 'No completed research for star rating test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {const starWidget = document.querySelector(@@ -192,7 +192,7 @@ const StarRatingTests = {return { passed: null, skipped: true, message: 'No completed research for star click test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {const stars = document.querySelectorAll(@@ -239,7 +239,7 @@ const StarRatingTests = {return { passed: null, skipped: true, message: 'No completed research for hover test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const starSelector = '.star, [class*="star"]:not([class*="start"]), .rating-star';const star = await page.$(starSelector);@@ -293,7 +293,7 @@ const ExportButtonTests = {return { passed: null, skipped: true, message: 'No completed research for export button test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {const buttons = Array.from(document.querySelectorAll('button, a.btn, .btn'));@@ -350,7 +350,7 @@ const ExportButtonTests = {return { passed: null, skipped: true, message: 'No completed research for PDF export test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {const buttons = Array.from(document.querySelectorAll('button, a.btn, .btn, a[download]'));@@ -384,7 +384,7 @@ const ExportButtonTests = {return { passed: null, skipped: true, message: 'No completed research for Markdown export test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {const buttons = Array.from(document.querySelectorAll('button, a.btn, .btn, a[download]'));@@ -418,7 +418,7 @@ const ExportButtonTests = {return { passed: null, skipped: true, message: 'No completed research for dropdown test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {// Look for export dropdown@@ -466,7 +466,7 @@ const ActionButtonTests = {return { passed: null, skipped: true, message: 'No completed research for back button test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {const buttons = Array.from(document.querySelectorAll('button, a.btn, .btn, a'));@@ -499,7 +499,7 @@ const ActionButtonTests = {return { passed: null, skipped: true, message: 'No completed research for metrics button test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {const buttons = Array.from(document.querySelectorAll('button, a.btn, .btn, a'));@@ -533,7 +533,7 @@ const ActionButtonTests = {return { passed: null, skipped: true, message: 'No completed research for help button test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {const buttons = Array.from(document.querySelectorAll('button, a.btn, .btn, a'));@@ -571,7 +571,7 @@ const LogPanelTests = {return { passed: null, skipped: true, message: 'No completed research for log panel test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });const result = await page.evaluate(() => {const logPanel = document.querySelector(@@ -615,7 +615,7 @@ const LogPanelTests = {return { passed: null, skipped: true, message: 'No completed research for expandable log test' };}- await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'networkidle2' });+ await page.goto(`${baseUrl}/results/${researchId}`, { waitUntil: 'domcontentloaded' });// Click log toggleconst clicked = await page.evaluate(() => {