admin-governance.spec 此前全 page.route mock /admin-api/muse/**(~20 端点)、前后端契约从未端到端跑;认证注入 localStorage key 硬编码 muse-vben-antd-... 实为 undefined-5.7.0-dev-core-access(VITE_APP_NAMESPACE 未定义→运行时 undefined)、mock 下从不暴露。
命门(实证打通):①认证=与 studio 共用 mock-token Bearer test1(mockSecret test+userId1);②权限=admin 用户原无角色(system_user_role 空)→403,globalSetup 幂等 seed system_user_role(1,1)(super_admin)+DEL redis user_role_ids:1 刷权限缓存→超管跳过 @PreAuthorize;③代理=admin vite 已硬编码 /admin-api→48080、nitroMock 默认关。
基建:新建 global-setup(seed user_role+DEL redis+PG 复位)、playwright.config 加 globalSetup+workers:1、加 pg。spec 改真 localStorage key+token test1+删 routeMuseAdminApis mock(catch-all /admin-api/** 补 tenant-id:1 真打 48080;notify/dict/tenant 平台外壳保留 mock 因切片库无 notify 表返 500)+get-permission-info 走真后端。account 子域真连:真分页 {pageNo,pageSize,total,list} 前端 PageResult 只读 list/total 契约兼容;其他 8 子域 test.skip。独立连跑 15 次绿(含冷启动)。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
32 lines
896 B
TypeScript
32 lines
896 B
TypeScript
import { defineConfig, devices } from 'playwright/test';
|
|
|
|
export default defineConfig({
|
|
expect: {
|
|
timeout: 10_000,
|
|
},
|
|
// 活体 e2e 每轮经 globalSetup 直连真实 PG seed 权限前提(super_admin)+ DEL redis 权限缓存;
|
|
// 需先 source infra.env(凭据不入库)。
|
|
globalSetup: './apps/web-antd/e2e/global-setup.ts',
|
|
testDir: './apps/web-antd/e2e',
|
|
timeout: 60_000,
|
|
use: {
|
|
baseURL: 'http://127.0.0.1:5667',
|
|
trace: 'retain-on-failure',
|
|
},
|
|
// 共享同一真实后端 DB(muse_slice_live)→ 串行跑避免跨用例竞态,保证可复现绿。
|
|
workers: 1,
|
|
webServer: {
|
|
command:
|
|
'pnpm --filter @vben/web-antd run dev --host 127.0.0.1 --port 5667',
|
|
reuseExistingServer: true,
|
|
timeout: 120_000,
|
|
url: 'http://127.0.0.1:5667',
|
|
},
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'] },
|
|
},
|
|
],
|
|
});
|