test(modeler): Playwright live e2e 三场景(改存量/新建/走查+权限)

三场景对真实 8093 网关 + 8089 flowable-service + 真库 eip4 全程点穿:
- 场景A 改存量:/process-modeler?procKey=总包合同交底 → 点会签 userTask「编写交底」
  → EIP4 侧板会签控件读回勾选 → 存草稿(URL 回填 modelId) → 发布(PublishConfirm
  断言 key/版本/运行实例) → 确认 → 起实例 → trace 断言 current userTask。
- 场景B 新建:会签模板新建 → 选 task_cosign 填办理人 content=ADMIN → 存草稿 → 发布
  → 起实例 → trace 断言 current userTask「会签审批」。
- 场景C 走查+权限:中文节点渲染 / palette 齐 / 标准面板+EIP4 侧板同屏 / 超管门 403。

config 复用运行中的 5173 vite(默认 proxy /api→8093),apiJson 直连 8093 同一后端。
数据纪律:afterAll 删本次草稿(净零);发布产生的流程版本无下架端点属固有副作用。
场景C④ alice/123456 dev 库缺席 → 降级为无 token 打 deploy/models 断言 403(同
requireSuperAdmin 拒绝分支) + admin 打 models 200 对照。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 16:12:14 +08:00
parent 54b0200ac0
commit 3808011c8c
2 changed files with 300 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import { defineConfig, devices } from '@playwright/test';
// 在线流程 Modeler live e2e 专用配置(T4.2)。
//
// 复用主会话已在跑的 vite dev(5173,vite.config 默认 proxy /api → http://localhost:8093),
// 后端指向当前 live 的 8093 网关 + 8089 flowable-service + 真库 eip4(含 T3.1/T3.2/T4.1 全部新代码)。
// 与 fivering 配置(自起 vite 5174 → 8094)隔离:本配置 reuseExistingServer 复用 5173,不新起端口。
//
// 依赖(跑前须在线,spec 头注释有 curl 自检):
// - 8093 网关/后端(curl -s -o /dev/null -w '%{http_code}' localhost:8093/v3/api-docs → 200)
// - 8089 flowable-service(经 8093 转发;start/trace 走它)
// - 5173 vite dev(curl localhost:5173 → 200;apiJson 直连 8093,与 UI 经 5173 代理同一后端)
// 跑法:npx playwright test -c playwright.process-modeler.config.ts
export default defineConfig({
testDir: './e2e',
testMatch: /process-modeler\.spec\.ts/,
fullyParallel: false,
workers: 1,
timeout: 180_000,
reporter: [['list']],
use: {
baseURL: 'http://localhost:5173',
trace: 'off',
screenshot: 'only-on-failure',
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
webServer: {
// reuseExistingServer:true → 5173 已在跑(主会话 npm run dev)则复用、不新起;
// 未跑时按 dev 同口径(VITE_BACKEND_TARGET=8093)拉起。
command:
'NODE_OPTIONS=--max-http-header-size=65536 VITE_BACKEND_TARGET=http://localhost:8093 npx vite --port 5173 --strictPort',
url: 'http://localhost:5173',
reuseExistingServer: true,
timeout: 120_000,
},
});