Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

test(web): retain application incident foreground preflight

pulse-triage[bot]7443465c288d
diff --git a/scripts/incident-browser-checks.md b/scripts/incident-browser-checks.md
index c350adb922..8017e26b05 100644
--- a/scripts/incident-browser-checks.md
+++ b/scripts/incident-browser-checks.md
@@ -29,3 +29,39 @@ production-button interaction. Keep these two evidence claims separate.
Both commands log browser/runtime versions, lifecycle observations, commands and
final state. Retain failed logs alongside successes; a successful component check
must not be described as installed or full-application acceptance.
+
+## Full application row / native return
+
+The existing VMware history journey has an opt-in headed Chromium extension:
+
+```sh
+pulse-heavy-run -- xvfb-run -a env PULSE_E2E_USE_LOCAL_BACKEND=1 \
+ PULSE_E2E_SKIP_PLAYWRIGHT_INSTALL=1 PULSE_E2E_INCIDENT_FOREGROUND=1 \
+ npm --prefix tests/integration test -- \
+ tests/36-vmware-alert-history-resource-incidents.spec.ts \
+ --project=chromium --headed --workers=1
+```
+
+Install the `tests/integration` lockfile dependencies as well. The managed runner
+builds and owns a local backend and embedded frontend, authenticates using the
+existing helper, and cleans up the backend. Do not target a shared installation.
+The extension selects the real history-table Resource button, settles the first
+incident response, observes native hidden/visible transitions with focus emulation
+disabled, then clicks the enabled production Refresh button. It requires exactly
+two incident reads and changed rendered details. This does not freeze the page.
+
+History, incident and resource HTTP responses are mocked; the history route's
+WebSocket is suppressed. Authentication uses the local backend, but this is not
+an exact release-pair, live WebSocket convergence, real incident-store, or delivered
+notification check. Keep any failed application run as evidence, not a component
+fixture success in its place.
+
+Known harness limitation (8 September 2026): the first local run reached the real
+history row and settled initial incident details, then failed the native-hidden
+preflight: the original page stayed `visible` for ten seconds after another
+Playwright page was activated. The source-built frontend/backend succeeded and
+the backend was stopped by cleanup. Do not remove the visibility assertion or
+replace it with a synthetic DOM event to claim foreground coverage. The native
+browser-control prerequisite remains unresolved; the Refresh portion of this
+application scenario has **not** been executed successfully. The raw single-CDP
+component checks above do not clear this application failure.
diff --git a/tests/integration/tests/36-vmware-alert-history-resource-incidents.spec.ts b/tests/integration/tests/36-vmware-alert-history-resource-incidents.spec.ts
index 14e7d3f32a..e0f8a130e9 100644
--- a/tests/integration/tests/36-vmware-alert-history-resource-incidents.spec.ts
+++ b/tests/integration/tests/36-vmware-alert-history-resource-incidents.spec.ts
@@ -8,6 +8,8 @@ test.describe("VMware alert history resource incidents", () => {
test("opens VMware resource incidents through the shared alert history surface", async ({
page,
isMobile,
+ context,
+ browserName,
}) => {
// Recent timestamps keep the fixture inside the history view's default
// period window; fixed dates silently age out of it.
@@ -64,6 +66,8 @@ test.describe("VMware alert history resource incidents", () => {
});
});
+ let incidentReads = 0;
+ let refreshed = false;
await page.route("**/api/alerts/incidents**", async (route) => {
const requestUrl = new URL(route.request().url());
if (requestUrl.searchParams.get("resource_id") !== "vm:app-01") {
@@ -75,6 +79,7 @@ test.describe("VMware alert history resource incidents", () => {
return;
}
+ incidentReads++;
await route.fulfill({
status: 200,
contentType: "application/json",
@@ -90,7 +95,7 @@ test.describe("VMware alert history resource incidents", () => {
resourceType: "vm",
node: "esxi-01.lab.local",
instance: "VMware",
- message: "VM vm-201 has VMware alarm VM replication fault (red)",
+ message: refreshed ? "Replication incident updated after return" : "VM vm-201 has VMware alarm VM replication fault (red)",
status: "open",
openedAt: INCIDENT_START,
acknowledged: false,
@@ -222,6 +227,41 @@ test.describe("VMware alert history resource incidents", () => {
incidentsPanel.getByText("Resource Health").first(),
).toBeVisible();
+ // Application route and real history-row control; incident HTTP is routed
+ // above and WebSocket is suppressed. This is not installed acceptance.
+ if (browserName === "chromium" && !isMobile && process.env.PULSE_E2E_INCIDENT_FOREGROUND === "1") {
+ const refresh = incidentsPanel.getByRole("button", { name: "Refresh", exact: true });
+ await expect(refresh).toBeEnabled();
+ expect(incidentReads).toBe(1);
+ console.log(JSON.stringify({ stage: "application-incident-initial-read-settled", incidentReads,
+ tokenAuthenticationPresent: await page.evaluate(() => Boolean(sessionStorage.getItem("pulse_auth"))),
+ liveWebSocket: false, incidentHTTP: "mocked" }));
+ const cdp = await context.newCDPSession(page);
+ await cdp.send("Emulation.setFocusEmulationEnabled", { enabled: false });
+ const other = await context.newPage();
+ try {
+ await other.goto("about:blank");
+ await other.bringToFront();
+ await expect.poll(() => page.evaluate(() => document.visibilityState), {
+ message: "Native background preflight must pass; forced visibility is not foreground evidence",
+ }).toBe("hidden");
+ refreshed = true;
+ await page.bringToFront();
+ await expect.poll(() => page.evaluate(() => document.visibilityState)).toBe("visible");
+ await expect(refresh).toBeEnabled();
+ expect(incidentReads).toBe(1);
+ await refresh.click();
+ await expect(incidentsPanel.getByText("Replication incident updated after return", { exact: true })).toBeVisible();
+ await expect(refresh).toBeEnabled();
+ expect(incidentReads).toBe(2);
+ console.log(JSON.stringify({ scenario: "application-history-foreground-refresh", incidentReads,
+ authentication: "ensureAuthenticated helper", incidentHTTP: "mocked", liveWebSocket: false,
+ visibility: "native hidden then visible", freeze: false }));
+ } finally {
+ await other.close();
+ await cdp.detach();
+ }
+ }
await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });
});
});