AI 大模型接入 + 自动化测试(手动/AI/定时三种触发)

- 自动化测试核心(packages/core/src/testing.ts):
  - JSONPath 求值($.a.b[0].c)、断言评估(状态码/耗时/Header/Body × 10 种操作)
  - 变量提取(响应 → 当前环境,{{var}} 链式传值)、Markdown 报告导出
- 用例模型:场景用例 = 有序步骤(引用 HTTP 接口 + 断言 + 提取),失败后继续可选
- 执行器 testRunner + 定时调度器 scheduler(应用运行期间按间隔自动执行)
- TestingView:用例列表 / 步骤编排 / 断言与提取编辑器 / 报告(统计卡+断言明细+过滤+再次运行+导出)
- AI 助手:OpenAI 兼容客户端(DeepSeek/智谱/Kimi/OpenAI/Ollama 预设)
  - 设置 → AI 助手:供应商 CRUD + 测试连接 + 当前使用切换
  - AI 生成场景用例:读取集合接口清单 → 编排步骤/断言/提取 → 预览保存
- 入口:侧栏底部「自动化测试」+ ⋯ 菜单;文档新增 /docs/testing /docs/ai
- 新增 11 个引擎单测(总 48 前端用例全绿);本地 E2E:运行通过+断言通过+petId 提取验证
This commit is contained in:
logan committed 2026-09-18 01:57:57 +08:00
1 parent 9a019408ab
commit 1bcd7be2ac
23 files changed
+2538 -7

No files matched your search

+45
View File
@@ -474,6 +474,51 @@
color: var(--accent-strong);
}
/* ---------- 自动化测试 ---------- */
.test-assert-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
margin-bottom: 6px;
}
.test-assert-row .ops-input { max-width: 150px; }
.test-assert-locator { font-family: ui-monospace, monospace; }
.test-assert-expected { font-family: ui-monospace, monospace; min-width: 110px; }
.test-stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.test-stat {
@apply rounded-xl px-3 py-2.5 text-center;
background: var(--panel-2);
border: 1px solid var(--border);
}
.test-stat.ok { border-color: color-mix(in srgb, var(--success) 45%, transparent); }
.test-stat.bad { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.test-stat-value { font-size: 20px; font-weight: 700; line-height: 1.3; }
.test-stat.ok .test-stat-value { color: var(--success); }
.test-stat.bad .test-stat-value { color: var(--danger); }
.test-stat-label { @apply mt-0.5 text-[11px]; color: var(--text-faint); }
.test-step-result {
@apply overflow-hidden rounded-xl;
background: var(--panel-2);
border: 1px solid var(--border);
}
.test-assert-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.test-assert-table th {
@apply px-2 py-1 text-left font-semibold;
color: var(--text-faint);
border-bottom: 1px solid var(--border);
}
.test-assert-table td {
@apply px-2 py-1 align-top;
border-bottom: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
color: var(--text-dim);
max-width: 320px;
overflow-wrap: anywhere;
}
/* ---------- {{变量}} 补全浮层 ---------- */
.var-hint-wrap { position: relative; min-width: 0; flex: 1; display: inline-flex; }
.var-hint-panel {