Files
learningcircuit--local-deep…/tests/ui_tests/test_metrics_screenshot.js
T
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

84 lines
2.9 KiB
JavaScript

const puppeteer = require('puppeteer');
const AuthHelper = require('./auth_helper');
async function captureMetricsScreenshot() {
const browser = await puppeteer.launch({
headless: false,
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
try {
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 720 });
const auth = new AuthHelper(page);
await auth.ensureAuthenticated();
console.log('Navigating to metrics...');
await page.goto('http://127.0.0.1:5000/metrics/', {
waitUntil: 'domcontentloaded',
timeout: 30000
});
// Wait for content to fully load
console.log('Waiting for metrics to load...');
await page.waitForSelector('.ldr-metrics-grid, .metrics-grid', { timeout: 10000 }).catch(() => {});
await new Promise(resolve => setTimeout(resolve, 5000));
// Take screenshot
await page.screenshot({
path: './metrics-grid-final.png',
fullPage: true
});
console.log('Screenshot saved: ./metrics-grid-final.png');
// Check grid layout
const gridInfo = await page.evaluate(() => {
const grid = document.querySelector('.ldr-metrics-grid');
if (!grid) return { error: 'Grid not found' };
const cards = grid.querySelectorAll('.ldr-metric-card');
const gridStyle = window.getComputedStyle(grid);
// Check card positions to see if they're side by side
const cardPositions = Array.from(cards).map(card => ({
left: card.offsetLeft,
top: card.offsetTop,
width: card.offsetWidth,
height: card.offsetHeight,
text: card.querySelector('.ldr-metric-label')?.textContent?.trim()
}));
// Group cards by row (same top position)
const rows = {};
cardPositions.forEach(card => {
if (!rows[card.top]) rows[card.top] = [];
rows[card.top].push(card);
});
return {
display: gridStyle.display,
gridTemplateColumns: gridStyle.gridTemplateColumns,
gap: gridStyle.gap,
totalCards: cards.length,
cardsPerRow: Object.values(rows)[0]?.length || 0,
rows: Object.keys(rows).length,
cardPositions
};
});
console.log('Grid Layout Analysis:', JSON.stringify(gridInfo, null, 2));
if (gridInfo.display === 'grid' && gridInfo.cardsPerRow > 1) {
console.log('✅ SUCCESS: Metrics are displayed in grid layout (side by side)');
} else {
console.log('❌ ISSUE: Metrics are not displayed side by side');
}
} finally {
await browser.close();
}
}
captureMetricsScreenshot().catch(console.error);