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
96 lines
3.3 KiB
JavaScript
96 lines
3.3 KiB
JavaScript
const puppeteer = require('puppeteer');
|
|
const { getPuppeteerLaunchOptions } = require('./puppeteer_config');
|
|
|
|
async function testMetricsDashboard() {
|
|
const browser = await puppeteer.launch(getPuppeteerLaunchOptions());
|
|
|
|
const page = await browser.newPage();
|
|
|
|
console.log('🚀 Testing metrics dashboard...');
|
|
|
|
try {
|
|
// Navigate to login page
|
|
await page.goto('http://127.0.0.1:5000/auth/login', { waitUntil: 'domcontentloaded' });
|
|
|
|
// Login with test user
|
|
const username = 'test_' + Date.now();
|
|
const password = 'T3st!Secure#2024$LDR';
|
|
|
|
// Register first
|
|
console.log('📝 Registering user:', username);
|
|
await page.click('a[href="/auth/register"]');
|
|
await page.waitForSelector('#username');
|
|
await page.type('#username', username);
|
|
await page.type('#password', password);
|
|
await page.type('#confirm_password', password);
|
|
|
|
// Check acknowledgment checkbox if present
|
|
const acknowledgeCheckbox = await page.$('input[name="acknowledge"]');
|
|
if (acknowledgeCheckbox) {
|
|
await page.click('input[name="acknowledge"]');
|
|
}
|
|
|
|
await page.click('button[type="submit"]');
|
|
|
|
// Wait for redirect to home
|
|
await page.waitForNavigation({ waitUntil: 'domcontentloaded' });
|
|
console.log('✅ Registration successful');
|
|
|
|
// Navigate to metrics page
|
|
console.log('📊 Navigating to metrics dashboard...');
|
|
await page.goto('http://127.0.0.1:5000/metrics/', { waitUntil: 'domcontentloaded' });
|
|
|
|
// Check if metrics page loaded
|
|
await page.waitForSelector('.metrics-container', { timeout: 5000 });
|
|
console.log('✅ Metrics container found');
|
|
|
|
// Check for error messages
|
|
const errorElement = await page.$('.error-message, .alert-danger');
|
|
if (errorElement) {
|
|
const errorText = await page.evaluate(el => el.textContent, errorElement);
|
|
console.log('❌ Error on page:', errorText);
|
|
} else {
|
|
console.log('✅ No error messages found');
|
|
}
|
|
|
|
// Check for metrics data
|
|
const hasCharts = await page.$('.chart-container, #token-usage-chart, canvas');
|
|
if (hasCharts) {
|
|
console.log('✅ Chart elements found');
|
|
} else {
|
|
console.log('⚠️ No chart elements found (expected for new user)');
|
|
}
|
|
|
|
|
|
// Try to access metrics API directly
|
|
console.log('🔍 Testing metrics API...');
|
|
const apiResponse = await page.evaluate(async () => {
|
|
try {
|
|
const response = await fetch('/metrics/api/data?period=30d&research_mode=all');
|
|
return {
|
|
status: response.status,
|
|
ok: response.ok,
|
|
data: await response.json()
|
|
};
|
|
} catch (error) {
|
|
return { error: error.message };
|
|
}
|
|
});
|
|
|
|
console.log('API Response:', JSON.stringify(apiResponse, null, 2));
|
|
|
|
console.log('✅ Metrics dashboard test completed!');
|
|
|
|
} catch (error) {
|
|
console.error('❌ Test failed:', error.message);
|
|
process.exitCode = 1;
|
|
} finally {
|
|
await browser.close();
|
|
}
|
|
}
|
|
|
|
testMetricsDashboard().catch(err => {
|
|
console.error('❌ Unhandled error:', err);
|
|
process.exitCode = 1;
|
|
});
|