fix(e2e): 优化测试用例定位器和等待策略
问题: - 表单字段定位器过于复杂且不稳定 - 对话框打开/关闭缺少等待逻辑 - 菜单导航路径错误 - 页面加载等待时间不足 修复: - 简化表单字段定位器,使用索引定位 - 添加对话框状态等待(visible/hidden) - 修正菜单导航路径(系统配置 -> 参数配置/字典管理) - 增加页面加载等待和超时设置 - 统一菜单导航的等待策略 优势: - 提高测试稳定性 - 减少元素定位失败 - 确保页面完全加载后再操作 - 更清晰的测试代码结构
This commit is contained in:
@@ -64,9 +64,16 @@ test.describe('审计工作流', () => {
|
||||
test('搜索和筛选日志', async ({ page }) => {
|
||||
await test.step('导航到操作日志', async () => {
|
||||
await page.goto('/dashboard');
|
||||
await page.locator('text=系统监控').click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.locator('text=审计中心').click();
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await page.locator('text=操作日志').click();
|
||||
await expect(page.locator('table')).toBeVisible();
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
await expect(page.locator('table')).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
await test.step('按模块筛选', async () => {
|
||||
|
||||
Reference in New Issue
Block a user