refactor: unify data preparations and research input snapshots
Deploy production / deploy (push) Successful in 53s
Deploy production / deploy (push) Successful in 53s
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
import { choosePreparation } from "./preparation-helpers";
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
// UI contract fixtures: no external model call or simulation is started by these tests.
|
||||
const fixed = {
|
||||
id: "semi-fixed-input",
|
||||
dataset_id: "TEST_FIN",
|
||||
name: "Semi 准备集合",
|
||||
note: "",
|
||||
version: 1,
|
||||
field_count: 1,
|
||||
dataset_count: 1,
|
||||
dataset_ids: ["TEST_FIN"],
|
||||
fields: [],
|
||||
preparation_ref: { id: "semi-fixed-input", version: 1 },
|
||||
field_ids: ["TEST_FIN_001"],
|
||||
field_types: { TEST_FIN_001: "MATRIX" },
|
||||
collection_version: "fixed-v1",
|
||||
@@ -20,8 +28,19 @@ for (const mode of ["templates", "variants", "features"] as const) {
|
||||
}) => {
|
||||
const errors: string[] = [];
|
||||
page.on("pageerror", (error) => errors.push(error.message));
|
||||
await page.route("**/api/v1/research/inputs", (route) =>
|
||||
route.fulfill({ json: { items: [fixed] } }),
|
||||
await page.route("**/api/v1/data-preparations?*", (route) =>
|
||||
route.fulfill({
|
||||
json: { items: [fixed], total: 1, limit: 25, offset: 0 },
|
||||
}),
|
||||
);
|
||||
await page.route(
|
||||
"**/api/v1/data-preparations/semi-fixed-input/selection?*",
|
||||
(route) => route.fulfill({ json: fixed }),
|
||||
);
|
||||
await page.route(
|
||||
"**/api/v1/research/input-snapshots/semi-fixed-input",
|
||||
(route) =>
|
||||
route.fulfill({ json: { ...fixed, preparation_ref: undefined } }),
|
||||
);
|
||||
await page.route(
|
||||
"**/api/v1/research/assets/semi-generated/versions",
|
||||
@@ -49,23 +68,18 @@ for (const mode of ["templates", "variants", "features"] as const) {
|
||||
exact: true,
|
||||
});
|
||||
await expect(generate).toBeDisabled();
|
||||
await sheet
|
||||
.getByRole("combobox", {
|
||||
name: feature ? "特征固定输入" : "固定研究输入",
|
||||
exact: true,
|
||||
})
|
||||
.click();
|
||||
await page
|
||||
.getByRole("option")
|
||||
.filter({ hasText: fixed.id.slice(0, 8) })
|
||||
.click();
|
||||
await choosePreparation(
|
||||
page,
|
||||
fixed.name,
|
||||
feature ? "选择特征数据准备" : "选择数据准备",
|
||||
);
|
||||
await input.click();
|
||||
if (mode === "variants")
|
||||
await sheet.getByLabel("种子 Alpha", { exact: true }).fill("TEST0001");
|
||||
const hypothesis = "检验 <收益> 与规模\n第二轮保留原始假设";
|
||||
await input.fill(hypothesis);
|
||||
await expect(
|
||||
sheet.locator(".research-ai-reference").filter({ hasText: fixed.id }),
|
||||
sheet.locator("p").filter({ hasText: /Semi 准备集合 ·/ }),
|
||||
).toBeVisible();
|
||||
let release!: () => void;
|
||||
const pending = new Promise<void>((resolve) => {
|
||||
@@ -117,7 +131,8 @@ for (const mode of ["templates", "variants", "features"] as const) {
|
||||
.poll(() => requestBody)
|
||||
.toMatchObject({
|
||||
hypothesis,
|
||||
input_ids: [fixed.id],
|
||||
input_ids: [],
|
||||
preparation_refs: [fixed.preparation_ref],
|
||||
method: feature
|
||||
? "feature"
|
||||
: mode === "variants"
|
||||
|
||||
Reference in New Issue
Block a user