test: 优化系统配置菜单测试选择器

- 增加展开系统管理菜单的步骤
- 更新选择器以匹配实际的菜单文本
- 提高测试稳定性
This commit is contained in:
张翔
2026-04-15 22:02:35 +08:00
parent b547db9ace
commit 8896362bd3
+17 -1
View File
@@ -239,10 +239,23 @@ async function captureStep(page, stepName) {
console.log('=====================================');
try {
// 首先展开系统管理菜单(如果是折叠状态)
const systemMenuSelector = '.el-sub-menu:has-text("系统管理")';
const systemMenuElement = page.locator(systemMenuSelector).first();
if (await systemMenuElement.count() > 0) {
// 点击展开系统管理菜单
await systemMenuElement.click();
await page.waitForTimeout(500);
// 然后点击参数配置菜单项
const configMenuSelectors = [
'.el-menu-item:has-text("参数配置")',
'.el-menu-item:has-text("系统配置")',
'.el-menu-item:has-text("配置管理")',
'text=参数配置',
'text=系统配置',
'text=配置管理',
'text=配置',
'[data-menu="config"]',
'a[href*="config"]'
];
@@ -264,6 +277,9 @@ async function captureStep(page, stepName) {
} else {
throw new Error('未找到系统配置菜单');
}
} else {
throw new Error('未找到系统管理菜单');
}
} catch (error) {
logTest('导航到系统配置页面', false, error.message);
}