This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user