From e0ec2d864e0492f6f36c0392b6f7313e44b2dc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=87=AA=E8=BE=BE?= <980324341@qq.com> Date: Sat, 5 Sep 2026 21:06:50 +0800 Subject: [PATCH] =?UTF-8?q?task-249(admin.html=E8=A7=82=E6=84=9F=E5=AF=B9?= =?UTF-8?q?=E9=BD=90):=20=E5=A3=B3=E5=B1=82=E6=8D=A2=E7=9A=AE=20e2e=20?= =?UTF-8?q?=E9=AA=8C=E6=94=B6=E8=A7=84=E6=A0=BC=20+=20task-20=20=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E8=83=B6=E5=9B=8A=E6=96=AD=E8=A8=80=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=EF=BC=88e2e=20=E8=AF=95=E8=B7=91=E8=A2=AB=E6=AE=8B=E7=95=99=20?= =?UTF-8?q?dev=20server=20=E9=98=BB=E5=A1=9E=EF=BC=8C=E8=AE=B0=E5=85=A5?= =?UTF-8?q?=E6=B8=85=E5=8D=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin-frontend-vue/e2e/13-shell.spec.ts | 47 +++++++++++++++++++ .../e2e/task-20-shell-smoke.spec.ts | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 admin-frontend-vue/e2e/13-shell.spec.ts diff --git a/admin-frontend-vue/e2e/13-shell.spec.ts b/admin-frontend-vue/e2e/13-shell.spec.ts new file mode 100644 index 00000000..7bd6bfb7 --- /dev/null +++ b/admin-frontend-vue/e2e/13-shell.spec.ts @@ -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([]) +}) diff --git a/admin-frontend-vue/e2e/task-20-shell-smoke.spec.ts b/admin-frontend-vue/e2e/task-20-shell-smoke.spec.ts index 3e59a0e3..45440efc 100644 --- a/admin-frontend-vue/e2e/task-20-shell-smoke.spec.ts +++ b/admin-frontend-vue/e2e/task-20-shell-smoke.spec.ts @@ -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() })