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.

Make environment-coupled e2e specs portable to the test stack

rcourtman5f3228cac4ec
diff --git a/tests/integration/tests/06-theme-visual.spec.ts b/tests/integration/tests/06-theme-visual.spec.ts
index 266d2f220d..8c85b8195c 100644
--- a/tests/integration/tests/06-theme-visual.spec.ts
+++ b/tests/integration/tests/06-theme-visual.spec.ts
@@ -3,6 +3,11 @@ import { ensureAuthenticated, maybeCompleteSetupWizard, waitForPulseReady } from
type ThemePreference = 'light' | 'dark';
+// stabilizeVisualState injects an inline stylesheet, which the backend's
+// nonce-based CSP (active whenever FRONTEND_DEV_SERVER is unset, i.e. in the
+// dockerized test stack and CI) would otherwise block.
+test.use({ bypassCSP: true });
+
const VISUAL_VIEWPORT = { width: 1366, height: 900 };
const STABLE_VERSION_INFO = {
version: '99.1.0-rc.1',
diff --git a/tests/integration/tests/14-commercial-cancellation-reactivation.spec.ts b/tests/integration/tests/14-commercial-cancellation-reactivation.spec.ts
index 4a9006db15..570a70ef30 100644
--- a/tests/integration/tests/14-commercial-cancellation-reactivation.spec.ts
+++ b/tests/integration/tests/14-commercial-cancellation-reactivation.spec.ts
@@ -502,6 +502,23 @@ test.describe.serial('Commercial cancellation/reactivation', () => {
test('monthly grandfathered continuity, cancel/resume, cancellation, and v6 re-entry', async ({ page }, testInfo) => {
test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only commercial coverage');
+ const monthlyFixtureVars = [
+ 'PULSE_E2E_STRIPE_API_KEY',
+ 'PULSE_E2E_STRIPE_WEBHOOK_SECRET',
+ 'PULSE_CCR_MONTHLY_CUSTOMER_ID',
+ 'PULSE_CCR_MONTHLY_SUBSCRIPTION_ID',
+ 'PULSE_CCR_MONTHLY_LEGACY_PRICE_ID',
+ 'PULSE_CCR_MONTHLY_TEST_CLOCK_ID',
+ 'PULSE_CCR_RETURNER_EMAIL',
+ ] as const;
+ const missingMonthlyVars = monthlyFixtureVars.filter(
+ (name) => (process.env[name] || '').trim() === '',
+ );
+ test.skip(
+ missingMonthlyVars.length > 0,
+ `Live-Stripe fixture env missing (create-commercial-cancellation-fixtures.mjs): ${missingMonthlyVars.join(', ')}`,
+ );
+
const stripeSecretKey = requiredEnv('PULSE_E2E_STRIPE_API_KEY');
const webhookSecret = requiredEnv('PULSE_E2E_STRIPE_WEBHOOK_SECRET');
const customerID = requiredEnv('PULSE_CCR_MONTHLY_CUSTOMER_ID');
@@ -637,6 +654,23 @@ test.describe.serial('Commercial cancellation/reactivation', () => {
test('annual grandfathered path matches monthly continuity boundary', async ({ page }, testInfo) => {
test.skip(testInfo.project.name.startsWith('mobile-'), 'Desktop-only commercial coverage');
+ const annualFixtureVars = [
+ 'PULSE_E2E_STRIPE_API_KEY',
+ 'PULSE_E2E_STRIPE_WEBHOOK_SECRET',
+ 'PULSE_CCR_ANNUAL_CUSTOMER_ID',
+ 'PULSE_CCR_ANNUAL_SUBSCRIPTION_ID',
+ 'PULSE_CCR_ANNUAL_LEGACY_PRICE_ID',
+ 'PULSE_CCR_ANNUAL_TEST_CLOCK_ID',
+ 'PULSE_CCR_RETURNER_EMAIL',
+ ] as const;
+ const missingAnnualVars = annualFixtureVars.filter(
+ (name) => (process.env[name] || '').trim() === '',
+ );
+ test.skip(
+ missingAnnualVars.length > 0,
+ `Live-Stripe fixture env missing (create-commercial-cancellation-fixtures.mjs): ${missingAnnualVars.join(', ')}`,
+ );
+
const stripeSecretKey = requiredEnv('PULSE_E2E_STRIPE_API_KEY');
const webhookSecret = requiredEnv('PULSE_E2E_STRIPE_WEBHOOK_SECRET');
const customerID = requiredEnv('PULSE_CCR_ANNUAL_CUSTOMER_ID');
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 12f9cd9aa6..35c5a436e3 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
@@ -1,4 +1,5 @@
import { expect, test } from "@playwright/test";
+import { ensureAuthenticated } from "./helpers";
const SCREENSHOT_PATH = "/tmp/vmware-alert-history-resource-incidents.png";
test.describe("VMware alert history resource incidents", () => {
@@ -7,6 +8,10 @@ test.describe("VMware alert history resource incidents", () => {
test("opens VMware resource incidents through the shared alert history surface", async ({
page,
}) => {
+ // Recent timestamps keep the fixture inside the history view's default
+ // period window; fixed dates silently age out of it.
+ const INCIDENT_START = new Date(Date.now() - 30 * 60 * 1000).toISOString();
+ const INCIDENT_LAST_SEEN = new Date(Date.now() - 28 * 60 * 1000).toISOString();
await page.route("**/api/alerts/config", async (route) => {
await route.fulfill({
status: 200,
@@ -43,8 +48,8 @@ test.describe("VMware alert history resource incidents", () => {
message: "VM vm-201 has VMware alarm VM replication fault (red)",
value: 0,
threshold: 0,
- startTime: "2026-03-30T18:13:00Z",
- lastSeen: "2026-03-30T18:15:00Z",
+ startTime: INCIDENT_START,
+ lastSeen: INCIDENT_LAST_SEEN,
acknowledged: false,
metadata: {
incidentCategory: "health",
@@ -84,13 +89,13 @@ test.describe("VMware alert history resource incidents", () => {
instance: "VMware",
message: "VM vm-201 has VMware alarm VM replication fault (red)",
status: "open",
- openedAt: "2026-03-30T18:13:00Z",
+ openedAt: INCIDENT_START,
acknowledged: false,
events: [
{
id: "event-1",
type: "alert_fired",
- timestamp: "2026-03-30T18:13:00Z",
+ timestamp: INCIDENT_START,
summary: "Alert fired",
details: {
vmwareConnectionId: "vc-1",
@@ -124,7 +129,7 @@ test.describe("VMware alert history resource incidents", () => {
sourceType: "api",
sources: ["vmware"],
status: "warning",
- lastSeen: "2026-03-30T18:15:00Z",
+ lastSeen: INCIDENT_LAST_SEEN,
vmware: {
connectionId: "vc-1",
connectionName: "Lab VC",
@@ -147,7 +152,7 @@ test.describe("VMware alert history resource incidents", () => {
source: "vmware",
summary:
"VM vm-201 has VMware alarm VM replication fault (red)",
- startedAt: "2026-03-30T18:13:00Z",
+ startedAt: INCIDENT_START,
},
],
},
@@ -162,7 +167,9 @@ test.describe("VMware alert history resource incidents", () => {
});
});
- await page.goto("http://127.0.0.1:5173/alerts/history", {
+ await ensureAuthenticated(page);
+
+ await page.goto("/alerts/history", {
waitUntil: "domcontentloaded",
});
@@ -186,11 +193,17 @@ test.describe("VMware alert history resource incidents", () => {
);
await historyRow.getByRole("button", { name: "Resource" }).click();
+ // The message renders in both the history table cell and the opened
+ // resource drawer; assert the drawer copy specifically.
await expect(
- page.getByText("VM vm-201 has VMware alarm VM replication fault (red)"),
+ page
+ .getByRole("paragraph")
+ .filter({ hasText: "VM vm-201 has VMware alarm VM replication fault (red)" }),
).toBeVisible();
await expect(page.getByText("Resource incidents")).toBeVisible();
- await expect(page.getByText("Resource Health")).toBeVisible();
+ // "Resource Health" renders as both the incident label and a type badge
+ // inside the drawer.
+ await expect(page.getByText("Resource Health").first()).toBeVisible();
await page.screenshot({ path: SCREENSHOT_PATH, fullPage: true });
});
diff --git a/tests/integration/tests/54-monitored-system-billing-focus.spec.ts b/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
index 81e79391f8..443674eb5d 100644
--- a/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
+++ b/tests/integration/tests/54-monitored-system-billing-focus.spec.ts
@@ -1,6 +1,7 @@
import { test, expect, type Page } from "@playwright/test";
+import { preferredPlaywrightRouteBaseURL } from "./runtime-defaults";
-const DEV_SERVER_URL = "http://127.0.0.1:5173";
+const DEV_SERVER_URL = preferredPlaywrightRouteBaseURL();
const MONITORED_SYSTEM_ENTITLEMENTS = {
capabilities: [],
diff --git a/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts b/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts
index dc9cd867f9..601f5ea526 100644
--- a/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts
+++ b/tests/integration/tests/55-self-hosted-upgrade-return.spec.ts
@@ -5,8 +5,9 @@ import {
type Page,
type Route,
} from "@playwright/test";
+import { preferredPlaywrightRouteBaseURL } from "./runtime-defaults";
-const DEV_SERVER_URL = "http://127.0.0.1:5173";
+const DEV_SERVER_URL = preferredPlaywrightRouteBaseURL();
const PURCHASE_START_PATH = "/auth/license-purchase-start";
const PURCHASE_START_URL = `${DEV_SERVER_URL}${PURCHASE_START_PATH}`;
const PULSE_ACCOUNT_PORTAL_URL = "https://cloud.pulserelay.pro/portal";