~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: resolve mobile sidebar overlap issue (#667)
LearningCircuit8942e6a29eb0
diff --git a/.github/workflows/mobile-ui-tests.yml b/.github/workflows/mobile-ui-tests.ymlnew file mode 100644index 0000000000..4e8ac8f9d3--- /dev/null+++ b/.github/workflows/mobile-ui-tests.yml@@ -0,0 +1,160 @@+name: Mobile UI Tests++on:+ push:+ branches: [ main, dev, 'fix/*', 'feature/*' ]+ paths:+ - 'src/local_deep_research/web/static/css/**'+ - 'src/local_deep_research/web/static/js/**'+ - 'src/local_deep_research/web/templates/**'+ - 'tests/ui_tests/**'+ - '.github/workflows/mobile-ui-tests.yml'+ 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:++jobs:+ mobile-ui-tests:+ runs-on: ubuntu-latest++ strategy:+ matrix:+ python-version: ['3.10', '3.11', '3.12']++ steps:+ - uses: actions/checkout@v4++ - name: Set up Python ${{ matrix.python-version }}+ uses: actions/setup-python@v5+ with:+ python-version: ${{ matrix.python-version }}++ - name: Install PDM+ run: |+ pip install --upgrade pip+ pip install pdm++ - name: Install Python dependencies+ run: |+ pdm install -d++ - name: Setup Node.js+ uses: actions/setup-node@v4+ 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: Start LDR server+ run: |+ 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: 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 test_mobile_navigation_ci.js++ - name: Upload test results+ if: always()+ uses: actions/upload-artifact@v4+ 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()+ uses: EnricoMi/publish-unit-test-result-action@v2+ with:+ files: tests/ui_tests/test-results.xml+ check_name: Mobile UI Test Results (Python ${{ matrix.python-version }})++ - name: Stop server+ if: always()+ run: |+ if [ ! -z "$SERVER_PID" ]; then+ kill $SERVER_PID || true+ fi+ pkill -f "python -m local_deep_research.web.app" || true++ - name: Comment PR with results+ if: github.event_name == 'pull_request' && always()+ uses: actions/github-script@v7+ with:+ script: |+ const fs = require('fs');+ const path = require('path');++ let results = {};+ try {+ const resultsPath = path.join(process.env.GITHUB_WORKSPACE, 'tests/ui_tests/test-results.json');+ if (fs.existsSync(resultsPath)) {+ results = JSON.parse(fs.readFileSync(resultsPath, 'utf8'));+ }+ } catch (e) {+ console.error('Could not read test results:', e);+ }++ const summary = results.summary || { total: 0, passed: 0, failed: 0 };+ const emoji = summary.failed === 0 ? '✅' : '❌';++ const body = `## ${emoji} Mobile UI Test Results++ **Python ${{ matrix.python-version }}**++ | Status | Count |+ |--------|-------|+ | Total | ${summary.total} |+ | ✅ Passed | ${summary.passed} |+ | ❌ Failed | ${summary.failed} |++ ${summary.failed > 0 ? '### Failed Tests\n' ++ (results.tests || [])+ .filter(t => t.status === 'failed')+ .map(t => `- **${t.name}**: ${t.error}`)+ .join('\n') : ''}++ [View Full Results](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})`;++ github.rest.issues.createComment({+ issue_number: context.issue.number,+ owner: context.repo.owner,+ repo: context.repo.repo,+ body: body+ });diff --git a/src/local_deep_research/web/static/css/mobile-navigation.css b/src/local_deep_research/web/static/css/mobile-navigation.cssnew file mode 100644index 0000000000..ad991f9e50--- /dev/null+++ b/src/local_deep_research/web/static/css/mobile-navigation.css@@ -0,0 +1,457 @@+/**+ * Mobile Navigation Styles+ * Bottom tab bar and sheet menu for mobile devices+ */++/* ========================================+ CSS Variables for Mobile Navigation+ ======================================== */+:root {+ --mobile-nav-height: 56px;+ --mobile-nav-bg: var(--bg-secondary, #0a0a0f);+ --mobile-nav-border: var(--border-color, #333);+ --mobile-nav-active: var(--accent-primary, #6e4ff6);+ --mobile-nav-text: var(--text-secondary, #888);+ --mobile-nav-text-active: var(--accent-primary, #6e4ff6);+ --mobile-sheet-bg: var(--bg-primary, #1e1e2e);+ --mobile-sheet-handle: #444;+ --mobile-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);+}++/* ========================================+ Bottom Navigation Bar+ ======================================== */+.mobile-bottom-nav {+ display: none;+ position: fixed;+ bottom: 0;+ left: 0;+ right: 0;+ height: var(--mobile-nav-height);+ background: var(--mobile-nav-bg);+ border-top: 1px solid var(--mobile-nav-border);+ z-index: 1000;+ transform: translateY(100%);+ transition: transform var(--mobile-transition);++ /* Safe area for iPhone notch/home indicator */+ padding-bottom: env(safe-area-inset-bottom);+}++.mobile-bottom-nav.visible {+ transform: translateY(0);+}++/* Navigation tabs container */+.mobile-bottom-nav {+ display: flex;+ justify-content: space-around;+ align-items: center;+}++/* Individual tab button */+.mobile-nav-tab {+ flex: 1;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ gap: 4px;+ padding: 8px 0;+ background: none;+ border: none;+ color: var(--mobile-nav-text);+ cursor: pointer;+ transition: all 0.2s ease;+ position: relative;+ -webkit-tap-highlight-color: transparent;+ user-select: none;+}++/* Tab hover/focus states */+.mobile-nav-tab:hover,+.mobile-nav-tab:focus {+ background: rgba(110, 79, 246, 0.1);+ outline: none;+}++.mobile-nav-tab:focus-visible {+ outline: 2px solid var(--mobile-nav-active);+ outline-offset: -2px;+}++/* Active tab */+.mobile-nav-tab.active {+ color: var(--mobile-nav-text-active);+}++/* Active indicator bar */+.mobile-nav-tab.active::before {+ content: '';+ position: absolute;+ top: 0;+ left: 20%;+ right: 20%;+ height: 2px;+ background: var(--mobile-nav-active);+ border-radius: 0 0 2px 2px;+}++/* Tab icon */+.mobile-nav-tab i {+ font-size: 20px;+ transition: transform 0.2s ease;+}++.mobile-nav-tab:active i {+ transform: scale(0.9);+}++/* Tab label */+.mobile-nav-label {+ font-size: 10px;+ font-weight: 500;+ letter-spacing: 0.01em;+}++/* ========================================+ Sheet Menu+ ======================================== */+.mobile-sheet-menu {+ position: fixed;+ bottom: 0;+ left: 0;+ right: 0;+ background: var(--mobile-sheet-bg);+ border-radius: 16px 16px 0 0;+ transform: translateY(100%);+ transition: transform var(--mobile-transition);+ z-index: 2000;+ max-height: 85vh;+ display: flex;+ flex-direction: column;+ box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);++ /* Safe area for iPhone */+ padding-bottom: env(safe-area-inset-bottom);+}++.mobile-sheet-menu.active {+ transform: translateY(0);+}++/* Drag handle */+.mobile-sheet-handle {+ width: 36px;+ height: 4px;+ background: var(--mobile-sheet-handle);+ border-radius: 2px;+ margin: 12px auto 8px;+ cursor: grab;+ flex-shrink: 0;+}++.mobile-sheet-handle:active {+ cursor: grabbing;+}++/* Sheet content */+.mobile-sheet-content {+ flex: 1;+ overflow-y: auto;+ overflow-x: hidden;+ padding: 0 0 20px;++ /* Smooth scrolling on iOS */+ -webkit-overflow-scrolling: touch;++ /* Scrollbar styling */+ scrollbar-width: thin;+ scrollbar-color: var(--mobile-sheet-handle) transparent;+}++.mobile-sheet-content::-webkit-scrollbar {+ width: 4px;+}++.mobile-sheet-content::-webkit-scrollbar-track {+ background: transparent;+}++.mobile-sheet-content::-webkit-scrollbar-thumb {+ background: var(--mobile-sheet-handle);+ border-radius: 2px;+}++/* Sheet sections */+.mobile-sheet-section {+ padding: 16px 16px 8px;+ border-bottom: 1px solid var(--mobile-nav-border);+}++.mobile-sheet-section:last-child {+ border-bottom: none;+}++.mobile-sheet-title {+ font-size: 11px;+ font-weight: 600;+ text-transform: uppercase;+ letter-spacing: 0.05em;+ color: var(--mobile-nav-text);+ margin-bottom: 12px;+ padding-left: 4px;+}++/* Sheet items container */+.mobile-sheet-items {+ display: flex;+ flex-direction: column;+ gap: 4px;+}++/* Sheet item button */+.mobile-sheet-item {+ display: flex;+ align-items: center;+ gap: 16px;+ padding: 12px 8px;+ background: none;+ border: none;+ color: var(--text-primary);+ font-size: 14px;+ text-align: left;+ cursor: pointer;+ border-radius: 8px;+ transition: background 0.2s ease;+ -webkit-tap-highlight-color: transparent;+ width: 100%;+}++.mobile-sheet-item:hover,+.mobile-sheet-item:focus {+ background: rgba(110, 79, 246, 0.1);+ outline: none;+}++.mobile-sheet-item:focus-visible {+ outline: 2px solid var(--mobile-nav-active);+ outline-offset: -2px;+}++.mobile-sheet-item:active {+ background: rgba(110, 79, 246, 0.2);+}++/* Sheet item icon */+.mobile-sheet-item i {+ width: 24px;+ font-size: 18px;+ text-align: center;+ color: var(--mobile-nav-text);+}++/* Sheet item label */+.mobile-sheet-label {+ flex: 1;+ font-weight: 400;+}++/* Sheet item badge */+.mobile-sheet-badge {+ background: var(--mobile-nav-active);+ color: white;+ font-size: 10px;+ font-weight: 600;+ padding: 2px 6px;+ border-radius: 10px;+ min-width: 18px;+ text-align: center;+}++/* ========================================+ Overlay+ ======================================== */+.mobile-sheet-overlay {+ position: fixed;+ top: 0;+ left: 0;+ right: 0;+ bottom: 0;+ background: rgba(0, 0, 0, 0.5);+ opacity: 0;+ pointer-events: none;+ transition: opacity var(--mobile-transition);+ z-index: 1999;+}++.mobile-sheet-overlay.active {+ opacity: 1;+ pointer-events: all;+}++/* ========================================+ Responsive Behavior+ ======================================== */++/* Show mobile navigation on small screens */+@media (max-width: 767px) {+ /* Show mobile nav */+ .mobile-bottom-nav {+ display: flex;+ }++ .mobile-bottom-nav.visible {+ display: flex;+ }++ /* Adjust body padding for nav bar */+ body.has-mobile-nav {+ padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));+ }++ /* Hide desktop sidebar completely */+ .sidebar {+ display: none !important;+ }++ /* Adjust main content */+ .main-content {+ margin-left: 0 !important;+ width: 100% !important;+ }++ /* Hide mobile tab bar that was in the template */+ .mobile-tab-bar {+ display: none !important;+ }++ /* Ensure content doesn't go under nav */+ .page.active {+ padding-bottom: calc(var(--mobile-nav-height) + 20px + env(safe-area-inset-bottom));+ }++ /* Adjust top bar */+ .top-bar {+ left: 0 !important;+ }+}++/* Tablet adjustments */+@media (min-width: 768px) and (max-width: 991px) {+ /* Keep sidebar but collapsed */+ .sidebar {+ width: 60px;+ }++ /* Hide mobile navigation */+ .mobile-bottom-nav {+ display: none !important;+ }+}++/* Desktop - ensure mobile nav is hidden */+@media (min-width: 992px) {+ .mobile-bottom-nav,+ .mobile-sheet-menu,+ .mobile-sheet-overlay {+ display: none !important;+ }+}++/* ========================================+ Animations+ ======================================== */++/* Slide up animation for sheet */+@keyframes slideUp {+ from {+ transform: translateY(100%);+ opacity: 0;+ }+ to {+ transform: translateY(0);+ opacity: 1;+ }+}++/* Fade in animation for overlay */+@keyframes fadeIn {+ from {+ opacity: 0;+ }+ to {+ opacity: 1;+ }+}++/* Ripple effect for buttons */+@keyframes ripple {+ 0% {+ transform: scale(0);+ opacity: 1;+ }+ 100% {+ transform: scale(4);+ opacity: 0;+ }+}++/* Add ripple on tap (optional enhancement) */+.mobile-nav-tab::after,+.mobile-sheet-item::after {+ content: '';+ position: absolute;+ top: 50%;+ left: 50%;+ width: 10px;+ height: 10px;+ background: var(--mobile-nav-active);+ border-radius: 50%;+ transform: translate(-50%, -50%) scale(0);+ opacity: 0;+}++.mobile-nav-tab:active::after,+.mobile-sheet-item:active::after {+ animation: ripple 0.6s ease-out;+}++/* ========================================+ Accessibility+ ======================================== */++/* High contrast mode support */+@media (prefers-contrast: high) {+ .mobile-nav-tab.active {+ text-decoration: underline;+ font-weight: bold;+ }++ .mobile-sheet-item:focus {+ outline: 3px solid;+ }+}++/* Reduced motion support */+@media (prefers-reduced-motion: reduce) {+ .mobile-bottom-nav,+ .mobile-sheet-menu,+ .mobile-sheet-overlay,+ .mobile-nav-tab,+ .mobile-sheet-item {+ transition: none !important;+ animation: none !important;+ }+}++/* ========================================+ Dark mode adjustments+ ======================================== */+[data-theme="light"] {+ --mobile-nav-bg: #f5f5f5;+ --mobile-nav-border: #ddd;+ --mobile-nav-text: #666;+ --mobile-sheet-bg: #fff;+ --mobile-sheet-handle: #ccc;+}diff --git a/src/local_deep_research/web/static/css/mobile-ui-fixes.css b/src/local_deep_research/web/static/css/mobile-ui-fixes.cssnew file mode 100644index 0000000000..9c8f5f507f--- /dev/null+++ b/src/local_deep_research/web/static/css/mobile-ui-fixes.css@@ -0,0 +1,355 @@+/**+ * Mobile UI Fixes+ * Addresses UI issues found in comprehensive mobile testing+ */++/* 1. Fix duplicate navigation - hide old nav */+.mobile-tab-bar {+ display: none !important;+}++/* 2. Fix content padding to account for mobile nav */+@media (max-width: 767px) {+ body.has-mobile-nav {+ padding-bottom: 80px; /* Height of mobile nav + safe area */+ }++ .main-content,+ .page.active,+ main {+ padding-bottom: 100px !important; /* Extra padding for content */+ margin-bottom: 0;+ }++ /* Fix for modals and overlays */+ .modal-content,+ .sheet-content {+ max-height: calc(100vh - 160px); /* Account for nav and safe areas */+ overflow-y: auto;+ }+}++/* 3. Fix top bar on mobile */+@media (max-width: 767px) {+ .top-bar {+ padding: 0.5rem;+ font-size: 14px;+ min-height: 50px;+ display: flex;+ align-items: center;+ justify-content: space-between;+ overflow: hidden;+ }++ .top-bar-right {+ flex-shrink: 0;+ margin-left: auto;+ }++ .user-menu {+ display: flex;+ align-items: center;+ gap: 0.5rem;+ max-width: 100%;+ }++ .user-info {+ font-size: 13px;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ max-width: 150px;+ }++ .logout-btn {+ font-size: 13px;+ padding: 0.25rem 0.5rem;+ white-space: nowrap;+ }++ /* Hide icon on very small screens */+ @media (max-width: 380px) {+ .user-info i {+ display: none;+ }+ }+}++/* 4. Fix Settings page horizontal scroll */+@media (max-width: 767px) {+ /* Make tab navigation scrollable */+ .nav-tabs,+ .tab-navigation,+ [role="tablist"] {+ display: flex;+ overflow-x: auto;+ overflow-y: hidden;+ -webkit-overflow-scrolling: touch;+ scrollbar-width: none;+ -ms-overflow-style: none;+ white-space: nowrap;+ gap: 0.5rem;+ padding: 0.5rem;+ margin: 0 -1rem; /* Extend to screen edges */+ padding: 0.5rem 1rem;+ }++ .nav-tabs::-webkit-scrollbar,+ .tab-navigation::-webkit-scrollbar {+ display: none;+ }++ .nav-tabs .nav-link,+ .tab-navigation button,+ .tab-button {+ flex-shrink: 0;+ white-space: nowrap;+ padding: 0.5rem 1rem;+ min-width: fit-content;+ }++ /* Settings content width fix */+ .settings-content,+ .settings-page {+ max-width: 100%;+ overflow-x: hidden;+ }++ .settings-grid {+ display: block;+ }++ /* Fix wide tables */+ table {+ max-width: 100%;+ overflow-x: auto;+ display: block;+ }++ /* Fix code blocks */+ pre, code {+ max-width: 100%;+ overflow-x: auto;+ word-wrap: break-word;+ }+}++/* 5. Increase touch targets to 44px minimum */+@media (max-width: 767px) {+ /* Input fields */+ input[type="text"],+ input[type="email"],+ input[type="password"],+ input[type="search"],+ input[type="number"],+ input[type="tel"],+ input[type="url"],+ textarea,+ select {+ min-height: 44px;+ padding: 10px 12px;+ font-size: 16px; /* Prevent zoom on iOS */+ }++ /* Buttons */+ button,+ .btn,+ a.btn,+ [role="button"] {+ min-height: 44px;+ min-width: 44px;+ padding: 10px 16px;+ font-size: 15px;+ }++ /* Small icon buttons */+ .icon-button,+ .btn-icon {+ width: 44px;+ height: 44px;+ display: inline-flex;+ align-items: center;+ justify-content: center;+ }++ /* Checkboxes and radio buttons */+ input[type="checkbox"],+ input[type="radio"] {+ min-width: 22px;+ min-height: 22px;+ margin: 11px; /* Total 44px touch target */+ }++ /* Links in navigation */+ .mobile-nav-tab {+ min-height: 56px;+ }+}++/* 6. Fix text readability */+@media (max-width: 767px) {+ /* Minimum font sizes */+ body {+ font-size: 14px;+ line-height: 1.5;+ }++ p, span, label {+ font-size: max(14px, 1em);+ }++ small, .text-small {+ font-size: 12px;+ }++ /* Prevent text truncation where possible */+ .truncate-mobile-false {+ white-space: normal;+ overflow: visible;+ text-overflow: clip;+ }+}++/* 7. Fix modal and sheet menu z-index */+.mobile-sheet-menu {+ z-index: 2000 !important;+}++.mobile-sheet-overlay {+ z-index: 1999 !important;+}++.mobile-bottom-nav {+ z-index: 1500 !important;+}++/* 8. Prevent horizontal scroll */+@media (max-width: 767px) {+ html, body {+ overflow-x: hidden;+ max-width: 100%;+ }++ * {+ max-width: 100vw;+ }++ /* Fix containers */+ .container,+ .container-fluid,+ .card,+ .modal-content {+ max-width: 100%;+ padding-left: 1rem;+ padding-right: 1rem;+ }+}++/* 9. Fix News page cards */+@media (max-width: 767px) {+ .news-card,+ .card {+ margin-left: 0;+ margin-right: 0;+ border-radius: 0.5rem;+ }++ .card-grid {+ grid-template-columns: 1fr;+ gap: 1rem;+ padding: 0;+ }+}++/* 10. Fix metrics/charts on mobile */+@media (max-width: 767px) {+ .chart-container,+ canvas {+ max-width: 100%;+ height: auto;+ }++ .metrics-grid {+ grid-template-columns: 1fr;+ }++ .stat-card {+ min-height: auto;+ padding: 1rem;+ }+}++/* 11. Safe area insets for iPhone notch/home indicator */+@supports (padding: max(0px)) {+ .mobile-bottom-nav {+ padding-bottom: max(0px, env(safe-area-inset-bottom));+ }++ body.has-mobile-nav {+ padding-bottom: calc(80px + env(safe-area-inset-bottom));+ }++ .mobile-sheet-menu {+ padding-bottom: max(20px, env(safe-area-inset-bottom));+ }+}++/* 12. Fix form layouts on mobile */+@media (max-width: 767px) {+ .form-row {+ display: block;+ }++ .form-row > * {+ width: 100%;+ margin-bottom: 1rem;+ }++ .form-group {+ margin-bottom: 1.5rem;+ }++ /* Stack form buttons */+ .form-buttons,+ .button-group {+ display: flex;+ flex-direction: column;+ gap: 0.5rem;+ }++ .form-buttons button,+ .button-group button {+ width: 100%;+ }+}++/* 13. Improve mobile navigation visibility */+.mobile-bottom-nav {+ box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);+ border-top: 1px solid var(--border-color);+}++/* 14. Fix research mode selection on mobile */+@media (max-width: 767px) {+ .research-mode-options {+ display: flex;+ flex-direction: column;+ gap: 1rem;+ }++ .research-mode-option {+ min-height: 60px;+ padding: 1rem;+ }+}++/* 15. Loading states and spinners positioning */+@media (max-width: 767px) {+ .loading-overlay {+ bottom: 80px; /* Above mobile nav */+ }++ .toast-container {+ bottom: 90px; /* Above mobile nav */+ }+}diff --git a/src/local_deep_research/web/static/css/styles.css b/src/local_deep_research/web/static/css/styles.cssindex f06ef352d1..f40c043793 100644--- a/src/local_deep_research/web/static/css/styles.css+++ b/src/local_deep_research/web/static/css/styles.css@@ -1236,16 +1236,42 @@ textarea:focus, input[type="text"]:focus {padding-bottom: calc(42vh + 60px); /* Log panel + mobile tab bar */}+ /* Hide sidebar by default on mobile */.sidebar {- width: 0;+ position: fixed;+ top: 0;+ left: 0;+ width: 240px;+ height: 100vh;transform: translateX(-100%);+ transition: transform 0.3s ease-in-out;+ z-index: 1100; /* High z-index to ensure it appears above content */+ background-color: var(--bg-secondary);+ box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);}+ /* Show sidebar when active */.sidebar.active {- width: 240px;transform: translateX(0);}+ /* Overlay/backdrop for mobile sidebar */+ .sidebar-overlay {+ display: none;+ position: fixed;+ top: 0;+ left: 0;+ width: 100%;+ height: 100%;+ background-color: rgba(0, 0, 0, 0.5);+ z-index: 1050;+ transition: opacity 0.3s ease-in-out;+ }++ .sidebar-overlay.active {+ display: block;+ }+/* Restore text in logo when sidebar is active on mobile */.sidebar.active .sidebar-header h2 {font-size: 1.25rem;@@ -1273,6 +1299,19 @@ textarea:focus, input[type="text"]:focus {.mobile-tab-bar {display: flex !important; /* Use !important to ensure it displays */}++ /* Ensure main content doesn't overlap with sidebar */+ .page {+ position: relative;+ z-index: 1;+ }++ /* Ensure forms and inputs are accessible */+ #research-form,+ #query {+ position: relative;+ z-index: 1;+ }}.progress-status {diff --git a/src/local_deep_research/web/static/js/mobile-navigation.js b/src/local_deep_research/web/static/js/mobile-navigation.jsnew file mode 100644index 0000000000..9f0599ecb1--- /dev/null+++ b/src/local_deep_research/web/static/js/mobile-navigation.js@@ -0,0 +1,475 @@+/**+ * Mobile Navigation - Non-module version+ * Provides bottom tab bar and sheet menu for mobile devices+ */++(function() {+ 'use strict';++ class MobileNavigation {+ constructor(options = {}) {+ this.options = {+ breakpoint: 768,+ enableGestures: true,+ persistState: true,+ ...options+ };++ this.state = {+ activeTab: 'research',+ sheetOpen: false,+ isVisible: false+ };++ this.elements = {};+ this.initialized = false;+ }++ init() {+ if (this.initialized) return;++ // Check if we should show mobile nav+ this.checkViewport();++ // Create DOM elements+ this.createNavigation();++ // Attach event listeners+ this.attachEventListeners();++ // Handle resize events+ this.handleResize();++ // Restore saved state if enabled+ if (this.options.persistState) {+ this.restoreState();+ }++ this.initialized = true;+ console.log('Mobile navigation initialized');+ }++ checkViewport() {+ this.state.isVisible = window.innerWidth <= this.options.breakpoint;+ return this.state.isVisible;+ }++ createNavigation() {+ // Don't create if already exists+ if (document.querySelector('.mobile-bottom-nav')) {+ this.elements.nav = document.querySelector('.mobile-bottom-nav');+ this.elements.sheet = document.querySelector('.mobile-sheet-menu');+ this.elements.overlay = document.querySelector('.mobile-sheet-overlay');+ return;+ }++ // Create bottom navigation+ this.createBottomNav();++ // Create sheet menu+ this.createSheetMenu();++ // Create overlay+ this.createOverlay();++ // Append to body+ document.body.appendChild(this.elements.nav);+ document.body.appendChild(this.elements.overlay);+ document.body.appendChild(this.elements.sheet);++ // Show if mobile+ if (this.state.isVisible) {+ this.toggle(true);+ }+ }++ createBottomNav() {+ const nav = document.createElement('nav');+ nav.className = 'mobile-bottom-nav';+ nav.setAttribute('role', 'navigation');+ nav.setAttribute('aria-label', 'Mobile navigation');++ const tabs = [+ { id: 'research', icon: 'fas fa-search', label: 'Research', path: '/' },+ { id: 'history', icon: 'fas fa-history', label: 'History', path: '/history/' },+ { id: 'metrics', icon: 'fas fa-chart-bar', label: 'Metrics', path: '/metrics/' },+ { id: 'news', icon: 'fas fa-newspaper', label: 'News', path: '/news/' },+ { id: 'more', icon: 'fas fa-bars', label: 'More', action: 'sheet' }+ ];++ nav.innerHTML = tabs.map(tab => `+ <button class="mobile-nav-tab ${this.isCurrentPage(tab) ? 'active' : ''}"+ data-tab-id="${tab.id}"+ data-action="${tab.action || 'navigate'}"+ data-path="${tab.path || ''}"+ role="tab"+ aria-selected="${this.isCurrentPage(tab) ? 'true' : 'false'}"+ aria-label="${tab.label}">+ <i class="${tab.icon}"></i>+ <span class="mobile-nav-label">${tab.label}</span>+ </button>+ `).join('');++ this.elements.nav = nav;+ }++ createSheetMenu() {+ const sheet = document.createElement('div');+ sheet.className = 'mobile-sheet-menu';+ sheet.setAttribute('role', 'dialog');+ sheet.setAttribute('aria-label', 'More options menu');+ sheet.setAttribute('aria-hidden', 'true');++ const username = this.getUsername();++ sheet.innerHTML = `+ <div class="mobile-sheet-handle" aria-label="Drag to dismiss"></div>++ <div class="mobile-sheet-content">+ <!-- User Section -->+ <div class="mobile-sheet-section">+ <h3 class="mobile-sheet-title">Account</h3>+ <div class="mobile-sheet-items">+ <button class="mobile-sheet-item" data-item-id="user" data-action="#">+ <i class="fas fa-user"></i>+ <span class="mobile-sheet-label">${username}</span>+ </button>+ <button class="mobile-sheet-item" data-item-id="settings" data-action="/settings/">+ <i class="fas fa-cog"></i>+ <span class="mobile-sheet-label">Settings</span>+ </button>+ <button class="mobile-sheet-item" data-item-id="logout" data-action="#logout">+ <i class="fas fa-sign-out-alt"></i>+ <span class="mobile-sheet-label">Logout</span>+ </button>+ </div>+ </div>++ <!-- Features Section -->+ <div class="mobile-sheet-section">+ <h3 class="mobile-sheet-title">Features</h3>+ <div class="mobile-sheet-items">+ <button class="mobile-sheet-item" data-item-id="subscriptions" data-action="/subscriptions/">+ <i class="fas fa-bell"></i>+ <span class="mobile-sheet-label">Subscriptions</span>+ </button>+ <button class="mobile-sheet-item" data-item-id="benchmark" data-action="/benchmark/">+ <i class="fas fa-tachometer-alt"></i>+ <span class="mobile-sheet-label">Benchmark</span>+ </button>+ <button class="mobile-sheet-item" data-item-id="benchmark-results" data-action="/benchmark/results/">+ <i class="fas fa-chart-line"></i>+ <span class="mobile-sheet-label">Benchmark Results</span>+ </button>+ </div>+ </div>++ <!-- Help Section -->+ <div class="mobile-sheet-section">+ <h3 class="mobile-sheet-title">Help & Info</h3>+ <div class="mobile-sheet-items">+ <button class="mobile-sheet-item" data-item-id="help" data-action="#help">+ <i class="fas fa-question-circle"></i>+ <span class="mobile-sheet-label">Help</span>+ </button>+ <button class="mobile-sheet-item" data-item-id="about" data-action="#about">+ <i class="fas fa-info-circle"></i>+ <span class="mobile-sheet-label">About</span>+ </button>+ </div>+ </div>+ </div>+ `;++ this.elements.sheet = sheet;+ }++ createOverlay() {+ const overlay = document.createElement('div');+ overlay.className = 'mobile-sheet-overlay';+ overlay.setAttribute('aria-hidden', 'true');+ this.elements.overlay = overlay;+ }++ attachEventListeners() {+ // Tab navigation+ if (this.elements.nav) {+ this.elements.nav.addEventListener('click', (e) => {+ const tab = e.target.closest('.mobile-nav-tab');+ if (!tab) return;++ const action = tab.dataset.action;+ const tabId = tab.dataset.tabId;++ if (action === 'sheet') {+ this.toggleSheet();+ } else {+ this.navigateToTab(tab.dataset.path);+ this.setActiveTab(tabId);+ }+ });+ }++ // Sheet menu items+ if (this.elements.sheet) {+ this.elements.sheet.addEventListener('click', (e) => {+ const item = e.target.closest('.mobile-sheet-item');+ if (!item) return;++ this.handleSheetItem(item.dataset.action, item.dataset.itemId);+ });+ }++ // Overlay click to close+ if (this.elements.overlay) {+ this.elements.overlay.addEventListener('click', () => {+ this.closeSheet();+ });+ }++ // Touch gestures for sheet+ if (this.options.enableGestures) {+ this.attachGestures();+ }+ }++ attachGestures() {+ if (!this.elements.sheet) return;++ let startY = 0;+ let currentY = 0;+ let isDragging = false;++ const handle = this.elements.sheet.querySelector('.mobile-sheet-handle');++ const handleTouchStart = (e) => {+ startY = e.touches[0].clientY;+ isDragging = true;+ this.elements.sheet.style.transition = 'none';+ };++ const handleTouchMove = (e) => {+ if (!isDragging) return;++ currentY = e.touches[0].clientY;+ const deltaY = currentY - startY;++ if (deltaY > 0) {+ this.elements.sheet.style.transform = `translateY(${deltaY}px)`;+ }+ };++ const handleTouchEnd = () => {+ if (!isDragging) return;++ isDragging = false;+ this.elements.sheet.style.transition = '';++ const deltaY = currentY - startY;+ const threshold = Math.min(100, this.elements.sheet.offsetHeight * 0.2);++ if (deltaY > threshold) {+ this.closeSheet();+ } else {+ this.elements.sheet.style.transform = '';+ }+ };++ if (handle) {+ handle.addEventListener('touchstart', handleTouchStart, { passive: true });+ handle.addEventListener('touchmove', handleTouchMove, { passive: true });+ handle.addEventListener('touchend', handleTouchEnd, { passive: true });+ }+ }++ handleResize() {+ let resizeTimer;++ window.addEventListener('resize', () => {+ clearTimeout(resizeTimer);+ resizeTimer = setTimeout(() => {+ const wasVisible = this.state.isVisible;+ this.checkViewport();++ if (wasVisible !== this.state.isVisible) {+ this.toggle(this.state.isVisible);++ if (!this.state.isVisible && this.state.sheetOpen) {+ this.closeSheet();+ }+ }+ }, 250);+ });+ }++ toggle(show) {+ if (show) {+ if (this.elements.nav) {+ this.elements.nav.classList.add('visible');+ }+ document.body.classList.add('has-mobile-nav');+ } else {+ if (this.elements.nav) {+ this.elements.nav.classList.remove('visible');+ }+ document.body.classList.remove('has-mobile-nav');+ }+ }++ navigateToTab(path) {+ if (path && path !== '#') {+ window.location.href = path;+ }+ }++ setActiveTab(tabId) {+ if (this.elements.nav) {+ this.elements.nav.querySelectorAll('.mobile-nav-tab').forEach(tab => {+ tab.classList.remove('active');+ tab.setAttribute('aria-selected', 'false');+ });++ const activeTab = this.elements.nav.querySelector(`[data-tab-id="${tabId}"]`);+ if (activeTab) {+ activeTab.classList.add('active');+ activeTab.setAttribute('aria-selected', 'true');+ }+ }++ this.state.activeTab = tabId;+ this.saveState();+ }++ toggleSheet() {+ if (this.state.sheetOpen) {+ this.closeSheet();+ } else {+ this.openSheet();+ }+ }++ openSheet() {+ if (this.elements.sheet) {+ this.elements.sheet.classList.add('active');+ this.elements.sheet.setAttribute('aria-hidden', 'false');+ }+ if (this.elements.overlay) {+ this.elements.overlay.classList.add('active');+ this.elements.overlay.setAttribute('aria-hidden', 'false');+ }++ document.body.style.overflow = 'hidden';+ this.state.sheetOpen = true;+ }++ closeSheet() {+ if (this.elements.sheet) {+ this.elements.sheet.classList.remove('active');+ this.elements.sheet.setAttribute('aria-hidden', 'true');+ this.elements.sheet.style.transform = '';+ }+ if (this.elements.overlay) {+ this.elements.overlay.classList.remove('active');+ this.elements.overlay.setAttribute('aria-hidden', 'true');+ }++ document.body.style.overflow = '';+ this.state.sheetOpen = false;+ }++ handleSheetItem(action, itemId) {+ this.closeSheet();++ if (action === '#logout') {+ this.handleLogout();+ } else if (action === '#help') {+ alert('Help documentation coming soon!');+ } else if (action === '#about') {+ alert('Local Deep Research - Mobile Navigation v1.0');+ } else if (action && !action.startsWith('#')) {+ window.location.href = action;+ }+ }++ handleLogout() {+ const logoutForm = document.getElementById('logout-form');+ if (logoutForm) {+ logoutForm.submit();+ }+ }++ getUsername() {+ const userInfo = document.querySelector('.user-info');+ if (userInfo) {+ const text = userInfo.textContent || '';+ return text.trim().replace(/[^\w\s@._-]/g, '').trim() || 'User';+ }+ return 'User';+ }++ isCurrentPage(tab) {+ const currentPath = window.location.pathname;++ if (tab.id === 'research' && currentPath === '/') return true;+ if (tab.id === 'history' && currentPath.startsWith('/history')) return true;+ if (tab.id === 'metrics' && currentPath.startsWith('/metrics')) return true;+ if (tab.id === 'news' && currentPath.startsWith('/news')) return true;++ return false;+ }++ saveState() {+ if (!this.options.persistState) return;++ try {+ localStorage.setItem('mobileNavState', JSON.stringify({+ activeTab: this.state.activeTab+ }));+ } catch (e) {+ console.error('Failed to save mobile nav state:', e);+ }+ }++ restoreState() {+ if (!this.options.persistState) return;++ try {+ const saved = localStorage.getItem('mobileNavState');+ if (saved) {+ const state = JSON.parse(saved);+ if (state.activeTab) {+ this.setActiveTab(state.activeTab);+ }+ }+ } catch (e) {+ console.error('Failed to restore mobile nav state:', e);+ }+ }++ destroy() {+ if (this.elements.nav) this.elements.nav.remove();+ if (this.elements.sheet) this.elements.sheet.remove();+ if (this.elements.overlay) this.elements.overlay.remove();+ document.body.classList.remove('has-mobile-nav');+ this.initialized = false;+ }+ }++ // Initialize when DOM is ready+ function initMobileNav() {+ if (window.mobileNav) {+ window.mobileNav.destroy();+ }+ window.mobileNav = new MobileNavigation();+ window.mobileNav.init();+ }++ if (document.readyState === 'loading') {+ document.addEventListener('DOMContentLoaded', initMobileNav);+ } else {+ initMobileNav();+ }++ // Expose to global scope for debugging+ window.MobileNavigation = MobileNavigation;+})();diff --git a/src/local_deep_research/web/templates/base.html b/src/local_deep_research/web/templates/base.htmlindex af9f1c8609..fdd32bb5f5 100644--- a/src/local_deep_research/web/templates/base.html+++ b/src/local_deep_research/web/templates/base.html@@ -13,6 +13,8 @@<!-- Keep local styles that aren't in npm packages --><link rel="stylesheet" href="/static/css/styles.css">+ <link rel="stylesheet" href="/static/css/mobile-navigation.css">+ <link rel="stylesheet" href="/static/css/mobile-ui-fixes.css">{% block extra_head %}{% endblock %}</head><body>@@ -104,5 +106,8 @@</script><script src="/static/js/components/settings_sync.js"></script>++ <!-- Mobile Navigation -->+ <script src="/static/js/mobile-navigation.js"></script></body></html>diff --git a/src/local_deep_research/web/templates/components/mobile_nav.html b/src/local_deep_research/web/templates/components/mobile_nav.htmlindex d0f0ac1132..fdd856f57e 100644--- a/src/local_deep_research/web/templates/components/mobile_nav.html+++ b/src/local_deep_research/web/templates/components/mobile_nav.html@@ -1,34 +1 @@-<nav class="mobile-tab-bar">- <ul>- <li {% if active_page == 'new-research' %}class="active"{% endif %} data-page="new-research">- <a href="/">- <i class="fas fa-search"></i>- <span>Research</span>- </a>- </li>- <li {% if active_page == 'history' %}class="active"{% endif %} data-page="history">- <a href="{{ url_for('history.history_page') }}">- <i class="fas fa-history"></i>- <span>History</span>- </a>- </li>- <li {% if active_page == 'news' %}class="active"{% endif %} data-page="news">- <a href="{{ url_for('news.news_page') }}">- <i class="fas fa-newspaper"></i>- <span>News</span>- </a>- </li>- <li {% if active_page == 'subscriptions' %}class="active"{% endif %} data-page="subscriptions">- <a href="{{ url_for('news.subscriptions_page') }}">- <i class="fas fa-bell"></i>- <span>Subscriptions</span>- </a>- </li>- <li {% if active_page == 'settings' %}class="active"{% endif %} data-page="settings">- <a href="{{ url_for('settings.settings_page') }}">- <i class="fas fa-cog"></i>- <span>Settings</span>- </a>- </li>- </ul>-</nav>+<!-- Old mobile navigation removed - using new dynamic mobile-navigation.js instead -->diff --git a/tests/ui_tests/mobile/README.md b/tests/ui_tests/mobile/README.mdnew file mode 100644index 0000000000..16df359083--- /dev/null+++ b/tests/ui_tests/mobile/README.md@@ -0,0 +1,40 @@+# Mobile UI Tests++Tests for mobile navigation and UI responsiveness. Fixes Issue #667 (sidebar overlap on mobile).++## Quick Start++```bash+# Install dependencies+npm install++# Run mobile navigation tests (CI/CD ready)+npm run test:mobile++# Generate screenshots for all pages+npm run test:mobile:screenshots++# Run comprehensive UI tests+node test_mobile_ui_comprehensive.js+```++## Available Test Scripts++See `package.json` for all test commands:+- `test:mobile` - Run CI/CD tests with assertions+- `test:mobile:visual` - Run tests with browser visible+- `test:mobile:json` - Output JSON results+- `test:mobile:junit` - Output JUnit XML for CI/CD+- `test:mobile:screenshots` - Generate visual screenshots++## CI/CD++GitHub Actions workflow: `.github/workflows/mobile-ui-tests.yml`++## What's Tested++- ✅ Mobile navigation visibility (< 768px)+- ✅ No sidebar overlap with inputs (Issue #667)+- ✅ Touch targets minimum 44px+- ✅ No horizontal scrolling+- ✅ Content not hidden behind navdiff --git a/tests/ui_tests/mobile/test_mobile_nav_all_pages.js b/tests/ui_tests/mobile/test_mobile_nav_all_pages.jsnew file mode 100644index 0000000000..e2ad340bec--- /dev/null+++ b/tests/ui_tests/mobile/test_mobile_nav_all_pages.js@@ -0,0 +1,410 @@+/**+ * Comprehensive Mobile Navigation Test - All Pages+ * Captures screenshots of every page with the new mobile navigation+ */++const puppeteer = require('puppeteer');+const AuthHelper = require('../auth_helper');+const path = require('path');+const fs = require('fs').promises;++// Test devices+const DEVICES = {+ 'iPhone_14_Pro_Max': {+ width: 430,+ height: 932,+ deviceScaleFactor: 3,+ isMobile: true,+ hasTouch: true,+ userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15'+ },+ 'iPhone_SE': {+ width: 375,+ height: 667,+ deviceScaleFactor: 2,+ isMobile: true,+ hasTouch: true+ },+ 'iPad_Mini': {+ width: 768,+ height: 1024,+ deviceScaleFactor: 2,+ isMobile: true,+ hasTouch: true+ }+};++// All pages to test+const PAGES_TO_TEST = [+ // Auth pages (no login required)+ { path: '/auth/login', name: 'Login', requiresAuth: false },+ { path: '/auth/register', name: 'Register', requiresAuth: false },++ // Main pages (login required)+ { path: '/', name: 'Research_Home', requiresAuth: true },+ { path: '/history/', name: 'History', requiresAuth: true },+ { path: '/news/', name: 'News', requiresAuth: true },+ { path: '/subscriptions/', name: 'Subscriptions', requiresAuth: true },+ { path: '/benchmark/', name: 'Benchmark', requiresAuth: true },+ { path: '/benchmark/results/', name: 'Benchmark_Results', requiresAuth: true },+ { path: '/metrics/', name: 'Metrics', requiresAuth: true },+ { path: '/settings/', name: 'Settings', requiresAuth: true },+];++async function testAllPages() {+ const baseUrl = process.env.TEST_BASE_URL || 'http://127.0.0.1:5000';+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5);+ const screenshotDir = path.join(__dirname, 'screenshots', 'mobile-nav-complete', timestamp);++ console.log('🚀 Comprehensive Mobile Navigation Test - All Pages');+ console.log('=' .repeat(60));+ console.log(`📁 Screenshots will be saved to:`);+ console.log(` ${screenshotDir}`);+ console.log('=' .repeat(60));++ // Create screenshot directory+ await fs.mkdir(screenshotDir, { recursive: true });++ let browser;+ const results = {+ total: 0,+ success: 0,+ failed: 0,+ screenshots: []+ };++ try {+ // Check if server is running+ console.log('\n🔍 Checking server status...');+ try {+ const testFetch = await fetch(baseUrl);+ console.log('✅ Server is running\n');+ } catch (error) {+ console.error('❌ Server is not running at', baseUrl);+ console.error(' Please start the server and try again');+ return;+ }++ browser = await puppeteer.launch({+ headless: process.env.HEADLESS !== 'false',+ args: ['--no-sandbox', '--disable-setuid-sandbox']+ });++ // Test each device+ for (const [deviceName, viewport] of Object.entries(DEVICES)) {+ console.log(`\n📱 Testing ${deviceName} (${viewport.width}x${viewport.height})`);+ console.log('═'.repeat(50));++ const deviceDir = path.join(screenshotDir, deviceName);+ await fs.mkdir(deviceDir, { recursive: true });++ const page = await browser.newPage();+ await page.setViewport(viewport);++ const authHelper = new AuthHelper(page, baseUrl);+ let isAuthenticated = false;++ try {+ // Test unauthenticated pages first+ for (const pageInfo of PAGES_TO_TEST.filter(p => !p.requiresAuth)) {+ results.total++;+ console.log(` 📄 ${pageInfo.name}...`);++ try {+ await page.goto(baseUrl + pageInfo.path, {+ waitUntil: 'networkidle2',+ timeout: 30000+ });++ // Wait for any animations+ await new Promise(resolve => setTimeout(resolve, 1000));++ // Capture page info+ const pageAnalysis = await page.evaluate(() => {+ const getMobileNavInfo = () => {+ const nav = document.querySelector('.mobile-bottom-nav');+ const sheet = document.querySelector('.mobile-sheet-menu');+ const tabBar = document.querySelector('.mobile-tab-bar');+ const sidebar = document.querySelector('.sidebar');++ return {+ hasMobileNav: !!nav,+ navVisible: nav ? window.getComputedStyle(nav).display !== 'none' : false,+ hasSheet: !!sheet,+ hasOldTabBar: !!tabBar,+ sidebarHidden: sidebar ?+ window.getComputedStyle(sidebar).display === 'none' ||+ window.getComputedStyle(sidebar).transform.includes('translateX') : true,+ bodyClass: document.body.className+ };+ };++ return {+ title: document.title,+ url: window.location.href,+ viewport: {+ width: window.innerWidth,+ height: window.innerHeight+ },+ mobileNav: getMobileNavInfo()+ };+ });++ // Take screenshot+ const screenshotPath = path.join(deviceDir, `${pageInfo.name}.png`);+ await page.screenshot({+ path: screenshotPath,+ fullPage: false+ });++ console.log(` ✅ Screenshot saved`);+ console.log(` 📊 Mobile nav: ${pageAnalysis.mobileNav.hasMobileNav ? 'Yes' : 'No'}, ` ++ `Visible: ${pageAnalysis.mobileNav.navVisible ? 'Yes' : 'No'}, ` ++ `Sidebar hidden: ${pageAnalysis.mobileNav.sidebarHidden ? 'Yes' : 'No'}`);++ results.success++;+ results.screenshots.push({+ device: deviceName,+ page: pageInfo.name,+ path: screenshotPath,+ analysis: pageAnalysis+ });++ } catch (error) {+ console.log(` ❌ Failed: ${error.message}`);+ results.failed++;+ }+ }++ // Now authenticate and test protected pages+ console.log(` 🔐 Authenticating...`);+ await authHelper.ensureAuthenticated();+ isAuthenticated = true;+ console.log(` ✅ Authenticated`);++ // Test authenticated pages+ for (const pageInfo of PAGES_TO_TEST.filter(p => p.requiresAuth)) {+ results.total++;+ console.log(` 📄 ${pageInfo.name}...`);++ try {+ await page.goto(baseUrl + pageInfo.path, {+ waitUntil: 'networkidle2',+ timeout: 30000+ });++ // Wait for any animations+ await new Promise(resolve => setTimeout(resolve, 1000));++ // Analyze page+ const pageAnalysis = await page.evaluate(() => {+ const getMobileNavInfo = () => {+ const nav = document.querySelector('.mobile-bottom-nav');+ const sheet = document.querySelector('.mobile-sheet-menu');+ const tabBar = document.querySelector('.mobile-tab-bar');+ const sidebar = document.querySelector('.sidebar');++ return {+ hasMobileNav: !!nav,+ navVisible: nav ? window.getComputedStyle(nav).display !== 'none' : false,+ hasSheet: !!sheet,+ hasOldTabBar: !!tabBar,+ sidebarHidden: sidebar ?+ window.getComputedStyle(sidebar).display === 'none' ||+ window.getComputedStyle(sidebar).transform.includes('translateX') : true,+ bodyClass: document.body.className+ };+ };++ return {+ title: document.title,+ url: window.location.href,+ viewport: {+ width: window.innerWidth,+ height: window.innerHeight+ },+ mobileNav: getMobileNavInfo()+ };+ });++ // Take screenshot+ const screenshotPath = path.join(deviceDir, `${pageInfo.name}.png`);+ await page.screenshot({+ path: screenshotPath,+ fullPage: false+ });++ console.log(` ✅ Screenshot saved`);+ console.log(` 📊 Mobile nav: ${pageAnalysis.mobileNav.hasMobileNav ? 'Yes' : 'No'}, ` ++ `Visible: ${pageAnalysis.mobileNav.navVisible ? 'Yes' : 'No'}, ` ++ `Sidebar hidden: ${pageAnalysis.mobileNav.sidebarHidden ? 'Yes' : 'No'}`);++ results.success++;+ results.screenshots.push({+ device: deviceName,+ page: pageInfo.name,+ path: screenshotPath,+ analysis: pageAnalysis+ });++ } catch (error) {+ console.log(` ❌ Failed: ${error.message}`);+ results.failed++;+ }+ }++ // Test sheet menu if mobile nav exists+ if (viewport.width <= 767) {+ console.log(` 🎯 Testing sheet menu...`);++ try {+ // Go back to home+ await page.goto(baseUrl, { waitUntil: 'networkidle2' });++ // Try to open sheet menu+ const sheetOpened = await page.evaluate(() => {+ const moreBtn = document.querySelector('.mobile-nav-tab[data-tab-id="more"]');+ if (moreBtn) {+ moreBtn.click();+ return true;+ }+ return false;+ });++ if (sheetOpened) {+ await new Promise(resolve => setTimeout(resolve, 500));++ // Take screenshot with sheet open+ const sheetScreenshotPath = path.join(deviceDir, 'Sheet_Menu_Open.png');+ await page.screenshot({+ path: sheetScreenshotPath,+ fullPage: false+ });++ console.log(` ✅ Sheet menu screenshot saved`);+ results.screenshots.push({+ device: deviceName,+ page: 'Sheet_Menu_Open',+ path: sheetScreenshotPath+ });+ }+ } catch (error) {+ console.log(` ⚠️ Could not test sheet menu: ${error.message}`);+ }+ }++ } catch (error) {+ console.error(` ❌ Device test failed: ${error.message}`);+ } finally {+ await page.close();+ }+ }++ // Generate summary report+ console.log('\n' + '═'.repeat(60));+ console.log('📊 TEST SUMMARY');+ console.log('═'.repeat(60));+ console.log(`Total pages tested: ${results.total}`);+ console.log(`Successful: ${results.success}`);+ console.log(`Failed: ${results.failed}`);+ console.log(`\n📁 Screenshots saved to:`);+ console.log(` ${screenshotDir}`);++ // Create an index HTML file for easy viewing+ const indexHtml = `<!DOCTYPE html>+<html>+<head>+ <title>Mobile Navigation Screenshots - ${timestamp}</title>+ <style>+ body {+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;+ background: #1a1a2e;+ color: #fff;+ padding: 20px;+ }+ h1 { color: #6e4ff6; }+ .device-section {+ margin: 40px 0;+ padding: 20px;+ background: #0f0f1e;+ border-radius: 10px;+ }+ .screenshots {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));+ gap: 20px;+ margin-top: 20px;+ }+ .screenshot {+ background: #2a2a3e;+ border-radius: 8px;+ padding: 10px;+ text-align: center;+ }+ .screenshot img {+ max-width: 100%;+ border-radius: 4px;+ border: 1px solid #333;+ }+ .screenshot h3 {+ margin: 10px 0 5px;+ color: #6e4ff6;+ font-size: 14px;+ }+ .info {+ font-size: 12px;+ color: #888;+ margin-top: 10px;+ }+ </style>+</head>+<body>+ <h1>Mobile Navigation Test Results</h1>+ <p>Generated: ${new Date().toLocaleString()}</p>+ ${Object.keys(DEVICES).map(device => `+ <div class="device-section">+ <h2>${device} (${DEVICES[device].width}x${DEVICES[device].height})</h2>+ <div class="screenshots">+ ${results.screenshots+ .filter(s => s.device === device)+ .map(s => `+ <div class="screenshot">+ <h3>${s.page.replace(/_/g, ' ')}</h3>+ <img src="${device}/${s.page}.png" alt="${s.page}">+ ${s.analysis ? `+ <div class="info">+ Nav: ${s.analysis.mobileNav.hasMobileNav ? '✅' : '❌'} |+ Visible: ${s.analysis.mobileNav.navVisible ? '✅' : '❌'} |+ Sidebar Hidden: ${s.analysis.mobileNav.sidebarHidden ? '✅' : '❌'}+ </div>+ ` : ''}+ </div>+ `).join('')}+ </div>+ </div>+ `).join('')}+</body>+</html>`;++ const indexPath = path.join(screenshotDir, 'index.html');+ await fs.writeFile(indexPath, indexHtml);++ console.log(`\n🌐 View all screenshots in browser:`);+ console.log(` file://${indexPath}`);++ } catch (error) {+ console.error('❌ Test failed:', error);+ process.exitCode = 1;+ } finally {+ if (browser) {+ await browser.close();+ }+ }+}++// Run if executed directly+if (require.main === module) {+ testAllPages();+}++module.exports = { testAllPages };diff --git a/tests/ui_tests/mobile/test_mobile_navigation_authenticated.js b/tests/ui_tests/mobile/test_mobile_navigation_authenticated.jsnew file mode 100644index 0000000000..6b5bd5011a--- /dev/null+++ b/tests/ui_tests/mobile/test_mobile_navigation_authenticated.js@@ -0,0 +1,97 @@+#!/usr/bin/env node+/**+ * Test mobile navigation on authenticated pages+ */++const puppeteer = require('puppeteer');+const AuthHelper = require('../auth_helper');++async function testAuthenticatedPages() {+ const baseUrl = 'http://127.0.0.1:5000';+ let browser;++ try {+ browser = await puppeteer.launch({+ headless: process.env.HEADLESS !== 'false',+ args: ['--no-sandbox', '--disable-setuid-sandbox']+ });++ const page = await browser.newPage();+ await page.setViewport({+ width: 430,+ height: 932,+ isMobile: true,+ hasTouch: true+ });++ // Authenticate first+ const authHelper = new AuthHelper(page, baseUrl);+ await authHelper.ensureAuthenticated();+ console.log('✅ Authenticated');++ // Test pages+ const pages = [+ { path: '/', name: 'Research' },+ { path: '/history/', name: 'History' },+ { path: '/news/', name: 'News' },+ { path: '/settings/', name: 'Settings' }+ ];++ for (const pageInfo of pages) {+ console.log(`\nTesting ${pageInfo.name}...`);+ await page.goto(baseUrl + pageInfo.path, {+ waitUntil: 'networkidle2',+ timeout: 30000+ });++ // Check for mobile navigation+ const mobileNavInfo = await page.evaluate(() => {+ const oldNav = document.querySelector('.mobile-tab-bar');+ const newNav = document.querySelector('.mobile-bottom-nav');+ const sidebar = document.querySelector('.sidebar');++ // Check what's in the DOM+ const allNavElements = document.querySelectorAll('[class*="mobile"]');+ const navClasses = Array.from(allNavElements).map(el => el.className);++ return {+ hasOldNav: !!oldNav,+ hasNewNav: !!newNav,+ sidebarVisible: sidebar ? window.getComputedStyle(sidebar).display !== 'none' : false,+ url: window.location.href,+ title: document.title,+ mobileElements: navClasses,+ bodyClasses: document.body.className+ };+ });++ console.log(' URL:', mobileNavInfo.url);+ console.log(' Old Nav (.mobile-tab-bar):', mobileNavInfo.hasOldNav ? 'YES' : 'NO');+ console.log(' New Nav (.mobile-bottom-nav):', mobileNavInfo.hasNewNav ? 'YES' : 'NO');+ console.log(' Sidebar visible:', mobileNavInfo.sidebarVisible ? 'YES' : 'NO');+ console.log(' Body classes:', mobileNavInfo.bodyClasses);+ if (mobileNavInfo.mobileElements.length > 0) {+ console.log(' Mobile elements found:', mobileNavInfo.mobileElements);+ }++ // Take screenshot+ const screenshotPath = `./test-${pageInfo.name.toLowerCase()}-mobile.png`;+ await page.screenshot({ path: screenshotPath });+ console.log(' Screenshot:', screenshotPath);+ }++ console.log('\n✅ Test complete');++ } catch (error) {+ console.error('❌ Test failed:', error);+ process.exit(1);+ } finally {+ if (browser) {+ await browser.close();+ }+ }+}++if (require.main === module) {+ testAuthenticatedPages();+}diff --git a/tests/ui_tests/mobile/test_mobile_navigation_ci.js b/tests/ui_tests/mobile/test_mobile_navigation_ci.jsnew file mode 100644index 0000000000..b9c181c490--- /dev/null+++ b/tests/ui_tests/mobile/test_mobile_navigation_ci.js@@ -0,0 +1,489 @@+#!/usr/bin/env node+/**+ * Mobile Navigation CI/CD Test Suite+ * Programmatic tests with assertions for automated testing+ */++const puppeteer = require('puppeteer');+const path = require('path');+const fs = require('fs').promises;++// Test configuration+const TEST_CONFIG = {+ baseUrl: process.env.TEST_BASE_URL || 'http://127.0.0.1:5000',+ headless: process.env.HEADLESS !== 'false',+ timeout: 30000,+ screenshotOnFailure: process.env.SCREENSHOT_ON_FAILURE !== 'false',+ outputFormat: process.env.OUTPUT_FORMAT || 'json', // json, junit, console+};++// Test devices+const DEVICES = {+ 'iPhone_14_Pro_Max': {+ width: 430,+ height: 932,+ deviceScaleFactor: 3,+ isMobile: true,+ hasTouch: true,+ },+ 'iPhone_SE': {+ width: 375,+ height: 667,+ deviceScaleFactor: 2,+ isMobile: true,+ hasTouch: true+ },+ 'iPad_Mini': {+ width: 768,+ height: 1024,+ deviceScaleFactor: 2,+ isMobile: true,+ hasTouch: true+ },+ 'Desktop': {+ width: 1920,+ height: 1080,+ deviceScaleFactor: 1,+ isMobile: false,+ hasTouch: false+ }+};++// Test results storage+class TestResults {+ constructor() {+ this.startTime = new Date();+ this.tests = [];+ this.summary = {+ total: 0,+ passed: 0,+ failed: 0,+ skipped: 0+ };+ }++ addTest(test) {+ this.tests.push(test);+ this.summary.total++;+ this.summary[test.status]++;+ }++ getJUnit() {+ const duration = (new Date() - this.startTime) / 1000;+ let xml = `<?xml version="1.0" encoding="UTF-8"?>\n`;+ xml += `<testsuites name="Mobile Navigation Tests" tests="${this.summary.total}" failures="${this.summary.failed}" time="${duration}">\n`;+ xml += ` <testsuite name="Mobile Navigation" tests="${this.summary.total}" failures="${this.summary.failed}" time="${duration}">\n`;++ for (const test of this.tests) {+ xml += ` <testcase classname="${test.suite}" name="${test.name}" time="${test.duration || 0}">\n`;+ if (test.status === 'failed') {+ xml += ` <failure message="${this.escapeXml(test.error || 'Test failed')}">\n`;+ xml += ` ${this.escapeXml(test.details || '')}\n`;+ xml += ` </failure>\n`;+ }+ xml += ` </testcase>\n`;+ }++ xml += ` </testsuite>\n`;+ xml += `</testsuites>`;+ return xml;+ }++ escapeXml(str) {+ return str.replace(/[<>&'"]/g, (c) => {+ switch (c) {+ case '<': return '<';+ case '>': return '>';+ case '&': return '&';+ case '\'': return ''';+ case '"': return '"';+ }+ });+ }++ getJSON() {+ return {+ startTime: this.startTime,+ endTime: new Date(),+ duration: (new Date() - this.startTime) / 1000,+ summary: this.summary,+ tests: this.tests+ };+ }+}++// Test assertions+class MobileNavAssertions {+ static async assertMobileNavExists(page, device) {+ const navElement = await page.$('.mobile-bottom-nav');+ if (!navElement) {+ throw new Error(`Mobile navigation not found on ${device}`);+ }+ return true;+ }++ static async assertMobileNavVisible(page, device, shouldBeVisible) {+ const isVisible = await page.evaluate(() => {+ const nav = document.querySelector('.mobile-bottom-nav');+ if (!nav) return false;+ const style = window.getComputedStyle(nav);+ return style.display !== 'none' && nav.classList.contains('visible');+ });++ if (isVisible !== shouldBeVisible) {+ throw new Error(`Mobile nav visibility mismatch on ${device}. Expected: ${shouldBeVisible}, Got: ${isVisible}`);+ }+ return true;+ }++ static async assertSidebarHidden(page, device, shouldBeHidden) {+ const isHidden = await page.evaluate(() => {+ const sidebar = document.querySelector('.sidebar');+ if (!sidebar) return true;+ const style = window.getComputedStyle(sidebar);+ return style.display === 'none' ||+ style.transform.includes('translateX(-100%)') ||+ style.transform.includes('translateX(-');+ });++ if (isHidden !== shouldBeHidden) {+ throw new Error(`Sidebar visibility mismatch on ${device}. Expected hidden: ${shouldBeHidden}, Got: ${isHidden}`);+ }+ return true;+ }++ static async assertTabCount(page, expectedCount) {+ const tabCount = await page.evaluate(() => {+ const tabs = document.querySelectorAll('.mobile-nav-tab');+ return tabs.length;+ });++ if (tabCount !== expectedCount) {+ throw new Error(`Tab count mismatch. Expected: ${expectedCount}, Got: ${tabCount}`);+ }+ return true;+ }++ static async assertActiveTab(page, expectedTab) {+ const activeTab = await page.evaluate(() => {+ const active = document.querySelector('.mobile-nav-tab.active');+ return active ? active.dataset.tabId : null;+ });++ if (activeTab !== expectedTab) {+ throw new Error(`Active tab mismatch. Expected: ${expectedTab}, Got: ${activeTab}`);+ }+ return true;+ }++ static async assertSheetMenuToggle(page) {+ // Click More button+ await page.click('.mobile-nav-tab[data-tab-id="more"]');+ await new Promise(resolve => setTimeout(resolve, 500));++ // Check if sheet is open+ const sheetOpen = await page.evaluate(() => {+ const sheet = document.querySelector('.mobile-sheet-menu');+ return sheet && sheet.classList.contains('active');+ });++ if (!sheetOpen) {+ throw new Error('Sheet menu failed to open');+ }++ // Close sheet+ await page.click('.mobile-sheet-overlay');+ await new Promise(resolve => setTimeout(resolve, 500));++ const sheetClosed = await page.evaluate(() => {+ const sheet = document.querySelector('.mobile-sheet-menu');+ return sheet && !sheet.classList.contains('active');+ });++ if (!sheetClosed) {+ throw new Error('Sheet menu failed to close');+ }++ return true;+ }++ static async assertNoOverlap(page) {+ const hasOverlap = await page.evaluate(() => {+ const searchInput = document.querySelector('input[type="text"], input[type="search"], textarea');+ const sidebar = document.querySelector('.sidebar');++ if (!searchInput || !sidebar) return false;++ const searchRect = searchInput.getBoundingClientRect();+ const sidebarRect = sidebar.getBoundingClientRect();++ // Check if sidebar overlaps search input+ return !(searchRect.right < sidebarRect.left ||+ searchRect.left > sidebarRect.right ||+ searchRect.bottom < sidebarRect.top ||+ searchRect.top > sidebarRect.bottom);+ });++ if (hasOverlap) {+ throw new Error('Sidebar overlaps with input elements (Issue #667)');+ }+ return true;+ }+}++// Main test runner+class MobileNavTestRunner {+ constructor() {+ this.results = new TestResults();+ this.browser = null;+ }++ async setup() {+ // Check server availability+ try {+ const response = await fetch(TEST_CONFIG.baseUrl);+ if (!response.ok) {+ throw new Error(`Server not responding at ${TEST_CONFIG.baseUrl}`);+ }+ } catch (error) {+ console.error(`❌ Server check failed: ${error.message}`);+ process.exit(1);+ }++ this.browser = await puppeteer.launch({+ headless: TEST_CONFIG.headless,+ args: ['--no-sandbox', '--disable-setuid-sandbox']+ });+ }++ async teardown() {+ if (this.browser) {+ await this.browser.close();+ }+ }++ async runTest(testName, testFn, context = {}) {+ const startTime = Date.now();+ const test = {+ name: testName,+ suite: context.suite || 'MobileNavigation',+ device: context.device,+ status: 'passed',+ error: null,+ details: null,+ duration: 0+ };++ try {+ await testFn();+ if (process.env.VERBOSE) {+ console.log(` ✅ ${testName}`);+ }+ } catch (error) {+ test.status = 'failed';+ test.error = error.message;+ test.details = error.stack;++ if (TEST_CONFIG.screenshotOnFailure && context.page) {+ const screenshotPath = `./test-failures/${context.device}_${testName.replace(/\s+/g, '_')}.png`;+ await fs.mkdir('./test-failures', { recursive: true });+ await context.page.screenshot({ path: screenshotPath });+ test.screenshot = screenshotPath;+ }++ console.error(` ❌ ${testName}: ${error.message}`);+ } finally {+ test.duration = (Date.now() - startTime) / 1000;+ this.results.addTest(test);+ }+ }++ async testDevice(deviceName, viewport) {+ console.log(`\nTesting ${deviceName}...`);+ const page = await this.browser.newPage();+ await page.setViewport(viewport);++ const context = { device: deviceName, page, suite: `MobileNav.${deviceName}` };++ try {+ // First authenticate to test on authenticated pages+ const AuthHelper = require('../auth_helper');+ const authHelper = new AuthHelper(page, TEST_CONFIG.baseUrl);+ await authHelper.ensureAuthenticated();++ // Navigate to home page after authentication+ await page.goto(TEST_CONFIG.baseUrl, {+ waitUntil: 'networkidle2',+ timeout: TEST_CONFIG.timeout+ });++ // Test 1: Mobile nav visibility based on viewport+ const shouldShowMobileNav = viewport.width <= 767;+ await this.runTest(+ `Mobile nav visibility (${viewport.width}px)`,+ async () => {+ if (shouldShowMobileNav) {+ await MobileNavAssertions.assertMobileNavExists(page, deviceName);+ await MobileNavAssertions.assertMobileNavVisible(page, deviceName, true);+ } else {+ await MobileNavAssertions.assertMobileNavVisible(page, deviceName, false);+ }+ },+ context+ );++ // Test 2: Sidebar hidden on mobile+ await this.runTest(+ 'Sidebar hidden on mobile',+ async () => {+ const shouldHideSidebar = viewport.width <= 767;+ await MobileNavAssertions.assertSidebarHidden(page, deviceName, shouldHideSidebar);+ },+ context+ );++ // Test 3: No overlap with input elements (Issue #667)+ await this.runTest(+ 'No sidebar overlap with inputs',+ async () => {+ await MobileNavAssertions.assertNoOverlap(page);+ },+ context+ );++ // Test 3b: Also test login page for overlap (Issue #667)+ await this.runTest(+ 'No sidebar overlap on login page',+ async () => {+ // Navigate to login page+ await page.goto(`${TEST_CONFIG.baseUrl}/auth/login`, {+ waitUntil: 'networkidle2',+ timeout: TEST_CONFIG.timeout+ });+ await MobileNavAssertions.assertNoOverlap(page);+ // Navigate back to home+ await page.goto(TEST_CONFIG.baseUrl, {+ waitUntil: 'networkidle2',+ timeout: TEST_CONFIG.timeout+ });+ },+ context+ );++ // Mobile-specific tests+ if (shouldShowMobileNav) {+ // Test 4: Correct number of tabs+ await this.runTest(+ 'Correct tab count',+ async () => {+ await MobileNavAssertions.assertTabCount(page, 5);+ },+ context+ );++ // Test 5: Sheet menu toggle+ await this.runTest(+ 'Sheet menu toggle',+ async () => {+ await MobileNavAssertions.assertSheetMenuToggle(page);+ },+ context+ );++ // Test 6: Navigation between pages+ await this.runTest(+ 'Tab navigation',+ async () => {+ // Click History tab+ const [response] = await Promise.all([+ page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 10000 }),+ page.click('.mobile-nav-tab[data-tab-id="history"]')+ ]);++ const url = page.url();+ if (!url.includes('/history')) {+ throw new Error(`Navigation failed. Expected /history, got ${url}`);+ }++ // Check active tab+ await MobileNavAssertions.assertActiveTab(page, 'history');+ },+ context+ );+ }++ } finally {+ await page.close();+ }+ }++ async run() {+ console.log('🚀 Mobile Navigation CI/CD Test Suite');+ console.log('=====================================');+ console.log(`Base URL: ${TEST_CONFIG.baseUrl}`);+ console.log(`Output Format: ${TEST_CONFIG.outputFormat}`);+ console.log('');++ await this.setup();++ try {+ // Test each device+ for (const [deviceName, viewport] of Object.entries(DEVICES)) {+ await this.testDevice(deviceName, viewport);+ }+ } finally {+ await this.teardown();+ }++ // Output results+ await this.outputResults();++ // Exit with appropriate code+ process.exit(this.results.summary.failed > 0 ? 1 : 0);+ }++ async outputResults() {+ console.log('\n=====================================');+ console.log('TEST RESULTS');+ console.log('=====================================');+ console.log(`Total: ${this.results.summary.total}`);+ console.log(`Passed: ${this.results.summary.passed}`);+ console.log(`Failed: ${this.results.summary.failed}`);+ console.log(`Duration: ${((new Date() - this.results.startTime) / 1000).toFixed(2)}s`);++ // Save results based on output format+ if (TEST_CONFIG.outputFormat === 'junit') {+ const junitPath = './test-results.xml';+ await fs.writeFile(junitPath, this.results.getJUnit());+ console.log(`\nJUnit results saved to: ${junitPath}`);+ } else if (TEST_CONFIG.outputFormat === 'json') {+ const jsonPath = './test-results.json';+ await fs.writeFile(jsonPath, JSON.stringify(this.results.getJSON(), null, 2));+ console.log(`\nJSON results saved to: ${jsonPath}`);+ }++ // Always output to console if there are failures+ if (this.results.summary.failed > 0) {+ console.log('\n❌ FAILED TESTS:');+ for (const test of this.results.tests) {+ if (test.status === 'failed') {+ console.log(` - ${test.suite}.${test.name}: ${test.error}`);+ if (test.screenshot) {+ console.log(` Screenshot: ${test.screenshot}`);+ }+ }+ }+ }+ }+}++// Run tests if executed directly+if (require.main === module) {+ const runner = new MobileNavTestRunner();+ runner.run().catch(error => {+ console.error('Test runner failed:', error);+ process.exit(1);+ });+}++module.exports = { MobileNavTestRunner, MobileNavAssertions, TestResults };diff --git a/tests/ui_tests/mobile/test_mobile_ui_comprehensive.js b/tests/ui_tests/mobile/test_mobile_ui_comprehensive.jsnew file mode 100644index 0000000000..f3f05a8d16--- /dev/null+++ b/tests/ui_tests/mobile/test_mobile_ui_comprehensive.js@@ -0,0 +1,386 @@+#!/usr/bin/env node+/**+ * Comprehensive Mobile UI Test+ * Tests all UI elements for mobile compatibility, not just navigation+ */++const puppeteer = require('puppeteer');+const AuthHelper = require('../auth_helper');+const fs = require('fs').promises;+const path = require('path');++class MobileUITester {+ constructor() {+ this.baseUrl = process.env.TEST_BASE_URL || 'http://127.0.0.1:5000';+ this.results = {+ passed: [],+ failed: [],+ warnings: []+ };+ }++ async test() {+ let browser;+ try {+ browser = await puppeteer.launch({+ headless: process.env.HEADLESS !== 'false',+ args: ['--no-sandbox', '--disable-setuid-sandbox']+ });++ const devices = [+ { name: 'iPhone_SE', width: 375, height: 667 },+ { name: 'iPhone_14_Pro', width: 430, height: 932 },+ { name: 'iPad_Mini', width: 768, height: 1024 }+ ];++ for (const device of devices) {+ await this.testDevice(browser, device);+ }++ this.printResults();++ // Exit with error if any tests failed+ process.exit(this.results.failed.length > 0 ? 1 : 0);++ } catch (error) {+ console.error('Test failed:', error);+ process.exit(1);+ } finally {+ if (browser) await browser.close();+ }+ }++ async testDevice(browser, device) {+ console.log(`\n📱 Testing ${device.name} (${device.width}x${device.height})`);+ console.log('═'.repeat(50));++ const page = await browser.newPage();+ await page.setViewport({+ width: device.width,+ height: device.height,+ isMobile: true,+ hasTouch: true+ });++ // Authenticate+ const authHelper = new AuthHelper(page, this.baseUrl);+ await authHelper.ensureAuthenticated();++ // Test pages+ const pages = [+ { path: '/', name: 'Research', tests: ['topBar', 'inputFields', 'buttons', 'modals'] },+ { path: '/history/', name: 'History', tests: ['topBar', 'searchBar', 'list'] },+ { path: '/news/', name: 'News', tests: ['topBar', 'filters', 'cards'] },+ { path: '/settings/', name: 'Settings', tests: ['topBar', 'tabs', 'forms', 'scrolling'] },+ { path: '/metrics/', name: 'Metrics', tests: ['topBar', 'charts', 'tables'] },+ { path: '/benchmark/', name: 'Benchmark', tests: ['topBar', 'forms', 'buttons'] }+ ];++ for (const pageInfo of pages) {+ console.log(`\n 📄 ${pageInfo.name}`);+ await page.goto(this.baseUrl + pageInfo.path, {+ waitUntil: 'networkidle2',+ timeout: 30000+ });++ // Run UI tests+ const results = await page.evaluate(() => {+ const tests = {};++ // 1. Check duplicate navigation bars+ tests.duplicateNavBars = {+ oldNav: !!document.querySelector('.mobile-tab-bar'),+ newNav: !!document.querySelector('.mobile-bottom-nav'),+ hasDuplicates: false+ };+ tests.duplicateNavBars.hasDuplicates =+ tests.duplicateNavBars.oldNav && tests.duplicateNavBars.newNav;++ // 2. Check top bar elements+ const topBar = document.querySelector('.top-bar');+ if (topBar) {+ const topBarRect = topBar.getBoundingClientRect();+ const userInfo = document.querySelector('.user-info');+ const logoutBtn = document.querySelector('.logout-btn');++ tests.topBar = {+ exists: true,+ overflowing: topBarRect.width < topBar.scrollWidth,+ userInfoVisible: userInfo ?+ window.getComputedStyle(userInfo).display !== 'none' : false,+ logoutVisible: logoutBtn ?+ window.getComputedStyle(logoutBtn).display !== 'none' : false,+ height: topBarRect.height,+ isClipped: false+ };++ // Check if elements are clipped+ if (userInfo) {+ const userRect = userInfo.getBoundingClientRect();+ tests.topBar.isClipped = userRect.right > window.innerWidth;+ }+ } else {+ tests.topBar = { exists: false };+ }++ // 3. Check input fields accessibility+ const inputs = document.querySelectorAll('input, textarea, select');+ tests.inputs = {+ total: inputs.length,+ accessible: 0,+ overlapped: [],+ tooSmall: []+ };++ inputs.forEach(input => {+ const rect = input.getBoundingClientRect();+ const style = window.getComputedStyle(input);++ // Check if visible and accessible+ if (rect.width > 0 && rect.height > 0 &&+ style.display !== 'none' && style.visibility !== 'hidden') {+ tests.inputs.accessible++;++ // Check if too small for touch (minimum 44x44px for iOS)+ if (rect.height < 44) {+ tests.inputs.tooSmall.push({+ type: input.tagName,+ height: rect.height,+ id: input.id || input.name+ });+ }+ }++ // Check for overlaps with navigation+ const navBar = document.querySelector('.mobile-bottom-nav, .mobile-tab-bar');+ if (navBar) {+ const navRect = navBar.getBoundingClientRect();+ if (rect.bottom > navRect.top && rect.top < navRect.bottom) {+ tests.inputs.overlapped.push({+ type: input.tagName,+ id: input.id || input.name+ });+ }+ }+ });++ // 4. Check buttons and touch targets+ const buttons = document.querySelectorAll('button, .btn, a.btn');+ tests.buttons = {+ total: buttons.length,+ tooSmall: [],+ overlapped: []+ };++ buttons.forEach(button => {+ const rect = button.getBoundingClientRect();+ if (rect.height < 44 || rect.width < 44) {+ tests.buttons.tooSmall.push({+ text: button.textContent.trim().substring(0, 20),+ size: `${rect.width}x${rect.height}`+ });+ }+ });++ // 5. Check horizontal scrolling (should not exist)+ tests.horizontalScroll = {+ bodyWidth: document.body.scrollWidth,+ windowWidth: window.innerWidth,+ hasScroll: document.body.scrollWidth > window.innerWidth+ };++ // 6. Check content padding for nav bars+ const mainContent = document.querySelector('.main-content, .page, main');+ if (mainContent) {+ const contentRect = mainContent.getBoundingClientRect();+ const navBar = document.querySelector('.mobile-bottom-nav');+ tests.contentPadding = {+ hasBottomPadding: false,+ bottomSpace: 0+ };++ if (navBar) {+ const navRect = navBar.getBoundingClientRect();+ tests.contentPadding.bottomSpace = window.innerHeight - contentRect.bottom;+ tests.contentPadding.hasBottomPadding =+ tests.contentPadding.bottomSpace >= navRect.height;+ }+ }++ // 7. Check tab navigation (Settings page)+ const tabs = document.querySelectorAll('.nav-tabs, .tab-navigation, [role="tablist"]');+ if (tabs.length > 0) {+ const tabContainer = tabs[0];+ const tabRect = tabContainer.getBoundingClientRect();+ tests.tabs = {+ exists: true,+ overflowing: tabContainer.scrollWidth > tabRect.width,+ scrollable: window.getComputedStyle(tabContainer).overflowX === 'auto' ||+ window.getComputedStyle(tabContainer).overflowX === 'scroll'+ };+ }++ // 8. Check modals and overlays+ const modals = document.querySelectorAll('.modal, .sheet-menu, .overlay');+ tests.modals = {+ visible: [],+ zIndexIssues: []+ };++ modals.forEach(modal => {+ const style = window.getComputedStyle(modal);+ if (style.display !== 'none' && style.visibility !== 'hidden') {+ tests.modals.visible.push(modal.className);++ // Check z-index+ const zIndex = parseInt(style.zIndex) || 0;+ if (zIndex < 1000) {+ tests.modals.zIndexIssues.push({+ class: modal.className,+ zIndex: zIndex+ });+ }+ }+ });++ // 9. Check text readability+ const textElements = document.querySelectorAll('p, span, label, h1, h2, h3, h4, h5, h6');+ tests.text = {+ tooSmall: [],+ truncated: []+ };++ textElements.forEach(elem => {+ const style = window.getComputedStyle(elem);+ const fontSize = parseFloat(style.fontSize);++ if (fontSize < 12) {+ tests.text.tooSmall.push({+ tag: elem.tagName,+ fontSize: fontSize,+ text: elem.textContent.substring(0, 30)+ });+ }++ // Check for text overflow+ if (elem.scrollWidth > elem.clientWidth) {+ tests.text.truncated.push({+ tag: elem.tagName,+ text: elem.textContent.substring(0, 30)+ });+ }+ });++ return tests;+ });++ // Analyze results+ this.analyzeResults(device.name, pageInfo.name, results);++ // Take screenshot for review+ const screenshotDir = './mobile-ui-tests';+ await fs.mkdir(screenshotDir, { recursive: true });+ const screenshotPath = path.join(screenshotDir, `${device.name}_${pageInfo.name}.png`);+ await page.screenshot({ path: screenshotPath, fullPage: false });+ }++ await page.close();+ }++ analyzeResults(device, pageName, results) {+ const context = `${device} - ${pageName}`;++ // Check for critical issues+ if (results.duplicateNavBars?.hasDuplicates) {+ this.results.failed.push(`${context}: Duplicate navigation bars (both old and new)`);+ }++ if (results.topBar?.isClipped) {+ this.results.failed.push(`${context}: Top bar elements are clipped/cut off`);+ }++ if (results.inputs?.overlapped?.length > 0) {+ this.results.failed.push(`${context}: ${results.inputs.overlapped.length} input(s) overlapped by navigation`);+ }++ if (results.horizontalScroll?.hasScroll) {+ this.results.failed.push(`${context}: Horizontal scroll detected (${results.horizontalScroll.bodyWidth}px > ${results.horizontalScroll.windowWidth}px)`);+ }++ if (results.contentPadding && !results.contentPadding.hasBottomPadding) {+ this.results.warnings.push(`${context}: Content may be hidden behind navigation bar`);+ }++ if (results.tabs?.overflowing && !results.tabs?.scrollable) {+ this.results.failed.push(`${context}: Tab navigation overflowing and not scrollable`);+ }++ // Check for warnings+ if (results.inputs?.tooSmall?.length > 0) {+ this.results.warnings.push(`${context}: ${results.inputs.tooSmall.length} input(s) below 44px touch target`);+ }++ if (results.buttons?.tooSmall?.length > 0) {+ this.results.warnings.push(`${context}: ${results.buttons.tooSmall.length} button(s) below 44px touch target`);+ }++ if (results.text?.tooSmall?.length > 0) {+ this.results.warnings.push(`${context}: ${results.text.tooSmall.length} text element(s) below 12px`);+ }++ if (results.text?.truncated?.length > 0) {+ this.results.warnings.push(`${context}: ${results.text.truncated.length} text element(s) truncated`);+ }++ // Log success if no issues+ if (!this.hasIssues(results)) {+ this.results.passed.push(`${context}: All UI elements properly displayed`);+ }+ }++ hasIssues(results) {+ return results.duplicateNavBars?.hasDuplicates ||+ results.topBar?.isClipped ||+ results.inputs?.overlapped?.length > 0 ||+ results.horizontalScroll?.hasScroll ||+ (results.tabs?.overflowing && !results.tabs?.scrollable);+ }++ printResults() {+ console.log('\n' + '═'.repeat(60));+ console.log('📊 MOBILE UI TEST RESULTS');+ console.log('═'.repeat(60));++ if (this.results.passed.length > 0) {+ console.log('\n✅ PASSED:');+ this.results.passed.forEach(p => console.log(` ${p}`));+ }++ if (this.results.failed.length > 0) {+ console.log('\n❌ FAILED:');+ this.results.failed.forEach(f => console.log(` ${f}`));+ }++ if (this.results.warnings.length > 0) {+ console.log('\n⚠️ WARNINGS:');+ this.results.warnings.forEach(w => console.log(` ${w}`));+ }++ console.log('\n' + '═'.repeat(60));+ console.log(`Total: ${this.results.passed.length} passed, ${this.results.failed.length} failed, ${this.results.warnings.length} warnings`);++ if (this.results.failed.length === 0) {+ console.log('✅ All critical UI tests passed!');+ } else {+ console.log('❌ Critical UI issues found - see failures above');+ }+ }+}++// Run tests+if (require.main === module) {+ const tester = new MobileUITester();+ tester.test();+}++module.exports = MobileUITester;diff --git a/tests/ui_tests/package.json b/tests/ui_tests/package.jsonindex f834e7b84d..8900453f4f 100644--- a/tests/ui_tests/package.json+++ b/tests/ui_tests/package.json@@ -19,7 +19,14 @@"test:research:verify": "node test_research_verify.js","test:research:fixed": "node test_research_fixed_model.js","test:research:working": "node test_research_working_config.js",- "test:models": "node check_available_models.js"+ "test:models": "node check_available_models.js",+ "test:mobile": "node mobile/test_mobile_navigation_ci.js",+ "test:mobile:visual": "HEADLESS=false node mobile/test_mobile_navigation_ci.js",+ "test:mobile:json": "OUTPUT_FORMAT=json node mobile/test_mobile_navigation_ci.js",+ "test:mobile:junit": "OUTPUT_FORMAT=junit node mobile/test_mobile_navigation_ci.js",+ "test:mobile:screenshots": "node mobile/test_mobile_nav_all_pages.js",+ "test:mobile:comprehensive": "node mobile/test_mobile_ui_comprehensive.js",+ "install-browsers": "npx puppeteer browsers install chrome"},"dependencies": {"puppeteer": "^22.8.2"