feat: add MCP research access and browser key management
This commit is contained in:
@@ -28,7 +28,9 @@ test("draft, immutable preview, mixed-result persistence and responsive workspac
|
||||
await page.getByRole("button", { name: "新建回测" }).click();
|
||||
await page.getByLabel("运行名称", { exact: true }).fill("浏览器回测验收");
|
||||
await page.getByRole("textbox", { name: "Region", exact: true }).fill("USA");
|
||||
await page.getByRole("textbox", { name: "Universe", exact: true }).fill("TOP3000");
|
||||
await page
|
||||
.getByRole("textbox", { name: "Universe", exact: true })
|
||||
.fill("TOP3000");
|
||||
await page.getByLabel("回测候选").fill("rank(close)\n-rank(volume)");
|
||||
await page.getByRole("button", { name: "保存草稿", exact: true }).click();
|
||||
await expect(page.getByText("草稿已保存", { exact: true })).toBeVisible();
|
||||
@@ -103,3 +105,86 @@ test("AI prepares one fixed preview, confirms once, and shows live run independe
|
||||
await chat.getByRole("button", { name: "打开回测详情", exact: true }).click();
|
||||
await expect(page.getByText("1 / 1 已保存", { exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
test("MCP direct batch appears through its run link and source filter", async ({
|
||||
page,
|
||||
}) => {
|
||||
await login(page);
|
||||
const token = (
|
||||
await (
|
||||
await page.request.post("/api/v1/test/mcp-token", { headers })
|
||||
).json()
|
||||
).token;
|
||||
const response = await page.request.post("/api/v1/mcp/", {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
Accept: "application/json, text/event-stream",
|
||||
},
|
||||
data: {
|
||||
jsonrpc: "2.0",
|
||||
id: "browser-batch",
|
||||
method: "tools/call",
|
||||
params: {
|
||||
name: "submit_backtests",
|
||||
arguments: {
|
||||
name: "MCP 浏览器留痕",
|
||||
idempotency_key: "browser-mcp",
|
||||
duplicate_policy: "rerun",
|
||||
candidates: [
|
||||
{
|
||||
client_item_id: "browser-1",
|
||||
expression: "rank(close) + 987",
|
||||
settings: {
|
||||
instrumentType: "EQUITY",
|
||||
region: "USA",
|
||||
universe: "TOP3000",
|
||||
delay: 1,
|
||||
decay: 0,
|
||||
neutralization: "INDUSTRY",
|
||||
truncation: 0.08,
|
||||
pasteurization: "ON",
|
||||
unitHandling: "VERIFY",
|
||||
nanHandling: "OFF",
|
||||
language: "FASTEXPR",
|
||||
visualization: false,
|
||||
maxTrade: "OFF",
|
||||
maxPosition: "OFF",
|
||||
},
|
||||
},
|
||||
],
|
||||
source: {
|
||||
reference: "browser-conversation",
|
||||
hypothesis: "验证直接回测留痕",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(response.ok()).toBeTruthy();
|
||||
const result = (await response.json()).result;
|
||||
expect(result.isError).toBeFalsy();
|
||||
const run = result.structuredContent;
|
||||
await page.goto(run.web_url);
|
||||
await expect(page.getByText("1 / 1 已保存", { exact: true })).toBeVisible({
|
||||
timeout: 20000,
|
||||
});
|
||||
await expect(
|
||||
page.getByText("研究来源:MCP 研究", { exact: true }),
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByText("来源引用:browser-conversation", { exact: true }),
|
||||
).toBeVisible();
|
||||
await page.reload();
|
||||
await expect(page.getByText("1 / 1 已保存", { exact: true })).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await page
|
||||
.getByRole("dialog")
|
||||
.getByRole("heading")
|
||||
.getByRole("button")
|
||||
.click();
|
||||
await page.getByText("全部研究来源", { exact: true }).click();
|
||||
await page.getByRole("option", { name: /MCP 研究/ }).click();
|
||||
await expect(
|
||||
page.getByRole("button", { name: "MCP 浏览器留痕", exact: true }),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user