fix: restore polished account experience and align AI with Lark design

This commit is contained in:
yuxuanhui
2026-09-07 23:31:23 +08:00
parent 3f3d417296
commit 7dcf46836f
23 changed files with 1669 additions and 807 deletions
+87
View File
@@ -173,3 +173,90 @@ test("collapse, navigation, reload, narrow viewport and cancellation preserve ex
401,
);
});
test("Lark workspace keeps pagination, account details and chat usable at every width", async ({
page,
}) => {
await login(page);
await configure(page);
await page.getByRole("button", { name: "Alpha 管理", exact: true }).click();
await expect(page.locator(".alpha-link")).toHaveCount(25);
await expect(page.locator(".sidebar")).toHaveCSS(
"background-color",
"rgb(249, 249, 249)",
);
await expect(page.locator(".nav-item.active")).toHaveCSS(
"background-color",
"rgba(31, 35, 41, 0.05)",
);
const chat = page.getByRole("complementary", { name: "AI 研究助手" });
for (const width of [1920, 1440, 1280, 850, 390]) {
await page.setViewportSize({ width, height: 900 });
const footer = page.locator('footer[aria-label="Alpha 分页"]');
await expect(footer).toBeVisible();
const before = (await footer.boundingBox())!;
expect(before.y + before.height).toBeLessThanOrEqual(900);
expect(before.y + before.height).toBeGreaterThan(864);
await page
.locator(".semi-table-body")
.evaluate((el) => el.scrollTo({ top: 1000 }));
expect((await footer.boundingBox())!.y).toBeCloseTo(before.y, 0);
await page.getByRole("button", { name: "打开研究助手" }).click();
await expect(chat).toBeVisible();
await expect(chat).toHaveCSS("background-color", "rgb(255, 255, 255)");
const box = (await chat.boundingBox())!;
expect(box.x + box.width).toBeCloseTo(width, 0);
if (width >= 1440) {
expect(
(await page.locator(".main-shell").boundingBox())!.width,
).toBeGreaterThan(600);
expect(
(await footer.boundingBox())!.x + (await footer.boundingBox())!.width,
).toBeLessThan(box.x);
} else {
await expect(page.locator(".main-shell")).toHaveAttribute("inert", "");
await expect(page.locator(".ai-mask")).toBeVisible();
}
expect(
await page.evaluate(
() => document.documentElement.scrollWidth <= window.innerWidth,
),
).toBe(true);
await page.screenshot({
path: `../output/playwright/lark-chat-${width}.png`,
});
await chat.getByRole("button", { name: "收起研究助手" }).click();
}
await page.setViewportSize({ width: 1440, height: 1000 });
await page.getByRole("button", { name: "个人信息", exact: true }).click();
await expect(page.getByRole("button", { name: "连接设置" })).toHaveAttribute(
"aria-expanded",
"false",
);
await expect(page.locator(".permission-list li")).toHaveCount(10);
await expect(page.getByRole("row", { name: /回测/ })).toContainText(
"10,000(本地设定)",
);
await page
.getByRole("textbox", { name: "模型标识", exact: true })
.fill("保留模型设置草稿");
await page.getByRole("button", { name: "打开研究助手" }).click();
const resize = chat.getByRole("separator", { name: "调整助手宽度" });
await resize.focus();
for (let i = 0; i < 11; i++) await resize.press("ArrowLeft");
expect((await chat.boundingBox())!.width).toBe(640);
await chat.getByRole("button", { name: "新会话", exact: true }).click();
const input = chat.getByRole("textbox", { name: "发送给研究助手" });
await input.fill("保留聊天草稿");
await page.getByRole("button", { name: "Alpha 管理", exact: true }).click();
await page.getByRole("button", { name: "个人信息", exact: true }).click();
await expect(input).toHaveValue("保留聊天草稿");
await expect(
page.getByRole("textbox", { name: "模型标识", exact: true }),
).toHaveValue("保留模型设置草稿");
await chat.getByRole("button", { name: "收起研究助手" }).click();
await page.screenshot({
path: "../output/playwright/lark-account.png",
fullPage: true,
});
});
+11
View File
@@ -16,6 +16,12 @@ test("account → full sync → research → resync → PnL → filtered export
await page.getByLabel("密码", { exact: true }).fill("browser-test-password");
await page.getByRole("button", { name: "进入工作空间" }).click();
await page.getByRole("button", { name: "个人信息", exact: true }).click();
const connectionSettings = page.getByRole("button", {
name: "连接设置",
exact: true,
});
if ((await connectionSettings.getAttribute("aria-expanded")) === "false")
await connectionSettings.click();
await page
.getByRole("textbox", { name: "WorldQuant 邮箱" })
.fill("test@example.com");
@@ -36,6 +42,11 @@ test("account → full sync → research → resync → PnL → filtered export
.toBe("connected");
await page.keyboard.press("Escape");
await expect(page.locator(".job-panel")).not.toBeVisible();
await expect(page.locator(".permission-list li")).toHaveCount(10);
await expect(page.locator(".session-summary")).toContainText("4 小时");
const simulation = page.getByRole("row", { name: /回测/ });
await expect(simulation).toContainText("10,000(本地设定)");
await expect(simulation).toContainText("9,997");
await page.getByRole("button", { name: "Alpha 管理", exact: true }).click();
await page.getByRole("button", { name: "同步平台数据" }).click();
await expect