test: migrate workbench fixtures to persistent event streams

Static fulfilled SSE bodies closed immediately and made ordinary UI cases reconnect. Serve persistent fixture streams, retain outage and cursor recovery coverage, and update legacy approval and investigation assertions for current disclosures and SVG diagrams.

Validation: 12 related browser scenarios, 877 unit tests, type checking, scoped ESLint, and diff checks. Unrelated SCADA replay changes remain outside this commit.
This commit is contained in:
2026-11-02 18:56:57 +08:00
parent 0ec74b15b2
commit 78481903d7
7 changed files with 125 additions and 53 deletions
+3 -5
View File
@@ -1,4 +1,5 @@
import type { Page } from "@playwright/test";
import { mockWorkbenchEventStream } from "./mock-workbench-event-stream";
const emptyRuntimeSnapshot = {
availability: "not_configured",
@@ -27,6 +28,7 @@ export async function mockScadaApi(
analysisRuns: Record<string, unknown> = {},
analysisHistory: unknown[] = []
) {
await mockWorkbenchEventStream(page);
const corsHeaders = { "Access-Control-Allow-Origin": "*" };
await page.route("https://tjwater-api.invalid/**", async (route) => {
if (route.request().method() === "OPTIONS") {
@@ -111,11 +113,7 @@ export async function mockScadaApi(
return;
}
if (url.pathname === "/api/v1/workbench/events") {
await route.fulfill({
contentType: "text/event-stream",
headers: { ...corsHeaders, "Cache-Control": "no-cache" },
body: ": test keepalive\n\n"
});
await route.fallback();
return;
}
if (url.pathname === "/api/v1/workbench/analysis-runs") {