Safety net for upcoming refactors: - 26 Playwright smoke tests via @playwright/test 1.50.0 in an official Playwright container (no host Node needed). Covers every Bedside sub-pill, the age→weight estimator, dose calculators (seizure/sepsis/anaphylaxis/ burns/airway), and interactive widgets (lightbox, vent SVG). - `npm run e2e` wrapper runs tests inside mcr.microsoft.com/playwright:v1.50.0-noble on the ped-ai_default Docker network so no host port mapping is needed. - public/e2e-harness.html + public/js/e2e-bootstrap.js load the calculators component without the SPA auth wall (scripts external to satisfy CSP). Server: - server.js now re-reads public/index.html on mtime change instead of caching at boot. Fixes the "edit HTML, restart container" friction. - CSP upgradeInsecureRequests disabled in helmet config; Caddy still enforces HTTPS at the reverse-proxy layer in production.
15 lines
678 B
JavaScript
15 lines
678 B
JavaScript
// E2E harness bootstrap — external file because the app's CSP blocks inline scripts.
|
|
// Runs after calc-math.js + calculators.js (all three have `defer`, so execution
|
|
// is in document order once parsing completes).
|
|
(async function bootstrap() {
|
|
try {
|
|
const host = document.getElementById('calculators-tab');
|
|
const html = await fetch('/components/calculators.html').then(r => r.text());
|
|
host.innerHTML = html;
|
|
document.dispatchEvent(new CustomEvent('tabChanged', { detail: { tab: 'calculators' } }));
|
|
window.__harnessReady = true;
|
|
} catch (e) {
|
|
console.error('[e2e-harness] bootstrap failed:', e);
|
|
window.__harnessError = String(e);
|
|
}
|
|
})();
|