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.

fix(e2e): synchronize editor commits and retain retry diagnostics

rcourtman72f6d2cf7d44
diff --cc .github/workflows/test-e2e.yml
index 95e511f894,95e511f894..5d4cb4c2ad
--- a/.github/workflows/test-e2e.yml
+++ b/.github/workflows/test-e2e.yml
@@@ -437,10 -437,10 +437,11 @@@ jobs
working-directory: tests/integration
run: node scripts/report-stable-e2e-failures.mjs test-results/junit.xml
-- # Preserve the completed stable failure before observational work can
-- # reach the job deadline. Probation must not take its receipts with it.
++ # Preserve failed attempts, including a passing first retry, before
++ # probation can reach the job deadline. Retry traces and failure images
++ # are diagnostic bytes even when the suite's final outcome is success.
- name: Upload Playwright report
-- if: ${{ !cancelled() && steps.stable.outcome == 'failure' }}
++ if: ${{ !cancelled() && (steps.stable.outcome == 'failure' || hashFiles('tests/integration/test-results/**/trace.zip', 'tests/integration/test-results/**/test-failed-*.png') != '') }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-report-shard-${{ matrix.shard }}
@@@ -450,7 -450,7 +451,7 @@@
# The HTML report already contains screenshots, videos and traces.
# Keep only the separate machine-readable result here.
- name: Upload JUnit results
-- if: ${{ !cancelled() && steps.stable.outcome == 'failure' }}
++ if: ${{ !cancelled() && (steps.stable.outcome == 'success' || steps.stable.outcome == 'failure') }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: junit-results-shard-${{ matrix.shard }}
@@@ -516,7 -516,7 +517,7 @@@
# continue-on-error keeps the job green on a probation failure, so
# failure() never fires for these; key off the step outcome instead.
- name: Upload probation Playwright report
-- if: ${{ !cancelled() && steps.probation.outcome == 'failure' }}
++ if: ${{ !cancelled() && (steps.probation.outcome == 'failure' || hashFiles('tests/integration/test-results-probation/**/trace.zip', 'tests/integration/test-results-probation/**/test-failed-*.png') != '') }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-report-probation-shard-${{ matrix.shard }}
@@@ -524,7 -524,7 +525,7 @@@
retention-days: 3
- name: Upload probation JUnit results
-- if: ${{ !cancelled() && steps.probation.outcome == 'failure' }}
++ if: ${{ !cancelled() && (steps.probation.outcome == 'success' || steps.probation.outcome == 'failure') }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: junit-results-probation-shard-${{ matrix.shard }}
diff --cc docs/release-control/v6/internal/subsystems/deployment-installability.md
index 5bbbf7f4fa,9b586b1e3f..74f2c21ff0
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@@ -3016,28 -3015,6 +3016,40 @@@ artifact-selection behaviour
deterministic token authentication after setup, and may use the server setup
API as a fallback only when the UI wizard fails to complete cleanly under the
managed hot-dev runtime.
+ A successful token probe and a protected workspace URL do not establish
+ completed browser bootstrap. Token, cookie reuse and password login wait for the mounted
+ authenticated app shell before returning control to a journey, so a pending
+ workspace redirect cannot overwrite its next deep link. Browser rejection
+ remains an authentication failure rather than a reason to accept the URL or
+ retry login. `tests/integration/scripts/fixture-auth.test.mjs` exercises the
+ actual token helper with delayed and rejected bootstrap; the runtime-home
+ onboarding browser contract also holds a real protected-state request.
+ That regression creates and revokes its own token through the admitted
+ session and shared browser-token helper. It must work with cookie-only and
+ primary-token fixtures without replacing their remembered credential.
++ Protected full-page navigations also await that mounted-shell boundary
++ before judging a consuming panel. A loading root is not a ready workspace.
++ The delayed-token browser regression owns a fresh page and holds only that
++ page's bootstrap reads, so reads from a departing document cannot release
++ or stall its control. Responsive threshold edits leave the whole desktop
++ row or use the card's Save control before asserting a staged change.
+ The Core E2E Docker stack explicitly sets bounded development-only general
+ and update request budgets for isolated browser contexts sharing one bridge
+ IP. Production limits and authentication limits remain enforced. The API
+ contracts subsystem owns validation and exhaustion semantics.
++ Core E2E retains a tier's HTML diagnostic report when it fails or produces
++ a first-retry trace/failure screenshot, including a retry that passes. Small
++ JUnit results are retained for every completed tier. Stable receipts are
++ uploaded before probation starts, and both tiers keep the existing three-day
++ retention. Artifact presence controls retention, not release readiness or
++ probation promotion.
+ Settings browser audits scroll the actual application content owner to its
+ observed bottom. Traversal must scale with the populated estate rather than
+ stop after a fixed number of wheel steps. The browser geometry regression
+ `tests/integration/scripts/settings-scroll-audit.test.mjs` retains native
+ Chromium/WebKit traversal of short and 30,000px content plus the positive
+ horizontal-overflow control; the live mobile audit keeps its bottom and
+ overflow assertions.
The built `index.html` must not modulepreload lazy route chunks: the SRI
plugin runs with `preloadDynamicChunks: false` so cold start fetches only the
entry and its static vendor imports (route-level code splitting stays
diff --cc scripts/tests/test_e2e_test_images.py
index 8af9ca87f3,c8364dc620..96a04d7fb3
--- a/scripts/tests/test_e2e_test_images.py
+++ b/scripts/tests/test_e2e_test_images.py
@@@ -289,7 -276,7 +289,29 @@@ class E2EImageWorkflowTest(unittest.Tes
self.assertLess(stable, start)
self.assertLess(start, probation)
end = consumer.index("\n - name:", start)
-- self.assertIn("!cancelled() && steps.stable.outcome == 'failure'", consumer[start:end])
++ receipt_block = consumer[start:end]
++ self.assertIn("!cancelled()", receipt_block)
++ self.assertIn("steps.stable.outcome == 'failure'", receipt_block)
++ if receipt == "Upload Playwright report":
++ self.assertIn("hashFiles(", receipt_block)
++ self.assertIn("tests/integration/test-results/**/trace.zip", receipt_block)
++ self.assertIn("tests/integration/test-results/**/test-failed-*.png", receipt_block)
++ else:
++ self.assertIn("steps.stable.outcome == 'success'", receipt_block)
++
++ for receipt in ("Upload probation Playwright report", "Upload probation JUnit results"):
++ start = consumer.index(f"- name: {receipt}\n")
++ self.assertLess(probation, start)
++ end = consumer.find("\n - name:", start)
++ receipt_block = consumer[start:end if end >= 0 else None]
++ self.assertIn("!cancelled()", receipt_block)
++ self.assertIn("steps.probation.outcome == 'failure'", receipt_block)
++ if receipt == "Upload probation Playwright report":
++ self.assertIn("hashFiles(", receipt_block)
++ self.assertIn("tests/integration/test-results-probation/**/trace.zip", receipt_block)
++ self.assertIn("tests/integration/test-results-probation/**/test-failed-*.png", receipt_block)
++ else:
++ self.assertIn("steps.probation.outcome == 'success'", receipt_block)
def test_fixture_admission_cannot_skip_source_images_or_lose_completed_receipts(self):
self.assert_fixture_admission(WORKFLOW.read_text())
@@@ -301,7 -288,7 +323,11 @@@
"run: npx playwright test --config=fixture-readiness.config.ts || true"),
(" id: fixture\n", " id: fixture\n continue-on-error: true\n"),
('PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY: "true"', 'PULSE_E2E_REQUIRE_DEFAULT_MOCK_READY: "false"'),
-- ("!cancelled() && steps.stable.outcome == 'failure'", "failure()"),
++ ("!cancelled() && (steps.stable.outcome == 'failure'", "failure() && (steps.stable.outcome == 'failure'"),
++ ("test-results/**/trace.zip", "other-results/**/trace.zip"),
++ ("test-results-probation/**/trace.zip", "other-results-probation/**/trace.zip"),
++ ("steps.stable.outcome == 'success'", "steps.stable.outcome == 'skipped'"),
++ ("steps.probation.outcome == 'success'", "steps.probation.outcome == 'skipped'"),
):
with self.subTest(mutation=new):
with self.assertRaises(AssertionError):
diff --cc tests/integration/tests/01-core-e2e.spec.ts
index 664fe388d8,f94f97ae7f..866e80bcd7
--- a/tests/integration/tests/01-core-e2e.spec.ts
+++ b/tests/integration/tests/01-core-e2e.spec.ts
@@@ -143,15 -148,15 +143,24 @@@ test.describe.serial('Core E2E flows',
const cpuInput = editorContainer.locator('input[type="number"]').first();
await expect(cpuInput).toBeVisible();
await cpuInput.fill(String(overrideValue));
-- await cpuInput.blur();
++ await expect(cpuInput).toHaveValue(String(overrideValue));
++ const unsaved = page.getByText('You have unsaved changes');
++ // Tabbing to a sibling control keeps the draft inside the editor.
++ await cpuInput.press('Tab');
++ expect(await editorContainer.evaluate((element) => element.contains(document.activeElement))).toBe(true);
++ await expect(unsaved).toHaveCount(0);
++ // Desktop commits when focus leaves the whole row. Cards retain the
++ // draft until Save. Move focus outside the editor, including its slider,
++ // and wait for the active layout's actual commit boundary.
++ await page.getByPlaceholder('Search resources...').focus();
const commitMobileEdit = page.getByRole('button', {
name: `Save threshold edits for ${resourceName}`,
});
++ await expect(unsaved.or(commitMobileEdit).first()).toBeVisible();
if (await commitMobileEdit.isVisible().catch(() => false)) {
await commitMobileEdit.click();
}
-- const unsaved = page.getByText('You have unsaved changes');
await expect(unsaved).toBeVisible();
await page.getByRole('button', { name: 'Save Changes' }).click();
await expect(unsaved).not.toBeVisible();
diff --cc tests/integration/tests/04-mobile.spec.ts
index 3b8aa65660,577ba23dba..2a2f3a837d
--- a/tests/integration/tests/04-mobile.spec.ts
+++ b/tests/integration/tests/04-mobile.spec.ts
@@@ -3,6 -3,6 +3,7 @@@ import
ensureAuthenticated,
setMockMode,
waitForDefaultMockRuntimeReady,
++ waitForAuthenticatedAppShell,
} from "./helpers";
const getViewportWidth = async (
@@@ -237,7 -237,7 +238,9 @@@ test.describe("Mobile viewport flows",
test("Platform filter bar does not overflow horizontally", async ({
page,
}) => {
-- await page.goto("/docker/overview");
++ await page.goto("/docker/overview", { waitUntil: "domcontentloaded" });
++ await waitForAuthenticatedAppShell(page);
++ await expect(page).toHaveURL(/\/docker\/overview$/);
await expect(page.getByPlaceholder("Search containers")).toBeVisible();
diff --cc tests/integration/tests/11-first-session.spec.ts
index dbec0c6b11,1f4e162e2f..265612eeba
--- a/tests/integration/tests/11-first-session.spec.ts
+++ b/tests/integration/tests/11-first-session.spec.ts
@@@ -8,6 -8,6 +8,7 @@@ import
primaryNavigationLink,
trackBrowserRequests,
waitForPulseReady,
++ waitForAuthenticatedAppShell,
} from "./helpers";
/**
@@@ -329,7 -305,39 +330,8 @@@ test.describe.serial("First-session exp
const hasFeature = features.has(feature);
if (!hasFeature) {
- // Install a MutationObserver via addInitScript BEFORE navigating so it
- // runs before any app code. This catches transient form elements that
- // flash before the paywall renders (flash-of-unlocked-content).
- await page.addInitScript(() => {
- (window as any).__pulseFlashDetected = false;
- const SELECTOR =
- 'form input:not([type="search"]), form textarea, form select';
-
- const checkForFlash = () => {
- const els = document.querySelectorAll(SELECTOR);
- if (els.length > 0) {
- (window as any).__pulseFlashDetected = true;
- }
- };
-
- const observer = new MutationObserver(checkForFlash);
-
- // Start observing on documentElement immediately (always available
- // in addInitScript context), so we catch body insertion and all
- // subsequent DOM mutations including app boot. This avoids the gap
- // where DOMContentLoaded fires after app scripts.
- observer.observe(document.documentElement, {
- childList: true,
- subtree: true,
- });
- // Also do an immediate check in case DOM is already populated.
- checkForFlash();
-
- // Auto-disconnect after 5 seconds to avoid leaking.
- setTimeout(() => observer.disconnect(), 5000);
- });
-
await page.goto(route, { waitUntil: "domcontentloaded" });
++ await waitForAuthenticatedAppShell(page);
await page.waitForURL(expectedURL, { timeout: 10_000 });
await expect(page.locator("#root")).toBeVisible();
@@@ -350,8 -351,21 +352,9 @@@
flashDetected,
`Gated route ${route} (feature=${feature}) showed form elements on unlicensed tier (flash-of-unlocked-content)`,
).toBe(false);
-
- // Paywall indicator should be visible.
- const paywallIndicator = page
- .getByRole("main")
- .getByText(paywallPattern)
- .first();
- const isPaywallVisible = await paywallIndicator
- .isVisible({ timeout: 5_000 })
- .catch(() => false);
- expect(
- isPaywallVisible,
- `Gated route ${route} (feature=${feature}) should show paywall when feature is not available`,
- ).toBeTruthy();
} else {
await page.goto(route, { waitUntil: "domcontentloaded" });
++ await waitForAuthenticatedAppShell(page);
await page.waitForURL(expectedURL, { timeout: 10_000 });
await expect(page.locator("#root")).toBeVisible();
diff --cc tests/integration/tests/62-runtime-home-onboarding-contract.spec.ts
index 876ae6b549,aacad89836..9067b6c271
--- a/tests/integration/tests/62-runtime-home-onboarding-contract.spec.ts
+++ b/tests/integration/tests/62-runtime-home-onboarding-contract.spec.ts
@@@ -108,58 -106,6 +108,54 @@@ test.describe("runtime-home onboarding
).toHaveCount(0);
});
+ test("waits for token bootstrap before navigating to the agent install handoff", async ({ page }) => {
+ await ensureAuthenticated(page);
+ const created = await apiRequest(page, "/api/security/tokens", {
+ method: "POST",
+ data: { name: "E2E browser bootstrap regression", scopes: ["*"] },
+ });
+ expect(created.ok()).toBeTruthy();
+ const { token, record } = await created.json() as { token: string; record: { id: string } };
+ expect(token).toBeTruthy();
+ expect(record.id).toBeTruthy();
- let tokenNavigationStarted = false;
- const onNavigation = () => {
- if (new URL(page.url()).searchParams.has("token")) tokenNavigationStarted = true;
- };
++ // This page owns only the bootstrap being tested. Replacing the setup
++ // page would also intercept its departing document's in-flight reads.
++ const bootstrapPage = await page.context().newPage();
+ let releaseBootstrap!: () => void;
+ const bootstrapHold = new Promise<void>(resolve => { releaseBootstrap = resolve; });
+ let notifyBlocked!: () => void;
+ const blocked = new Promise<void>(resolve => { notifyBlocked = resolve; });
+ const holdState = async (route: import("@playwright/test").Route) => {
- if (tokenNavigationStarted) {
- notifyBlocked();
- await bootstrapHold;
- }
++ notifyBlocked();
++ await bootstrapHold;
+ await route.continue();
+ };
+ let authentication: Promise<boolean> | undefined;
+ try {
- page.on("framenavigated", onNavigation);
- await page.route("**/api/state/summary", holdState);
++ await bootstrapPage.route("**/api/state/summary", holdState);
+ let completed = false;
- authentication = authenticateWithAPIToken(page, token).then(result => { completed = true; return result; });
++ authentication = authenticateWithAPIToken(bootstrapPage, token).then(result => { completed = true; return result; });
+ await Promise.race([blocked, authentication]);
+ expect(completed, "token authentication must await protected browser bootstrap").toBe(false);
+ releaseBootstrap();
+ expect(await authentication).toBe(true);
- await page.goto("/settings/infrastructure?add=agent", { waitUntil: "domcontentloaded" });
- await expect(page).toHaveURL(/\/settings\/infrastructure\?add=agent$/);
- await expect(page.getByRole("dialog").getByRole("heading", {
++ await bootstrapPage.goto("/settings/infrastructure?add=agent", { waitUntil: "domcontentloaded" });
++ await expect(bootstrapPage).toHaveURL(/\/settings\/infrastructure\?add=agent$/);
++ await expect(bootstrapPage.getByRole("dialog").getByRole("heading", {
+ name: "Add Pulse Agent", exact: true,
+ })).toBeVisible();
+ } finally {
+ releaseBootstrap();
+ await authentication?.catch(() => {});
- await page.unroute("**/api/state/summary", holdState);
- page.off("framenavigated", onNavigation);
++ await bootstrapPage.unroute("**/api/state/summary", holdState);
++ await bootstrapPage.close();
+ const revoked = await apiRequest(page, `/api/security/tokens/${encodeURIComponent(record.id)}`, {
+ method: "DELETE",
+ });
+ expect(revoked.ok(), "the test-owned bootstrap token must be revoked").toBeTruthy();
+ }
+ });
+
test("retires legacy platform-management paths to the not-found page", async ({
page,
}) => {
diff --cc tests/integration/tests/helpers.ts
index 9586e3acb0,c0dcea65b6..b5bc0be2db
--- a/tests/integration/tests/helpers.ts
+++ b/tests/integration/tests/helpers.ts
@@@ -163,7 -163,7 +163,7 @@@ export async function waitForAppShell(p
);
}
--async function waitForAuthenticatedAppShell(page: Page, timeoutMs = 20_000) {
++export async function waitForAuthenticatedAppShell(page: Page, timeoutMs = 20_000) {
// A protected URL and a nonempty root also describe pending bootstrap and
// Login after a rejected summary request. The app-scroll-shell mounts only
// after loading, needsAuth and enhanced-store admission have completed.