diff --git a/novalon-manage-web/e2e/journeys/admin-complete-workflow.spec.ts b/novalon-manage-web/e2e/journeys/admin-complete-workflow.spec.ts index 6fd0c1f..ab18a37 100644 --- a/novalon-manage-web/e2e/journeys/admin-complete-workflow.spec.ts +++ b/novalon-manage-web/e2e/journeys/admin-complete-workflow.spec.ts @@ -13,21 +13,26 @@ test.describe('管理员完整工作流', () => { 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).toHaveURL(/.*roles/); + await page.waitForLoadState('networkidle'); + await expect(page).toHaveURL(/.*roles/, { timeout: 10000 }); }); await test.step('点击创建角色按钮', async () => { await page.locator('button:has-text("新增角色")').click(); + await page.waitForSelector('.el-dialog', { state: 'visible', timeout: 5000 }); }); await test.step('填写角色信息', async () => { - await page.locator('.el-dialog').locator('text=角色名称').locator('..').locator('input').fill(roleName); - await page.locator('.el-dialog').locator('text=角色标识').locator('..').locator('input').fill(roleKey); + const dialog = page.locator('.el-dialog'); + await dialog.locator('input').first().fill(roleName); + await dialog.locator('input').nth(1).fill(roleKey); }); await test.step('提交表单', async () => { - await page.locator('button:has-text("确定")').click(); + await page.locator('.el-dialog button:has-text("确定")').click(); + await page.waitForSelector('.el-dialog', { state: 'hidden', timeout: 10000 }); await expect(page.locator('.el-message--success')).toBeVisible({ timeout: 5000 }); }); }); @@ -35,25 +40,31 @@ 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 expect(page).toHaveURL(/.*users/); + await page.waitForLoadState('networkidle'); + await expect(page).toHaveURL(/.*users/, { timeout: 10000 }); }); await test.step('点击创建用户按钮', async () => { await page.locator('button:has-text("新增用户")').click(); + await page.waitForSelector('.el-dialog', { state: 'visible', timeout: 5000 }); }); await test.step('填写用户信息', async () => { - await page.locator('.el-dialog').locator('text=用户名').locator('..').locator('input').fill(username); - await page.locator('.el-dialog').locator('text=密码').locator('..').locator('input').fill('Test@123'); - await page.locator('.el-dialog').locator('text=昵称').locator('..').locator('input').fill(`测试用户${timestamp}`); - await page.locator('.el-dialog').locator('text=邮箱').locator('..').locator('input').fill(`test_${timestamp}@example.com`); - await page.locator('.el-dialog').locator('text=手机号').locator('..').locator('input').fill('13800138000'); + const dialog = page.locator('.el-dialog'); + await dialog.locator('input').first().fill(username); + await dialog.locator('input[type="password"]').fill('Test@123'); + await dialog.locator('input').nth(2).fill(`测试用户${timestamp}`); + await dialog.locator('input').nth(3).fill(`test_${timestamp}@example.com`); + await dialog.locator('input').nth(4).fill('13800138000'); }); await test.step('提交表单', async () => { - await page.locator('button:has-text("确定")').click(); + await page.locator('.el-dialog button:has-text("确定")').click(); + await page.waitForSelector('.el-dialog', { state: 'hidden', timeout: 10000 }); await expect(page.locator('.el-message--success')).toBeVisible({ timeout: 5000 }); }); }); diff --git a/novalon-manage-web/e2e/journeys/audit-workflow.spec.ts b/novalon-manage-web/e2e/journeys/audit-workflow.spec.ts index b9a4553..d9c49f9 100644 --- a/novalon-manage-web/e2e/journeys/audit-workflow.spec.ts +++ b/novalon-manage-web/e2e/journeys/audit-workflow.spec.ts @@ -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 () => { diff --git a/novalon-manage-web/e2e/journeys/system-config-workflow.spec.ts b/novalon-manage-web/e2e/journeys/system-config-workflow.spec.ts index 512593d..3a7591a 100644 --- a/novalon-manage-web/e2e/journeys/system-config-workflow.spec.ts +++ b/novalon-manage-web/e2e/journeys/system-config-workflow.spec.ts @@ -49,8 +49,12 @@ 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(500); await page.locator('text=字典管理').click(); + await page.waitForLoadState('networkidle'); + await expect(page).toHaveURL(/.*dict/, { timeout: 10000 }); }); await test.step('查看字典列表', async () => { @@ -70,8 +74,12 @@ test.describe('系统配置工作流', () => { test('参数管理流程', async ({ page }) => { await test.step('导航到参数管理', async () => { await page.goto('/dashboard'); - await page.locator('text=系统管理').click(); - await page.locator('text=参数管理').click(); + await page.waitForLoadState('networkidle'); + await page.locator('text=系统配置').click(); + await page.waitForTimeout(500); + await page.locator('text=参数配置').click(); + await page.waitForLoadState('networkidle'); + await expect(page).toHaveURL(/.*sys\/config/, { timeout: 10000 }); }); await test.step('查看参数列表', async () => {