~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
test(ui-tests): real assertions for mobile interactions (dead-field audit) (#4679)
LearningCircuit61472e97d3ea
diff --git a/tests/ui_tests/test_mobile_interactions_ci.js b/tests/ui_tests/test_mobile_interactions_ci.jsindex bcdf7747c5..b0d5e08785 100644--- a/tests/ui_tests/test_mobile_interactions_ci.js+++ b/tests/ui_tests/test_mobile_interactions_ci.js@@ -6,7 +6,7 @@** Run: node test_mobile_interactions_ci.js*/-const { setupTest, teardownTest, TestResults, log, delay, viewports, navigateTo, withTimeout } = require('./test_lib');+const { setupTest, teardownTest, TestResults, log, navigateTo, withTimeout } = require('./test_lib');// ============================================================================// Mobile Modal Tests@@ -56,34 +56,74 @@ const MobileModalTests = {},async modalScrollableContent(page, baseUrl) {+ // /settings/ renders NO modal, so the old test always skipped+ // ("No modal content found"). The real app renders a Bootstrap+ // delete-confirmation modal (#deleteConfirmModal, included by+ // pages/library.html). We open it on /library with enough detail+ // rows to overflow a 375x667 phone, then assert it really opens and+ // its tall content stays reachable via the modal's scroll container.await page.setViewport({ width: 375, height: 667, isMobile: true, hasTouch: true });- await navigateTo(page, `${baseUrl}/settings/`);+ await navigateTo(page, `${baseUrl}/library/`);- const result = await page.evaluate(() => {- // Look for any scrollable modal content- const modalContent = document.querySelector('.modal-body, .dialog-content, .sheet-content');- if (!modalContent) return { hasModalContent: false };+ // Page-specific anchor: fail (not skip) if login/error loaded instead.+ await page.waitForSelector('.ldr-library-container', { timeout: 10000 });+ await page.waitForSelector('#deleteConfirmModal .modal-body', { timeout: 10000 });++ // Open the modal with long content (forces vertical overflow).+ const opened = await page.evaluate(() => {+ if (!window.DeleteConfirmation || !window.DeleteConfirmation.show) {+ return { api: false };+ }+ window.DeleteConfirmation.show({+ action: 'deleteDocument',+ details: Array.from({ length: 60 }, (_, i) => `Document row ${i}`),+ });+ return { api: true };+ });++ if (!opened.api) {+ return { passed: false, message: 'window.DeleteConfirmation.show API not available on /library' };+ }- const style = window.getComputedStyle(modalContent);- const isScrollable = style.overflowY === 'auto' || style.overflowY === 'scroll' ||- modalContent.scrollHeight > modalContent.clientHeight;+ // Wait for Bootstrap to apply the .show / display:block state.+ await page.waitForFunction(() => {+ const m = document.getElementById('deleteConfirmModal');+ return m && m.classList.contains('show') && window.getComputedStyle(m).display !== 'none';+ }, { timeout: 5000 });+ const result = await page.evaluate(() => {+ const modal = document.getElementById('deleteConfirmModal');+ const content = modal.querySelector('.modal-content');+ const body = modal.querySelector('.modal-body');+ const contentStyle = window.getComputedStyle(content);+ const bodyRect = body.getBoundingClientRect();++ // On mobile (<=767px) the real scroll container is .modal-content,+ // which mobile-responsive.css caps with+ // `max-height: calc(100vh - 180px); overflow-y: auto`. Reading+ // overflow on the OUTER .modal would be meaningless here — Bootstrap+ // base sets `.modal{overflow:hidden auto}` unconditionally, so that+ // check can never fail. Assert the container is actually scrollable+ // AND that the injected 60-row content overflows its capped height,+ // so a regression that removes the mobile cap (content would grow to+ // fit with no overflow) fails this test.return {- hasModalContent: true,- isScrollable,- overflowY: style.overflowY,- scrollHeight: modalContent.scrollHeight,- clientHeight: modalContent.clientHeight+ containerOverflowY: contentStyle.overflowY,+ containerScrolls: contentStyle.overflowY === 'auto' || contentStyle.overflowY === 'scroll',+ bodyVisible: bodyRect.width > 0 && bodyRect.height > 0,+ contentOverflows: content.scrollHeight > content.clientHeight,+ contentScrollHeight: content.scrollHeight,+ contentClientHeight: content.clientHeight,+ viewportHeight: window.innerHeight,};});- if (!result.hasModalContent) {- return { passed: null, skipped: true, message: 'No modal content found to test scrolling' };- }-+ const passed = result.containerScrolls && result.bodyVisible && result.contentOverflows;return {- passed: result.isScrollable || result.overflowY === 'auto',- message: `Modal content scrollable: overflow=${result.overflowY}`+ passed,+ message: passed+ ? `Delete modal content scrollable on mobile (overflow=${result.containerOverflowY}, content ${result.contentScrollHeight}px > container ${result.contentClientHeight}px on ${result.viewportHeight}px screen)`+ : `Modal scroll check failed (overflowY=${result.containerOverflowY}, bodyVisible=${result.bodyVisible}, contentOverflows=${result.contentOverflows}, contentScroll=${result.contentScrollHeight}, contentClient=${result.contentClientHeight})`};}};@@ -156,47 +196,59 @@ const MobileNavTests = {},async mobileMenuCloses(page, baseUrl) {+ // The old test looked for .hamburger / .navbar-toggler / .nav-link /+ // .navbar-collapse — none of which exist in this app, so it always+ // skipped ("No menu links found"). The real mobile menu is built by+ // static/js/mobile-navigation.js: a bottom tab bar+ // (.ldr-mobile-bottom-nav) whose "More" tab ([data-tab-id="more"])+ // opens a sheet (.ldr-mobile-sheet-menu, gains .active). Selecting a+ // sheet item (.ldr-mobile-sheet-item) calls closeSheet() before+ // navigating, so the sheet must collapse on selection.await page.setViewport({ width: 375, height: 667, isMobile: true, hasTouch: true });await navigateTo(page, `${baseUrl}/`);- // Open menu first+ // Mobile nav is created on DOMContentLoaded; wait for the real menu.+ await page.waitForSelector('.ldr-mobile-bottom-nav [data-tab-id="more"]', { timeout: 10000 });+ await page.waitForSelector('.ldr-mobile-sheet-menu', { timeout: 10000 });++ // Open the sheet via the "More" tab and confirm it actually opened.await page.evaluate(() => {- const hamburger = document.querySelector('.hamburger, .mobile-menu-toggle, .navbar-toggler');- if (hamburger) hamburger.click();+ document.querySelector('.ldr-mobile-bottom-nav [data-tab-id="more"]').click();});+ await page.waitForFunction(+ () => document.querySelector('.ldr-mobile-sheet-menu')?.classList.contains('active') === true,+ { timeout: 5000 }+ );- await delay(300);-- // Click a menu item+ // Select a sheet item; handleSheetItem() runs closeSheet() synchronously+ // (removing .active + setting aria-hidden) before navigating away.const result = await page.evaluate(() => {- const menuLinks = document.querySelectorAll('.mobile-menu a, .navbar-collapse a, .nav-link');- if (menuLinks.length === 0) return { hasLinks: false };-- const link = menuLinks[0];- link.click();+ const sheet = document.querySelector('.ldr-mobile-sheet-menu');+ const item = sheet.querySelector('.ldr-mobile-sheet-item[data-item-id="metrics"]') ||+ sheet.querySelector('.ldr-mobile-sheet-item');+ if (!item) return { hasLinks: false };- return new Promise(resolve => {- setTimeout(() => {- const menu = document.querySelector('.mobile-menu, .navbar-collapse.show');- const isClosed = !menu || menu.style.display === 'none' || !menu.classList.contains('show');-- resolve({- hasLinks: true,- menuClosed: isClosed- });- }, 300);- });+ const wasOpen = sheet.classList.contains('active');+ item.click();+ return {+ hasLinks: true,+ wasOpen,+ menuClosed: !sheet.classList.contains('active') &&+ sheet.getAttribute('aria-hidden') === 'true',+ ariaHidden: sheet.getAttribute('aria-hidden'),+ };});if (!result.hasLinks) {- return { passed: null, skipped: true, message: 'No menu links found' };+ return { passed: false, message: 'Mobile sheet rendered no menu items (.ldr-mobile-sheet-item)' };}+ const passed = result.wasOpen && result.menuClosed;return {- passed: result.menuClosed,- message: result.menuClosed- ? 'Menu closes after selection'- : 'Menu did not close after selection'+ passed,+ message: passed+ ? 'Mobile sheet menu collapses after selecting an item'+ : `Sheet did not collapse on selection (wasOpen=${result.wasOpen}, aria-hidden=${result.ariaHidden})`};},