feat: 完善 Alpha 详情页布局与提交检查,增加描述生成与验证功能
Deploy production / deploy (push) Successful in 54s

This commit is contained in:
yuxuanhui
2026-09-10 11:45:05 +08:00
parent f67b4d99b7
commit 9334b6f651
12 changed files with 500 additions and 122 deletions
+1 -1
View File
@@ -85,7 +85,7 @@ test("model settings, text stream, contextual query, confirmation and preserved
await page.getByRole("textbox", { name: "搜索 Alpha" }).fill("TEST0001");
await page.getByRole("button", { name: "查询", exact: true }).click();
await page.locator(".alpha-link").click();
await page.getByRole("tab", { name: "研究记录" }).click();
await page.getByRole("tab", { name: "研究信息" }).click();
await page
.getByRole("textbox", { name: "研究备注" })
.fill("尚未保存的人工研究草稿");
+88 -1
View File
@@ -92,8 +92,67 @@ test("submission tabs, day selection, local correlation and reload", async ({
await page.keyboard.press("Escape");
await page.getByRole("textbox", { name: "搜索 Alpha" }).fill("TEST0004");
await page.getByRole("button", { name: "查询", exact: true }).click();
await page.route("**/api/v1/alphas/TEST0004", async (route) => {
const response = await route.fetch();
const detail = await response.json();
detail.is_metrics.nested = {
yearly: { sharpe: 1.25, status: "PASS" },
samples: 120,
enabled: false,
};
await route.fulfill({ response, json: detail });
});
await page.locator(".alpha-link").click();
await page.getByRole("tab", { name: "本地自相关", exact: true }).click();
const sheet = page.locator(".alpha-detail");
await expect(sheet.getByRole("tab")).toHaveText([
"概览与表达式",
"指标",
"相关性检查",
"基线比较",
"变体关系",
"研究信息",
]);
const width = await sheet
.locator(".semi-sidesheet-inner")
.evaluate((element) => element.getBoundingClientRect().width);
expect(width).toBeCloseTo(1440 * 0.8, 0);
await expect(
sheet.getByRole("button", { name: "研究此 Alpha 的变体" }),
).not.toBeVisible();
await sheet.getByRole("tab", { name: "指标", exact: true }).click();
const metrics = sheet.locator(".detail-section").filter({
has: page.getByRole("heading", { name: "IS 指标", exact: true }),
});
await expect(metrics.locator(".nested-descriptions").first()).toContainText(
"1.25",
);
await expect(
metrics
.locator(".semi-descriptions-horizontal > table > tbody > tr")
.first()
.locator(":scope > th"),
).toHaveCount(3);
await expect(
metrics.locator(".semi-tag").filter({ hasText: "PASS" }),
).toBeVisible();
await expect(
metrics.locator(".semi-tag").filter({ hasText: "否" }),
).toBeVisible();
expect(
await metrics
.locator("th, td")
.evaluateAll((cells) =>
cells.every((cell) => getComputedStyle(cell).textAlign === "left"),
),
).toBe(true);
await page.screenshot({
path: "../output/playwright/alpha-detail-metrics.png",
});
await sheet.getByRole("tab", { name: "变体关系", exact: true }).click();
await expect(
sheet.getByRole("button", { name: "研究此 Alpha 的变体" }),
).toBeVisible();
await page.getByRole("tab", { name: "相关性检查", exact: true }).click();
await page.getByRole("button", { name: "检测自相关", exact: true }).click();
await expect
.poll(
@@ -110,6 +169,34 @@ test("submission tabs, day selection, local correlation and reload", async ({
await expect(page.locator(".job-panel")).not.toBeVisible();
await expect(page.locator(".correlation-panel")).toContainText("相关性偏高");
await expect(page.locator(".correlation-panel")).toContainText("1.0000");
const header = await sheet.locator(".detail-title").boundingBox();
const tabs = await sheet
.getByRole("tab", { name: "相关性检查", exact: true })
.boundingBox();
const content = sheet.locator(".alpha-detail-tabs > .semi-tabs-content");
await content.evaluate((element) => {
element.scrollTop = element.scrollHeight;
});
expect(
await content.evaluate((element) => element.scrollTop),
).toBeGreaterThan(0);
expect((await sheet.locator(".detail-title").boundingBox())!.y).toBe(
header!.y,
);
expect(
(await sheet
.getByRole("tab", { name: "相关性检查", exact: true })
.boundingBox())!.y,
).toBe(tabs!.y);
await expect(
sheet.getByRole("textbox", { name: "regular Description", exact: true }),
).toBeVisible();
await page.screenshot({
path: "../output/playwright/alpha-detail-scrolled.png",
});
await content.evaluate((element) => {
element.scrollTop = 0;
});
await page.screenshot({
path: "../output/playwright/local-correlation.png",
animations: "disabled",
+2 -7
View File
@@ -140,13 +140,8 @@ test("feature conversion, saved views and immutable evaluations", async ({
await page.getByRole("textbox", { name: "搜索 Alpha" }).fill("TEST0001");
await page.getByRole("button", { name: "查询", exact: true }).click();
await expect(page.locator(".alpha-link")).toHaveCount(1);
const alpha = await (
await page.request.get("/api/v1/alphas/TEST0001")
).json();
await page
.getByRole("button", { name: alpha.name || alpha.id, exact: true })
.click();
await page.getByRole("tab", { name: "评估报告", exact: true }).click();
await page.locator(".alpha-link").click();
await page.getByRole("tab", { name: "研究信息", exact: true }).click();
await page.getByRole("button", { name: "保存规则评估" }).click();
await expect(
page.getByText("规则:Sharpe ≥", { exact: false }),
+3 -3
View File
@@ -99,7 +99,7 @@ test("account → scoped sync → research → resync → PnL → filtered expor
await expect(
page.getByRole("heading", { name: "Combo", exact: true }),
).toBeVisible();
await page.getByRole("tab", { name: "研究记录" }).click();
await page.getByRole("tab", { name: "研究信息" }).click();
await page
.getByRole("textbox", { name: "研究备注" })
.fill("需要检验跨区域稳定性;保留这条研究假设。");
@@ -109,7 +109,7 @@ test("account → scoped sync → research → resync → PnL → filtered expor
await page.getByText("收藏此 Alpha", { exact: true }).click();
await page.getByRole("button", { name: "保存研究记录" }).click();
await expect(page.getByText("研究记录已保存")).toBeVisible();
await page.getByRole("tab", { name: "PnL 曲线" }).click();
await page.getByRole("tab", { name: "指标", exact: true }).click();
await page.getByRole("button", { name: "获取 PnL", exact: true }).click();
await expect
.poll(
@@ -145,7 +145,7 @@ test("account → scoped sync → research → resync → PnL → filtered expor
await page.getByRole("button", { name: "查询", exact: true }).click();
await expect(page.locator(".alpha-link")).toHaveCount(1);
await page.locator(".alpha-link").click();
await page.getByRole("tab", { name: "研究记录" }).click();
await page.getByRole("tab", { name: "研究信息" }).click();
await expect(page.getByRole("textbox", { name: "研究备注" })).toHaveValue(
"需要检验跨区域稳定性;保留这条研究假设。",
);