Initial commit: Telegram Management System
Some checks failed
Deploy / deploy (push) Has been cancelled
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>
This commit is contained in:
88
frontend/test-tree-table.js
Normal file
88
frontend/test-tree-table.js
Normal file
@@ -0,0 +1,88 @@
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
async function testTreeTable() {
|
||||
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.log('正在测试树表格组件...');
|
||||
|
||||
try {
|
||||
// 先登录
|
||||
await page.goto('http://localhost:8890/login', { waitUntil: 'networkidle' });
|
||||
const usernameInput = await page.locator('input[placeholder*="用户名"], input[placeholder*="username"], input[type="text"]').first();
|
||||
const passwordInput = await page.locator('input[placeholder*="密码"], input[placeholder*="password"], input[type="password"]').first();
|
||||
await usernameInput.fill('admin');
|
||||
await passwordInput.fill('111111');
|
||||
const submitButton = await page.locator('button[type="submit"], button:has-text("登录"), button:has-text("Login")').first();
|
||||
await submitButton.click();
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
// 访问树表格页面
|
||||
await page.goto('http://localhost:8890/components/tree_table_page', {
|
||||
waitUntil: 'networkidle',
|
||||
timeout: 30000
|
||||
});
|
||||
|
||||
console.log('已访问树表格页面');
|
||||
|
||||
// 等待页面加载
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
// 截图
|
||||
await page.screenshot({
|
||||
path: 'tree-table-test.png',
|
||||
fullPage: true
|
||||
});
|
||||
|
||||
// 检查是否有新的树表格组件
|
||||
const hasTreeTable = await page.locator('.p-treetable').count();
|
||||
if (hasTreeTable > 0) {
|
||||
console.log('✅ 找到 PrimeVue 树表格组件');
|
||||
|
||||
// 测试展开/收起功能
|
||||
const expandButton = await page.locator('button:has-text("展开全部")').first();
|
||||
if (await expandButton.isVisible()) {
|
||||
await expandButton.click();
|
||||
console.log('✅ 展开全部按钮工作正常');
|
||||
}
|
||||
|
||||
// 测试搜索功能
|
||||
const searchInput = await page.locator('.p-inputtext').first();
|
||||
if (await searchInput.isVisible()) {
|
||||
await searchInput.fill('Tom');
|
||||
console.log('✅ 搜索功能可用');
|
||||
}
|
||||
} else {
|
||||
console.log('❌ 未找到树表格组件');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('测试失败:', error.message);
|
||||
}
|
||||
|
||||
// 保持浏览器打开5秒以便观察
|
||||
await page.waitForTimeout(5000);
|
||||
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
testTreeTable().catch(console.error);
|
||||
Reference in New Issue
Block a user