Files
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.1 KiB
JavaScript

/**
* Simple test to verify news.js loads without syntax errors
*/
const puppeteer = require('puppeteer');
const AuthHelper = require('./auth_helper');
const BASE_URL = process.env.BASE_URL || 'http://127.0.0.1:5000';
async function testNewsJsLoads() {
const browser = await puppeteer.launch({
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const page = await browser.newPage();
// Track JavaScript errors
const jsErrors = [];
page.on('pageerror', error => {
jsErrors.push({
message: error.message,
stack: error.stack
});
});
const authHelper = new AuthHelper(page, BASE_URL);
try {
// Login
console.log('🔐 Logging in...');
await authHelper.ensureAuthenticated();
// Load news page
console.log('📄 Loading news page...');
await page.goto(`${BASE_URL}/news`, {
waitUntil: 'domcontentloaded',
timeout: 30000
});
// Wait a bit for scripts to execute
await new Promise(resolve => setTimeout(resolve, 3000));
// Check for JavaScript errors
if (jsErrors.length > 0) {
console.log('❌ JavaScript errors detected:');
jsErrors.forEach(err => {
console.log(' Error:', err.message);
if (err.stack) {
console.log(' Stack:', err.stack.split('\n')[0]);
}
});
} else {
console.log('✅ No JavaScript errors');
}
// Check if useNewsTemplate function is available
const functionExists = await page.evaluate(() => {
return typeof window.useNewsTemplate === 'function';
});
if (functionExists) {
console.log('✅ useNewsTemplate function is available');
// Test clicking a template button
const clicked = await page.evaluate(() => {
const buttons = Array.from(document.querySelectorAll('.template-btn'));
const breakingNewsBtn = buttons.find(b => b.textContent.includes('Breaking News'));
if (breakingNewsBtn) {
console.log('Found Breaking News button');
return true;
}
return false;
});
console.log(clicked ? '✅ Breaking News button found' : '❌ Breaking News button not found');
} else {
console.log('❌ useNewsTemplate function NOT available');
// Check what functions are available
const availableFunctions = await page.evaluate(() => {
return Object.keys(window).filter(key =>
key.includes('News') && typeof window[key] === 'function'
);
});
console.log(' Available news-related functions:', availableFunctions);
}
} catch (error) {
console.error('❌ Test failed:', error.message);
} finally {
await browser.close();
}
}
// Run the test
testNewsJsLoads().catch(console.error);