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:
128
frontend/menu-exploration-test.js
Normal file
128
frontend/menu-exploration-test.js
Normal file
@@ -0,0 +1,128 @@
|
||||
const { chromium } = require('playwright');
|
||||
|
||||
async function exploreMenuStructure() {
|
||||
console.log('🚀 探索菜单结构测试');
|
||||
|
||||
const browser = await chromium.launch({ headless: false });
|
||||
const page = await browser.newPage();
|
||||
|
||||
try {
|
||||
// 1. 访问首页并登录
|
||||
console.log('📍 访问首页并登录');
|
||||
await page.goto('http://localhost:8890');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// 登录
|
||||
await page.locator('input[type="text"]').first().fill('admin');
|
||||
await page.locator('input[type="password"]').first().fill('111111');
|
||||
await page.locator('button:has-text("登录")').first().click();
|
||||
await page.waitForTimeout(3000);
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
// 2. 获取所有菜单项
|
||||
console.log('📋 获取所有菜单项...');
|
||||
const menuItems = await page.$$eval('.ivu-menu .ivu-menu-item, .ivu-menu .ivu-menu-submenu-title',
|
||||
elements => elements.map(el => el.textContent.trim())
|
||||
);
|
||||
|
||||
console.log('📋 发现的菜单项:');
|
||||
menuItems.forEach((item, index) => {
|
||||
console.log(` ${index + 1}. ${item}`);
|
||||
});
|
||||
|
||||
// 3. 查找包含"管理"的菜单项
|
||||
const managementMenus = menuItems.filter(item => item.includes('管理'));
|
||||
console.log('🎯 包含"管理"的菜单项:', managementMenus);
|
||||
|
||||
// 4. 尝试查找统一注册系统相关的菜单
|
||||
const registerMenus = menuItems.filter(item =>
|
||||
item.includes('注册') ||
|
||||
item.includes('账号') ||
|
||||
item.includes('统一') ||
|
||||
item.includes('TG') ||
|
||||
item.includes('Telegram')
|
||||
);
|
||||
console.log('🔍 可能相关的菜单项:', registerMenus);
|
||||
|
||||
// 5. 点击每个管理类菜单查看子菜单
|
||||
for (const menuText of managementMenus) {
|
||||
console.log(`\n🔍 点击菜单: ${menuText}`);
|
||||
|
||||
try {
|
||||
const menuElement = page.locator(`.ivu-menu-submenu-title:has-text("${menuText}")`).first();
|
||||
if (await menuElement.isVisible()) {
|
||||
await menuElement.click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
// 查找子菜单
|
||||
const subMenus = await page.$$eval('.ivu-menu-submenu .ivu-menu-item',
|
||||
elements => elements.map(el => el.textContent.trim())
|
||||
);
|
||||
|
||||
console.log(` 子菜单:`, subMenus);
|
||||
|
||||
// 检查是否有统一注册系统
|
||||
const hasUnifiedRegister = subMenus.some(sub =>
|
||||
sub.includes('统一注册') ||
|
||||
sub.includes('注册系统') ||
|
||||
sub.includes('unifiedRegister')
|
||||
);
|
||||
|
||||
if (hasUnifiedRegister) {
|
||||
console.log('🎉 找到统一注册系统菜单!');
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(` 无法点击菜单 ${menuText}:`, error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// 6. 尝试直接访问统一注册页面
|
||||
console.log('\n🔗 尝试直接访问统一注册页面...');
|
||||
await page.goto('http://localhost:8890/#/tgAccountManage/unifiedRegister');
|
||||
await page.waitForTimeout(3000);
|
||||
|
||||
const currentURL = page.url();
|
||||
console.log('📍 当前URL:', currentURL);
|
||||
|
||||
if (currentURL.includes('unifiedRegister')) {
|
||||
console.log('✅ 成功直接访问统一注册系统页面!');
|
||||
|
||||
await page.screenshot({ path: 'unified-register-direct-access.png' });
|
||||
console.log('📸 统一注册页面截图已保存');
|
||||
|
||||
// 检查页面内容
|
||||
const pageElements = await page.$$eval('h1, h2, h3, .title',
|
||||
elements => elements.map(el => el.textContent.trim())
|
||||
);
|
||||
console.log('📋 页面标题元素:', pageElements);
|
||||
|
||||
// 检查策略选择
|
||||
const strategies = await page.$$eval('input[type="radio"], .radio-group',
|
||||
elements => elements.map(el => {
|
||||
const label = el.closest('label') || el.nextElementSibling || el.previousElementSibling;
|
||||
return label ? label.textContent.trim() : el.textContent.trim();
|
||||
})
|
||||
);
|
||||
console.log('⚙️ 策略选项:', strategies);
|
||||
|
||||
// 检查配置面板
|
||||
const configSections = await page.$$eval('.config, .form, [class*="config"]',
|
||||
elements => elements.map(el => el.textContent.trim().substring(0, 50))
|
||||
);
|
||||
console.log('📝 配置面板:', configSections);
|
||||
|
||||
} else {
|
||||
console.log('❌ 无法直接访问统一注册系统页面');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ 测试过程中出现错误:', error.message);
|
||||
await page.screenshot({ path: 'menu-exploration-error.png' });
|
||||
} finally {
|
||||
await browser.close();
|
||||
console.log('🏁 菜单探索测试完成');
|
||||
}
|
||||
}
|
||||
|
||||
exploreMenuStructure().catch(console.error);
|
||||
Reference in New Issue
Block a user