feat: expand intelligent investigation workspace
This commit is contained in:
@@ -21,6 +21,11 @@ for (const width of [1440, 375, 320]) {
|
||||
}
|
||||
]
|
||||
});
|
||||
// Restored sessions must complete the pending-interaction check before sending.
|
||||
await page.route("**/api/v1/session/*/interactions", async (route) => {
|
||||
if (route.request().method() !== "GET") return route.fallback();
|
||||
await route.fulfill({ headers: { "Access-Control-Allow-Origin": "*" }, json: { items: [] } });
|
||||
});
|
||||
const parts = [
|
||||
{ type: "text", text: "以下资料均为演练数据。" },
|
||||
{ type: "data-answer_ui", id: "pressure", data: block },
|
||||
@@ -105,14 +110,13 @@ for (const width of [1440, 375, 320]) {
|
||||
await panel.getByRole("button", { name: "发送 Agent 指令" }).click();
|
||||
const ui = panel.locator('[data-answer-ui="pressure"]');
|
||||
await expect(ui).toHaveCount(1);
|
||||
const process = panel
|
||||
.locator("details")
|
||||
.filter({ has: page.locator("summary", { hasText: "查看处理过程" }) });
|
||||
const process = panel.locator("details[data-agent-process]");
|
||||
const processToggle = panel.getByRole("button", { name: "查看处理过程", exact: true });
|
||||
await expect(process).not.toHaveAttribute("open");
|
||||
await expect(panel.getByText("以下资料均为演练数据。", { exact: true })).toBeHidden();
|
||||
await process.locator("summary").click();
|
||||
await processToggle.click();
|
||||
await expect(panel.getByText("以下资料均为演练数据。", { exact: true })).toBeVisible();
|
||||
await process.locator("summary").click();
|
||||
await processToggle.click();
|
||||
if (width >= 1024) {
|
||||
const handle = page.getByRole("separator", { name: "调整 Agent 面板宽度" });
|
||||
for (const panelWidth of [400, 640]) {
|
||||
@@ -129,10 +133,32 @@ for (const width of [1440, 375, 320]) {
|
||||
}
|
||||
}
|
||||
await expect(ui.getByText("0.30", { exact: false }).first()).toBeVisible();
|
||||
await expect(panel.getByText("交互回答", { exact: true })).toBeVisible();
|
||||
await expect(panel.getByText("交互回答", { exact: true })).toHaveCount(0);
|
||||
const contentNav = ui.getByRole("navigation", { name: "回答内容导航" });
|
||||
const browseAnswer = contentNav.getByRole("button", { name: "浏览回答" });
|
||||
await browseAnswer.click();
|
||||
await expect(page.getByRole("menuitem", { name: "查看指标,2项" })).toBeVisible();
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(browseAnswer).toBeFocused();
|
||||
await page.keyboard.press("Enter");
|
||||
await page.getByRole("menuitem", { name: "查看补充资料,1项" }).focus();
|
||||
await page.keyboard.press("Enter");
|
||||
await expect(ui.locator(".answer-ui-form")).toBeFocused();
|
||||
await ui.getByLabel("现场位置(必填)").fill("导航保留的现场草稿");
|
||||
await browseAnswer.click();
|
||||
await page.getByRole("menuitem", { name: "查看趋势,1项" }).click();
|
||||
await expect(ui.locator(".answer-ui-chart")).toBeFocused();
|
||||
await expect(ui.getByLabel("现场位置(必填)")).toHaveValue("导航保留的现场草稿");
|
||||
await panel.locator(".agent-conversation-scroll").evaluate((element) => { element.scrollTop = 0; });
|
||||
await expect(panel.getByText("查看演练监测资料", { exact: true })).toBeVisible();
|
||||
await panel.screenshot({ path: `test-results/agent-chat-redesign-${width}.png` });
|
||||
await ui.getByRole("group", { name: /按回车查看数据点/ }).focus();
|
||||
await page.keyboard.press("Enter");
|
||||
await ui.getByRole("combobox", { name: "选择数据点" }).click();
|
||||
await page.getByRole("option", { name: "09:00", exact: true }).click();
|
||||
await expect(ui.getByRole("region", { name: "数据点详情" }).locator("dl")).toContainText("0.28");
|
||||
await ui.getByRole("button", { name: "关闭数据点详情", exact: true }).click();
|
||||
await expect(ui.getByRole("combobox", { name: "选择数据点" })).toBeHidden();
|
||||
const lineTab = ui.getByRole("tab", { name: "折线", exact: true });
|
||||
await lineTab.focus();
|
||||
await page.keyboard.press("ArrowRight");
|
||||
@@ -175,24 +201,29 @@ for (const width of [1440, 375, 320]) {
|
||||
await copy.click();
|
||||
await expect(panel.getByRole("button", { name: "回复已复制", exact: true }).first()).toBeVisible();
|
||||
expect(await page.evaluate(() => navigator.clipboard.readText())).toContain("仍需用户补充现场核验资料。");
|
||||
// The same editor and data selection move into the workspace and back.
|
||||
// The same editor and data filter move into the workspace and back.
|
||||
await ui.getByLabel("现场位置(必填)").fill("尚未提交的现场位置");
|
||||
await ui.getByRole("tab", { name: "数据", exact: true }).click();
|
||||
await ui.getByRole("textbox", { name: "搜索演练监测趋势" }).fill("09:00");
|
||||
await ui.getByRole("checkbox", { name: "选择第 2 行" }).check();
|
||||
await panel.getByRole("button", { name: "展开查看", exact: true }).click();
|
||||
const workspace = page.getByRole("region", { name: "展开报告工作区", exact: true });
|
||||
await expect(workspace).toBeVisible();
|
||||
await expect(page.getByLabel("现场位置(必填)")).toHaveCount(1);
|
||||
await expect(workspace.getByLabel("现场位置(必填)")).toHaveValue("尚未提交的现场位置");
|
||||
await expect(workspace.getByRole("textbox", { name: "搜索演练监测趋势" })).toHaveValue("09:00");
|
||||
await expect(workspace.getByRole("checkbox", { name: "选择第 2 行" })).toBeChecked();
|
||||
await workspace.getByRole("tab", { name: "折线", exact: true }).click();
|
||||
for (const close of await page.getByRole("button", { name: "关闭通知", exact: true }).all()) await close.click();
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
const geometry = await captureReadingGeometry(workspace, testInfo);
|
||||
expect(geometry.metricsHeight).toBeLessThan(145);
|
||||
expect(geometry.chartOffset).toBeLessThan(430);
|
||||
// The expanded reader reserves room for larger text and the task heading.
|
||||
// The chart still starts within one viewport, and the document scrolls inside its window.
|
||||
expect(geometry.chartOffset).toBeLessThan(600);
|
||||
const readerBounds = (await workspace.boundingBox())!;
|
||||
expect(readerBounds.x).toBeGreaterThan(0);
|
||||
expect(readerBounds.y).toBeGreaterThan(0);
|
||||
expect(readerBounds.x + readerBounds.width).toBeLessThan(width);
|
||||
expect(readerBounds.y + readerBounds.height).toBeLessThan(900);
|
||||
expect(geometry.horizontalOverflow).toBe(false);
|
||||
await page.screenshot({ path: `test-results/answer-workspace-${width}.png` });
|
||||
await workspace.getByRole("tab", { name: "数据", exact: true }).click();
|
||||
@@ -201,12 +232,11 @@ for (const width of [1440, 375, 320]) {
|
||||
await expect(ui.getByLabel("现场位置(必填)")).toHaveValue("尚未提交的现场位置");
|
||||
await expect(panel.getByRole("button", { name: "展开查看", exact: true })).toBeFocused();
|
||||
await panel.getByRole("button", { name: "展开查看", exact: true }).click();
|
||||
await workspace.locator("[data-interactive-table]").getByRole("button", { name: "针对这部分提问" }).click();
|
||||
await expect(workspace.getByRole("checkbox")).toHaveCount(0);
|
||||
await expect(workspace.getByRole("button", { name: /加入分析|针对.*提问/ })).toHaveCount(0);
|
||||
await page.keyboard.press("Escape");
|
||||
await expect(workspace).toHaveCount(0);
|
||||
await panel.getByText("查看引用内容", { exact: true }).click();
|
||||
await expect(panel.getByText("引用内容块:pressure", { exact: false })).toBeVisible();
|
||||
expect(prompts).toHaveLength(1);
|
||||
await panel.getByRole("button", { name: "移除内容引用" }).click();
|
||||
// Leave the current editor before restoring canonical persisted history.
|
||||
await panel.getByRole("button", { name: "新建 Agent 对话" }).click();
|
||||
await expect(ui).toHaveCount(0);
|
||||
|
||||
Reference in New Issue
Block a user