From bd4b2a579e3979141a574f48c5fcca44037a9676 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 12:34:31 +0800 Subject: [PATCH] =?UTF-8?q?task-19(=E5=A3=B3=E5=B1=82/=E8=B7=AF=E7=94=B1):?= =?UTF-8?q?=20=E9=AA=8C=E8=AF=81=E9=A6=96=E6=89=B9=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BB=8E=E5=A3=B3=E5=B1=82=E6=AD=A3=E7=A1=AE=E6=8C=82=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit e2e 8 用例:users/menus/groups 三页面经壳层挂载、根路由跳首个可见页、菜单激活态、 面包屑(分组->页面) 与 404 兜底的真实浏览器断言。 --- .../e2e/task-19-first-batch-mount.spec.ts | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 admin-frontend-vue/e2e/task-19-first-batch-mount.spec.ts diff --git a/admin-frontend-vue/e2e/task-19-first-batch-mount.spec.ts b/admin-frontend-vue/e2e/task-19-first-batch-mount.spec.ts new file mode 100644 index 00000000..7dd01014 --- /dev/null +++ b/admin-frontend-vue/e2e/task-19-first-batch-mount.spec.ts @@ -0,0 +1,64 @@ +import { expect, test, type Page } from '@playwright/test' + +async function gotoRoute(page: Page, path: string) { + await page.goto(path) +} + +test('test_task_019_first_batch_mount_normal_primary_path', async ({ page }) => { + await gotoRoute(page, '/admin-vue/account/users') + await expect(page.locator('main h2')).toHaveText('用户管理') + await expect(page.locator('.admin-topbar h1')).toHaveText('用户管理') +}) + +test('test_task_019_first_batch_mount_normal_variant_input', async ({ page }) => { + await gotoRoute(page, '/admin-vue/account/menus') + await expect(page.locator('main h2')).toHaveText('菜单管理') + await expect(page.locator('.admin-topbar h1')).toHaveText('菜单管理') +}) + +test('test_task_019_first_batch_mount_normal_repeated_operation_is_idempotent', async ({ page }) => { + await gotoRoute(page, '/admin-vue/account/groups') + await expect(page.locator('main h2')).toHaveText('数据权限分组') + await gotoRoute(page, '/admin-vue/account/users') + await expect(page.locator('main h2')).toHaveText('用户管理') + await gotoRoute(page, '/admin-vue/account/groups') + await expect(page.locator('main h2')).toHaveText('数据权限分组') +}) + +test('test_task_019_first_batch_mount_boundary_empty_input', async ({ page }) => { + // 根路由跳转到首个可见页面(用户管理)。 + await gotoRoute(page, '/admin-vue/') + await expect(page.locator('main h2')).toHaveText('用户管理') + await expect(page).toHaveURL(/\/account\/users$/) +}) + +test('test_task_019_first_batch_mount_boundary_single_item', async ({ page }) => { + await gotoRoute(page, '/admin-vue/account/menus') + await expect(page.locator('main h2')).toHaveText('菜单管理') + const active = page.locator('.el-menu-item.is-active') + await expect(active).toHaveText('菜单管理') +}) + +test('test_task_019_first_batch_mount_boundary_limit_or_missing_field', async ({ page }) => { + // 三个页面均可从侧边栏导航切换(挂载于同一壳层实例)。 + await gotoRoute(page, '/admin-vue/account/users') + await expect(page.locator('main h2')).toHaveText('用户管理') + await page.getByText('菜单管理', { exact: true }).first().click() + await expect(page.locator('main h2')).toHaveText('菜单管理') + await page.getByText('数据权限分组', { exact: true }).first().click() + await expect(page.locator('main h2')).toHaveText('数据权限分组') +}) + +test('test_task_019_first_batch_mount_invalid_input_rejected', async ({ page }) => { + await gotoRoute(page, '/admin-vue/no-such-page') + await expect(page.locator('.not-found')).toBeVisible() + await expect(page.locator('.admin-topbar h1')).toHaveText('页面不存在') +}) + +test('test_task_019_first_batch_mount_dependency_failure_returns_actionable_message', async ({ page }) => { + // 分组内页面展示 分组->页面 两级面包屑。 + await gotoRoute(page, '/admin-vue/account/users') + await expect(page.locator('.admin-breadcrumb')).toBeVisible() + await expect(page.locator('.admin-breadcrumb')).toContainText('账号权限') + await expect(page.locator('.admin-breadcrumb')).toContainText('用户管理') +})