feat: add versioned research templates and alpha variants
This commit is contained in:
+30
-20
@@ -6,7 +6,7 @@ async function login(page: Page) {
|
||||
await page.getByLabel("密码", { exact: true }).fill("browser-test-password");
|
||||
await page.getByRole("button", { name: "进入工作空间" }).click();
|
||||
await expect(
|
||||
page.getByRole("button", { name: "打开研究助手" }),
|
||||
page.getByRole("button", { name: "切换研究助手" }),
|
||||
).toBeVisible();
|
||||
}
|
||||
async function configure(page: Page) {
|
||||
@@ -63,7 +63,7 @@ test("model settings, text stream, contextual query, confirmation and preserved
|
||||
const errors: string[] = [];
|
||||
page.on("pageerror", (error) => errors.push(error.message));
|
||||
await login(page);
|
||||
await page.getByRole("button", { name: "个人信息", exact: true }).click();
|
||||
await page.getByRole("button", { name: "配置", exact: true }).click();
|
||||
await page
|
||||
.getByRole("textbox", { name: "模型 Base URL" })
|
||||
.fill("https://model.test/v1");
|
||||
@@ -79,6 +79,7 @@ test("model settings, text stream, contextual query, confirmation and preserved
|
||||
.getByText("启用研究助手(能力测试通过后可开启)", { exact: true })
|
||||
.click();
|
||||
await page.getByRole("button", { name: "保存模型配置" }).click();
|
||||
await page.locator(".settings-drawer .semi-sidesheet-close").click();
|
||||
await configure(page);
|
||||
await page.getByRole("button", { name: "Alpha 管理", exact: true }).click();
|
||||
await page.getByRole("textbox", { name: "搜索 Alpha" }).fill("TEST0001");
|
||||
@@ -89,7 +90,7 @@ test("model settings, text stream, contextual query, confirmation and preserved
|
||||
.getByRole("textbox", { name: "研究备注" })
|
||||
.fill("尚未保存的人工研究草稿");
|
||||
// A global launcher must remain reachable when the detail mask is open.
|
||||
await page.getByRole("button", { name: "打开研究助手" }).click();
|
||||
await page.getByRole("button", { name: "切换研究助手" }).click();
|
||||
const chat = page.getByRole("complementary", { name: "AI 研究助手" });
|
||||
await chat.getByRole("button", { name: "新会话", exact: true }).click();
|
||||
await expect(chat.locator(".ai-context")).toContainText("TEST0001");
|
||||
@@ -130,7 +131,7 @@ test("model settings, text stream, contextual query, confirmation and preserved
|
||||
expect(JSON.stringify(history)).not.toContain("尚未保存的人工研究草稿");
|
||||
expect(history.runs.at(-1).tools[0].result.filters.turnover_max).toBe(0.15);
|
||||
await page.reload();
|
||||
await page.getByRole("button", { name: "打开研究助手" }).click();
|
||||
await page.getByRole("button", { name: "切换研究助手" }).click();
|
||||
await expect(
|
||||
chat.getByText("筛选换手率不超过 15% 的 Alpha", { exact: true }),
|
||||
).toBeVisible();
|
||||
@@ -150,16 +151,17 @@ test("collapse, navigation, reload, narrow viewport and cancellation preserve ex
|
||||
}) => {
|
||||
await login(page);
|
||||
await configure(page);
|
||||
await page.getByRole("button", { name: "打开研究助手" }).click();
|
||||
await page.getByRole("button", { name: "切换研究助手" }).click();
|
||||
const chat = page.getByRole("complementary", { name: "AI 研究助手" });
|
||||
await chat.getByRole("button", { name: "新会话", exact: true }).click();
|
||||
await chat.getByRole("textbox", { name: "发送给研究助手" }).fill("SLOW");
|
||||
await chat.getByRole("button", { name: "发送", exact: true }).click();
|
||||
await expect(chat.getByText("正在查询", { exact: true })).toBeVisible();
|
||||
await chat.getByRole("button", { name: "收起研究助手" }).click();
|
||||
await page.getByRole("button", { name: "个人信息", exact: true }).click();
|
||||
await page.getByRole("button", { name: "用户菜单", exact: true }).click();
|
||||
await page.getByRole("button", { name: "查看个人信息", exact: true }).click();
|
||||
await page.reload();
|
||||
await page.getByRole("button", { name: "打开研究助手" }).click();
|
||||
await page.getByRole("button", { name: "切换研究助手" }).click();
|
||||
await expect(
|
||||
chat.getByText("正在查询,查询完成。", { exact: true }),
|
||||
).toBeVisible({ timeout: 10000 });
|
||||
@@ -174,6 +176,7 @@ test("collapse, navigation, reload, narrow viewport and cancellation preserve ex
|
||||
await chat.getByRole("textbox", { name: "发送给研究助手" }).focus();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(chat).not.toBeVisible();
|
||||
await page.getByRole("button", { name: "用户菜单" }).click();
|
||||
await page.getByRole("button", { name: "退出登录" }).click();
|
||||
await expect(
|
||||
page.getByRole("heading", { name: "登录研究工作空间" }),
|
||||
@@ -190,13 +193,10 @@ test("Lark workspace keeps pagination, account details and chat usable at every
|
||||
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(
|
||||
await expect(page.locator(".app-sidebar")).toHaveCSS("width", "230px");
|
||||
await expect(page.locator(".sidebar-nav-item.active")).toHaveCSS(
|
||||
"background-color",
|
||||
"rgb(249, 249, 249)",
|
||||
);
|
||||
await expect(page.locator(".nav-item.active")).toHaveCSS(
|
||||
"background-color",
|
||||
"rgba(31, 35, 41, 0.05)",
|
||||
"rgb(234, 240, 255)",
|
||||
);
|
||||
const chat = page.getByRole("complementary", { name: "AI 研究助手" });
|
||||
for (const width of [1920, 1440, 1280, 850, 390]) {
|
||||
@@ -210,7 +210,7 @@ test("Lark workspace keeps pagination, account details and chat usable at every
|
||||
.locator(".alpha-page-view:not([hidden]) .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 page.getByRole("button", { name: "切换研究助手" }).click();
|
||||
await expect(chat).toBeVisible();
|
||||
await expect(chat).toHaveCSS("background-color", "rgb(255, 255, 255)");
|
||||
const box = (await chat.boundingBox())!;
|
||||
@@ -237,7 +237,8 @@ test("Lark workspace keeps pagination, account details and chat usable at every
|
||||
await chat.getByRole("button", { name: "收起研究助手" }).click();
|
||||
}
|
||||
await page.setViewportSize({ width: 1440, height: 1000 });
|
||||
await page.getByRole("button", { name: "个人信息", exact: true }).click();
|
||||
await page.getByRole("button", { name: "用户菜单", exact: true }).click();
|
||||
await page.getByRole("button", { name: "查看个人信息", exact: true }).click();
|
||||
await expect(page.getByRole("button", { name: "连接设置" })).toHaveAttribute(
|
||||
"aria-expanded",
|
||||
"false",
|
||||
@@ -246,10 +247,12 @@ test("Lark workspace keeps pagination, account details and chat usable at every
|
||||
await expect(page.getByRole("row", { name: /回测/ })).toContainText(
|
||||
"10,000(本地设定)",
|
||||
);
|
||||
await page.getByRole("button", { name: "配置", exact: true }).click();
|
||||
await page
|
||||
.getByRole("textbox", { name: "模型标识", exact: true })
|
||||
.fill("保留模型设置草稿");
|
||||
await page.getByRole("button", { name: "打开研究助手" }).click();
|
||||
await page.locator(".settings-drawer .semi-sidesheet-close").click();
|
||||
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");
|
||||
@@ -258,12 +261,19 @@ test("Lark workspace keeps pagination, account details and chat usable at every
|
||||
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 page.getByRole("button", { name: "用户菜单", exact: true }).click();
|
||||
await page.getByRole("button", { name: "查看个人信息", exact: true }).click();
|
||||
await expect(input).toHaveValue("保留聊天草稿");
|
||||
await chat.getByRole("button", { name: "收起研究助手" }).click();
|
||||
await page.getByRole("button", { name: "配置", exact: true }).click();
|
||||
await expect(
|
||||
page.getByRole("textbox", { name: "模型标识", exact: true }),
|
||||
).toHaveValue("保留模型设置草稿");
|
||||
await chat.getByRole("button", { name: "收起研究助手" }).click();
|
||||
await page.screenshot({
|
||||
path: "../output/playwright/settings-drawer.png",
|
||||
animations: "disabled",
|
||||
});
|
||||
await page.locator(".settings-drawer .semi-sidesheet-close").click();
|
||||
await page.screenshot({
|
||||
path: "../output/playwright/lark-account.png",
|
||||
fullPage: true,
|
||||
@@ -277,7 +287,7 @@ test("Markdown streams incomplete code, finishes safely and restores history", a
|
||||
page.on("pageerror", (error) => errors.push(error.message));
|
||||
await login(page);
|
||||
await configure(page);
|
||||
await page.getByRole("button", { name: "打开研究助手" }).click();
|
||||
await page.getByRole("button", { name: "切换研究助手" }).click();
|
||||
const chat = page.getByRole("complementary", { name: "AI 研究助手" });
|
||||
await chat.getByRole("button", { name: "新会话", exact: true }).click();
|
||||
const prefix = "## 研究结论\n\n**正在生成**\n\n```python\nrank(close)";
|
||||
@@ -391,7 +401,7 @@ test("Markdown streams incomplete code, finishes safely and restores history", a
|
||||
).toBe(true);
|
||||
await page.screenshot({ path: "../output/playwright/ai-markdown.png" });
|
||||
await page.reload();
|
||||
await page.getByRole("button", { name: "打开研究助手" }).click();
|
||||
await page.getByRole("button", { name: "切换研究助手" }).click();
|
||||
await expect(chat.getByRole("heading", { name: "研究结论" })).toBeVisible();
|
||||
await expect(chat.getByRole("cell", { name: "1.2" })).toBeVisible();
|
||||
expect(errors).toEqual([]);
|
||||
|
||||
Reference in New Issue
Block a user