Files
opsxapi/src/features/testing/regression.ts
T
logan 2bb4ef7a95 桌面 GUI 外链修复 + 主题顺序调整(含结构扁平化进行中的工作区基线)
- 集成 tauri-plugin-opener:Cargo/lib.rs/capabilities/npm 四处接线,新增 src/openExternal.ts(桌面走 opener,浏览器回退 window.open,相对路径绝对化)
- 关于页 4 个链接、活动栏官网菜单、代理错误横幅 2 处健康检查链接全部改走 openExternal,桌面端可正常跳转
- 设置→外观 主题顺序调整为 深色/浅色/跟随系统
- release 二进制重编并验证(浏览器实测关于页链接可开文档页)
- 附带工作区中未提交的扁平化重构现状(另一会话进行中)
- homepage 落地页与文档终检通过(8787 / 与 /docs 双 200)
2026-10-16 03:03:36 +08:00

33 lines
1.5 KiB
TypeScript

import { createSeedWorkspace } from "../../core/index";
import { useWorkspace } from "../../workspaceStore";
const REGRESSION_CASE_ID = "tc-opsx-http8-regression";
/** 装载 / 刷新本地 Gin echo 八组合回归用例(不整库清空) */
export function installHttp8Regression(): string {
const seed = createSeedWorkspace();
const state = useWorkspace.getState();
const seedCase = seed.testCases.find((c) => c.id === REGRESSION_CASE_ID) ?? seed.testCases[0]!;
const localEnv = seed.environments.find((e) => e.name === "本地") ?? seed.environments[0];
const hasCase = state.testCases.some((c) => c.id === REGRESSION_CASE_ID);
const hasCollection = state.collections.some((c) => c.name === "示例集合");
const localExisting = state.environments.find((e) => e.name === "本地");
state.loadWorkspaceData({
version: 2,
collections: hasCollection
? state.collections.map((c) => (c.name === "示例集合" ? seed.collections[0]! : c))
: [...state.collections, ...seed.collections],
environments: localExisting
? state.environments
: [...state.environments, ...seed.environments.filter((e) => e.name === "本地")],
activeEnvironmentId: localExisting?.id ?? localEnv?.id ?? state.activeEnvironmentId,
history: state.history,
settings: state.settings,
testCases: hasCase
? state.testCases.map((c) => (c.id === REGRESSION_CASE_ID ? seedCase : c))
: [...state.testCases, seedCase],
testRuns: state.testRuns,
schedules: state.schedules,
});
return seedCase.id;
}