fix(e2e): 修复测试用例元素定位器和等待时间问题
问题: - 表单字段定位器使用placeholder,但实际字段没有placeholder - 测试用例查找不存在的"备注"字段 - 菜单导航缺少等待时间,导致页面加载不完整 - URL验证缺少超时设置 修复: - admin-complete-workflow.spec.ts: 使用label文本定位表单字段,移除备注字段 - audit-workflow.spec.ts: 添加页面加载等待和超时设置 - system-config-workflow.spec.ts: 添加页面加载等待和超时设置 优势: - 提高测试稳定性 - 减少因时序问题导致的失败 - 更准确的元素定位
This commit is contained in:
@@ -19,9 +19,12 @@ test.describe('审计工作流', () => {
|
||||
|
||||
await test.step('导航到操作日志', async () => {
|
||||
await page.goto('/dashboard');
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.locator('text=审计中心').click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator('text=操作日志').click();
|
||||
await expect(page.locator('table')).toBeVisible();
|
||||
await page.waitForLoadState('networkidle');
|
||||
await expect(page.locator('table')).toBeVisible({ timeout: 10000 });
|
||||
});
|
||||
|
||||
await test.step('验证操作日志记录', async () => {
|
||||
@@ -34,8 +37,11 @@ test.describe('审计工作流', () => {
|
||||
test('查看登录日志', async ({ page }) => {
|
||||
await test.step('导航到登录日志', async () => {
|
||||
await page.goto('/dashboard');
|
||||
await page.waitForLoadState('networkidle');
|
||||
await page.locator('text=审计中心').click();
|
||||
await page.waitForTimeout(500);
|
||||
await page.locator('text=登录日志').click();
|
||||
await page.waitForLoadState('networkidle');
|
||||
});
|
||||
|
||||
await test.step('验证登录日志显示', async () => {
|
||||
|
||||
Reference in New Issue
Block a user