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.

Check rendered webhook safety without incidental fixture assumptions

pulse-triage[bot]76430cc05842
diff --git a/frontend-modern/browser-tests/webhook-guidance.cjs b/frontend-modern/browser-tests/webhook-guidance.cjs
index 5339f8277a..5a948f73d7 100644
--- a/frontend-modern/browser-tests/webhook-guidance.cjs
+++ b/frontend-modern/browser-tests/webhook-guidance.cjs
@@ -27,8 +27,15 @@ const { chromium, webkit } = require('playwright');
const page = await browser.newPage({ viewport: { width, height: 1000 },
...(engine === 'webkit' ? { isMobile: true, hasTouch: true } : {}) });
const errors = [];
+ const unexpectedAPIRequests = [];
page.on('pageerror', (error) => errors.push(error.message));
page.on('console', (message) => { if (message.type() === 'error') errors.push(message.text()); });
+ page.on('request', (request) => {
+ const pathname = new URL(request.url()).pathname;
+ if (pathname.startsWith('/api/') && pathname !== '/api/security/status') {
+ unexpectedAPIRequests.push(pathname);
+ }
+ });
let securityRequests = 0;
// Docs imports runtime context, whose initial auth check is unrelated
// to Markdown rendering. Model first-run state explicitly; there is no
@@ -83,16 +90,17 @@ const { chromium, webkit } = require('playwright');
await page.reload({ waitUntil: 'domcontentloaded' });
await page.getByRole('heading', { name: 'Sample PSA payloads', exact: true }).waitFor();
await page.waitForFunction(() => document.activeElement?.id === 'sample-psa-payloads');
- await page.waitForResponse((response) => response.url().endsWith('/api/security/status')).catch(() => {
- // It may already have completed before the fragment was focused.
- assert.ok(securityRequests >= 2);
- });
+ // An incidental import is not obliged to make an auth request on every
+ // engine/reload. Observe those requests, but assert only the Docs result
+ // and absence of unintended backend activity or errors.
+ await page.waitForLoadState('networkidle');
assert.deepEqual(errors, []);
+ assert.deepEqual(unexpectedAPIRequests, []);
results.push({ engine, browserVersion: browser.version(), width,
scope: engine === 'webkit' ? 'phone-emulated, not native' : 'desktop',
warningsRendered: true, keyboardReceiverLink: true, keyboardTemplateLink: true,
templateTextExact: true, reloadFragmentFocus: true, noDocumentOverflow: true,
- syntheticFirstRunSecurityRequests: securityRequests, errors });
+ syntheticFirstRunSecurityRequests: securityRequests, unexpectedAPIRequests, errors });
await browser.close();
browser = undefined;
}
diff --git a/scripts/tests/test_webhook_verification_docs.py b/scripts/tests/test_webhook_verification_docs.py
index db57a6f58b..78fee09927 100644
--- a/scripts/tests/test_webhook_verification_docs.py
+++ b/scripts/tests/test_webhook_verification_docs.py
@@ -156,7 +156,7 @@ class WebhookVerificationDocsTest(unittest.TestCase):
"event and severity", "whole-second precision",
"incomplete or ambiguous events", "atomically",
"Do not mark an event processed before its action succeeds"):
- self.assertIn(phrase, text.replace("**", ""))
+ self.assertIn(phrase, text.replace("**", "").replace("`", ""))
self.assertNotIn("deduplicate on it", text)
self.assertNotIn("two-priority PSA mapping covers the full range", text)
self.assertIn('"info"', text)