P4-5: 前端改写后脚本指令 onEvent 重放胶水
AmisRenderer embed 前注册自定义 amis 动作 replayScriptCommands: scriptCommands.translateCommands 把后端 facade 返回的 29 UI 动词指令 翻译成 amis 动作(show/hidden/static/setValue/setOptions/addOption/ toast/reload/...),逐条经 amis-core runActions 重放;带 componentId 者走组件级路由,componentId=大写列名与字段 name 天然对齐。 e2e(playwright,后端 8086 + dev):2 真实 FULL_AUTO facade-only 模板 - 福利保险结算单 inited → setFieldVisible 隐藏 BEGINDATE(截图留档) - 办公用品领用申请 change → bindField(getFieldValue) 回填 OLD_STORE_ID (服务端 getFieldValue 从 item 求值闭环,截图留档),2 passed。 测试:vitest scriptCommands 12 + registerReplayAction 4;tsc+build 全绿。 工具链:devDeps 加 vitest/jsdom/testing-library/playwright + test script。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
24
playwright.config.ts
Normal file
24
playwright.config.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { defineConfig, devices } from '@playwright/test';
|
||||
|
||||
// P4-5 端到端:改写后脚本挂回 onEvent 重放(打开页面→触发交互→断言指令重放生效)。
|
||||
// dev server 由 webServer 拉起;/api 经 vite proxy 反代到后端 8086(启动前须先起 8086)。
|
||||
export default defineConfig({
|
||||
testDir: './e2e',
|
||||
fullyParallel: false,
|
||||
workers: 1,
|
||||
timeout: 60_000,
|
||||
reporter: [['list']],
|
||||
use: {
|
||||
baseURL: 'http://localhost:5174',
|
||||
trace: 'off',
|
||||
screenshot: 'only-on-failure',
|
||||
},
|
||||
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
|
||||
webServer: {
|
||||
// 后端反代到 8086(脚本执行端点);dev 端口 5174 避开占用
|
||||
command: 'VITE_BACKEND_TARGET=http://localhost:8086 npx vite --port 5174 --strictPort',
|
||||
url: 'http://localhost:5174',
|
||||
reuseExistingServer: false,
|
||||
timeout: 120_000,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user