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 ab18a37..2336a67 100644 --- a/novalon-manage-web/e2e/journeys/admin-complete-workflow.spec.ts +++ b/novalon-manage-web/e2e/journeys/admin-complete-workflow.spec.ts @@ -72,9 +72,14 @@ test.describe('管理员完整工作流', () => { test('验证新用户登录', async ({ page }) => { await test.step('管理员登出', async () => { await page.goto('/dashboard'); - await page.locator('.el-dropdown-link').click(); + await page.waitForLoadState('networkidle'); + + const dropdownButton = page.locator('button:has-text("admin")').first(); + await dropdownButton.click(); + await page.waitForTimeout(500); + await page.locator('text=退出登录').click(); - await page.waitForURL(/.*login/); + await page.waitForURL(/.*login/, { timeout: 10000 }); }); await test.step('新用户登录', async () => { @@ -94,8 +99,15 @@ test.describe('管理员完整工作流', () => { test('清理测试数据', async ({ page }) => { await test.step('管理员重新登录', async () => { await page.goto('/dashboard'); - await page.locator('.el-dropdown-link').click(); - await page.locator('text=退出登录').click(); + await page.waitForLoadState('networkidle'); + + const dropdownButton = page.locator('button:has-text("admin")').first(); + if (await dropdownButton.isVisible()) { + await dropdownButton.click(); + await page.waitForTimeout(500); + await page.locator('text=退出登录').click(); + } + await page.goto('/login'); await page.locator('input[placeholder*="用户名"]').fill('admin'); await page.locator('input[placeholder*="密码"]').fill('admin123'); diff --git a/novalon-manage-web/e2e/journeys/audit-workflow.spec.ts b/novalon-manage-web/e2e/journeys/audit-workflow.spec.ts index d9c49f9..c16825c 100644 --- a/novalon-manage-web/e2e/journeys/audit-workflow.spec.ts +++ b/novalon-manage-web/e2e/journeys/audit-workflow.spec.ts @@ -24,12 +24,12 @@ test.describe('审计工作流', () => { await page.locator('text=审计中心').click(); await page.waitForTimeout(1000); - await page.locator('text=操作日志').click(); + await page.locator('menuitem:has-text("操作日志")').click(); await page.waitForLoadState('networkidle'); await page.waitForTimeout(1000); await expect(page).toHaveURL(/.*oplog/, { timeout: 10000 }); - await expect(page.locator('table')).toBeVisible({ timeout: 10000 }); + await expect(page.locator('.el-table')).toBeVisible({ timeout: 10000 }); }); await test.step('验证操作日志记录', async () => { @@ -47,7 +47,7 @@ test.describe('审计工作流', () => { await page.locator('text=审计中心').click(); await page.waitForTimeout(1000); - await page.locator('text=登录日志').click(); + await page.locator('menuitem:has-text("登录日志")').click(); await page.waitForLoadState('networkidle'); await page.waitForTimeout(1000); @@ -55,8 +55,8 @@ test.describe('审计工作流', () => { }); await test.step('验证登录日志显示', async () => { - await expect(page.locator('table')).toBeVisible(); - const logContent = await page.locator('table').textContent(); + await expect(page.locator('.el-table')).toBeVisible({ timeout: 10000 }); + const logContent = await page.locator('.el-table').textContent(); expect(logContent).toContain('admin'); }); }); @@ -69,11 +69,11 @@ test.describe('审计工作流', () => { await page.locator('text=审计中心').click(); await page.waitForTimeout(1000); - await page.locator('text=操作日志').click(); + await page.locator('menuitem:has-text("操作日志")').click(); await page.waitForLoadState('networkidle'); await page.waitForTimeout(1000); - await expect(page.locator('table')).toBeVisible({ timeout: 10000 }); + await expect(page.locator('.el-table')).toBeVisible({ timeout: 10000 }); }); await test.step('按模块筛选', async () => { diff --git a/novalon-manage-web/playwright/.auth/user.json b/novalon-manage-web/playwright/.auth/user.json index 37ad976..df267e7 100644 --- a/novalon-manage-web/playwright/.auth/user.json +++ b/novalon-manage-web/playwright/.auth/user.json @@ -14,7 +14,7 @@ }, { "name": "token", - "value": "eyJhbGciOiJIUzM4NCJ9.eyJyb2xlcyI6W10sInVzZXJJZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInN1YiI6ImFkbWluIiwiaWF0IjoxNzc1NTM4NzgxLCJleHAiOjE3NzU2MjUxODF9.-YWMX8Fdyt8-W0rppNP5QT6t2KI2HMj95LTijW209EBAav4u1lNuZZvBLUp0mbhT" + "value": "eyJhbGciOiJIUzM4NCJ9.eyJyb2xlcyI6W10sInVzZXJJZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIsInN1YiI6ImFkbWluIiwiaWF0IjoxNzc1NTQwMTQ4LCJleHAiOjE3NzU2MjY1NDh9.4i6qWxQjh--zr9CD8HDtM2ewxuEd4dITICiclx9ukcbFGWwu9WhDfhTSC4vWycAQ" } ] }