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.

test: add Playwright mobile UI testing infrastructure

LearningCircuitdb58531c6d0b
diff --git a/.gitignore b/.gitignore
index 2252720b1a..fe2ac41a16 100644
--- a/.gitignore
+++ b/.gitignore
@@ -259,3 +259,11 @@ backup/
tests/**/*.md
# To whitelist specific test MD files, add them explicitly like:
# !tests/specific-file-to-include.md
+
+# Whitelist Playwright test infrastructure
+!tests/ui_tests/playwright/
+!tests/ui_tests/playwright/package.json
+!tests/ui_tests/playwright/README.md
+!tests/ui_tests/playwright/playwright.config.js
+!tests/ui_tests/playwright/tests/
+!tests/ui_tests/playwright/tests/*.js
diff --git a/tests/ui_tests/mobile/test_research_page_mobile.js b/tests/ui_tests/mobile/test_research_page_mobile.js
new file mode 100644
index 0000000000..ff806bb683
--- /dev/null
+++ b/tests/ui_tests/mobile/test_research_page_mobile.js
@@ -0,0 +1,678 @@
+#!/usr/bin/env node
+/**
+ * Research Page Mobile Layout Tests
+ *
+ * Specifically tests the main Research page (home) for mobile layout issues,
+ * with focus on elements at the bottom that can get "mashed together"
+ * or hidden behind the mobile navigation.
+ *
+ * Key elements tested:
+ * - Research Query textarea
+ * - Research Mode selection
+ * - Advanced Options toggle and panel
+ * - Start Research button
+ * - Sound notifications checkbox
+ * - Help panel ("How Research Works")
+ * - Spacing between all form elements
+ *
+ * Run: node test_research_page_mobile.js
+ *
+ * Environment variables:
+ * - TEST_BASE_URL: Server URL (default: http://127.0.0.1:5000)
+ * - CI: Set to 'true' for CI mode
+ * - HEADLESS: 'true' or 'false' (default: true)
+ */
+
+const puppeteer = require('puppeteer');
+const fs = require('fs');
+const path = require('path');
+const AuthHelper = require('../auth_helper');
+const { getPuppeteerLaunchOptions } = require('../puppeteer_config');
+
+// Configuration
+const BASE_URL = process.env.TEST_BASE_URL || 'http://127.0.0.1:5000';
+const IS_CI = process.env.CI === 'true';
+const HEADLESS = process.env.HEADLESS !== 'false';
+
+// Mobile viewports to test
+const MOBILE_VIEWPORTS = {
+ 'iPhone_SE': { width: 375, height: 667 }, // Small phone
+ 'iPhone_14_Pro': { width: 393, height: 852 }, // Standard phone
+ 'iPhone_14_Pro_Max': { width: 430, height: 932 }, // Large phone
+ 'iPhone_SE_landscape': { width: 667, height: 375 }, // Landscape
+ 'Android_small': { width: 360, height: 640 }, // Small Android
+};
+
+// Minimum spacing between interactive elements (in pixels)
+const MIN_SPACING_BETWEEN_ELEMENTS = 8;
+const MIN_SPACING_ABOVE_NAV = 16;
+const MIN_TOUCH_TARGET = 44;
+const MOBILE_NAV_HEIGHT = 56;
+
+// Test results
+class TestResults {
+ constructor() {
+ this.tests = [];
+ this.startTime = Date.now();
+ }
+
+ addResult(viewport, testName, passed, message, details = null) {
+ this.tests.push({
+ viewport,
+ testName,
+ passed,
+ message,
+ details,
+ timestamp: new Date().toISOString()
+ });
+ }
+
+ get summary() {
+ const total = this.tests.length;
+ const passed = this.tests.filter(t => t.passed).length;
+ return { total, passed, failed: total - passed, duration: Date.now() - this.startTime };
+ }
+
+ toJSON() {
+ return { summary: this.summary, tests: this.tests };
+ }
+}
+
+/**
+ * Main test class for Research page mobile layout
+ */
+class ResearchPageMobileTests {
+ constructor() {
+ this.results = new TestResults();
+ this.browser = null;
+ this.page = null;
+ this.screenshotDir = path.join(__dirname, 'screenshots', 'research-page');
+ }
+
+ async setup() {
+ // Create screenshot directory if not CI
+ if (!IS_CI && !fs.existsSync(this.screenshotDir)) {
+ fs.mkdirSync(this.screenshotDir, { recursive: true });
+ }
+
+ this.browser = await puppeteer.launch(getPuppeteerLaunchOptions({
+ headless: HEADLESS
+ }));
+ this.page = await this.browser.newPage();
+
+ // Set initial desktop viewport for authentication
+ await this.page.setViewport({ width: 1280, height: 800 });
+
+ // Authenticate
+ const authHelper = new AuthHelper(this.page, BASE_URL);
+ await authHelper.ensureAuthenticated();
+ console.log('Authentication complete');
+ }
+
+ async cleanup() {
+ if (this.browser) {
+ await this.browser.close();
+ }
+ }
+
+ /**
+ * Take screenshot with annotations
+ */
+ async takeScreenshot(name, viewport, annotations = []) {
+ if (IS_CI) return null;
+
+ try {
+ // Add visual annotations
+ if (annotations.length > 0) {
+ await this.page.evaluate((annotations) => {
+ // Remove previous annotations
+ document.querySelectorAll('.test-annotation').forEach(el => el.remove());
+
+ annotations.forEach((ann, i) => {
+ const el = document.createElement('div');
+ el.className = 'test-annotation';
+ el.style.cssText = `
+ position: fixed;
+ left: ${ann.left}px;
+ top: ${ann.top}px;
+ width: ${ann.width}px;
+ height: ${ann.height}px;
+ border: 2px solid ${ann.color || 'red'};
+ background: ${ann.color || 'red'}22;
+ z-index: 99999;
+ pointer-events: none;
+ `;
+ if (ann.label) {
+ const label = document.createElement('span');
+ label.style.cssText = `
+ position: absolute;
+ top: -20px;
+ left: 0;
+ background: ${ann.color || 'red'};
+ color: white;
+ padding: 2px 6px;
+ font-size: 10px;
+ border-radius: 3px;
+ white-space: nowrap;
+ `;
+ label.textContent = ann.label;
+ el.appendChild(label);
+ }
+ document.body.appendChild(el);
+ });
+ }, annotations);
+ }
+
+ const screenshotPath = path.join(this.screenshotDir, `${viewport}_${name}.png`);
+ await this.page.screenshot({ path: screenshotPath, fullPage: false });
+
+ // Clean up annotations
+ await this.page.evaluate(() => {
+ document.querySelectorAll('.test-annotation').forEach(el => el.remove());
+ });
+
+ return screenshotPath;
+ } catch (error) {
+ console.error(`Screenshot error: ${error.message}`);
+ return null;
+ }
+ }
+
+ /**
+ * Get element positions for the research page bottom section
+ */
+ async getResearchPageElements() {
+ return await this.page.evaluate((MOBILE_NAV_HEIGHT) => {
+ const viewportHeight = window.innerHeight;
+ const mobileNav = document.querySelector('.ldr-mobile-bottom-nav');
+ const navRect = mobileNav ? mobileNav.getBoundingClientRect() : null;
+ const navVisible = mobileNav &&
+ window.getComputedStyle(mobileNav).display !== 'none' &&
+ mobileNav.classList.contains('visible');
+
+ // Key elements on Research page
+ const elements = {
+ // Form elements
+ queryTextarea: document.querySelector('#query'),
+ modeSelection: document.querySelector('.ldr-mode-selection'),
+ advancedToggle: document.querySelector('.ldr-advanced-options-toggle'),
+ advancedPanel: document.querySelector('.ldr-advanced-options-panel'),
+
+ // Bottom elements (the "mashed together" area)
+ formActions: document.querySelector('.ldr-form-actions'),
+ startButton: document.querySelector('#start-research-btn'),
+ formOptions: document.querySelector('.ldr-form-options'),
+ notificationToggle: document.querySelector('#notification-toggle'),
+ helpPanel: document.querySelector('.ldr-help-panel'),
+
+ // Container
+ researchCard: document.querySelector('.ldr-research-card'),
+ page: document.querySelector('.ldr-page.active'),
+ };
+
+ const results = {
+ viewport: { width: window.innerWidth, height: viewportHeight },
+ mobileNav: {
+ exists: !!mobileNav,
+ visible: navVisible,
+ rect: navRect ? {
+ top: navRect.top,
+ height: navRect.height
+ } : null,
+ effectiveTop: navVisible ? navRect.top : viewportHeight
+ },
+ elements: {},
+ issues: []
+ };
+
+ // Analyze each element
+ for (const [name, el] of Object.entries(elements)) {
+ if (!el) {
+ results.elements[name] = { exists: false };
+ continue;
+ }
+
+ const rect = el.getBoundingClientRect();
+ const style = window.getComputedStyle(el);
+
+ results.elements[name] = {
+ exists: true,
+ rect: {
+ top: rect.top,
+ bottom: rect.bottom,
+ left: rect.left,
+ right: rect.right,
+ width: rect.width,
+ height: rect.height
+ },
+ computed: {
+ marginTop: parseFloat(style.marginTop) || 0,
+ marginBottom: parseFloat(style.marginBottom) || 0,
+ paddingTop: parseFloat(style.paddingTop) || 0,
+ paddingBottom: parseFloat(style.paddingBottom) || 0,
+ },
+ isVisible: style.display !== 'none' && style.visibility !== 'hidden' && rect.height > 0,
+ isAboveNav: !navVisible || rect.bottom <= navRect.top
+ };
+
+ // Check if element is hidden behind nav
+ if (navVisible && rect.bottom > navRect.top && rect.top < viewportHeight) {
+ results.issues.push({
+ type: 'behind-nav',
+ element: name,
+ message: `${name} extends behind mobile nav (bottom: ${Math.round(rect.bottom)}px, navTop: ${Math.round(navRect.top)}px)`,
+ overlap: rect.bottom - navRect.top
+ });
+ }
+ }
+
+ return results;
+ }, MOBILE_NAV_HEIGHT);
+ }
+
+ /**
+ * Check vertical spacing between consecutive elements
+ */
+ async checkVerticalSpacing(viewport) {
+ const data = await this.getResearchPageElements();
+
+ // Elements that should have adequate spacing between them (in order from top to bottom)
+ const orderedElements = [
+ 'queryTextarea',
+ 'modeSelection',
+ 'advancedToggle',
+ 'formActions', // Contains start button
+ 'formOptions', // Contains notification toggle
+ 'helpPanel'
+ ];
+
+ const spacingIssues = [];
+ let prevElement = null;
+ let prevName = null;
+
+ for (const name of orderedElements) {
+ const el = data.elements[name];
+ if (!el?.exists || !el?.isVisible) continue;
+
+ if (prevElement) {
+ const spacing = el.rect.top - prevElement.rect.bottom;
+ if (spacing < MIN_SPACING_BETWEEN_ELEMENTS) {
+ spacingIssues.push({
+ between: `${prevName} and ${name}`,
+ spacing: Math.round(spacing),
+ required: MIN_SPACING_BETWEEN_ELEMENTS,
+ message: `Insufficient spacing (${Math.round(spacing)}px) between ${prevName} and ${name}`
+ });
+ }
+ }
+
+ prevElement = el;
+ prevName = name;
+ }
+
+ const passed = spacingIssues.length === 0;
+ const message = passed
+ ? 'All elements have adequate vertical spacing'
+ : `Found ${spacingIssues.length} spacing issues: ${spacingIssues.map(i => i.message).join('; ')}`;
+
+ this.results.addResult(viewport, 'Vertical Spacing Between Elements', passed, message, { spacingIssues, data });
+
+ // Take screenshot with issues highlighted
+ if (!passed && !IS_CI) {
+ const annotations = spacingIssues.map(issue => {
+ const parts = issue.between.split(' and ');
+ const el1 = data.elements[parts[0]];
+ const el2 = data.elements[parts[1]];
+ if (el1?.exists && el2?.exists) {
+ return {
+ left: 10,
+ top: el1.rect.bottom,
+ width: el1.rect.width - 20,
+ height: el2.rect.top - el1.rect.bottom,
+ color: 'orange',
+ label: `Gap: ${issue.spacing}px (need ${issue.required}px)`
+ };
+ }
+ return null;
+ }).filter(Boolean);
+ await this.takeScreenshot('spacing-issues', viewport, annotations);
+ }
+
+ return passed;
+ }
+
+ /**
+ * Check if last element is properly visible above mobile nav
+ */
+ async checkLastElementVisibility(viewport) {
+ const data = await this.getResearchPageElements();
+
+ if (!data.mobileNav.visible) {
+ this.results.addResult(viewport, 'Last Element Above Nav', true, 'Mobile nav not visible, skip check');
+ return true;
+ }
+
+ // Find the last visible element
+ const bottomElements = ['helpPanel', 'formOptions', 'formActions'];
+ let lastElement = null;
+ let lastName = null;
+
+ for (const name of bottomElements) {
+ const el = data.elements[name];
+ if (el?.exists && el?.isVisible) {
+ if (!lastElement || el.rect.bottom > lastElement.rect.bottom) {
+ lastElement = el;
+ lastName = name;
+ }
+ }
+ }
+
+ if (!lastElement) {
+ this.results.addResult(viewport, 'Last Element Above Nav', false, 'Could not find any bottom elements');
+ return false;
+ }
+
+ const navTop = data.mobileNav.rect.top;
+ const spaceAboveNav = navTop - lastElement.rect.bottom;
+ const passed = spaceAboveNav >= MIN_SPACING_ABOVE_NAV;
+
+ const message = passed
+ ? `Last element (${lastName}) has ${Math.round(spaceAboveNav)}px space above mobile nav`
+ : `Last element (${lastName}) too close to nav: ${Math.round(spaceAboveNav)}px (need ${MIN_SPACING_ABOVE_NAV}px)`;
+
+ this.results.addResult(viewport, 'Last Element Above Nav', passed, message, {
+ lastElement: lastName,
+ spaceAboveNav,
+ navTop,
+ lastElementBottom: lastElement.rect.bottom
+ });
+
+ // Screenshot with nav highlighted
+ if (!passed && !IS_CI) {
+ await this.takeScreenshot('last-element-nav', viewport, [
+ {
+ left: lastElement.rect.left,
+ top: lastElement.rect.top,
+ width: lastElement.rect.width,
+ height: lastElement.rect.height,
+ color: 'blue',
+ label: lastName
+ },
+ {
+ left: 0,
+ top: navTop,
+ width: data.viewport.width,
+ height: MOBILE_NAV_HEIGHT,
+ color: 'red',
+ label: 'Mobile Nav'
+ }
+ ]);
+ }
+
+ return passed;
+ }
+
+ /**
+ * Check if elements are overlapping (mashed together)
+ */
+ async checkForOverlappingElements(viewport) {
+ const data = await this.getResearchPageElements();
+
+ const overlaps = [];
+ const interactiveElements = [
+ 'startButton',
+ 'notificationToggle',
+ 'advancedToggle'
+ ];
+
+ const rects = [];
+ for (const name of interactiveElements) {
+ const el = data.elements[name];
+ if (el?.exists && el?.isVisible) {
+ rects.push({ name, rect: el.rect });
+ }
+ }
+
+ // Check for overlaps
+ for (let i = 0; i < rects.length; i++) {
+ for (let j = i + 1; j < rects.length; j++) {
+ const r1 = rects[i].rect;
+ const r2 = rects[j].rect;
+
+ const overlap = !(r1.right < r2.left ||
+ r1.left > r2.right ||
+ r1.bottom < r2.top ||
+ r1.top > r2.bottom);
+
+ if (overlap) {
+ overlaps.push({
+ element1: rects[i].name,
+ element2: rects[j].name,
+ message: `${rects[i].name} overlaps with ${rects[j].name}`
+ });
+ }
+ }
+ }
+
+ const passed = overlaps.length === 0;
+ const message = passed
+ ? 'No overlapping interactive elements'
+ : `Found ${overlaps.length} overlaps: ${overlaps.map(o => o.message).join('; ')}`;
+
+ this.results.addResult(viewport, 'No Overlapping Elements', passed, message, { overlaps });
+ return passed;
+ }
+
+ /**
+ * Check touch target sizes for key elements
+ */
+ async checkTouchTargets(viewport) {
+ const data = await this.getResearchPageElements();
+
+ const smallTargets = [];
+ const touchElements = ['startButton', 'notificationToggle', 'advancedToggle'];
+
+ for (const name of touchElements) {
+ const el = data.elements[name];
+ if (!el?.exists || !el?.isVisible) continue;
+
+ if (el.rect.height < MIN_TOUCH_TARGET || el.rect.width < MIN_TOUCH_TARGET) {
+ smallTargets.push({
+ element: name,
+ width: Math.round(el.rect.width),
+ height: Math.round(el.rect.height),
+ required: MIN_TOUCH_TARGET,
+ message: `${name} too small: ${Math.round(el.rect.width)}x${Math.round(el.rect.height)}px (need ${MIN_TOUCH_TARGET}px)`
+ });
+ }
+ }
+
+ const passed = smallTargets.length === 0;
+ const message = passed
+ ? 'All touch targets meet minimum size requirements'
+ : `Found ${smallTargets.length} small touch targets: ${smallTargets.map(t => t.message).join('; ')}`;
+
+ this.results.addResult(viewport, 'Touch Target Sizes', passed, message, { smallTargets });
+ return passed;
+ }
+
+ /**
+ * Check page has proper bottom padding for mobile nav
+ */
+ async checkBottomPadding(viewport) {
+ const data = await this.getResearchPageElements();
+
+ if (!data.mobileNav.visible) {
+ this.results.addResult(viewport, 'Bottom Padding for Nav', true, 'Mobile nav not visible, skip check');
+ return true;
+ }
+
+ const page = data.elements.page;
+ if (!page?.exists) {
+ this.results.addResult(viewport, 'Bottom Padding for Nav', false, 'Could not find page container');
+ return false;
+ }
+
+ const totalPadding = page.computed.paddingBottom + page.computed.marginBottom;
+ const requiredPadding = MOBILE_NAV_HEIGHT + 20; // Nav height plus some breathing room
+ const passed = totalPadding >= requiredPadding;
+
+ const message = passed
+ ? `Page has adequate bottom padding (${Math.round(totalPadding)}px)`
+ : `Insufficient bottom padding: ${Math.round(totalPadding)}px (need ${requiredPadding}px for mobile nav)`;
+
+ this.results.addResult(viewport, 'Bottom Padding for Nav', passed, message, {
+ paddingBottom: page.computed.paddingBottom,
+ marginBottom: page.computed.marginBottom,
+ totalPadding,
+ requiredPadding
+ });
+
+ return passed;
+ }
+
+ /**
+ * Check content is scrollable to reveal all elements
+ */
+ async checkScrollability(viewport) {
+ const result = await this.page.evaluate(() => {
+ const page = document.querySelector('.ldr-page.active');
+ if (!page) return { exists: false };
+
+ const rect = page.getBoundingClientRect();
+ const isScrollable = page.scrollHeight > page.clientHeight ||
+ document.body.scrollHeight > window.innerHeight;
+
+ // Try scrolling to bottom
+ window.scrollTo(0, document.body.scrollHeight);
+
+ return {
+ exists: true,
+ isScrollable,
+ scrollHeight: document.body.scrollHeight,
+ viewportHeight: window.innerHeight,
+ canScrollToBottom: true
+ };
+ });
+
+ // Scroll back to top
+ await this.page.evaluate(() => window.scrollTo(0, 0));
+
+ const passed = result.exists;
+ const message = result.isScrollable
+ ? `Page is scrollable (content: ${result.scrollHeight}px, viewport: ${result.viewportHeight}px)`
+ : 'Page content fits in viewport without scrolling';
+
+ this.results.addResult(viewport, 'Content Scrollability', passed, message, result);
+ return passed;
+ }
+
+ /**
+ * Run all tests for a viewport
+ */
+ async testViewport(viewportName, viewportConfig) {
+ console.log(`\nTesting ${viewportName} (${viewportConfig.width}x${viewportConfig.height})...`);
+
+ await this.page.setViewport({
+ width: viewportConfig.width,
+ height: viewportConfig.height,
+ isMobile: true,
+ hasTouch: true
+ });
+
+ // Navigate to research page
+ await this.page.goto(BASE_URL, {
+ waitUntil: 'domcontentloaded',
+ timeout: 30000
+ });
+
+ // Wait for mobile nav to initialize
+ await new Promise(resolve => setTimeout(resolve, 1000));
+
+ // Run all tests
+ await this.checkVerticalSpacing(viewportName);
+ await this.checkLastElementVisibility(viewportName);
+ await this.checkForOverlappingElements(viewportName);
+ await this.checkTouchTargets(viewportName);
+ await this.checkBottomPadding(viewportName);
+ await this.checkScrollability(viewportName);
+
+ // Take a general screenshot
+ if (!IS_CI) {
+ await this.takeScreenshot('full-page', viewportName);
+ }
+ }
+
+ /**
+ * Main test runner
+ */
+ async run() {
+ console.log('========================================');
+ console.log(' Research Page Mobile Layout Tests');
+ console.log('========================================');
+ console.log(`Base URL: ${BASE_URL}`);
+ console.log(`Viewports: ${Object.keys(MOBILE_VIEWPORTS).length}`);
+ console.log('');
+
+ await this.setup();
+
+ try {
+ for (const [name, config] of Object.entries(MOBILE_VIEWPORTS)) {
+ await this.testViewport(name, config);
+ }
+ } finally {
+ await this.cleanup();
+ }
+
+ this.printSummary();
+ this.saveResults();
+
+ process.exit(this.results.summary.failed > 0 ? 1 : 0);
+ }
+
+ printSummary() {
+ const { summary } = this.results;
+
+ console.log('\n========================================');
+ console.log(' Test Summary');
+ console.log('========================================');
+ console.log(` Total: ${summary.total}`);
+ console.log(` Passed: ${summary.passed}`);
+ console.log(` Failed: ${summary.failed}`);
+ console.log(` Time: ${(summary.duration / 1000).toFixed(2)}s`);
+ console.log('========================================\n');
+
+ if (summary.failed > 0) {
+ console.log('Failed Tests:');
+ for (const test of this.results.tests.filter(t => !t.passed)) {
+ console.log(` ✗ [${test.viewport}] ${test.testName}`);
+ console.log(` ${test.message}`);
+ }
+ console.log('');
+ } else {
+ console.log('All tests passed!');
+ }
+ }
+
+ saveResults() {
+ const outputDir = path.join(__dirname, 'test-results');
+ if (!fs.existsSync(outputDir)) {
+ fs.mkdirSync(outputDir, { recursive: true });
+ }
+
+ const jsonPath = path.join(outputDir, 'research-page-mobile.json');
+ fs.writeFileSync(jsonPath, JSON.stringify(this.results.toJSON(), null, 2));
+ console.log(`Results saved to: ${jsonPath}`);
+ }
+}
+
+// Run tests
+if (require.main === module) {
+ const tester = new ResearchPageMobileTests();
+ tester.run().catch(error => {
+ console.error('Test failed:', error);
+ process.exit(1);
+ });
+}
+
+module.exports = { ResearchPageMobileTests };
diff --git a/tests/ui_tests/package.json b/tests/ui_tests/package.json
index ae8732d1fb..14e88ec8f4 100644
--- a/tests/ui_tests/package.json
+++ b/tests/ui_tests/package.json
@@ -26,6 +26,9 @@
"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",
+ "test:mobile:research": "node mobile/test_research_page_mobile.js",
+ "test:mobile:research:visual": "HEADLESS=false node mobile/test_research_page_mobile.js",
+ "test:mobile:layout": "node mobile/test_layout_bugs_ci.js",
"install-browsers": "npx puppeteer browsers install chrome"
},
"dependencies": {
diff --git a/tests/ui_tests/playwright/README.md b/tests/ui_tests/playwright/README.md
new file mode 100644
index 0000000000..0fc08dbda5
--- /dev/null
+++ b/tests/ui_tests/playwright/README.md
@@ -0,0 +1,149 @@
+# Playwright Mobile UI Tests
+
+Modern mobile UI testing with visual regression for Local Deep Research.
+
+## Why Playwright Instead of Puppeteer?
+
+Based on [industry research](https://www.browserstack.com/guide/playwright-vs-puppeteer), Playwright is the superior choice for mobile testing:
+
+| Feature | Puppeteer | Playwright |
+|---------|-----------|------------|
+| Browser Support | Chromium only | Chromium, Firefox, **WebKit (Safari)** |
+| Device Profiles | Limited | 100+ built-in devices |
+| Touch Gestures | Basic | Full support (swipe, pinch, etc.) |
+| Visual Regression | None | Built-in screenshot comparison |
+| Cross-browser | No | Yes |
+| Mobile Safari Testing | No | Yes (via WebKit) |
+
+## What This Tests
+
+### 1. Visual Regression Testing
+- **Full page screenshots** compared against baselines
+- **Bottom section screenshots** for the "mashed together" area
+- **Form actions area** where elements were cramped
+
+### 2. Element Spacing
+- Verifies minimum 8px gap between form elements
+- Detects overlapping interactive elements
+- Catches the "mashed together" layout bugs
+
+### 3. Touch Targets (iOS Accessibility)
+- All buttons >= 44x44px (Apple HIG requirement)
+- Checkboxes have adequate touch areas
+- Links are tappable on mobile
+
+### 4. Mobile Nav Clearance
+- Last element has 16px+ clearance above nav
+- Page has adequate bottom padding (76px+)
+- Content not hidden behind bottom navigation
+
+### 5. Scroll Behavior
+- All content reachable by scrolling
+- No horizontal scroll on mobile
+- Help panel visible when scrolled to bottom
+
+## Quick Start
+
+```bash
+# Install dependencies
+npm install
+
+# Install browsers
+npm run install-browsers
+
+# Run all tests
+npm test
+
+# Run only mobile tests
+npm run test:mobile
+
+# Update visual baselines
+npm run test:visual
+
+# Debug mode with UI
+npm run test:ui
+```
+
+## Device Coverage
+
+### Mobile (Primary)
+- iPhone SE (375x667) - Smallest common iPhone
+- iPhone 14 (393x852) - Current standard
+- iPhone 14 Pro Max (430x932) - Large phone
+- Pixel 5 (393x851) - Android reference
+- Galaxy S23 (360x780) - Samsung flagship
+
+### Tablet
+- iPad Mini (768x1024) - Breakpoint threshold
+- iPad Pro 11 (834x1194) - Large tablet
+
+### Desktop
+- Chrome, Firefox, Safari
+
+### Landscape (Critical for layout bugs)
+- iPhone SE Landscape
+- iPhone 14 Landscape
+
+## Visual Regression Workflow
+
+1. **First run**: Creates baseline screenshots
+2. **Subsequent runs**: Compares against baselines
+3. **On failure**: Shows visual diff highlighting changes
+4. **To update**: Run `npm run test:visual`
+
+### Screenshot Storage
+
+```
+tests/
+ research-page-full.png-snapshots/
+ research-page-full-iPhone-SE.png
+ research-page-full-iPhone-14.png
+ ...
+```
+
+## CI/CD Integration
+
+Add to your GitHub Actions workflow:
+
+```yaml
+- name: Run Playwright tests
+ run: |
+ cd tests/ui_tests/playwright
+ npm ci
+ npx playwright install --with-deps
+ npm test
+
+- name: Upload test results
+ if: failure()
+ uses: actions/upload-artifact@v4
+ with:
+ name: playwright-report
+ path: tests/ui_tests/playwright/playwright-report/
+```
+
+## Adding Percy (Optional)
+
+For cloud-based visual regression with AI diff:
+
+```bash
+# Install Percy
+npm install --save-dev @percy/cli @percy/playwright
+
+# Set your Percy token from the Percy dashboard
+# Then run with Percy
+npx percy exec -- npm test
+```
+
+## Key Files
+
+- `playwright.config.js` - Device configurations and settings
+- `tests/research-page.spec.js` - Research page mobile tests
+- `package.json` - Dependencies and scripts
+
+## Sources
+
+- [BrowserStack: Playwright vs Puppeteer](https://www.browserstack.com/guide/playwright-vs-puppeteer)
+- [Panto AI: Visual Regression in Mobile QA](https://www.getpanto.ai/blog/visual-regression-testing-in-mobile-qa)
+- [Quash: Responsive Design Testing 2025](https://quashbugs.com/blog/responsive-design-testing-mobile-screen-size-2025)
+- [Playwright Emulation Docs](https://playwright.dev/docs/emulation)
+- [Percy + Playwright Integration](https://github.com/percy/percy-playwright)
diff --git a/tests/ui_tests/playwright/package.json b/tests/ui_tests/playwright/package.json
new file mode 100644
index 0000000000..18b5cb31ec
--- /dev/null
+++ b/tests/ui_tests/playwright/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "ldr-playwright-tests",
+ "version": "1.0.0",
+ "description": "Playwright UI tests for Local Deep Research - proper mobile testing with visual regression",
+ "scripts": {
+ "test": "playwright test",
+ "test:mobile": "playwright test --project='iPhone SE' --project='iPhone 14' --project='Pixel 5'",
+ "test:tablet": "playwright test --project='iPad Mini' --project='iPad Pro 11'",
+ "test:desktop": "playwright test --project='Desktop Chrome' --project='Desktop Firefox' --project='Desktop Safari'",
+ "test:visual": "playwright test --update-snapshots",
+ "test:headed": "playwright test --headed",
+ "test:debug": "playwright test --debug",
+ "test:ui": "playwright test --ui",
+ "report": "playwright show-report",
+ "install-browsers": "playwright install"
+ },
+ "devDependencies": {
+ "@playwright/test": "^1.48.0",
+ "@percy/cli": "^1.29.0",
+ "@percy/playwright": "^1.0.6"
+ },
+ "keywords": [
+ "playwright",
+ "testing",
+ "mobile",
+ "visual-regression"
+ ]
+}
diff --git a/tests/ui_tests/playwright/playwright.config.js b/tests/ui_tests/playwright/playwright.config.js
new file mode 100644
index 0000000000..80fc777362
--- /dev/null
+++ b/tests/ui_tests/playwright/playwright.config.js
@@ -0,0 +1,198 @@
+/**
+ * Playwright Configuration for Local Deep Research
+ *
+ * This configuration enables proper mobile UI testing with:
+ * - Visual regression testing (screenshot comparison)
+ * - Multiple mobile device profiles
+ * - Cross-browser testing (Chromium, Firefox, WebKit/Safari)
+ * - Parallel execution for faster CI runs
+ *
+ * Migration from Puppeteer: This provides the "real" testing
+ * that Puppeteer emulation cannot deliver.
+ */
+
+import { defineConfig, devices } from '@playwright/test';
+
+/**
+ * See https://playwright.dev/docs/test-configuration
+ */
+export default defineConfig({
+ testDir: './tests',
+
+ /* Run tests in files in parallel */
+ fullyParallel: true,
+
+ /* Fail the build on CI if you accidentally left test.only in the source code */
+ forbidOnly: !!process.env.CI,
+
+ /* Retry on CI only */
+ retries: process.env.CI ? 2 : 0,
+
+ /* Opt out of parallel tests on CI for more consistent results */
+ workers: process.env.CI ? 1 : undefined,
+
+ /* Reporter to use */
+ reporter: [
+ ['html', { open: 'never' }],
+ ['json', { outputFile: 'test-results/results.json' }],
+ ['junit', { outputFile: 'test-results/results.xml' }],
+ ],
+
+ /* Shared settings for all projects */
+ use: {
+ /* Base URL to use in actions like `await page.goto('/')` */
+ baseURL: process.env.TEST_BASE_URL || 'http://127.0.0.1:5000',
+
+ /* Collect trace when retrying the failed test */
+ trace: 'on-first-retry',
+
+ /* Take screenshot on failure */
+ screenshot: 'only-on-failure',
+
+ /* Record video on failure */
+ video: 'on-first-retry',
+ },
+
+ /* Configure projects for major browsers and mobile devices */
+ projects: [
+ // ==========================================
+ // MOBILE DEVICES - Primary Testing Targets
+ // ==========================================
+
+ // Small iPhones (most constrained viewport)
+ {
+ name: 'iPhone SE',
+ use: {
+ ...devices['iPhone SE'],
+ // Additional settings for thorough testing
+ hasTouch: true,
+ isMobile: true,
+ },
+ },
+
+ // Standard iPhone (most popular)
+ {
+ name: 'iPhone 14',
+ use: {
+ ...devices['iPhone 14'],
+ hasTouch: true,
+ isMobile: true,
+ },
+ },
+
+ // Large iPhone (Pro Max)
+ {
+ name: 'iPhone 14 Pro Max',
+ use: {
+ ...devices['iPhone 14 Pro Max'],
+ hasTouch: true,
+ isMobile: true,
+ },
+ },
+
+ // Android - Small (budget phones)
+ {
+ name: 'Pixel 5',
+ use: {
+ ...devices['Pixel 5'],
+ hasTouch: true,
+ isMobile: true,
+ },
+ },
+
+ // Android - Large (Samsung Galaxy)
+ {
+ name: 'Galaxy S23',
+ use: {
+ viewport: { width: 360, height: 780 },
+ deviceScaleFactor: 3,
+ hasTouch: true,
+ isMobile: true,
+ userAgent: 'Mozilla/5.0 (Linux; Android 13; SM-S911B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36',
+ },
+ },
+
+ // ==========================================
+ // TABLETS
+ // ==========================================
+
+ {
+ name: 'iPad Mini',
+ use: {
+ ...devices['iPad Mini'],
+ hasTouch: true,
+ isMobile: true,
+ },
+ },
+
+ {
+ name: 'iPad Pro 11',
+ use: {
+ ...devices['iPad Pro 11'],
+ hasTouch: true,
+ isMobile: true,
+ },
+ },
+
+ // ==========================================
+ // LANDSCAPE ORIENTATIONS (Critical for layout bugs)
+ // ==========================================
+
+ {
+ name: 'iPhone SE Landscape',
+ use: {
+ ...devices['iPhone SE landscape'],
+ hasTouch: true,
+ isMobile: true,
+ },
+ },
+
+ {
+ name: 'iPhone 14 Landscape',
+ use: {
+ ...devices['iPhone 14 landscape'],
+ hasTouch: true,
+ isMobile: true,
+ },
+ },
+
+ // ==========================================
+ // DESKTOP BROWSERS
+ // ==========================================
+
+ {
+ name: 'Desktop Chrome',
+ use: { ...devices['Desktop Chrome'] },
+ },
+
+ {
+ name: 'Desktop Firefox',
+ use: { ...devices['Desktop Firefox'] },
+ },
+
+ {
+ name: 'Desktop Safari',
+ use: { ...devices['Desktop Safari'] },
+ },
+
+ // ==========================================
+ // WEBKIT/SAFARI MOBILE (Critical for iOS bugs)
+ // ==========================================
+
+ {
+ name: 'Mobile Safari',
+ use: {
+ ...devices['iPhone 14'],
+ browserName: 'webkit', // This uses WebKit, closer to real Safari
+ },
+ },
+ ],
+
+ /* Run your local dev server before starting the tests */
+ webServer: process.env.CI ? undefined : {
+ command: 'cd ../../../ && pdm run python -m local_deep_research.web.app',
+ url: 'http://127.0.0.1:5000',
+ reuseExistingServer: !process.env.CI,
+ timeout: 120000,
+ },
+});
diff --git a/tests/ui_tests/playwright/tests/research-page.spec.js b/tests/ui_tests/playwright/tests/research-page.spec.js
new file mode 100644
index 0000000000..528d7067fd
--- /dev/null
+++ b/tests/ui_tests/playwright/tests/research-page.spec.js
@@ -0,0 +1,397 @@
+/**
+ * Research Page Mobile Layout Tests
+ *
+ * These tests specifically target the "mashed together" issues on the
+ * Research page (home page) on mobile devices.
+ *
+ * Key areas tested:
+ * 1. Visual regression - screenshot comparison against baselines
+ * 2. Element spacing - adequate gaps between form elements
+ * 3. Touch targets - minimum 44px for iOS accessibility
+ * 4. Mobile nav clearance - content not hidden behind bottom nav
+ * 5. Scroll behavior - all content reachable by scrolling
+ */
+
+import { test, expect } from '@playwright/test';
+
+// Test configuration
+const MOBILE_NAV_HEIGHT = 56;
+const MIN_ELEMENT_SPACING = 8;
+const MIN_TOUCH_TARGET = 44;
+const MIN_NAV_CLEARANCE = 16;
+
+// Helper to authenticate
+async function authenticate(page) {
+ await page.goto('/auth/login');
+ await page.fill('input[name="username"]', 'test_admin');
+ await page.fill('input[name="password"]', 'testpass123');
+ await page.click('button[type="submit"]');
+ await page.waitForURL('/', { timeout: 10000 });
+}
+
+// ============================================
+// VISUAL REGRESSION TESTS
+// ============================================
+
+test.describe('Research Page - Visual Regression', () => {
+ test.beforeEach(async ({ page }) => {
+ await authenticate(page);
+ });
+
+ test('full page screenshot matches baseline', async ({ page }) => {
+ await page.goto('/');
+ await page.waitForLoadState('networkidle');
+
+ // Wait for mobile nav to initialize
+ await page.waitForTimeout(500);
+
+ // Take full-page screenshot and compare to baseline
+ await expect(page).toHaveScreenshot('research-page-full.png', {
+ fullPage: true,
+ // Allow 1% pixel difference for anti-aliasing variations
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+
+ test('bottom section screenshot matches baseline', async ({ page }) => {
+ await page.goto('/');
+ await page.waitForLoadState('networkidle');
+
+ // Scroll to bottom to capture the "mashed together" area
+ await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
+ await page.waitForTimeout(300);
+
+ await expect(page).toHaveScreenshot('research-page-bottom.png', {
+ maxDiffPixelRatio: 0.01,
+ });
+ });
+
+ test('form actions area screenshot', async ({ page }) => {
+ await page.goto('/');
+ await page.waitForLoadState('networkidle');
+
+ // Capture just the form actions area
+ const formActions = page.locator('.ldr-form-actions');
+ if (await formActions.count() > 0) {
+ await expect(formActions).toHaveScreenshot('form-actions.png');
+ }
+ });
+});
+
+// ============================================
+// ELEMENT SPACING TESTS
+// ============================================
+
+test.describe('Research Page - Element Spacing', () => {
+ test.beforeEach(async ({ page }) => {
+ await authenticate(page);
+ await page.goto('/');
+ await page.waitForLoadState('networkidle');
+ });
+
+ test('adequate spacing between form elements', async ({ page }) => {
+ // Get positions of key elements
+ const elements = await page.evaluate(() => {
+ const getRect = (selector) => {
+ const el = document.querySelector(selector);
+ if (!el) return null;
+ const rect = el.getBoundingClientRect();
+ return { top: rect.top, bottom: rect.bottom, height: rect.height };
+ };
+
+ return {
+ queryTextarea: getRect('#query'),
+ modeSelection: getRect('.ldr-mode-selection'),
+ advancedToggle: getRect('.ldr-advanced-options-toggle'),
+ formActions: getRect('.ldr-form-actions'),
+ formOptions: getRect('.ldr-form-options'),
+ helpPanel: getRect('.ldr-help-panel'),
+ };
+ });
+
+ // Check spacing between consecutive elements
+ const orderedElements = [
+ { name: 'queryTextarea', data: elements.queryTextarea },
+ { name: 'modeSelection', data: elements.modeSelection },
+ { name: 'advancedToggle', data: elements.advancedToggle },
+ { name: 'formActions', data: elements.formActions },
+ { name: 'formOptions', data: elements.formOptions },
+ { name: 'helpPanel', data: elements.helpPanel },
+ ].filter(e => e.data !== null);
+
+ for (let i = 1; i < orderedElements.length; i++) {
+ const prev = orderedElements[i - 1];
+ const curr = orderedElements[i];
+
+ if (prev.data && curr.data) {
+ const spacing = curr.data.top - prev.data.bottom;
+ expect(spacing, `Spacing between ${prev.name} and ${curr.name}`).toBeGreaterThanOrEqual(MIN_ELEMENT_SPACING);
+ }
+ }
+ });
+
+ test('no overlapping interactive elements', async ({ page }) => {
+ const overlaps = await page.evaluate(() => {
+ const elements = [
+ document.querySelector('#start-research-btn'),
+ document.querySelector('#notification-toggle'),
+ document.querySelector('.ldr-advanced-options-toggle'),
+ ].filter(Boolean);
+
+ const rects = elements.map(el => el.getBoundingClientRect());
+ const overlapping = [];
+
+ for (let i = 0; i < rects.length; i++) {
+ for (let j = i + 1; j < rects.length; j++) {
+ const r1 = rects[i];
+ const r2 = rects[j];
+
+ const overlap = !(r1.right < r2.left ||
+ r1.left > r2.right ||
+ r1.bottom < r2.top ||
+ r1.top > r2.bottom);
+
+ if (overlap) {
+ overlapping.push(`Element ${i} overlaps with element ${j}`);
+ }
+ }
+ }
+
+ return overlapping;
+ });
+
+ expect(overlaps, 'No elements should overlap').toHaveLength(0);
+ });
+});
+
+// ============================================
+// TOUCH TARGET TESTS
+// ============================================
+
+test.describe('Research Page - Touch Targets', () => {
+ test.beforeEach(async ({ page }) => {
+ await authenticate(page);
+ await page.goto('/');
+ await page.waitForLoadState('networkidle');
+ });
+
+ test('Start Research button meets 44px minimum', async ({ page }) => {
+ const button = page.locator('#start-research-btn');
+ const box = await button.boundingBox();
+
+ expect(box, 'Button should exist').toBeTruthy();
+ expect(box.height, 'Button height >= 44px').toBeGreaterThanOrEqual(MIN_TOUCH_TARGET);
+ expect(box.width, 'Button width >= 44px').toBeGreaterThanOrEqual(MIN_TOUCH_TARGET);
+ });
+
+ test('notification toggle meets 44px minimum', async ({ page }) => {
+ const toggle = page.locator('#notification-toggle');
+ const box = await toggle.boundingBox();
+
+ // For checkboxes, we check the label's touch area
+ if (box && (box.height < MIN_TOUCH_TARGET || box.width < MIN_TOUCH_TARGET)) {
+ // Check if parent label provides adequate touch area
+ const label = page.locator('label[for="notification-toggle"]');
+ const labelBox = await label.boundingBox();
+
+ expect(labelBox, 'Label should provide touch area').toBeTruthy();
+ expect(labelBox.height, 'Label height >= 44px').toBeGreaterThanOrEqual(MIN_TOUCH_TARGET);
+ }
+ });
+
+ test('all interactive elements have adequate touch targets', async ({ page }) => {
+ const smallTargets = await page.evaluate((MIN_SIZE) => {
+ const elements = document.querySelectorAll('button, a, input, select, textarea, [role="button"]');
+ const issues = [];
+
+ elements.forEach(el => {
+ const rect = el.getBoundingClientRect();
+ const style = window.getComputedStyle(el);
+
+ // Skip hidden elements
+ if (style.display === 'none' || style.visibility === 'hidden') return;
+ if (rect.width === 0 || rect.height === 0) return;
+
+ if (rect.width < MIN_SIZE || rect.height < MIN_SIZE) {
+ issues.push({
+ tag: el.tagName.toLowerCase(),
+ size: `${Math.round(rect.width)}x${Math.round(rect.height)}`,
+ text: (el.textContent || '').slice(0, 30),
+ });
+ }
+ });
+
+ return issues;
+ }, MIN_TOUCH_TARGET);
+
+ // Allow some small elements but flag if too many
+ expect(smallTargets.length, `Small touch targets: ${JSON.stringify(smallTargets)}`).toBeLessThan(5);
+ });
+});
+
+// ============================================
+// MOBILE NAVIGATION CLEARANCE TESTS
+// ============================================
+
+test.describe('Research Page - Mobile Nav Clearance', () => {
+ test.beforeEach(async ({ page }) => {
+ await authenticate(page);
+ await page.goto('/');
+ await page.waitForLoadState('networkidle');
+ await page.waitForTimeout(500); // Wait for mobile nav to initialize
+ });
+
+ test('last element has clearance above mobile nav', async ({ page, isMobile }) => {
+ // Skip for desktop
+ if (!isMobile) {
+ test.skip();
+ return;
+ }
+
+ const result = await page.evaluate((NAV_HEIGHT, MIN_CLEARANCE) => {
+ const mobileNav = document.querySelector('.ldr-mobile-bottom-nav');
+ if (!mobileNav) return { hasNav: false, clearance: 0 };
+
+ const navStyle = window.getComputedStyle(mobileNav);
+ if (navStyle.display === 'none') return { hasNav: false, clearance: 0 };
+
+ const navRect = mobileNav.getBoundingClientRect();
+
+ // Find the last visible content element
+ const contentElements = [
+ document.querySelector('.ldr-help-panel'),
+ document.querySelector('.ldr-form-options'),
+ document.querySelector('.ldr-form-actions'),
+ ].filter(Boolean);
+
+ let lastBottom = 0;
+ contentElements.forEach(el => {
+ const rect = el.getBoundingClientRect();
+ if (rect.bottom > lastBottom) {
+ lastBottom = rect.bottom;
+ }
+ });
+
+ return {
+ hasNav: true,
+ navTop: navRect.top,
+ lastElementBottom: lastBottom,
+ clearance: navRect.top - lastBottom,
+ };
+ }, MOBILE_NAV_HEIGHT, MIN_NAV_CLEARANCE);
+
+ if (result.hasNav) {
+ expect(result.clearance, `Clearance above nav: ${result.clearance}px`).toBeGreaterThanOrEqual(MIN_NAV_CLEARANCE);
+ }
+ });
+
+ test('page has adequate bottom padding for nav', async ({ page, isMobile }) => {
+ if (!isMobile) {
+ test.skip();
+ return;
+ }
+
+ const padding = await page.evaluate(() => {
+ const page = document.querySelector('.ldr-page.active');
+ if (!page) return 0;
+
+ const style = window.getComputedStyle(page);
+ return parseFloat(style.paddingBottom) + parseFloat(style.marginBottom);
+ });
+
+ // Should have at least nav height + some breathing room
+ expect(padding, 'Bottom padding for mobile nav').toBeGreaterThanOrEqual(MOBILE_NAV_HEIGHT + 20);
+ });
+});
+
+// ============================================
+// SCROLL BEHAVIOR TESTS
+// ============================================
+
+test.describe('Research Page - Scrollability', () => {
+ test.beforeEach(async ({ page }) => {
+ await authenticate(page);
+ await page.goto('/');
+ await page.waitForLoadState('networkidle');
+ });
+
+ test('can scroll to reveal all content', async ({ page }) => {
+ // Scroll to bottom
+ await page.evaluate(() => window.scrollTo(0, document.body.scrollHeight));
+ await page.waitForTimeout(300);
+
+ // Check that help panel is visible
+ const helpPanel = page.locator('.ldr-help-panel');
+ if (await helpPanel.count() > 0) {
+ await expect(helpPanel).toBeInViewport();
+ }
+
+ // Check that Start Research button is still accessible (scroll back up)
+ await page.evaluate(() => window.scrollTo(0, 0));
+ await page.waitForTimeout(300);
+
+ const startButton = page.locator('#start-research-btn');
+ await expect(startButton).toBeInViewport();
+ });
+
+ test('no horizontal scroll on mobile', async ({ page }) => {
+ const hasHorizontalScroll = await page.evaluate(() => {
+ return document.documentElement.scrollWidth > window.innerWidth;
+ });
+
+ expect(hasHorizontalScroll, 'Should have no horizontal scroll').toBe(false);
+ });
+});
+
+// ============================================
+// ADVANCED OPTIONS PANEL TESTS
+// ============================================
+
+test.describe('Research Page - Advanced Options', () => {
+ test.beforeEach(async ({ page }) => {
+ await authenticate(page);
+ await page.goto('/');
+ await page.waitForLoadState('networkidle');
+ });
+
+ test('advanced options toggle works on mobile', async ({ page }) => {
+ const toggle = page.locator('.ldr-advanced-options-toggle');
+ const panel = page.locator('.ldr-advanced-options-panel');
+
+ // Panel should be hidden initially
+ await expect(panel).not.toBeVisible();
+
+ // Click to expand
+ await toggle.click();
+ await page.waitForTimeout(300);
+
+ // Panel should now be visible
+ await expect(panel).toBeVisible();
+
+ // Check no horizontal overflow after expanding
+ const hasHorizontalScroll = await page.evaluate(() => {
+ return document.documentElement.scrollWidth > window.innerWidth;
+ });
+ expect(hasHorizontalScroll, 'No horizontal scroll after expanding').toBe(false);
+ });
+
+ test('advanced options panel content is accessible', async ({ page, isMobile }) => {
+ if (!isMobile) {
+ test.skip();
+ return;
+ }
+
+ const toggle = page.locator('.ldr-advanced-options-toggle');
+ await toggle.click();
+ await page.waitForTimeout(300);
+
+ // Check that form fields inside are usable
+ const modelSelect = page.locator('#model_provider');
+ if (await modelSelect.count() > 0) {
+ await expect(modelSelect).toBeVisible();
+
+ const box = await modelSelect.boundingBox();
+ expect(box.height, 'Model select height >= 44px').toBeGreaterThanOrEqual(MIN_TOUCH_TARGET);
+ }
+ });
+});