// 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 { // Cache-bust so stale playwright browser caches never serve an outdated // component HTML between reorg deploys. const cb = '?cb=' + Date.now(); const [calcHtml, bedsideHtml] = await Promise.all([ fetch('/components/calculators.html' + cb).then(r => r.text()), fetch('/components/bedside.html' + cb).then(r => r.text()), ]); document.getElementById('calculators-tab').innerHTML = calcHtml; document.getElementById('bedside-tab').innerHTML = bedsideHtml; // Fire tabChanged for both so per-tab initialisers run. document.dispatchEvent(new CustomEvent('tabChanged', { detail: { tab: 'calculators' } })); document.dispatchEvent(new CustomEvent('tabChanged', { detail: { tab: 'bedside' } })); window.__harnessReady = true; } catch (e) { console.error('[e2e-harness] bootstrap failed:', e); window.__harnessError = String(e); } })();