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.

ci: add enhanced responsive UI tests workflow

LearningCircuit96eb8e5e05ff
diff --git a/.github/workflows/responsive-ui-tests-enhanced.yml b/.github/workflows/responsive-ui-tests-enhanced.yml
new file mode 100644
index 0000000000..a60dc54c22
--- /dev/null
+++ b/.github/workflows/responsive-ui-tests-enhanced.yml
@@ -0,0 +1,432 @@
+name: Responsive UI Tests
+
+on:
+ pull_request:
+ branches: [ main, dev ]
+ workflow_dispatch:
+ inputs:
+ viewport_type:
+ description: 'Viewport type to test'
+ required: false
+ default: 'all'
+ type: choice
+ options:
+ - all
+ - mobile
+ - tablet
+ - desktop
+
+jobs:
+ ui-tests:
+ runs-on: ubuntu-latest
+ timeout-minutes: 20
+
+ strategy:
+ fail-fast: false
+ matrix:
+ viewport: [mobile, desktop] # Test mobile and desktop on each PR
+
+ services:
+ postgres:
+ image: postgres:14
+ env:
+ POSTGRES_USER: postgres
+ POSTGRES_PASSWORD: postgres
+ POSTGRES_DB: ldr_test
+ ports:
+ - 5432:5432
+ options: >-
+ --health-cmd pg_isready
+ --health-interval 10s
+ --health-timeout 5s
+ --health-retries 5
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.11'
+ cache: 'pip'
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20'
+ cache: 'npm'
+ cache-dependency-path: tests/ui_tests/package-lock.json
+
+ - name: Install system dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y \
+ wget \
+ gnupg \
+ ca-certificates \
+ fonts-liberation \
+ libasound2 \
+ libatk-bridge2.0-0 \
+ libatk1.0-0 \
+ libcups2 \
+ libdbus-1-3 \
+ libdrm2 \
+ libgbm1 \
+ libgtk-3-0 \
+ libnspr4 \
+ libnss3 \
+ libx11-xcb1 \
+ libxcomposite1 \
+ libxdamage1 \
+ libxrandr2 \
+ xdg-utils \
+ imagemagick
+
+ - name: Install Python dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install -e .
+
+ - name: Install Node dependencies
+ working-directory: tests/ui_tests
+ run: |
+ npm ci
+ npx puppeteer browsers install chrome
+
+ - name: Set up test environment
+ env:
+ DATABASE_URL: postgresql://postgres:postgres@localhost:5432/ldr_test
+ run: |
+ # Create .env file for tests
+ cat > .env << EOF
+ DATABASE_URL=$DATABASE_URL
+ SECRET_KEY=test-secret-key-for-ci
+ FLASK_APP=local_deep_research.web.app
+ FLASK_ENV=testing
+ WTF_CSRF_ENABLED=False
+ TEST_BASE_URL=http://127.0.0.1:5000
+ EOF
+
+ # Initialize database
+ python -c "from local_deep_research.web.app import create_app, db; app = create_app(); app.app_context().push(); db.create_all()"
+
+ - name: Start application server
+ env:
+ DATABASE_URL: postgresql://postgres:postgres@localhost:5432/ldr_test
+ run: |
+ python -m local_deep_research.web.app &
+ echo $! > server.pid
+
+ # Wait for server to be ready
+ for i in {1..30}; do
+ if curl -s http://127.0.0.1:5000/ 2>/dev/null | grep -q "Research"; then
+ echo "Server is ready"
+ break
+ fi
+ echo "Waiting for server... (attempt $i/30)"
+ sleep 2
+ done
+
+ - name: Run responsive UI tests - ${{ matrix.viewport }}
+ id: run-tests
+ working-directory: tests/ui_tests/responsive
+ run: |
+ set +e # Don't exit on test failure
+
+ # Run tests and capture output
+ HEADLESS=true node test_responsive_ui_comprehensive.js ${{ matrix.viewport }} 2>&1 | tee test-output.log
+ TEST_EXIT_CODE=${PIPESTATUS[0]}
+
+ # Extract summary for PR comment
+ echo "### 📱 ${{ matrix.viewport }} Test Results" > test-summary.md
+ echo "" >> test-summary.md
+
+ # Extract pass/fail counts
+ PASSED=$(grep -oP '\d+(?= passed)' test-output.log | tail -1 || echo "0")
+ FAILED=$(grep -oP '\d+(?= failed)' test-output.log | tail -1 || echo "0")
+ WARNINGS=$(grep -oP '\d+(?= warnings)' test-output.log | tail -1 || echo "0")
+
+ if [ "$FAILED" -eq "0" ]; then
+ echo "✅ **All tests passed!**" >> test-summary.md
+ else
+ echo "❌ **$FAILED critical issues found**" >> test-summary.md
+ fi
+
+ echo "" >> test-summary.md
+ echo "- ✅ Passed: $PASSED" >> test-summary.md
+ echo "- ❌ Failed: $FAILED" >> test-summary.md
+ echo "- ⚠️ Warnings: $WARNINGS" >> test-summary.md
+ echo "" >> test-summary.md
+
+ # Extract key issues if any
+ if [ "$FAILED" -gt "0" ] || [ "$WARNINGS" -gt "0" ]; then
+ echo "<details>" >> test-summary.md
+ echo "<summary>View Issues</summary>" >> test-summary.md
+ echo "" >> test-summary.md
+ echo '```' >> test-summary.md
+ grep -A 50 "IMPROVEMENT SUGGESTIONS" test-output.log | head -60 >> test-summary.md
+ echo '```' >> test-summary.md
+ echo "</details>" >> test-summary.md
+ fi
+
+ echo "test_exit_code=$TEST_EXIT_CODE" >> $GITHUB_OUTPUT
+ echo "test_failed=$FAILED" >> $GITHUB_OUTPUT
+
+ # Only fail the job if there are critical failures
+ if [ "$FAILED" -gt "0" ]; then
+ exit 1
+ else
+ exit 0
+ fi
+
+ - name: Generate screenshot gallery
+ if: always()
+ working-directory: tests/ui_tests/responsive
+ run: |
+ # Create an HTML gallery of screenshots
+ cat > screenshot-gallery.html << 'EOF'
+ <!DOCTYPE html>
+ <html>
+ <head>
+ <title>UI Test Screenshots - ${{ matrix.viewport }}</title>
+ <style>
+ body { font-family: Arial, sans-serif; margin: 20px; background: #f5f5f5; }
+ h1 { color: #333; }
+ .gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
+ .screenshot { background: white; border-radius: 8px; padding: 10px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
+ .screenshot img { width: 100%; height: auto; border-radius: 4px; cursor: pointer; }
+ .screenshot h3 { margin: 10px 0 5px 0; color: #555; font-size: 14px; }
+ .modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); }
+ .modal-content { margin: auto; display: block; max-width: 90%; max-height: 90%; margin-top: 50px; }
+ .close { position: absolute; top: 15px; right: 35px; color: #f1f1f1; font-size: 40px; cursor: pointer; }
+ .status-failed { border-left: 4px solid #e74c3c; }
+ .status-passed { border-left: 4px solid #27ae60; }
+ </style>
+ </head>
+ <body>
+ <h1>📸 UI Test Screenshots - ${{ matrix.viewport }}</h1>
+ <p>Test run: ${{ github.run_id }} | Branch: ${{ github.head_ref || github.ref_name }}</p>
+ <div class="gallery">
+ EOF
+
+ # Add screenshots to gallery
+ for dir in responsive-ui-tests/*/; do
+ if [ -d "$dir" ]; then
+ for img in "$dir"*.png; do
+ if [ -f "$img" ]; then
+ filename=$(basename "$img")
+ device=$(basename "$dir")
+
+ # Create thumbnail
+ convert "$img" -resize 400x400 "thumb_$filename" 2>/dev/null || cp "$img" "thumb_$filename"
+
+ # Determine status based on test output
+ status="status-passed"
+ if grep -q "$filename" test-output.log 2>/dev/null; then
+ status="status-failed"
+ fi
+
+ echo "<div class='screenshot $status'>" >> screenshot-gallery.html
+ echo " <h3>$device - ${filename%.png}</h3>" >> screenshot-gallery.html
+ echo " <img src='$img' onclick='openModal(this)' alt='$filename'>" >> screenshot-gallery.html
+ echo "</div>" >> screenshot-gallery.html
+ fi
+ done
+ fi
+ done
+
+ cat >> screenshot-gallery.html << 'EOF'
+ </div>
+ <div id="modal" class="modal" onclick="closeModal()">
+ <span class="close">&times;</span>
+ <img class="modal-content" id="modal-img">
+ </div>
+ <script>
+ function openModal(img) {
+ document.getElementById('modal').style.display = 'block';
+ document.getElementById('modal-img').src = img.src;
+ }
+ function closeModal() {
+ document.getElementById('modal').style.display = 'none';
+ }
+ </script>
+ </body>
+ </html>
+ EOF
+
+ echo "Screenshot gallery created"
+
+ - name: Upload screenshots and gallery
+ if: always()
+ uses: actions/upload-artifact@v3
+ with:
+ name: ui-test-results-${{ matrix.viewport }}
+ path: |
+ tests/ui_tests/responsive/responsive-ui-tests/
+ tests/ui_tests/responsive/screenshot-gallery.html
+ tests/ui_tests/responsive/test-output.log
+ tests/ui_tests/responsive/test-summary.md
+ retention-days: 7
+
+ - name: Upload to GitHub Pages (if available)
+ if: always() && github.event_name == 'pull_request'
+ continue-on-error: true
+ run: |
+ # This requires GitHub Pages to be enabled for the repo
+ # Create a branch for the screenshots
+ BRANCH_NAME="pr-screenshots-${{ github.event.pull_request.number }}-${{ matrix.viewport }}"
+
+ cd tests/ui_tests/responsive
+ git init
+ git config user.name "GitHub Actions"
+ git config user.email "[email protected]"
+
+ # Add all screenshots and gallery
+ git add responsive-ui-tests screenshot-gallery.html
+ git commit -m "Screenshots for PR #${{ github.event.pull_request.number }}"
+
+ # Push to a dedicated branch (requires write permissions)
+ git push --force "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:$BRANCH_NAME 2>/dev/null || true
+
+ # The URL would be: https://[owner].github.io/[repo]/pr-screenshots-[number]-[viewport]/screenshot-gallery.html
+ echo "Screenshots available at: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/$BRANCH_NAME/screenshot-gallery.html" || true
+
+ - name: Stop application server
+ if: always()
+ run: |
+ if [ -f server.pid ]; then
+ kill $(cat server.pid) || true
+ rm server.pid
+ fi
+
+ post-results:
+ needs: ui-tests
+ runs-on: ubuntu-latest
+ if: always() && github.event_name == 'pull_request'
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Download all artifacts
+ uses: actions/download-artifact@v3
+ with:
+ path: test-artifacts/
+
+ - name: Generate combined report
+ run: |
+ # Create a combined markdown report with screenshot links
+ echo "# 📊 Responsive UI Test Report" > combined-report.md
+ echo "" >> combined-report.md
+ echo "## Test Summary" >> combined-report.md
+ echo "" >> combined-report.md
+
+ # Process each viewport's results
+ for dir in test-artifacts/ui-test-results-*/; do
+ if [ -d "$dir" ]; then
+ viewport=$(basename "$dir" | sed 's/ui-test-results-//')
+ echo "### $viewport" >> combined-report.md
+
+ if [ -f "$dir/test-summary.md" ]; then
+ cat "$dir/test-summary.md" >> combined-report.md
+ fi
+
+ # Count screenshots
+ screenshot_count=$(find "$dir" -name "*.png" 2>/dev/null | wc -l)
+ if [ "$screenshot_count" -gt "0" ]; then
+ echo "" >> combined-report.md
+ echo "📸 **$screenshot_count screenshots captured**" >> combined-report.md
+ fi
+
+ echo "" >> combined-report.md
+ fi
+ done
+
+ echo "## 📥 Download Options" >> combined-report.md
+ echo "" >> combined-report.md
+ echo "- [Download all test artifacts](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> combined-report.md
+ echo "- View artifacts in the 'Artifacts' section below the workflow summary" >> combined-report.md
+
+ - name: Upload combined report
+ uses: actions/upload-artifact@v3
+ with:
+ name: combined-test-report
+ path: combined-report.md
+ retention-days: 30
+
+ - name: Comment PR with enhanced summary
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const fs = require('fs');
+
+ // Read the combined report
+ let report = '';
+ try {
+ report = fs.readFileSync('combined-report.md', 'utf8');
+ } catch (e) {
+ report = '## Test Report\nFailed to generate combined report';
+ }
+
+ const jobStatuses = {
+ mobile: '${{ needs.ui-tests.result }}' === 'success',
+ desktop: '${{ needs.ui-tests.result }}' === 'success'
+ };
+
+ const overallStatus = Object.values(jobStatuses).every(s => s);
+ const statusEmoji = overallStatus ? '✅' : '❌';
+ const statusText = overallStatus ? 'All UI tests passed' : 'UI tests failed';
+
+ const comment = `## ${statusEmoji} Responsive UI Test Results
+
+ **Status:** ${statusText}
+
+ | Viewport | Status | Screenshots |
+ |----------|--------|-------------|
+ | 📱 Mobile | ${jobStatuses.mobile ? '✅ Passed' : '❌ Failed'} | [View](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts) |
+ | 🖥️ Desktop | ${jobStatuses.desktop ? '✅ Passed' : '❌ Failed'} | [View](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}#artifacts) |
+
+ ### 📸 Viewing Screenshots
+
+ 1. Click the links above or go to the [workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
+ 2. Scroll to **Artifacts** section
+ 3. Download \`ui-test-results-mobile\` or \`ui-test-results-desktop\`
+ 4. Open \`screenshot-gallery.html\` for an interactive gallery
+
+ <details>
+ <summary>📋 Detailed Test Report</summary>
+
+ ${report}
+
+ </details>
+
+ _Tests cover: accessibility, performance, responsive design, form validation, and interactive elements._`;
+
+ // Find existing comment
+ const { data: comments } = await github.rest.issues.listComments({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.issue.number,
+ });
+
+ const botComment = comments.find(comment =>
+ comment.user.type === 'Bot' &&
+ comment.body.includes('Responsive UI Test Results')
+ );
+
+ if (botComment) {
+ await github.rest.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: botComment.id,
+ body: comment
+ });
+ } else {
+ await github.rest.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.issue.number,
+ body: comment
+ });
+ }