feat: initialize TJWater WebGIS frontend
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
test("renders the migrated WebGIS workbench shell", async ({ page }) => {
|
||||
const riveRequests: string[] = [];
|
||||
page.on("request", (request) => {
|
||||
if (/\.riv(?:\?|$)/.test(request.url())) {
|
||||
riveRequests.push(request.url());
|
||||
}
|
||||
});
|
||||
|
||||
await page.goto("/");
|
||||
await expect(page.getByText("供水管网智能调度系统")).toBeVisible();
|
||||
await expect(page.getByText("调度工作台")).toBeVisible();
|
||||
await expect(page.getByLabel("推荐问题")).toBeVisible();
|
||||
|
||||
const runtimeConfig = await page.evaluate(() => globalThis.__TJWATER_CONFIG__);
|
||||
expect(runtimeConfig).toMatchObject({
|
||||
TJWATER_MAP_URL: expect.any(String),
|
||||
TJWATER_GEOSERVER_WORKSPACE: expect.any(String),
|
||||
TJWATER_AGENT_API_BASE_URL: expect.any(String)
|
||||
});
|
||||
expect(Object.keys(runtimeConfig as Record<string, unknown>)).not.toContainEqual(
|
||||
expect.stringMatching(/^(NEXT_PUBLIC_|VITE_)/)
|
||||
);
|
||||
|
||||
const mapAsset = await page.request.get("/map/valve.png");
|
||||
expect(mapAsset.ok()).toBe(true);
|
||||
expect(mapAsset.headers()["content-type"]).toBe("image/png");
|
||||
await expect(page.locator('[aria-label="Agent 命令面板"] canvas').first()).toBeVisible({
|
||||
timeout: 25_000
|
||||
});
|
||||
await expect.poll(() => riveRequests.length, { timeout: 25_000 }).toBe(1);
|
||||
});
|
||||
Reference in New Issue
Block a user