F1-4: schema 页全量接入——错误边界、健康度扫描、抽样渲染实测

渲染链路加固:
- PageRenderPage 加 AmisErrorBoundary class component + SchemaErrorCard,覆盖
  schema 拉取失败/JSON 异常/amis 渲染抛错三种路径,不白屏不崩 Tab
- schema 加载成功后调用 recordRecentPage 写入最近打开
- src/api/schema.ts mock 模式下未配置 templateId 自动 fallback 后端接口

全量健康度扫描 (scripts/schema-scan.mjs):
- 登录→psql 拉取 1489 个 template_id→并发≤8 扫描→产出报告
- 结果: 1489/1489 HTTP 200,JSON 可解析率 100%,顶层 type 全为 page,零失败

抽样渲染实测 (e2e/schema-samples.spec.ts):
- 9 种类型 26 个样本,Node 侧预登录注入真实 JWT,断言 amis-host 挂载且无错误卡片
- 结果: 26/26 全部通过,截图存 e2e/artifacts/

配置更新:
- playwright.config.ts 后端反代改为 8093 (dev profile,含所有端点)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 20:32:53 +08:00
parent effc21d929
commit 0d8593e022
33 changed files with 597 additions and 18 deletions

View File

@@ -1,7 +1,7 @@
import { defineConfig, devices } from '@playwright/test';
// P4-5 端到端:改写后脚本挂回 onEvent 重放(打开页面→触发交互→断言指令重放生效)。
// dev server 由 webServer 拉起;/api 经 vite proxy 反代到后端 8086(启动前须先起 8086)。
// F1-4 端到端:schema 全量抽样渲染 + P4-5 改写后脚本挂回 onEvent 重放。
// dev server 由 webServer 拉起;/api 经 vite proxy 反代到后端 8093(dev profile)。
export default defineConfig({
testDir: './e2e',
fullyParallel: false,
@@ -15,8 +15,8 @@ export default defineConfig({
},
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
webServer: {
// 后端反代到 8086(脚本执行端点);dev 端口 5174 避开占用
command: 'VITE_BACKEND_TARGET=http://localhost:8086 npx vite --port 5174 --strictPort',
// 后端统一反代到 8093(dev profile,含所有端点:auth/menu/schema/script/entity)
command: 'VITE_BACKEND_TARGET=http://localhost:8093 npx vite --port 5174 --strictPort',
url: 'http://localhost:5174',
reuseExistingServer: false,
timeout: 120_000,