Some checks failed
Deploy / deploy (push) Has been cancelled
Full-stack web application for Telegram management - Frontend: Vue 3 + Vben Admin - Backend: NestJS - Features: User management, group broadcast, statistics 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
74 lines
1.9 KiB
JavaScript
74 lines
1.9 KiB
JavaScript
const { chromium } = require('playwright');
|
|
|
|
async function testHomepage() {
|
|
const browser = await chromium.launch({
|
|
headless: false,
|
|
slowMo: 50
|
|
});
|
|
|
|
const context = await browser.newContext({
|
|
viewport: { width: 1920, height: 1080 }
|
|
});
|
|
|
|
const page = await context.newPage();
|
|
|
|
// 监听控制台错误
|
|
page.on('console', msg => {
|
|
if (msg.type() === 'error') {
|
|
console.error(`控制台错误: ${msg.text()}`);
|
|
}
|
|
});
|
|
|
|
page.on('pageerror', error => {
|
|
console.error(`页面错误: ${error.message}`);
|
|
console.error(`错误堆栈: ${error.stack}`);
|
|
});
|
|
|
|
console.log('正在访问首页...');
|
|
|
|
try {
|
|
await page.goto('http://localhost:8890/', {
|
|
waitUntil: 'networkidle',
|
|
timeout: 30000
|
|
});
|
|
|
|
// 等待页面加载
|
|
await page.waitForTimeout(2000);
|
|
|
|
// 截图
|
|
await page.screenshot({
|
|
path: 'homepage-test.png',
|
|
fullPage: true
|
|
});
|
|
|
|
// 检查是否有错误信息
|
|
const errorText = await page.locator('.ivu-notice-desc').count();
|
|
if (errorText > 0) {
|
|
console.log('发现错误提示!');
|
|
const errors = await page.locator('.ivu-notice-desc').allTextContents();
|
|
console.log('错误信息:', errors);
|
|
}
|
|
|
|
// 检查页面是否正常渲染
|
|
const hasContent = await page.locator('body').count();
|
|
if (hasContent > 0) {
|
|
const bodyText = await page.locator('body').textContent();
|
|
if (bodyText.trim() === '') {
|
|
console.log('⚠️ 页面是空白的!');
|
|
} else {
|
|
console.log('✅ 页面有内容');
|
|
console.log('页面标题:', await page.title());
|
|
}
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('测试失败:', error.message);
|
|
}
|
|
|
|
// 保持浏览器打开5秒以便观察
|
|
await page.waitForTimeout(5000);
|
|
|
|
await browser.close();
|
|
}
|
|
|
|
testHomepage().catch(console.error); |