Files
learningcircuit--local-deep…/tests/ui_tests/mobile/test_mobile_navigation_authenticated.js
wehub-resource-sync 7a0da7932b
OSV-Scanner (Scheduled) / scan-scheduled (push) Failing after 0s
Create Release / test-gate (push) Has been cancelled
Create Release / release-gate (push) Has been cancelled
Create Release / ci-gate (push) Has been cancelled
Create Release / version-check (push) Has been cancelled
Create Release / e2e-test-gate (push) Has been cancelled
Create Release / responsive-test-gate (push) Has been cancelled
Create Release / compat-test-gate (push) Has been cancelled
Create Release / compose-integration-gate (push) Has been cancelled
Create Release / vulture-gate (push) Has been cancelled
Create Release / build (push) Has been cancelled
Create Release / provenance (push) Has been cancelled
Create Release / prerelease-docker (push) Has been cancelled
Create Release / publish-docker (push) Has been cancelled
Create Release / create-release (push) Has been cancelled
Create Release / cleanup-changelog (push) Has been cancelled
Create Release / trigger-pypi (push) Has been cancelled
Create Release / monitor-pypi (push) Has been cancelled
Create Release / Clean up orphan prerelease tags and signatures (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-form] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-metrics] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [research-workflow] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-core] (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [history-news] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [library] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [link-analytics] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-core] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [chat-lifecycle] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [error-benchmark] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [settings-pages] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) (push) Has been cancelled
Docker Tests (Consolidated) / Accessibility Tests (push) Has been cancelled
Docker Tests (Consolidated) / LLM Unit Tests (push) Has been cancelled
Docker Tests (Consolidated) / LLM Example Tests (push) Has been cancelled
Docker Tests (Consolidated) / Production Image Smoke Test (push) Has been cancelled
Docker Tests (Consolidated) / Infrastructure Tests (push) Has been cancelled
OSSF Scorecard / OSSF Security Scorecard Analysis (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [mobile] (push) Has been cancelled
Backwards Compatibility / Verify Encryption Constants (push) Has been cancelled
Backwards Compatibility / PyPI Version Compatibility (push) Has been cancelled
Backwards Compatibility / Database Migration Tests (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Docker Tests (Consolidated) / detect-changes (push) Has been cancelled
Docker Tests (Consolidated) / Build Test Image (push) Has been cancelled
Docker Tests (Consolidated) / All Pytest Tests + Coverage (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [accessibility] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [api-crud] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-login] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-pages] (push) Has been cancelled
Docker Tests (Consolidated) / UI Tests (Puppeteer) [auth-register] (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:08:55 +08:00

98 lines
3.4 KiB
JavaScript

#!/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: 'domcontentloaded',
timeout: 30000
});
// Check for mobile navigation
const mobileNavInfo = await page.evaluate(() => {
const oldNav = document.querySelector('.mobile-tab-bar');
const newNav = document.querySelector('.ldr-mobile-bottom-nav');
const sidebar = document.querySelector('.ldr-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 (.ldr-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();
}