@microi.net/cli 5.9.1 → 5.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/.codebuddy-plugin/marketplace.json +2 -2
  2. package/.codebuddy-plugin/plugin.json +1 -1
  3. package/.codex-plugin/plugin.json +1 -1
  4. package/.workbuddy-plugin/marketplace.json +2 -2
  5. package/.workbuddy-plugin/plugin.json +1 -1
  6. package/LICENSE +21 -21
  7. package/README.md +71 -71
  8. package/assets/build-meta.json +5 -5
  9. package/assets/feature-matrix.json +138 -138
  10. package/assets/logo.svg +4 -4
  11. package/cordis.patch.yml +1 -1
  12. package/package.json +1 -1
  13. package/scripts/microi-codex-broker.js +466 -450
  14. package/scripts/microi-codex-router.js +634 -618
  15. package/scripts/microi-skills.meta.json +386 -377
  16. package/skills/.microi-skills-version.json +2 -2
  17. package/skills/.progressive-disclosure-manifest.json +148 -123
  18. package/skills/README.md +287 -287
  19. package/skills/ai-engine/SKILL.md +269 -269
  20. package/skills/ai-engine/agents/openai.yaml +4 -4
  21. package/skills/ai-engine/references/ai-employees.md +48 -48
  22. package/skills/ai-engine/references/self-hosted-digital-human.md +59 -59
  23. package/skills/ai-platform-governance/SKILL.md +177 -177
  24. package/skills/ai-platform-governance/references/progressive-01-/345/212/237/350/203/275/345/274/200/345/205/263.md +190 -190
  25. package/skills/app-store/SKILL.md +525 -525
  26. package/skills/app-store/agents/openai.yaml +4 -4
  27. package/skills/business-blueprint/SKILL.md +193 -193
  28. package/skills/datasource-engine/SKILL.md +93 -93
  29. package/skills/datasource-engine/agents/openai.yaml +4 -4
  30. package/skills/dos-orm/SKILL.md +101 -95
  31. package/skills/dos-orm/references/api-reference.md +229 -229
  32. package/skills/email-engine/SKILL.md +81 -81
  33. package/skills/email-engine/references/v8-email.md +34 -34
  34. package/skills/job-engine/SKILL.md +176 -176
  35. package/skills/job-engine/agents/openai.yaml +4 -4
  36. package/skills/message-notification/SKILL.md +156 -156
  37. package/skills/message-notification/agents/openai.yaml +5 -5
  38. package/skills/message-notification/references/contracts.md +102 -102
  39. package/skills/microi/SKILL.md +14 -14
  40. package/skills/microi-ai-app-auth.js +652 -652
  41. package/skills/microi-ai-application/SKILL.md +115 -115
  42. package/skills/microi-ai-application/agents/openai.yaml +4 -4
  43. package/skills/microi-ai-application/references/frontend-baseline.md +164 -164
  44. package/skills/microi-client-frontend/SKILL.md +242 -242
  45. package/skills/microi-client-frontend/references/progressive-01-3-/345/212/250/346/200/201/346/214/211/351/222/256/347/263/273/347/273/237.md +144 -144
  46. package/skills/microi-client-frontend/references/progressive-02-8-/350/277/220/350/241/214/346/227/266/351/253/230/351/242/221/345/235/221/345/244/215/347/233/230.md +196 -196
  47. package/skills/microi-client-frontend/references/progressive-03-vue3-/345/211/215/347/253/257/345/276/256/346/234/215/345/212/241/345/256/277/344/270/273/350/247/204/345/210/231.md +167 -167
  48. package/skills/microi-codex-installer/SKILL.md +231 -231
  49. package/skills/microi-codex-installer/agents/openai.yaml +7 -7
  50. package/skills/microi-datasource-mapping/SKILL.md +122 -122
  51. package/skills/microi-db-schema/SKILL.md +175 -175
  52. package/skills/microi-db-schema/agents/openai.yaml +4 -4
  53. package/skills/microi-db-schema/references/core-tables.md +695 -695
  54. package/skills/microi-db-schema/references/form-component-options.md +256 -256
  55. package/skills/microi-db-schema/references/schema-overview.md +202 -202
  56. package/skills/microi-db-schema/references/schema.md +646 -646
  57. package/skills/microi-db-schema/references/table-catalog.md +1599 -1599
  58. package/skills/microi-deployment/SKILL.md +239 -220
  59. package/skills/microi-deployment/references/deployment-matrix.md +109 -109
  60. package/skills/microi-docs-coverage/SKILL.md +133 -133
  61. package/skills/microi-docs-coverage/references/capability-map.md +90 -90
  62. package/skills/microi-docs-coverage/scripts/audit-doc-skill-coverage.mjs +894 -894
  63. package/skills/microi-form-engine/SKILL.md +338 -333
  64. package/skills/microi-form-engine/references/component-catalog.md +218 -218
  65. package/skills/microi-form-engine/references/data-source-events.md +124 -124
  66. package/skills/microi-frontend-sdk/SKILL.md +194 -194
  67. package/skills/microi-frontend-sdk/references/progressive-01-token-/345/275/223/345/211/215/347/231/273/345/275/225/347/224/250/346/210/267/344/270/216/345/275/223/345/211/215/347/273/210/347/253/257/347/231/273/345/275/225/345/215/217/350/256/256.md +176 -176
  68. package/skills/microi-left-right-layout/SKILL.md +141 -141
  69. package/skills/microi-microservice/SKILL.md +330 -328
  70. package/skills/microi-microservice/references/runtime-delivery.md +278 -278
  71. package/skills/microi-mobile-app-quality/SKILL.md +203 -197
  72. package/skills/microi-mobile-app-quality/references/mobile-first-delivery.md +75 -0
  73. package/skills/microi-mobile-app-quality/references/progressive-01-4-/351/207/215/350/246/201/346/214/211/351/222/256/345/277/205/351/241/273/345/270/246/345/233/276/346/240/207.md +227 -224
  74. package/skills/microi-mobile-app-quality/references/progressive-02-9-/344/270/273/351/242/230/345/210/207/346/215/242/345/277/205/351/241/273/347/234/237/345/256/236/344/270/224/345/205/250/345/261/200/347/224/237/346/225/210.md +129 -128
  75. package/skills/microi-solution-quotation/SKILL.md +78 -78
  76. package/skills/microi-solution-quotation/agents/openai.yaml +4 -4
  77. package/skills/microi-solution-quotation/scripts/build_solution_quote.py +296 -296
  78. package/skills/microi-sso/SKILL.md +95 -91
  79. package/skills/microi-sso/references/acceptance.md +51 -49
  80. package/skills/microi-sso/references/configuration-and-security.md +53 -53
  81. package/skills/microi-sso/references/inbound.md +53 -53
  82. package/skills/microi-sso/references/outbound.md +43 -39
  83. package/skills/microi-ui/SKILL.md +192 -192
  84. package/skills/microi-ui/references/progressive-01-/347/247/273/345/212/250/347/253/257/345/234/272/346/231/257/350/223/235/345/233/276.md +183 -183
  85. package/skills/microi-uniapp-frontend/SKILL.md +206 -199
  86. package/skills/microi-uniapp-frontend/references/progressive-01-/347/247/273/345/212/250/347/253/257/345/210/206/347/261/273-/345/217/214/346/240/217/345/210/227/350/241/250/347/213/254/347/253/213/346/273/232/345/212/250.md +261 -261
  87. package/skills/microi-uniapp-frontend/references/progressive-02-/345/205/263/351/224/256/344/270/232/345/212/241/350/265/204/344/272/247/344/270/215/345/276/227/351/273/230/350/256/244/351/200/211/344/270/255.md +154 -154
  88. package/skills/microi.v8.js +1921 -1921
  89. package/skills/module-engine/SKILL.md +255 -255
  90. package/skills/module-engine/references/module-config.md +204 -204
  91. package/skills/ocr-engine/SKILL.md +113 -113
  92. package/skills/ocr-engine/agents/openai.yaml +4 -4
  93. package/skills/page-engine/SKILL.md +206 -206
  94. package/skills/page-engine/examples/compact-dashboard.json +1444 -1444
  95. package/skills/page-engine/references/progressive-01-/346/211/200/346/234/211/347/273/204/344/273/266/347/261/273/345/236/213.md +234 -234
  96. package/skills/page-engine/references/progressive-02-/347/211/210/346/234/254/345/216/206/345/217/262-/345/271/266/345/217/221/344/277/235/345/255/230/344/270/216/345/233/236/346/273/232.md +60 -60
  97. package/skills/performance-testing/SKILL.md +227 -221
  98. package/skills/playwright-e2e/SKILL.md +197 -196
  99. package/skills/playwright-e2e/references/progressive-01-/345/205/250/350/207/252/345/212/250/347/231/273/345/275/225-/345/205/215/351/252/214/350/257/201/347/240/201-/344/275/206/344/270/215/345/205/215/345/257/206/347/240/201-/345/277/205/350/257/273.md +173 -173
  100. package/skills/playwright-e2e/references/progressive-02-/346/226/207/345/255/227/345/257/271/346/257/224/345/272/246/344/270/216/345/217/257/350/257/273/346/200/247/350/207/252/345/212/250/345/214/226/346/243/200/346/237/245-/345/277/205/345/201/232.md +183 -183
  101. package/skills/playwright-e2e/references/progressive-03-microi-helper-/346/250/241/346/235/277.md +221 -221
  102. package/skills/playwright-e2e/references/progressive-04-ci-/345/273/272/350/256/256.md +115 -115
  103. package/skills/print-engine/SKILL.md +259 -259
  104. package/skills/production-readonly-audit/SKILL.md +41 -41
  105. package/skills/report-engine/SKILL.md +71 -71
  106. package/skills/report-engine/agents/openai.yaml +4 -4
  107. package/skills/scripts/optimize-progressive-disclosure.mjs +204 -204
  108. package/skills/scripts/refresh-progressive-disclosure.mjs +64 -64
  109. package/skills/scripts/sync-embedded-skills.mjs +46 -46
  110. package/skills/scripts/validate-progressive-disclosure.mjs +57 -57
  111. package/skills/search-engine/SKILL.md +75 -75
  112. package/skills/search-engine/agents/openai.yaml +4 -4
  113. package/skills/spider-engine/SKILL.md +190 -190
  114. package/skills/system-observability/SKILL.md +259 -246
  115. package/skills/system-observability/references/memory-incident-triage.md +77 -77
  116. package/skills/translate-engine/SKILL.md +140 -140
  117. package/skills/translate-engine/agents/openai.yaml +4 -4
  118. package/skills/ui-design/SKILL.md +223 -223
  119. package/skills/ui-design/assets/pattern-showcase/app.js +54 -54
  120. package/skills/ui-design/assets/pattern-showcase/index.html +163 -163
  121. package/skills/ui-design/assets/pattern-showcase/styles.css +311 -311
  122. package/skills/ui-design/assets/templates/MCI-DESIGN.md +206 -206
  123. package/skills/ui-design/references/design-pattern-library.md +184 -184
  124. package/skills/ui-design/references/mci-design-contract.md +163 -163
  125. package/skills/ui-design/references/motion-and-media.md +78 -78
  126. package/skills/ui-design/references/product-flow-recipes.md +94 -94
  127. package/skills/ui-design/references/progressive-01-/351/242/234/350/211/262/344/275/223/347/263/273-css-variables-/346/224/257/346/214/201/344/270/273/351/242/230/345/210/207/346/215/242.md +218 -218
  128. package/skills/ui-design/references/progressive-02-/345/255/227/344/275/223.md +164 -164
  129. package/skills/ui-design/references/progressive-03-/345/212/250/346/225/210/350/247/204/350/214/203-/344/270/260/345/257/214/344/275/206/344/270/215/345/215/241.md +235 -235
  130. package/skills/ui-design/references/progressive-04-/347/273/204/344/273/266/351/243/216/346/240/274/351/200/237/346/237/245.md +152 -152
  131. package/skills/ui-design/references/progressive-05-/347/247/273/345/212/250/347/253/257/344/270/223/347/224/250/350/247/204/350/214/203.md +238 -238
  132. package/skills/ui-design/references/progressive-06-/344/270/273/351/242/230/345/210/207/346/215/242/345/256/236/347/216/260.md +194 -194
  133. package/skills/ui-design/references/progressive-07-/351/200/237/346/237/245-/344/273/216/345/244/264/346/220/255/345/273/272/344/270/200/344/270/252/347/247/273/345/212/250/347/253/257/351/241/265/351/235/242.md +207 -207
  134. package/skills/ui-design/references/progressive-08-/350/241/250/345/215/225/345/210/206/347/273/204/350/247/204/350/214/203-tabs-vs-collapsegroup-/345/274/272/345/210/266.md +142 -142
  135. package/skills/uniapp-mall-assets/SKILL.md +176 -176
  136. package/skills/unity-integration/SKILL.md +178 -171
  137. package/skills/unity-integration/agents/openai.yaml +4 -4
  138. package/skills/unity-integration/references/ai-app-delivery.md +119 -119
  139. package/skills/unity-integration/references/sdk-api.md +82 -82
  140. package/skills/unity-integration/references/toolbox-migration.md +66 -66
  141. package/skills/unity-integration/references/webgl-hosting.md +57 -57
  142. package/skills/v8-api-config/SKILL.md +388 -388
  143. package/skills/v8-cache-pattern/SKILL.md +312 -312
  144. package/skills/v8-crud-api/SKILL.md +179 -178
  145. package/skills/v8-crud-api/references/progressive-01-/346/237/245/350/257/242/345/210/227/350/241/250-/345/210/206/351/241/265.md +226 -226
  146. package/skills/v8-crud-api/references/progressive-02-where-/346/235/241/344/273/266/350/257/255/346/263/225/351/200/237/346/237/245.md +49 -49
  147. package/skills/v8-debugging/SKILL.md +284 -284
  148. package/skills/v8-explorer-tree/SKILL.md +228 -228
  149. package/skills/v8-export-import/SKILL.md +219 -219
  150. package/skills/v8-export-import/references/progressive-01-excellayout-/351/253/230/347/272/247/350/207/252/347/224/261/345/270/203/345/261/200.md +211 -211
  151. package/skills/v8-export-import/references/progressive-02-powerpoint-/345/257/274/345/207/272.md +202 -202
  152. package/skills/v8-export-import/references/progressive-03-/345/256/211/345/205/250-/346/200/247/350/203/275/346/263/250/346/204/217.md +42 -42
  153. package/skills/v8-file-upload/SKILL.md +255 -284
  154. package/skills/v8-file-upload/references/cdn-alias-repair.md +13 -0
  155. package/skills/v8-file-upload/references/progressive-01-/345/205/254/346/234/211/346/241/266-vs-/347/247/201/346/234/211/346/241/266.md +263 -263
  156. package/skills/v8-file-upload/references/progressive-02-office-/346/226/207/344/273/266/345/234/250/347/272/277/347/274/226/350/276/221/347/211/210/346/234/254/345/217/267/350/247/204/345/210/231.md +161 -161
  157. package/skills/v8-file-upload/references/progressive-03-/347/251/272/347/233/256/345/275/225/346/240/207/350/256/260/344/270/216/350/277/234/347/250/213/344/270/213/350/275/275.md +36 -0
  158. package/skills/v8-formengine-http/SKILL.md +238 -238
  159. package/skills/v8-frontend-events/SKILL.md +180 -180
  160. package/skills/v8-frontend-events/references/bluetooth-print-api.md +135 -135
  161. package/skills/v8-frontend-events/references/bluetooth-print.md +258 -258
  162. package/skills/v8-frontend-events/references/progressive-01-/345/210/227/350/241/250/344/272/213/344/273/266.md +219 -219
  163. package/skills/v8-http-integration/SKILL.md +182 -182
  164. package/skills/v8-http-integration/references/progressive-01-get-/350/257/267/346/261/202.md +220 -220
  165. package/skills/v8-http-integration/references/progressive-02-/351/224/231/350/257/257/345/244/204/347/220/206/346/250/241/345/274/217.md +44 -44
  166. package/skills/v8-image-processing/SKILL.md +190 -190
  167. package/skills/v8-image-processing/agents/openai.yaml +4 -4
  168. package/skills/v8-image-processing/references/api-reference.md +623 -623
  169. package/skills/v8-menu-buttons/SKILL.md +186 -186
  170. package/skills/v8-menu-buttons/references/progressive-01-2-/346/214/211/351/222/256/345/257/271/350/261/241-schema.md +222 -222
  171. package/skills/v8-menu-buttons/references/progressive-02-8-/346/250/241/345/274/217-f-/345/220/216/345/217/260/344/273/273/345/212/241/346/214/211/351/222/256-/351/225/277/344/273/273/345/212/241.md +228 -228
  172. package/skills/v8-menu-buttons/references/progressive-03-10-/345/217/215/346/250/241/345/274/217-/351/201/277/345/205/215.md +104 -104
  173. package/skills/v8-mongodb/SKILL.md +200 -200
  174. package/skills/v8-mq-mqtt/SKILL.md +178 -176
  175. package/skills/v8-mq-mqtt/references/mqtt-production.md +352 -342
  176. package/skills/v8-mq-mqtt/references/progressive-01-v8-mqtt-iot-/347/211/251/350/201/224/347/275/221.md +181 -181
  177. package/skills/v8-mq-mqtt/scripts/check-mqtt-skill-coverage.mjs +203 -203
  178. package/skills/v8-saas-multi-tenant/SKILL.md +305 -305
  179. package/skills/v8-security/SKILL.md +227 -210
  180. package/skills/v8-security/references/progressive-01-2-/346/235/203/351/231/220/346/240/241/351/252/214.md +200 -200
  181. package/skills/v8-security/references/progressive-02-7-/346/227/245/345/277/227/350/256/260/345/275/225.md +160 -160
  182. package/skills/v8-sql-query/SKILL.md +302 -302
  183. package/skills/v8-table-event/SKILL.md +176 -176
  184. package/skills/v8-table-event/references/progressive-01-informv8-js-/350/241/250/345/215/225/346/211/223/345/274/200/344/272/213/344/273/266.md +216 -216
  185. package/skills/v8-table-event/references/progressive-02-/345/211/215/347/253/257/344/272/213/344/273/266/345/220/215-v8-eventname-/345/217/257/350/203/275/347/232/204/345/200/274.md +46 -46
  186. package/skills/v8-tcp-integration/SKILL.md +158 -147
  187. package/skills/v8-tcp-integration/agents/openai.yaml +4 -4
  188. package/skills/v8-template-engine/SKILL.md +167 -167
  189. package/skills/v8-utilities/SKILL.md +104 -104
  190. package/skills/v8-utilities/references/client-api-index.md +143 -143
  191. package/skills/v8-utilities/references/platform-http-routes.md +83 -83
  192. package/skills/v8-utilities/references/server-api-index.md +188 -188
  193. package/skills/v8-workflow/SKILL.md +252 -252
  194. package/skills/v8-workflow/references/progressive-01-/350/212/202/347/202/271/345/274/200/345/247/213-v8-/344/272/213/344/273/266.md +180 -180
  195. package/skills/v8-workflow/references/workflow-configuration.md +49 -49
  196. package/skills/vision-engine/SKILL.md +160 -160
  197. package/skills/vision-engine/agents/openai.yaml +4 -4
  198. package/skills/vision-engine/references/architecture-and-acceptance.md +194 -194
  199. package/skills/workspace-conventions/SKILL.md +13 -13
  200. package/skills/workspace-conventions/references/progressive-03-cli-/344/270/216-ide-/346/217/222/344/273/266/351/224/231/347/211/210/345/205/261/345/255/230/347/272/246/345/256/232.md +2 -2
@@ -1,115 +1,115 @@
1
- # playwright-e2e 详细参考 4
2
-
3
- > 按需读取;本文件由 SKILL.md 的原章节无损拆分。
4
-
5
- <!-- microi-progressive:chunk id=playwright-e2e-023 sha256=d0fe6ae9a31033fca37017b9c065dba2ef9acfc91505eb113e4084180a322ace -->
6
- ## CI 建议
7
-
8
- ```yaml
9
- name: e2e
10
- on: [push, pull_request]
11
- jobs:
12
- playwright:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v4
16
- - uses: actions/setup-node@v4
17
- with:
18
- node-version: 20
19
- - run: npm ci
20
- - run: npx playwright install --with-deps chromium
21
- - run: npm run test:e2e
22
- env:
23
- PW_BASE_URL: http://127.0.0.1:5180
24
- PW_API_BASE: ${{ secrets.PW_API_BASE }}
25
- PW_OS_CLIENT: ${{ secrets.PW_OS_CLIENT }}
26
- PW_TEST_ACCOUNT: ${{ secrets.PW_TEST_ACCOUNT }}
27
- PW_TEST_PASSWORD: ${{ secrets.PW_TEST_PASSWORD }}
28
- ```
29
-
30
- <!-- /microi-progressive:chunk -->
31
- <!-- microi-progressive:chunk id=playwright-e2e-024 sha256=e14464e157beb905d85fdd1f284b677538f60d6d9d3a860515626e52738dac5b -->
32
- ## 常见问题
33
-
34
- | 现象 | 原因 | 处理 |
35
- |---|---|---|
36
- | 接口返回 `Code=1001/1002` | Token 失效或未传 | 登录 fixture 注入 Token,或检查 Header |
37
- | 登录接口返回 `Code=0` | 账号数据不存在或 `AllowAnonymous=0` | 准备测试账号,必要时设置匿名 |
38
- | `microi_run_engine` 成功但 `/apiengine/{key}` 返回“未启用” | `IsEnable=0`、`StopHttp=1` 或保存代码时丢失接口元数据 | 设置匿名/启用后清缓存,并用 HTTP 路径复测 |
39
- | 新增接口一开始 404 | 动态路由缓存尚未刷新 | HTTP 调用带 `apiengine: 1` Header 直达接口引擎,并刷新缓存/重启后端 |
40
- | `microi_set_engine_anonymous` 显示已启用但 HTTP 仍提示 `sys_apiengine` 不存在 | 历史引擎 `ApiAddress` 为空或不是 `/apiengine/{key}` | 批量补齐 `ApiAddress`、`IsEnable=1`、`StopHttp=0`,并清 key/id/address 三类缓存 |
41
- | 保存接口代码后 MCP 自己报 `string does not contain DosIsNullOrWhiteSpace` | 后端 C# 在动态对象路径上调用扩展方法 | 改用 `string.IsNullOrWhiteSpace`,不要在 MCP 路径新增 `DosIsNullOrWhiteSpace` 调用 |
42
- | MCP `run_engine` 里 `V8.Db` 为 null | MCP 执行上下文没有注入直连 Db | 维护/测试引擎优先使用 `V8.FormEngine.GetTableData/UptFormData` |
43
- | H5 静态资源 404 | `vite.config.js` 未配置相对路径 | uni-app H5 设置 `base: './'` |
44
- | 本地浏览器下载失败 | Playwright 下载 Chromium 受阻 | 先用 `PW_BROWSER_CHANNEL=msedge`,没有 Edge 时从吾码 CDN 下载 Chromium 并设置 `PW_CHROMIUM_EXECUTABLE` |
45
- | 用例偶发失败 | HMR 或网络请求未稳定 | CI 使用静态构建,断言明确等待关键元素 |
46
- | 页面有横向滚动 | 组件撑出视口 | 对根容器和列表容器加 `max-width:100vw; overflow-x:hidden` |
47
-
48
- ### 多服务器、多租户并行上下文模板
49
-
50
- `incognito` 的本质是独立存储上下文。Playwright 的 `browser.newContext()` 每次都会创建隔离上下文,
51
- 比在同一个浏览器 context 中开多个 Page 更可靠:
52
-
53
- ```js
54
- function buildLocalMicroiUrl({ apiBase, osClient, route = '/' }) {
55
- return `http://localhost:61500/?OsClient=${encodeURIComponent(osClient)}`
56
- + `&ApiBase=${encodeURIComponent(apiBase)}#${route}`;
57
- }
58
-
59
- const targetA = await browser.newContext();
60
- const pageA = await targetA.newPage();
61
- await pageA.goto(buildLocalMicroiUrl({ apiBase: apiA, osClient: tenantA, route: '/home' }));
62
- await pageA.waitForFunction(() => Boolean(window.__MICROI_RUNTIME_ENDPOINT__));
63
- await expect.poll(() => pageA.evaluate(() => window.__MICROI_RUNTIME_ENDPOINT__)).toMatchObject({
64
- apiBase: apiA,
65
- osClient: tenantA,
66
- requiresIsolatedContextForParallelTenants: true
67
- });
68
-
69
- const targetB = await browser.newContext();
70
- // targetB 重复同样流程;禁止复用 targetA.newPage() 测 tenantB。
71
- ```
72
-
73
- 若给定的是线上吾码页面,先在第三个一次性 context 中读取
74
- `window.__MICROI_RUNTIME_ENDPOINT__`。旧版回退脚本只读取公开运行目标,不读取或输出 Token:
75
-
76
- ```js
77
- const endpoint = await page.evaluate(() => {
78
- const current = window.__MICROI_RUNTIME_ENDPOINT__;
79
- if (current?.apiBase && current?.osClient) return current;
80
- const stored = JSON.parse(localStorage.getItem('microi.net') || '{}');
81
- return {
82
- apiBase: window.ApiBase || stored.ApiBase || location.origin,
83
- osClient: new URLSearchParams(location.search).get('OsClient') || window.OsClient || stored.OsClient || ''
84
- };
85
- });
86
- ```
87
-
88
- OsClient 仍为空时调用目标站点域名租户解析接口或从成功请求确认。手工 Chrome 的第二个不同租户
89
- 至少使用无痕窗口,但同一 Chrome 无痕会话的多个窗口可能继续共享存储;三个以上目标使用独立
90
- Profile 或独立 `--user-data-dir`。
91
-
92
- <!-- /microi-progressive:chunk -->
93
- <!-- microi-progressive:chunk id=playwright-e2e-025 sha256=be071153d695081b7c20d34cb5e9563480e3f09d9cd0292f2ca4b0245438787b -->
94
- ## 前端微服务 E2E 必测点
95
-
96
- 测试 Vue3 MicroApp 微服务时,不能只验证 `/micro-app/{OsClient}/{appKey}/index.html` 或带 token 的临时 URL。必须先建立真实登录态,再访问用户实际使用的不带 token 菜单路由,例如 `/#/micro-app/{MsKey}/{RoutePath}`,并确认地址栏没有退回旧的 `micro-app-host` 长地址。
97
-
98
- 同一套微服务绑定多个菜单时,至少选择 3 个真实菜单往返切换 8 轮,逐轮断言主框架 route、当前菜单和子应用可见内容匹配,且没有 `element head is missing`、`Failed to fetch`、`ERR_TOO_MANY_REDIRECTS`、`app name conflict`、永久骨架屏或空白内容。不能只断言 `<micro-app>` 元素存在。
99
-
100
- 页签缓存验收必须覆盖单一所有者与清理边界:在一个缓存范围内修改表单输入、筛选、内部路由或滚动位置,切走再返回后状态应保持;连续打开 6 个菜单微服务实例,断言运行时最多保留 5 个,最久未使用的隐藏实例重入时正常冷启动;关闭当前/其它/全部 Tab 后对应实例消失,退出登录后全部实例清空。恢复页还要断言收到最新 Token/OsClient/权限/主题/视口上下文,且任一时刻只有一个可见活动微服务。若子应用有轮询或 WebSocket,记录 `appstate-change`,确认 `afterhidden` 暂停、`aftershow` 幂等恢复而没有重复连接。
101
-
102
- 如果页面内提供 Microi SDK 调用按钮,必须点击并断言返回 `Code=1`,同时确认没有 `登录身份已过期`、`1001`、`1002`。只看到标题文本不代表鉴权链路通过。
103
-
104
- <!-- /microi-progressive:chunk -->
105
- <!-- microi-progressive:chunk id=playwright-e2e-026 sha256=3c8a1e8bbe281064f30f406703230d8df213f1f1e1d124edb8f9fc8a1df782ea -->
106
- ## 动态模块按钮验收
107
-
108
- 修复或新增 `MoreBtns/FormBtns/PageBtns/PageTabs` 时,运行页看到按钮只证明“最终渲染结果”,不能证明入口确实可由模块引擎维护。至少同时保留三类证据:
109
-
110
- 1. 后端/MCP 回读目标 `sys_menu`,断言对应按钮稳定 `Id`、`Name`、位置字段、`V8CodeShow` 和 `V8Code` 均已保存,并且未覆盖其它客户按钮。
111
- 2. 使用真实管理员登录模块引擎设计器,打开目标模块,断言相应按钮编辑区能看到该按钮及代码。
112
- 3. 分别在实际列表/卡片或 PC/移动端运行态检查按钮显隐并点击到目标交互;源码回归还要确认通用模板和宽度计算中不存在按模块 Id、Url、表名写死的同名入口。
113
-
114
- 按钮通过 `V8.OpenDialog` 打开主前端定制组件时,还要断言组件已在全局注册、`ComponentName` 与注册名一致、`DataAppend` 能到达组件,并确认源码没有新增 `V8.Open<业务名>` 专用包装。按钮通过 `V8.OpenAppDialog` 打开微服务时,按 AppKey、RoutePath 和发布版本回读并验收。涉及新旧版本滚动发布时分别说明组件/应用资源尚未就绪和已就绪的预期,不得只在单一版本页面上验收。
115
- <!-- /microi-progressive:chunk -->
1
+ # playwright-e2e 详细参考 4
2
+
3
+ > 按需读取;本文件由 SKILL.md 的原章节无损拆分。
4
+
5
+ <!-- microi-progressive:chunk id=playwright-e2e-023 sha256=d0fe6ae9a31033fca37017b9c065dba2ef9acfc91505eb113e4084180a322ace -->
6
+ ## CI 建议
7
+
8
+ ```yaml
9
+ name: e2e
10
+ on: [push, pull_request]
11
+ jobs:
12
+ playwright:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version: 20
19
+ - run: npm ci
20
+ - run: npx playwright install --with-deps chromium
21
+ - run: npm run test:e2e
22
+ env:
23
+ PW_BASE_URL: http://127.0.0.1:5180
24
+ PW_API_BASE: ${{ secrets.PW_API_BASE }}
25
+ PW_OS_CLIENT: ${{ secrets.PW_OS_CLIENT }}
26
+ PW_TEST_ACCOUNT: ${{ secrets.PW_TEST_ACCOUNT }}
27
+ PW_TEST_PASSWORD: ${{ secrets.PW_TEST_PASSWORD }}
28
+ ```
29
+
30
+ <!-- /microi-progressive:chunk -->
31
+ <!-- microi-progressive:chunk id=playwright-e2e-024 sha256=e14464e157beb905d85fdd1f284b677538f60d6d9d3a860515626e52738dac5b -->
32
+ ## 常见问题
33
+
34
+ | 现象 | 原因 | 处理 |
35
+ |---|---|---|
36
+ | 接口返回 `Code=1001/1002` | Token 失效或未传 | 登录 fixture 注入 Token,或检查 Header |
37
+ | 登录接口返回 `Code=0` | 账号数据不存在或 `AllowAnonymous=0` | 准备测试账号,必要时设置匿名 |
38
+ | `microi_run_engine` 成功但 `/apiengine/{key}` 返回“未启用” | `IsEnable=0`、`StopHttp=1` 或保存代码时丢失接口元数据 | 设置匿名/启用后清缓存,并用 HTTP 路径复测 |
39
+ | 新增接口一开始 404 | 动态路由缓存尚未刷新 | HTTP 调用带 `apiengine: 1` Header 直达接口引擎,并刷新缓存/重启后端 |
40
+ | `microi_set_engine_anonymous` 显示已启用但 HTTP 仍提示 `sys_apiengine` 不存在 | 历史引擎 `ApiAddress` 为空或不是 `/apiengine/{key}` | 批量补齐 `ApiAddress`、`IsEnable=1`、`StopHttp=0`,并清 key/id/address 三类缓存 |
41
+ | 保存接口代码后 MCP 自己报 `string does not contain DosIsNullOrWhiteSpace` | 后端 C# 在动态对象路径上调用扩展方法 | 改用 `string.IsNullOrWhiteSpace`,不要在 MCP 路径新增 `DosIsNullOrWhiteSpace` 调用 |
42
+ | MCP `run_engine` 里 `V8.Db` 为 null | MCP 执行上下文没有注入直连 Db | 维护/测试引擎优先使用 `V8.FormEngine.GetTableData/UptFormData` |
43
+ | H5 静态资源 404 | `vite.config.js` 未配置相对路径 | uni-app H5 设置 `base: './'` |
44
+ | 本地浏览器下载失败 | Playwright 下载 Chromium 受阻 | 先用 `PW_BROWSER_CHANNEL=msedge`,没有 Edge 时从吾码 CDN 下载 Chromium 并设置 `PW_CHROMIUM_EXECUTABLE` |
45
+ | 用例偶发失败 | HMR 或网络请求未稳定 | CI 使用静态构建,断言明确等待关键元素 |
46
+ | 页面有横向滚动 | 组件撑出视口 | 对根容器和列表容器加 `max-width:100vw; overflow-x:hidden` |
47
+
48
+ ### 多服务器、多租户并行上下文模板
49
+
50
+ `incognito` 的本质是独立存储上下文。Playwright 的 `browser.newContext()` 每次都会创建隔离上下文,
51
+ 比在同一个浏览器 context 中开多个 Page 更可靠:
52
+
53
+ ```js
54
+ function buildLocalMicroiUrl({ apiBase, osClient, route = '/' }) {
55
+ return `http://localhost:61500/?OsClient=${encodeURIComponent(osClient)}`
56
+ + `&ApiBase=${encodeURIComponent(apiBase)}#${route}`;
57
+ }
58
+
59
+ const targetA = await browser.newContext();
60
+ const pageA = await targetA.newPage();
61
+ await pageA.goto(buildLocalMicroiUrl({ apiBase: apiA, osClient: tenantA, route: '/home' }));
62
+ await pageA.waitForFunction(() => Boolean(window.__MICROI_RUNTIME_ENDPOINT__));
63
+ await expect.poll(() => pageA.evaluate(() => window.__MICROI_RUNTIME_ENDPOINT__)).toMatchObject({
64
+ apiBase: apiA,
65
+ osClient: tenantA,
66
+ requiresIsolatedContextForParallelTenants: true
67
+ });
68
+
69
+ const targetB = await browser.newContext();
70
+ // targetB 重复同样流程;禁止复用 targetA.newPage() 测 tenantB。
71
+ ```
72
+
73
+ 若给定的是线上吾码页面,先在第三个一次性 context 中读取
74
+ `window.__MICROI_RUNTIME_ENDPOINT__`。旧版回退脚本只读取公开运行目标,不读取或输出 Token:
75
+
76
+ ```js
77
+ const endpoint = await page.evaluate(() => {
78
+ const current = window.__MICROI_RUNTIME_ENDPOINT__;
79
+ if (current?.apiBase && current?.osClient) return current;
80
+ const stored = JSON.parse(localStorage.getItem('microi.net') || '{}');
81
+ return {
82
+ apiBase: window.ApiBase || stored.ApiBase || location.origin,
83
+ osClient: new URLSearchParams(location.search).get('OsClient') || window.OsClient || stored.OsClient || ''
84
+ };
85
+ });
86
+ ```
87
+
88
+ OsClient 仍为空时调用目标站点域名租户解析接口或从成功请求确认。手工 Chrome 的第二个不同租户
89
+ 至少使用无痕窗口,但同一 Chrome 无痕会话的多个窗口可能继续共享存储;三个以上目标使用独立
90
+ Profile 或独立 `--user-data-dir`。
91
+
92
+ <!-- /microi-progressive:chunk -->
93
+ <!-- microi-progressive:chunk id=playwright-e2e-025 sha256=be071153d695081b7c20d34cb5e9563480e3f09d9cd0292f2ca4b0245438787b -->
94
+ ## 前端微服务 E2E 必测点
95
+
96
+ 测试 Vue3 MicroApp 微服务时,不能只验证 `/micro-app/{OsClient}/{appKey}/index.html` 或带 token 的临时 URL。必须先建立真实登录态,再访问用户实际使用的不带 token 菜单路由,例如 `/#/micro-app/{MsKey}/{RoutePath}`,并确认地址栏没有退回旧的 `micro-app-host` 长地址。
97
+
98
+ 同一套微服务绑定多个菜单时,至少选择 3 个真实菜单往返切换 8 轮,逐轮断言主框架 route、当前菜单和子应用可见内容匹配,且没有 `element head is missing`、`Failed to fetch`、`ERR_TOO_MANY_REDIRECTS`、`app name conflict`、永久骨架屏或空白内容。不能只断言 `<micro-app>` 元素存在。
99
+
100
+ 页签缓存验收必须覆盖单一所有者与清理边界:在一个缓存范围内修改表单输入、筛选、内部路由或滚动位置,切走再返回后状态应保持;连续打开 6 个菜单微服务实例,断言运行时最多保留 5 个,最久未使用的隐藏实例重入时正常冷启动;关闭当前/其它/全部 Tab 后对应实例消失,退出登录后全部实例清空。恢复页还要断言收到最新 Token/OsClient/权限/主题/视口上下文,且任一时刻只有一个可见活动微服务。若子应用有轮询或 WebSocket,记录 `appstate-change`,确认 `afterhidden` 暂停、`aftershow` 幂等恢复而没有重复连接。
101
+
102
+ 如果页面内提供 Microi SDK 调用按钮,必须点击并断言返回 `Code=1`,同时确认没有 `登录身份已过期`、`1001`、`1002`。只看到标题文本不代表鉴权链路通过。
103
+
104
+ <!-- /microi-progressive:chunk -->
105
+ <!-- microi-progressive:chunk id=playwright-e2e-026 sha256=3c8a1e8bbe281064f30f406703230d8df213f1f1e1d124edb8f9fc8a1df782ea -->
106
+ ## 动态模块按钮验收
107
+
108
+ 修复或新增 `MoreBtns/FormBtns/PageBtns/PageTabs` 时,运行页看到按钮只证明“最终渲染结果”,不能证明入口确实可由模块引擎维护。至少同时保留三类证据:
109
+
110
+ 1. 后端/MCP 回读目标 `sys_menu`,断言对应按钮稳定 `Id`、`Name`、位置字段、`V8CodeShow` 和 `V8Code` 均已保存,并且未覆盖其它客户按钮。
111
+ 2. 使用真实管理员登录模块引擎设计器,打开目标模块,断言相应按钮编辑区能看到该按钮及代码。
112
+ 3. 分别在实际列表/卡片或 PC/移动端运行态检查按钮显隐并点击到目标交互;源码回归还要确认通用模板和宽度计算中不存在按模块 Id、Url、表名写死的同名入口。
113
+
114
+ 按钮通过 `V8.OpenDialog` 打开主前端定制组件时,还要断言组件已在全局注册、`ComponentName` 与注册名一致、`DataAppend` 能到达组件,并确认源码没有新增 `V8.Open<业务名>` 专用包装。按钮通过 `V8.OpenAppDialog` 打开微服务时,按 AppKey、RoutePath 和发布版本回读并验收。涉及新旧版本滚动发布时分别说明组件/应用资源尚未就绪和已就绪的预期,不得只在单一版本页面上验收。
115
+ <!-- /microi-progressive:chunk -->