import { expect, test } from "@playwright/test"; test("opening Agent and condition panels does not move the map camera", async ({ page }) => { await page.goto("/", { waitUntil: "domcontentloaded" }); await page.waitForFunction( () => Boolean(window.__waterNetworkMap?.getLayer("scada-hit")) && !window.__waterNetworkMap?.isMoving() ); await page.evaluate(() => { const map = window.__waterNetworkMap; document.documentElement.dataset.panelCameraMoveCount = "0"; map?.on("movestart", () => { const currentCount = Number(document.documentElement.dataset.panelCameraMoveCount ?? "0"); document.documentElement.dataset.panelCameraMoveCount = String(currentCount + 1); }); }); await page.getByRole("button", { name: "折叠 Agent 面板" }).click(); await expect(page.locator('aside[aria-label="Agent 折叠栏"]')).toBeVisible(); await page.getByRole("button", { name: /展开 Agent 助手面板/ }).click(); await expect(page.locator('aside[aria-label="Agent 命令面板"]')).toBeVisible(); await page.getByRole("button", { name: "工况任务", exact: true }).click(); const conditionPanel = page.getByRole("region", { name: "工况任务", exact: true }); await conditionPanel.getByRole("button", { name: "展开工况任务" }).click(); await expect(conditionPanel).toHaveCSS("width", "880px"); expect(await page.evaluate(() => document.documentElement.dataset.panelCameraMoveCount)).toBe( "0" ); });