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:
2026-06-11 16:56:04 +08:00
parent b3486c093e
commit 82e01f893a
17 changed files with 1788 additions and 4 deletions

View File

@@ -7,7 +7,8 @@
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest run"
},
"dependencies": {
"axios": "1.7.9",
@@ -16,11 +17,17 @@
"react-router-dom": "6.28.0"
},
"devDependencies": {
"@playwright/test": "^1.60.0",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@types/node": "22.10.2",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@vitejs/plugin-react": "4.3.4",
"jsdom": "^29.1.1",
"typescript": "5.6.3",
"vite": "5.4.11"
"vite": "5.4.11",
"vitest": "^2.1.9"
}
}