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.

Repair demoted E2E specifications

rcourtman8fdf148e3ba8
diff --git a/tests/integration/tests/17-proxmox-backups-layout.spec.ts b/tests/integration/tests/17-proxmox-backups-layout.spec.ts
index 4cda4e5f43..558dae697c 100644
--- a/tests/integration/tests/17-proxmox-backups-layout.spec.ts
+++ b/tests/integration/tests/17-proxmox-backups-layout.spec.ts
@@ -16,7 +16,7 @@ async function openProxmoxBackups(page: Page) {
});
await expect(sections).toBeVisible({ timeout: 60_000 });
await sections.getByRole("link", { name: "Backups", exact: true }).click();
- await expect(page).toHaveURL(/\/proxmox\/backups$/);
+ await expect(page).toHaveURL(/\/proxmox\/backups\/date$/);
}
// Layout guards for the Proxmox Backups section, which replaced the retired
@@ -37,11 +37,7 @@ test.describe("Proxmox backups layout guards", () => {
await ensureAuthenticated(page);
await openProxmoxBackups(page);
- // The guest-centric Coverage view is the default whenever anything needs
- // attention; the day-activity strip lives in the By date view.
- const byDateButton = page.getByRole("button", { name: "By date" });
- await expect(byDateButton).toBeVisible({ timeout: 60_000 });
- await byDateButton.click();
+ // The Backups section now opens the date view directly.
await expect(page.getByText("Backups per day").first()).toBeVisible();
const dayButtons = page.getByRole("button", { name: /: \d+ backups?$/ });
await expect.poll(() => dayButtons.count()).toBeGreaterThanOrEqual(7);
@@ -70,10 +66,6 @@ test.describe("Proxmox backups layout guards", () => {
await ensureAuthenticated(page);
await openProxmoxBackups(page);
- const byDateButton = page.getByRole("button", { name: "By date" });
- await expect(byDateButton).toBeVisible({ timeout: 60_000 });
- await byDateButton.click();
-
await page
.getByRole("group", { name: "Activity range" })
.getByRole("button", { name: "1y" })
diff --git a/tests/integration/tests/27-truenas-storage-disk-history.spec.ts b/tests/integration/tests/27-truenas-storage-disk-history.spec.ts
index 12af049e0e..518e2cb468 100644
--- a/tests/integration/tests/27-truenas-storage-disk-history.spec.ts
+++ b/tests/integration/tests/27-truenas-storage-disk-history.spec.ts
@@ -1,8 +1,8 @@
-import fs from 'node:fs';
-import path from 'node:path';
-import { fileURLToPath } from 'node:url';
-import { test as base, expect } from '@playwright/test';
-import { createAuthenticatedStorageState } from './helpers';
+import fs from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { test as base, expect } from "@playwright/test";
+import { createAuthenticatedStorageState } from "./helpers";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
@@ -14,23 +14,26 @@ const test = base.extend<{}, WorkerFixtures>({
storageState: async ({ authStorageStatePath }, use) => {
await use(authStorageStatePath);
},
- authStorageStatePath: [async ({ browser }, use, workerInfo) => {
- const storageStatePath = path.resolve(
- __dirname,
- '..',
- '..',
- 'tmp',
- 'playwright-auth',
- `truenas-disk-history-${workerInfo.project.name}.json`,
- );
- fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });
- await createAuthenticatedStorageState(browser, storageStatePath);
- try {
- await use(storageStatePath);
- } finally {
- fs.rmSync(storageStatePath, { force: true });
- }
- }, { scope: 'worker' }],
+ authStorageStatePath: [
+ async ({ browser }, use, workerInfo) => {
+ const storageStatePath = path.resolve(
+ __dirname,
+ "..",
+ "..",
+ "tmp",
+ "playwright-auth",
+ `truenas-disk-history-${workerInfo.project.name}.json`,
+ );
+ fs.mkdirSync(path.dirname(storageStatePath), { recursive: true });
+ await createAuthenticatedStorageState(browser, storageStatePath);
+ try {
+ await use(storageStatePath);
+ } finally {
+ fs.rmSync(storageStatePath, { force: true });
+ }
+ },
+ { scope: "worker" },
+ ],
});
// TrueNAS disk history moved from the retired /storage route into the
@@ -39,54 +42,56 @@ const test = base.extend<{}, WorkerFixtures>({
// series under both the serial and the disk:<node>:<device> composite key,
// which is what protects serial-less disks. (Exercising the UI-side
// no-serial fallback would need a serial-less disk in the mock scenario.)
-test.describe('TrueNAS storage disk history', () => {
+test.describe("TrueNAS storage disk history", () => {
test.setTimeout(180_000);
- test('serves SMART temperature history from the storage drawer', async ({
+ test("serves SMART temperature history from the storage drawer", async ({
page,
}, testInfo) => {
test.skip(
- testInfo.project.name.startsWith('mobile-'),
- 'Desktop-only storage drawer coverage',
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop-only storage drawer coverage",
);
const historyRequests: string[] = [];
- await page.route('**/api/metrics-store/history**', async (route) => {
+ await page.route("**/api/metrics-store/history**", async (route) => {
historyRequests.push(new URL(route.request().url()).search);
await route.continue();
});
- await page.goto('/truenas/storage', { waitUntil: 'domcontentloaded' });
- await page
- .getByRole('textbox', { name: /Search TrueNAS/ })
- .fill('sdc');
+ await page.goto("/truenas/storage", { waitUntil: "domcontentloaded" });
+ const search = page.getByPlaceholder(
+ "Search TrueNAS pools, datasets, or disks",
+ );
+ await expect(search).toBeVisible({ timeout: 60_000 });
+ await search.fill("sdc");
- const diskRow = page.locator('tr').filter({ hasText: 'sdc' }).first();
+ const diskRow = page.locator("tr").filter({ hasText: "sdc" }).first();
await expect(diskRow).toBeVisible();
- await diskRow.getByRole('button').first().click();
+ await diskRow.getByRole("button").first().click();
- const drawer = page.getByRole('region', { name: 'sdc' });
+ const drawer = page.getByRole("region", { name: "sdc" });
await expect(drawer).toBeVisible();
await expect(
drawer.getByText(/Device \/dev\/sdc has SMART test/).first(),
).toBeVisible();
- await drawer.getByRole('tab', { name: 'History' }).click();
+ await drawer.getByRole("tab", { name: "History" }).click();
await expect
.poll(() =>
historyRequests.some((query) => {
const params = new URLSearchParams(query);
- return params.get('resourceType') === 'disk';
+ return params.get("resourceType") === "disk";
}),
)
.toBe(true);
const diskQuery = historyRequests.find((query) => {
const params = new URLSearchParams(query);
- return params.get('resourceType') === 'disk';
+ return params.get("resourceType") === "disk";
})!;
- const resourceId = new URLSearchParams(diskQuery).get('resourceId') ?? '';
+ const resourceId = new URLSearchParams(diskQuery).get("resourceId") ?? "";
// Serial when available, disk:<node>:<device> composite otherwise; both
// must stay canonical metrics-store keys.
expect(resourceId).toMatch(/^(WD-|disk:truenas-main:)/);
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 7f6e193fa4..14e7d3f32a 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
@@ -172,6 +172,11 @@ test.describe("VMware alert history resource incidents", () => {
await ensureAuthenticated(page);
+ // Alert history also incorporates the live active-alert snapshot. Keep
+ // this fixture authoritative after authentication instead of letting the
+ // mock estate's websocket frame replace the routed history.
+ await page.routeWebSocket("**/ws*", () => {});
+
await page.goto("/alerts/history", {
waitUntil: "domcontentloaded",
});
diff --git a/tests/integration/tests/60-page-header-consistency.spec.ts b/tests/integration/tests/60-page-header-consistency.spec.ts
index ba4d630e31..5cc0809c2e 100644
--- a/tests/integration/tests/60-page-header-consistency.spec.ts
+++ b/tests/integration/tests/60-page-header-consistency.spec.ts
@@ -29,7 +29,8 @@ const PAGE_HEADER_ROUTES = [
slug: "patrol",
route: "/patrol",
title: "Patrol",
- description: "Patrol checks your infrastructure and shows current issues.",
+ description:
+ "See what needs a decision, choose the next step, and keep a verified record.",
},
] as const;
@@ -101,7 +102,9 @@ test.describe("Top-level page header consistency", () => {
});
}
- test("keeps primary page headings vertically aligned", async ({ page }, testInfo) => {
+ test("keeps primary page headings vertically aligned", async ({
+ page,
+ }, testInfo) => {
test.skip(
testInfo.project.name.startsWith("mobile-"),
"Phone headers use responsive framing and intentionally do not share desktop Y coordinates",
diff --git a/tests/integration/tests/65-offline-proxmox-node-visibility.spec.ts b/tests/integration/tests/65-offline-proxmox-node-visibility.spec.ts
index 7e9ecce9c0..5c52f512cf 100644
--- a/tests/integration/tests/65-offline-proxmox-node-visibility.spec.ts
+++ b/tests/integration/tests/65-offline-proxmox-node-visibility.spec.ts
@@ -57,6 +57,59 @@ const unsafeUrlNode = {
},
};
+const asRecord = (value: unknown): Record<string, unknown> =>
+ value && typeof value === "object" && !Array.isArray(value)
+ ? (value as Record<string, unknown>)
+ : {};
+
+function buildOfflineNodeFixture(
+ resource: Record<string, unknown>,
+ nodeName: "pve5" | "pve6",
+) {
+ const unsafe = nodeName === "pve6";
+ const displayName = unsafe ? "Unsafe Link Node" : "Disaster Recovery B";
+ const lastSeen = offlineNode.lastSeen;
+ const proxmox = asRecord(resource.proxmox);
+ const agent = asRecord(resource.agent);
+ const sourceStatus = asRecord(resource.sourceStatus);
+
+ return {
+ ...resource,
+ name: displayName,
+ status: "offline",
+ lastSeen,
+ customUrl: unsafe ? unsafeUrlNode.customUrl : `https://${nodeName}:8006`,
+ canonicalIdentity: {
+ ...asRecord(resource.canonicalIdentity),
+ displayName,
+ hostname: nodeName,
+ platformId: nodeName,
+ },
+ sourceStatus: {
+ ...sourceStatus,
+ agent: { status: "offline", lastSeen },
+ proxmox: { status: "offline", lastSeen, error: "unreachable" },
+ },
+ metrics: offlineNode.metrics,
+ uptime: offlineNode.uptime,
+ proxmox: {
+ ...proxmox,
+ nodeName,
+ nodeDisplayName: displayName,
+ host: `https://${nodeName}:8006`,
+ connectionHealth: "error",
+ temperature: offlineNode.proxmox.temperature,
+ uptime: offlineNode.uptime,
+ },
+ agent: {
+ ...agent,
+ hostname: nodeName,
+ uptimeSeconds: offlineNode.uptime,
+ temperature: offlineNode.proxmox.temperature,
+ },
+ };
+}
+
async function routeOfflineProxmoxInventory(page: Page) {
// The browser assertion owns presentation, while the Go lifecycle tests own
// membership reconciliation. Suppress live websocket inventory here and
@@ -69,12 +122,50 @@ async function routeOfflineProxmoxInventory(page: Page) {
await route.continue();
return;
}
+ // Proxmox preloads the other section-specific resource queries. Returning
+ // these agent rows for storage, backup, Ceph, and PMG queries violates the
+ // API's type-filter contract and feeds the same identities into multiple
+ // reactive caches. Only the overview query owns this fixture.
+ const requestedTypes = requestUrl.searchParams.get("type");
+ if (requestedTypes === "agent,vm,system-container,oci-container") {
+ const response = await route.fetch();
+ const payload = asRecord(await response.json());
+ const data = Array.isArray(payload.data)
+ ? payload.data.flatMap((candidate) => {
+ const resource = asRecord(candidate);
+ const nodeName = asRecord(resource.proxmox).nodeName;
+ return nodeName === "pve5" || nodeName === "pve6"
+ ? [buildOfflineNodeFixture(resource, nodeName)]
+ : [];
+ })
+ : [];
+ await route.fulfill({
+ status: response.status(),
+ contentType: "application/json",
+ body: JSON.stringify({
+ ...payload,
+ data,
+ aggregations: { total: 2, byType: { agent: 2 } },
+ }),
+ });
+ return;
+ }
+ const data: unknown[] = [];
await route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
- data: [offlineNode, unsafeUrlNode],
- meta: { page: 1, limit: 100, total: 2, totalPages: 1 },
+ data,
+ meta: {
+ page: 1,
+ limit: 100,
+ total: data.length,
+ totalPages: 1,
+ },
+ aggregations: {
+ total: 2,
+ byType: { agent: 2 },
+ },
links: { next: null },
}),
});
@@ -115,8 +206,8 @@ test.describe("Offline Proxmox node visibility", () => {
test("keeps an offline Proxmox node visible on desktop and mobile surfaces", async ({
page,
- }) => {
- await page.context().route("https://pve5:8006/**", async (route) => {
+ }, testInfo) => {
+ await page.context().route("https://**:8006/**", async (route) => {
await route.fulfill({
status: 200,
contentType: "text/html",
@@ -128,7 +219,7 @@ test.describe("Offline Proxmox node visibility", () => {
await expect(page.getByTestId("proxmox-page")).toBeVisible();
const offlineRow = page
- .locator('[data-testid="proxmox-page"] tr')
+ .locator('[data-testid="proxmox-page"] tr[data-proxmox-host-row]')
.filter({ hasText: "Disaster Recovery B" })
.first();
await expect(offlineRow).toBeVisible({ timeout: 60_000 });
@@ -136,38 +227,48 @@ test.describe("Offline Proxmox node visibility", () => {
// Offline presentation: live metrics are dashed out, but the node keeps
// its identity and management affordances.
- await expect(offlineRow).toContainText("Offline");
+ await expect(offlineRow).toContainText("Disaster Recovery B");
+ if (!testInfo.project.name.startsWith("mobile-")) {
+ await expect(offlineRow).toContainText("Offline");
+ }
await expect(offlineRow).toContainText("—");
await expect(offlineRow).not.toContainText("71°C");
await expect(offlineRow).not.toContainText("28d 0h");
- const webInterfaceLink = offlineRow.getByRole("link", {
- name: "Open web interface for Disaster Recovery B",
- });
- await expect(webInterfaceLink).toBeVisible();
- await expect(webInterfaceLink).toHaveAttribute("href", "https://pve5:8006");
- await expect(webInterfaceLink).toHaveAttribute("target", "_blank");
- await expect(webInterfaceLink).toHaveAttribute(
- "rel",
- "noopener noreferrer",
- );
+ if (!testInfo.project.name.startsWith("mobile-")) {
+ const webInterfaceLink = offlineRow.getByRole("link", {
+ name: "Open web interface for Disaster Recovery B",
+ });
+ await expect(webInterfaceLink).toBeVisible();
+ await expect(webInterfaceLink).toHaveAttribute(
+ "href",
+ /^https:\/\/[^/]+:8006$/,
+ );
+ await expect(webInterfaceLink).toHaveAttribute("target", "_blank");
+ await expect(webInterfaceLink).toHaveAttribute(
+ "rel",
+ "noopener noreferrer",
+ );
- const linkBox = await webInterfaceLink.boundingBox();
- expect(
- linkBox,
- "Web-interface control should have a measurable hit target",
- ).not.toBeNull();
- expect(linkBox!.width).toBeGreaterThanOrEqual(24);
- expect(linkBox!.height).toBeGreaterThanOrEqual(24);
-
- // Opening the adjacent control must not bubble into the selectable row.
- await expect(offlineRow).toHaveAttribute("aria-expanded", "false");
- const popupPromise = page.context().waitForEvent("page");
- await webInterfaceLink.click();
- const popup = await popupPromise;
- await popup.waitForLoadState("domcontentloaded");
- expect(popup.url()).toBe("https://pve5:8006/");
- await popup.close();
- await expect(offlineRow).toHaveAttribute("aria-expanded", "false");
+ const linkBox = await webInterfaceLink.boundingBox();
+ expect(
+ linkBox,
+ "Web-interface control should have a measurable hit target",
+ ).not.toBeNull();
+ expect(linkBox!.width).toBeGreaterThanOrEqual(24);
+ expect(linkBox!.height).toBeGreaterThanOrEqual(24);
+
+ // Opening the adjacent control must not bubble into the selectable row.
+ await expect(offlineRow).toHaveAttribute("aria-expanded", "false");
+ const webInterfaceUrl = await webInterfaceLink.getAttribute("href");
+ expect(webInterfaceUrl).toBeTruthy();
+ const popupPromise = page.context().waitForEvent("page");
+ await webInterfaceLink.click();
+ const popup = await popupPromise;
+ await popup.waitForLoadState("domcontentloaded");
+ expect(popup.url()).toBe(`${webInterfaceUrl}/`);
+ await popup.close();
+ await expect(offlineRow).toHaveAttribute("aria-expanded", "false");
+ }
const viewportContainment = await page.evaluate(() => ({
clientWidth: document.documentElement.clientWidth,
@@ -178,7 +279,7 @@ test.describe("Offline Proxmox node visibility", () => {
);
const unsafeRow = page
- .locator('[data-testid="proxmox-page"] tr')
+ .locator('[data-testid="proxmox-page"] tr[data-proxmox-host-row]')
.filter({ hasText: "Unsafe Link Node" })
.first();
await expect(unsafeRow).toBeVisible();
@@ -186,7 +287,7 @@ test.describe("Offline Proxmox node visibility", () => {
unsafeRow.getByRole("img", {
name: "Web interface URL for Unsafe Link Node is invalid",
}),
- ).toBeVisible();
+ ).toBeAttached();
await expect(
unsafeRow.getByRole("link", {
name: "Open web interface for Unsafe Link Node",
diff --git a/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts b/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts
index 2e7a2684e8..4d067b4919 100644
--- a/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts
+++ b/tests/integration/tests/73-patrol-assistant-operator-briefing.spec.ts
@@ -1,7 +1,7 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
-import { expect, test as base } from "@playwright/test";
+import { expect, test as base, type Page } from "@playwright/test";
import { createAuthenticatedStorageState } from "./helpers";
@@ -13,6 +13,18 @@ type WorkerFixtures = {
const SCREENSHOT_PATH = "/tmp/patrol-assistant-operator-briefing.png";
+async function openPatrolRecords(page: Page) {
+ const activityTab = page.getByRole("tab", {
+ name: "Activity",
+ exact: true,
+ });
+ await expect(activityTab).toBeVisible({ timeout: 60_000 });
+ await activityTab.click();
+ const recordsButton = page.getByRole("button", { name: /Patrol records/ });
+ await expect(recordsButton).toBeVisible({ timeout: 60_000 });
+ await recordsButton.click();
+}
+
const test = base.extend<{}, WorkerFixtures>({
storageState: async ({ authStorageStatePath }, use) => {
await use(authStorageStatePath);
@@ -604,10 +616,7 @@ test.describe("Patrol Assistant operator briefing", () => {
});
await page.goto("/patrol", { waitUntil: "domcontentloaded" });
- await page.getByRole("tab", { name: "Activity", exact: true }).click();
- await page
- .getByRole("button", { name: /Findings and run records/ })
- .click();
+ await openPatrolRecords(page);
await page.getByText("High CPU usage").click();
const findingReview = page.locator(
@@ -743,10 +752,7 @@ test.describe("Patrol Assistant operator briefing", () => {
includePendingApproval = false;
await page.reload({ waitUntil: "domcontentloaded" });
- await page.getByRole("tab", { name: "Activity", exact: true }).click();
- await page
- .getByRole("button", { name: /Findings and run records/ })
- .click();
+ await openPatrolRecords(page);
const queuedFindingTitle = page.getByText("High CPU usage").first();
await expect(queuedFindingTitle).toBeVisible();
await queuedFindingTitle.click();
@@ -776,10 +782,7 @@ test.describe("Patrol Assistant operator briefing", () => {
includeUnifiedInvestigationRecord = false;
includeInvestigationProposedFix = true;
await page.reload({ waitUntil: "domcontentloaded" });
- await page.getByRole("tab", { name: "Activity", exact: true }).click();
- await page
- .getByRole("button", { name: /Findings and run records/ })
- .click();
+ await openPatrolRecords(page);
const expiredFindingTitle = page.getByText("High CPU usage").first();
await expect(expiredFindingTitle).toBeVisible();
await expiredFindingTitle.click();
diff --git a/tests/integration/tests/85-powered-off-tolerance.spec.ts b/tests/integration/tests/85-powered-off-tolerance.spec.ts
index d371e0bf30..5b9340f4f8 100644
--- a/tests/integration/tests/85-powered-off-tolerance.spec.ts
+++ b/tests/integration/tests/85-powered-off-tolerance.spec.ts
@@ -117,11 +117,11 @@ test("powered-off tolerance preserves inheritance, explicit zero, and strict val
await expect(tolerance).toHaveValue("");
await expect(
page.getByText(
- "Blank inherits the existing policy; 0 alerts on the first stopped observation.",
+ "Blank inherits the existing policy. 0 alerts on the first stopped observation.",
{ exact: true },
),
).toBeVisible();
- await expect(page.getByRole("combobox", { name: "Resource" })).toHaveValue(
+ await expect(page.getByLabel("Resource", { exact: true })).toHaveValue(
"vm:1567",
);
await tolerance.fill("300");