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.

feat: Add visual debugging with screenshots to responsive UI tests

LearningCircuitfaff63da5ac8
diff --git a/tests/ui_tests/test_responsive_ui_comprehensive.js b/tests/ui_tests/test_responsive_ui_comprehensive.js
index a39bcf4745..db29ab44b8 100644
--- a/tests/ui_tests/test_responsive_ui_comprehensive.js
+++ b/tests/ui_tests/test_responsive_ui_comprehensive.js
@@ -6,6 +6,8 @@
const puppeteer = require('puppeteer');
const AuthHelper = require('./auth_helper');
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
+const fs = require('fs');
+const path = require('path');
// Viewport configurations
const VIEWPORTS = {
@@ -33,6 +35,12 @@ class ResponsiveUITester {
warnings: 0,
issues: []
};
+
+ // Create screenshots directory
+ this.screenshotsDir = path.join(__dirname, 'screenshots', viewport);
+ if (!process.env.CI && !fs.existsSync(this.screenshotsDir)) {
+ fs.mkdirSync(this.screenshotsDir, { recursive: true });
+ }
}
async init() {
@@ -95,6 +103,13 @@ class ResponsiveUITester {
if (hasHorizontalOverflow) {
this.results.warnings++;
this.results.issues.push(`⚠️ ${pageInfo.name}: Horizontal overflow detected at ${this.viewport}`);
+
+ // Take screenshot if not in CI
+ if (!process.env.CI) {
+ const screenshotPath = path.join(this.screenshotsDir, `${pageInfo.name.toLowerCase()}-overflow.png`);
+ await this.page.screenshot({ path: screenshotPath, fullPage: true });
+ console.log(` 📸 Screenshot saved: ${screenshotPath}`);
+ }
}
// Check for overlapping elements
@@ -102,6 +117,19 @@ class ResponsiveUITester {
if (hasOverlaps) {
this.results.warnings++;
this.results.issues.push(`⚠️ ${pageInfo.name}: Overlapping elements detected at ${this.viewport}`);
+
+ // Highlight overlapping elements and take screenshot if not in CI
+ if (!process.env.CI) {
+ await this.page.evaluate(() => {
+ const elements = document.querySelectorAll('button, a, input, select');
+ elements.forEach(el => {
+ el.style.outline = '2px solid red';
+ });
+ });
+ const screenshotPath = path.join(this.screenshotsDir, `${pageInfo.name.toLowerCase()}-overlaps.png`);
+ await this.page.screenshot({ path: screenshotPath, fullPage: true });
+ console.log(` 📸 Screenshot saved: ${screenshotPath}`);
+ }
}
// Check text readability
@@ -120,6 +148,24 @@ class ResponsiveUITester {
if (hasSmallText && this.viewport === 'mobile') {
this.results.warnings++;
this.results.issues.push(`⚠️ ${pageInfo.name}: Text too small for mobile viewing`);
+
+ // Highlight small text and take screenshot if not in CI
+ if (!process.env.CI) {
+ await this.page.evaluate(() => {
+ const elements = document.querySelectorAll('*');
+ elements.forEach(el => {
+ const style = window.getComputedStyle(el);
+ const fontSize = parseFloat(style.fontSize);
+ if (fontSize > 0 && fontSize < 12 && el.textContent.trim()) {
+ el.style.backgroundColor = 'yellow';
+ el.style.border = '1px solid orange';
+ }
+ });
+ });
+ const screenshotPath = path.join(this.screenshotsDir, `${pageInfo.name.toLowerCase()}-small-text.png`);
+ await this.page.screenshot({ path: screenshotPath, fullPage: true });
+ console.log(` 📸 Screenshot saved: ${screenshotPath}`);
+ }
}
// Check touch target sizes for mobile
@@ -138,6 +184,23 @@ class ResponsiveUITester {
if (hasSmallTouchTargets) {
this.results.warnings++;
this.results.issues.push(`⚠️ ${pageInfo.name}: Touch targets too small (< 44px)`);
+
+ // Highlight small touch targets and take screenshot if not in CI
+ if (!process.env.CI) {
+ await this.page.evaluate(() => {
+ const clickables = document.querySelectorAll('button, a, input, select, textarea');
+ clickables.forEach(el => {
+ const rect = el.getBoundingClientRect();
+ if (rect.width > 0 && rect.height > 0 && (rect.width < 44 || rect.height < 44)) {
+ el.style.outline = '2px dashed blue';
+ el.style.outlineOffset = '2px';
+ }
+ });
+ });
+ const screenshotPath = path.join(this.screenshotsDir, `${pageInfo.name.toLowerCase()}-small-touch-targets.png`);
+ await this.page.screenshot({ path: screenshotPath, fullPage: true });
+ console.log(` 📸 Screenshot saved: ${screenshotPath}`);
+ }
}
}