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: Implement comprehensive responsive UI tests

LearningCircuitfa52b6fa5330
diff --git a/.github/workflows/responsive-ui-tests-enhanced.yml b/.github/workflows/responsive-ui-tests-enhanced.yml
index e097d0b5a5..8cdec8f48b 100644
--- a/.github/workflows/responsive-ui-tests-enhanced.yml
+++ b/.github/workflows/responsive-ui-tests-enhanced.yml
@@ -130,13 +130,39 @@ jobs:
- name: Run responsive UI tests - ${{ matrix.viewport }}
id: run-tests
+ working-directory: tests/ui_tests
run: |
- # TODO: Responsive UI tests are not yet implemented
- # The test file test_responsive_ui_comprehensive.js does not exist
- # For now, we'll skip these tests
- echo "Responsive UI tests for ${{ matrix.viewport }} - SKIPPED (not implemented)"
- echo "test_exit_code=0" >> $GITHUB_OUTPUT
- echo "test_failed=0" >> $GITHUB_OUTPUT
+ set +e # Don't exit on test failure
+
+ # Run tests and capture output
+ HEADLESS=true node test_responsive_ui_comprehensive.js ${{ matrix.viewport }} 2>&1 | tee test-output.log
+ TEST_EXIT_CODE=${PIPESTATUS[0]}
+
+ # Extract summary for PR comment
+ echo "### 📱 ${{ matrix.viewport }} Test Results" > test-summary.md
+ echo "" >> test-summary.md
+
+ # Extract pass/fail counts
+ PASSED=$(grep -oP '\d+(?= passed)' test-output.log | tail -1 || echo "0")
+ FAILED=$(grep -oP '\d+(?= failed)' test-output.log | tail -1 || echo "0")
+ WARNINGS=$(grep -oP '\d+(?= warnings)' test-output.log | tail -1 || echo "0")
+
+ if [ "$FAILED" -eq "0" ]; then
+ echo "✅ **All tests passed!**" >> test-summary.md
+ else
+ echo "❌ **$FAILED critical issues found**" >> test-summary.md
+ fi
+
+ echo "" >> test-summary.md
+ echo "- ✅ Passed: $PASSED" >> test-summary.md
+ echo "- ❌ Failed: $FAILED" >> test-summary.md
+ echo "- ⚠️ Warnings: $WARNINGS" >> test-summary.md
+
+ echo "test_exit_code=$TEST_EXIT_CODE" >> $GITHUB_OUTPUT
+ echo "test_failed=$FAILED" >> $GITHUB_OUTPUT
+
+ # Only fail if critical failures
+ exit $TEST_EXIT_CODE
- name: Generate screenshot gallery
if: false # Disabled - screenshots not needed in CI
diff --git a/tests/ui_tests/test_responsive_ui_comprehensive.js b/tests/ui_tests/test_responsive_ui_comprehensive.js
new file mode 100644
index 0000000000..fe3101bde4
--- /dev/null
+++ b/tests/ui_tests/test_responsive_ui_comprehensive.js
@@ -0,0 +1,223 @@
+/**
+ * Comprehensive Responsive UI Testing
+ * Tests UI responsiveness across different viewport sizes
+ */
+
+const puppeteer = require('puppeteer');
+const AuthHelper = require('./auth_helper');
+
+// Viewport configurations
+const VIEWPORTS = {
+ mobile: { width: 375, height: 667, deviceScaleFactor: 2, isMobile: true, hasTouch: true },
+ tablet: { width: 768, height: 1024, deviceScaleFactor: 2, isMobile: true, hasTouch: true },
+ desktop: { width: 1280, height: 720, deviceScaleFactor: 1, isMobile: false, hasTouch: false }
+};
+
+// Pages to test
+const TEST_PAGES = [
+ { name: 'Home', path: '/' },
+ { name: 'Settings', path: '/settings/' },
+ { name: 'Metrics', path: '/metrics/' },
+ { name: 'History', path: '/history/' },
+ { name: 'News', path: '/news/' }
+];
+
+class ResponsiveUITester {
+ constructor(viewport = 'desktop') {
+ this.viewport = viewport;
+ this.baseUrl = process.env.TEST_BASE_URL || 'http://127.0.0.1:5000';
+ this.results = {
+ passed: 0,
+ failed: 0,
+ warnings: 0,
+ issues: []
+ };
+ }
+
+ async init() {
+ this.browser = await puppeteer.launch({
+ headless: process.env.HEADLESS !== 'false',
+ args: ['--no-sandbox', '--disable-setuid-sandbox']
+ });
+
+ this.page = await this.browser.newPage();
+ await this.page.setViewport(VIEWPORTS[this.viewport]);
+
+ // Authenticate
+ const auth = new AuthHelper(this.page, this.baseUrl);
+ await auth.ensureAuthenticated();
+ }
+
+ async testPage(pageInfo) {
+ const url = `${this.baseUrl}${pageInfo.path}`;
+ console.log(`Testing ${pageInfo.name} at ${this.viewport} viewport...`);
+
+ try {
+ await this.page.goto(url, {
+ waitUntil: 'networkidle2',
+ timeout: 30000
+ });
+
+ // Check for horizontal overflow
+ const hasHorizontalOverflow = await this.page.evaluate(() => {
+ return document.body.scrollWidth > window.innerWidth;
+ });
+
+ if (hasHorizontalOverflow) {
+ this.results.warnings++;
+ this.results.issues.push(`⚠️ ${pageInfo.name}: Horizontal overflow detected at ${this.viewport}`);
+ }
+
+ // Check for overlapping elements
+ const hasOverlaps = await this.checkForOverlaps();
+ if (hasOverlaps) {
+ this.results.warnings++;
+ this.results.issues.push(`⚠️ ${pageInfo.name}: Overlapping elements detected at ${this.viewport}`);
+ }
+
+ // Check text readability
+ const hasSmallText = await this.page.evaluate(() => {
+ const elements = document.querySelectorAll('*');
+ for (const el of elements) {
+ const style = window.getComputedStyle(el);
+ const fontSize = parseFloat(style.fontSize);
+ if (fontSize > 0 && fontSize < 12 && el.textContent.trim()) {
+ return true;
+ }
+ }
+ return false;
+ });
+
+ if (hasSmallText && this.viewport === 'mobile') {
+ this.results.warnings++;
+ this.results.issues.push(`⚠️ ${pageInfo.name}: Text too small for mobile viewing`);
+ }
+
+ // Check touch target sizes for mobile
+ if (this.viewport === 'mobile') {
+ const hasSmallTouchTargets = await this.page.evaluate(() => {
+ const clickables = document.querySelectorAll('button, a, input, select, textarea');
+ for (const el of clickables) {
+ const rect = el.getBoundingClientRect();
+ if (rect.width > 0 && rect.height > 0 && (rect.width < 44 || rect.height < 44)) {
+ return true;
+ }
+ }
+ return false;
+ });
+
+ if (hasSmallTouchTargets) {
+ this.results.warnings++;
+ this.results.issues.push(`⚠️ ${pageInfo.name}: Touch targets too small (< 44px)`);
+ }
+ }
+
+ this.results.passed++;
+ console.log(`✅ ${pageInfo.name} passed basic responsive checks`);
+
+ } catch (error) {
+ this.results.failed++;
+ this.results.issues.push(`❌ ${pageInfo.name}: ${error.message}`);
+ console.error(`❌ Error testing ${pageInfo.name}:`, error.message);
+ }
+ }
+
+ async checkForOverlaps() {
+ return await this.page.evaluate(() => {
+ const elements = document.querySelectorAll('button, a, input, select');
+ const rects = [];
+
+ for (const el of elements) {
+ const rect = el.getBoundingClientRect();
+ if (rect.width > 0 && rect.height > 0) {
+ rects.push(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];
+ const r2 = rects[j];
+
+ const overlap = !(r1.right < r2.left ||
+ r1.left > r2.right ||
+ r1.bottom < r2.top ||
+ r1.top > r2.bottom);
+
+ if (overlap) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ });
+ }
+
+ async runTests() {
+ await this.init();
+
+ console.log(`\n📱 Running Responsive UI Tests for ${this.viewport.toUpperCase()} viewport\n`);
+
+ for (const pageInfo of TEST_PAGES) {
+ await this.testPage(pageInfo);
+ }
+
+ await this.cleanup();
+ this.printResults();
+ }
+
+ async cleanup() {
+ if (this.browser) {
+ await this.browser.close();
+ }
+ }
+
+ printResults() {
+ console.log('\n' + '='.repeat(50));
+ console.log('RESPONSIVE UI TEST RESULTS');
+ console.log('='.repeat(50));
+ console.log(`Viewport: ${this.viewport.toUpperCase()}`);
+ console.log(`✅ ${this.results.passed} passed`);
+ console.log(`❌ ${this.results.failed} failed`);
+ console.log(`⚠️ ${this.results.warnings} warnings`);
+
+ if (this.results.issues.length > 0) {
+ console.log('\nIMPROVEMENT SUGGESTIONS:');
+ this.results.issues.forEach(issue => {
+ console.log(issue);
+ });
+ }
+
+ console.log('='.repeat(50));
+
+ // Exit with error if there are failures
+ if (this.results.failed > 0) {
+ process.exit(1);
+ }
+ }
+}
+
+// Main execution
+async function main() {
+ const viewport = process.argv[2] || 'desktop';
+
+ if (!VIEWPORTS[viewport]) {
+ console.error(`Invalid viewport: ${viewport}. Use: mobile, tablet, or desktop`);
+ process.exit(1);
+ }
+
+ const tester = new ResponsiveUITester(viewport);
+ await tester.runTests();
+}
+
+// Run if executed directly
+if (require.main === module) {
+ main().catch(error => {
+ console.error('Test execution failed:', error);
+ process.exit(1);
+ });
+}
+
+module.exports = { ResponsiveUITester };