feat(workbench): expand SCADA monitoring and investigation presentation

This commit is contained in:
2026-11-07 19:50:14 +08:00
parent 0801e161ec
commit ba71e2d529
133 changed files with 6754 additions and 1438 deletions
@@ -1,8 +1,11 @@
import { expect, test } from "@playwright/test";
import { mockInvestigationPresentation } from "./support/mock-investigation-presentation";
for (const width of [1440, 1024]) {
test(`batch feature location highlights all matches and reports missing IDs at ${width}px`, async ({ page }) => {
for (const { width, entry } of [
{ width: 1440, entry: "dev" }, { width: 1024, entry: "dev" },
{ width: 1440, entry: "tool" }, { width: 375, entry: "tool" }, { width: 320, entry: "tool" }
]) {
test(`batch feature location highlights all matches and reports missing IDs through ${entry} at ${width}px`, async ({ page }) => {
await page.setViewportSize({ width, height: 900 });
await mockInvestigationPresentation(page, []);
const queries: string[] = [];
@@ -18,9 +21,10 @@ for (const width of [1440, 1024]) {
});
await page.goto("/", { waitUntil: "domcontentloaded" });
await page.waitForFunction(() => Boolean(window.__waterNetworkMap?.getLayer("scada-pressure-hit")));
await page.getByRole("button", { name: "切换地图 Dev Panel" }).click();
const panel = page.getByTestId("map-dev-panel");
await panel.getByRole("tab", { name: "地图调试", exact: true }).click();
const trigger = page.getByRole("button", { name: entry === "dev" ? "切换地图 Dev Panel" : "定位:查询地址或管网要素" });
await trigger.click();
const panel = entry === "dev" ? page.getByTestId("map-dev-panel") : page.getByRole("region", { name: "定位", exact: true });
await panel.getByRole("tab", { name: entry === "dev" ? "地图调试" : "管网要素", exact: true }).click();
const ids = panel.getByRole("textbox", { name: "要素 ID(可多个)" });
await ids.fill("P-1,P-2\nP-1 missing");
await panel.getByRole("button", { name: "定位并高亮", exact: true }).click();
@@ -35,7 +39,14 @@ for (const width of [1440, 1024]) {
return bounds?.contains([121.4, 31.05]) && bounds.contains([121.52, 31.14]);
})).toBe(true);
await expect(panel).toHaveJSProperty("scrollWidth", await panel.evaluate((element) => element.clientWidth));
await page.screenshot({ path: `/tmp/map-multi-feature-location-${width}.png` });
if (entry === "tool") {
const heading = panel.getByRole("heading", { name: "定位", exact: true });
expect(await heading.evaluate((element) => {
const box = element.getBoundingClientRect();
return document.elementFromPoint(box.x + box.width / 2, box.y + box.height / 2) === element;
})).toBe(true);
}
await page.screenshot({ path: `/tmp/map-multi-feature-location-${entry}-${width}.png` });
await panel.getByRole("button", { name: "清除高亮", exact: true }).click();
await expect.poll(highlights).toEqual([false, false]);
@@ -55,7 +66,8 @@ for (const width of [1440, 1024]) {
await expect.poll(highlights).toEqual([false, false]);
await ids.fill(" ");
await expect(panel.getByRole("button", { name: "定位并高亮", exact: true })).toBeDisabled();
await page.keyboard.press("Escape");
if (entry === "dev") await page.keyboard.press("Escape");
else await trigger.click();
await expect(panel).toBeHidden();
});
}