feat(charts): manage investigation charts in a scrolling workspace
This commit is contained in:
@@ -62,6 +62,7 @@ test("调查进度替换整图,跟随只展示新指令并在关闭时清理
|
||||
};
|
||||
});
|
||||
let task: OperationalTask = {
|
||||
execution_scope: "production",
|
||||
project_id: projectId, task_id: taskId, task_type: "event_investigation", workflow: "water_quality_complaint",
|
||||
lifecycle_status: "open", status: "running", priority: "normal", revision: 1, execution_generation: 1,
|
||||
execution_request_id: requestId, title: "合成投诉联动调查", summary: "浏览器验证用合成投诉,不是真实工单",
|
||||
@@ -106,6 +107,7 @@ test("调查进度替换整图,跟随只展示新指令并在关闭时清理
|
||||
return route.fulfill({ json: { task_id: taskId, execution_generation: 1,
|
||||
active_run: { run_id: runId, generation: 1, status: "running" }, event_cursor: eventCursor } });
|
||||
}
|
||||
if (route.request().url().includes("/presentation-events")) return route.fulfill({ json: { task_id: taskId, event_cursor: eventCursor, items: [], next_after: null } });
|
||||
if (route.request().url().includes("/reports")) return route.fulfill({ json: { items: [], next_offset: null } });
|
||||
return route.fulfill({ json: task });
|
||||
});
|
||||
@@ -127,6 +129,7 @@ test("调查进度替换整图,跟随只展示新指令并在关闭时清理
|
||||
await panel.getByText("合成投诉联动调查", { exact: true }).first().click();
|
||||
await expect(panel.getByText("正在核对投诉点位", { exact: true }).first()).toBeVisible();
|
||||
const diagram = panel.getByLabel("调查脉络", { exact: true });
|
||||
await diagram.scrollIntoViewIfNeeded();
|
||||
await expect(diagram.locator("svg g.node.tjRunning")).toHaveCount(1);
|
||||
const animations = () => page.evaluate(() => (window as unknown as { reportAnimations: string[] }).reportAnimations);
|
||||
expect(await animations()).toEqual([]);
|
||||
@@ -142,7 +145,7 @@ test("调查进度替换整图,跟随只展示新指令并在关闭时清理
|
||||
await expect(diagram).not.toContainText("投诉点位核对");
|
||||
await expect(diagram.locator("svg g.node.tjRunning")).toHaveCount(0);
|
||||
await expect(diagram).toHaveAttribute("data-retained-reader", "true");
|
||||
await expect.poll(animations).toEqual(["当前调查进展"]);
|
||||
await expect.poll(animations).toContain("当前调查进展");
|
||||
|
||||
task = { ...task, revision: 3, latest_report: { revision: 1, execution_generation: 1,
|
||||
source_session_id: "investigation-test", published_at: now, published_by: "agent", report: {
|
||||
@@ -153,24 +156,24 @@ test("调查进度替换整图,跟随只展示新指令并在关闭时清理
|
||||
await panel.getByRole("button", { name: "刷新工况任务", exact: true }).click();
|
||||
const report = panel.getByRole("region", { name: "任务报告", exact: true });
|
||||
await expect(report).toContainText("合成结论:等待现场核查");
|
||||
await expect.poll(animations).toEqual(["当前调查进展", "任务报告"]);
|
||||
await report.getByText("判断说明与建议", { exact: true }).click();
|
||||
await report.locator("details").evaluate((element) => element.setAttribute("data-retained-reader", "true"));
|
||||
await expect.poll(animations).toContain("任务报告");
|
||||
await report.evaluate((element) => element.setAttribute("data-retained-reader", "true"));
|
||||
const beforeReportUpdate = (await animations()).filter((label) => label === "任务报告").length;
|
||||
task = { ...task, revision: 4, latest_report: { ...task.latest_report!, revision: 2,
|
||||
report: { ...task.latest_report!.report, current_conclusion: "合成结论:现场核查已更新" } } };
|
||||
await panel.getByRole("button", { name: "刷新工况任务", exact: true }).click();
|
||||
await expect(report).toContainText("合成结论:现场核查已更新");
|
||||
await expect(report.locator("details")).toHaveAttribute("open", "");
|
||||
await expect(report.locator("details")).toHaveAttribute("data-retained-reader", "true");
|
||||
await expect.poll(animations).toEqual(["当前调查进展", "任务报告", "任务报告"]);
|
||||
await expect(report).toHaveAttribute("data-retained-reader", "true");
|
||||
await expect.poll(() => animations().then((entries) => entries.filter((label) => label === "任务报告").length)).toBeGreaterThan(beforeReportUpdate);
|
||||
await testInfo.attach("report-update", { body: await report.screenshot(), contentType: "image/png" });
|
||||
|
||||
await page.emulateMedia({ reducedMotion: "reduce" });
|
||||
const beforeReducedMotion = await animations();
|
||||
task = { ...task, revision: 5, latest_report: { ...task.latest_report!, revision: 3,
|
||||
report: { ...task.latest_report!.report, current_conclusion: "合成结论:减少动态效果下更新" } } };
|
||||
await panel.getByRole("button", { name: "刷新工况任务", exact: true }).click();
|
||||
await expect(report).toContainText("合成结论:减少动态效果下更新");
|
||||
expect(await animations()).toEqual(["当前调查进展", "任务报告", "任务报告"]);
|
||||
expect(await animations()).toEqual(beforeReducedMotion);
|
||||
await page.emulateMedia({ reducedMotion: "no-preference" });
|
||||
await page.getByRole("button", { name: "切换地图 Dev Panel" }).click();
|
||||
const follow = page.getByRole("checkbox", { name: "跟随所选调查" });
|
||||
@@ -185,9 +188,11 @@ test("调查进度替换整图,跟随只展示新指令并在关闭时清理
|
||||
expect(checkboxAlignment).toEqual({ width: 20, height: 20, offsetX: 0, offsetY: 0 });
|
||||
await expect.poll(() => cursorReads).toBeGreaterThan(0);
|
||||
const dev = page.getByTestId("map-dev-panel");
|
||||
const sections = dev.locator("details");
|
||||
await expect(sections).toHaveCount(5);
|
||||
await expect(sections.filter({ hasText: "调查联动" })).toHaveAttribute("open", "");
|
||||
await expect(dev.getByRole("tab", { name: "调查测试", exact: true })).toHaveAttribute("aria-selected", "true");
|
||||
await expect(dev.getByRole("region", { name: "调查联动", exact: true })).toBeVisible();
|
||||
await dev.getByRole("tab", { name: "地图调试", exact: true }).click();
|
||||
const sections = dev.getByRole("tabpanel", { name: "地图调试", exact: true }).locator("details");
|
||||
await expect(sections).toHaveCount(4);
|
||||
await expect(sections.filter({ hasText: "要素定位" })).toHaveAttribute("open", "");
|
||||
await expect(sections.filter({ hasText: "水流调试" })).not.toHaveAttribute("open", "");
|
||||
await testInfo.attach("dev-panel-default", { body: await page.screenshot({ path: testInfo.outputPath("dev-panel-default.png") }), contentType: "image/png" });
|
||||
@@ -238,6 +243,9 @@ test("调查进度替换整图,跟随只展示新指令并在关闭时清理
|
||||
await expect(page.locator('[data-investigation-chart="pressure"]')).toHaveCount(0);
|
||||
await emit({ action: "open_chart", ...chart });
|
||||
await expect(page.locator('[data-investigation-chart="pressure"]')).toBeVisible();
|
||||
const chartManager = page.getByRole("dialog", { name: "图表管理", exact: true });
|
||||
await expect(chartManager).toBeVisible();
|
||||
await chartManager.getByRole("button", { name: "关闭窗口", exact: true }).click();
|
||||
await emit({ action: "close_chart", chart_id: "pressure" });
|
||||
await expect(page.locator('[data-investigation-chart="pressure"]')).toHaveCount(0);
|
||||
const data = { type: "FeatureCollection", features: [
|
||||
@@ -263,6 +271,7 @@ test("调查进度替换整图,跟随只展示新指令并在关闭时清理
|
||||
await testInfo.attach("live-investigation-mobile", { body: await page.screenshot({ path: testInfo.outputPath("live-investigation-mobile.png") }), contentType: "image/png" });
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
await page.getByRole("button", { name: "切换地图 Dev Panel" }).click();
|
||||
await dev.getByRole("tab", { name: "调查测试", exact: true }).click();
|
||||
await follow.uncheck();
|
||||
await expect(follow).not.toBeChecked();
|
||||
await follow.focus();
|
||||
|
||||
Reference in New Issue
Block a user