fix: Alpha 列表失败项单行省略并提供完整提示

This commit is contained in:
yuxuanhui
2026-09-10 14:09:39 +08:00
parent ac92b3e70b
commit f8e23dccb9
2 changed files with 44 additions and 2 deletions
+19 -2
View File
@@ -15,6 +15,7 @@ import {
Tag, Tag,
TextArea, TextArea,
Toast, Toast,
Typography,
} from "@douyinfe/semi-ui-19"; } from "@douyinfe/semi-ui-19";
import type { ColumnProps } from "@douyinfe/semi-ui-19/lib/es/table/interface"; import type { ColumnProps } from "@douyinfe/semi-ui-19/lib/es/table/interface";
import { import {
@@ -487,9 +488,25 @@ export function AlphaPage({
title: "失败项", title: "失败项",
width: 230, width: 230,
render: (_, row) => ( render: (_, row) => (
<span title={row!.failed_checks?.join("、")}> <Typography.Text
className="alpha-failed-checks"
size="inherit"
style={{ width: "100%" }}
ellipsis={{
showTooltip: {
opts: {
content: row!.failed_checks?.join("\n"),
style: {
whiteSpace: "pre-line",
overflowWrap: "anywhere",
maxWidth: 420,
},
},
},
}}
>
{row!.failed_checks?.join("、") || "—"} {row!.failed_checks?.join("、") || "—"}
</span> </Typography.Text>
), ),
}, },
{ {
+25
View File
@@ -5,6 +5,20 @@ test("submission tabs, day selection, local correlation and reload", async ({
}) => { }) => {
const errors: string[] = []; const errors: string[] = [];
page.on("pageerror", (error) => errors.push(error.message)); page.on("pageerror", (error) => errors.push(error.message));
const failedChecks = [
"LOW_SHARPE",
"LOW_FITNESS",
"LOW_GLB_AMER_SHARPE",
"LOW_GLB_EMEA_SHARPE",
"LOW_GLB_APAC_SHARPE",
"LOW_2Y_SHARPE",
];
await page.route("**/api/v1/alphas?*", async (route) => {
const response = await route.fetch();
const data = await response.json();
if (data.items?.length) data.items[0].failed_checks = failedChecks;
await route.fulfill({ response, json: data });
});
await page.goto("/#alphas"); await page.goto("/#alphas");
await page.getByLabel("密码", { exact: true }).fill("browser-test-password"); await page.getByLabel("密码", { exact: true }).fill("browser-test-password");
await page.getByRole("button", { name: "进入工作空间" }).click(); await page.getByRole("button", { name: "进入工作空间" }).click();
@@ -70,6 +84,17 @@ test("submission tabs, day selection, local correlation and reload", async ({
await page.getByRole("textbox", { name: "搜索 Alpha" }).fill("TEST0003"); await page.getByRole("textbox", { name: "搜索 Alpha" }).fill("TEST0003");
await page.getByRole("button", { name: "查询", exact: true }).click(); await page.getByRole("button", { name: "查询", exact: true }).click();
await expect(page.locator(".alpha-link")).toHaveCount(1); await expect(page.locator(".alpha-link")).toHaveCount(1);
const failedCell = page.locator(".alpha-failed-checks");
await failedCell.scrollIntoViewIfNeeded();
expect((await failedCell.boundingBox())!.height).toBeLessThanOrEqual(24);
await failedCell.hover();
await expect(page.getByRole("tooltip")).toHaveText(failedChecks.join("\n"));
await page.screenshot({
path: "../output/playwright/alpha-failed-checks-tooltip.png",
animations: "disabled",
});
await page.getByRole("tab", { name: "待提交", exact: true }).hover();
await page.getByRole("tab", { name: "待提交", exact: true }).click(); await page.getByRole("tab", { name: "待提交", exact: true }).click();
await expect(page.getByRole("textbox", { name: "搜索 Alpha" })).toHaveValue( await expect(page.getByRole("textbox", { name: "搜索 Alpha" })).toHaveValue(
"", "",