task-249(admin.html观感对齐): 壳层换皮 e2e 验收规格 + task-20 角色胶囊断言同步(e2e 试跑被残留 dev server 阻塞,记入清单)

This commit is contained in:
2026-09-05 21:06:50 +08:00
parent cea7662fc3
commit e0ec2d864e
2 changed files with 48 additions and 1 deletions
+47
View File
@@ -0,0 +1,47 @@
import { expect, test, type Page } from '@playwright/test'
// module 13 task 249:壳层换皮真实验收 —— 蓝白浅色变量生效、角色胶囊/次级退出、
// 代表页跳转无 pageerror。断言用 CSS 变量与 DOM 结构,避免仅截图无断言。
async function openAdmin(page: Page) {
await page.goto('/admin-vue/')
await expect(page.locator('main h2')).toHaveText('用户管理')
}
test('test_task_249_shell_light_normal_primary_path', async ({ page }) => {
await openAdmin(page)
const vars = await page.evaluate(() => {
const s = getComputedStyle(document.documentElement)
return {
sidebar: s.getPropertyValue('--admin-sidebar').trim(),
primary: s.getPropertyValue('--admin-primary').trim(),
}
})
expect(vars.sidebar).toBe('#f8fbfe')
expect(vars.primary).toBe('#4f78a5')
await expect(page.locator('.admin-user-role')).toHaveText('super_admin')
})
test('test_task_249_shell_light_normal_variant_input', async ({ page }) => {
await openAdmin(page)
await expect(page.locator('.admin-user-logout')).toBeVisible()
await expect(page.locator('.admin-kicker')).toHaveText('运营管理控制台')
})
test('test_task_249_shell_light_boundary_empty_input', async ({ page }) => {
// 未知路由仍进 404,不因换皮破坏。
await page.goto('/admin-vue/definitely/not/exists')
await expect(page.locator('.not-found')).toContainText('404')
})
test('test_task_249_shell_light_invalid_input_rejected', async ({ page }) => {
// 代表页跳转整段无未捕获脚本错误。
const errors: string[] = []
page.on('pageerror', (error) => errors.push(error.message))
await openAdmin(page)
await page.goto('/admin-vue/account/menus')
await expect(page.locator('main h2')).toHaveText('菜单管理')
await page.goto('/admin-vue/account/groups')
await expect(page.locator('main h2')).toHaveText('数据权限分组')
expect(errors).toEqual([])
})
@@ -9,7 +9,7 @@ test('test_task_020_shell_browser_smoke_normal_primary_path', async ({ page }) =
await openAdmin(page)
await expect(page.getByRole('navigation', { name: '侧边栏菜单' })).toBeVisible()
await expect(page.locator('.admin-user-meta strong')).toHaveText('admin')
await expect(page.locator('.admin-user-meta span')).toHaveText('super_admin')
await expect(page.locator('.admin-user-role')).toHaveText('super_admin')
await expect(page.getByText('账号权限', { exact: true }).first()).toBeVisible()
})