Three separate reasons tests were failing, none of them a defect in the app. The calculators. e2e-harness.html loaded calculators.js and drugs-loader.js with `defer` after they were split into ES modules; index.html was updated at the time and this page was not. A module parsed as a classic script throws "Cannot use import statement outside a module" before a line runs, so no click handler was ever attached: the pills rendered from static HTML and did nothing. Only the first calculator appeared to pass, because it carries `active` in the markup and needs no click. That was 52 failures. Settings and FAQ. Both moved from the tab rail into the account-card menu; the helper still clicked button.tab-btn[data-tab=…] and timed out. Ten more. The AI mocks, which had stopped intercepting for two independent reasons and so were calling the real model on every run — spending credits and comparing genuine output against strings like "MOCK HPI from dictation". A '**/api/x' glob matches no URL on Playwright 1.50, and page.route fails silently when nothing matches; measured against a real URL, that glob and '*/**/api/x' both matched zero times where a regex matched. Fixing that alone was not enough: the app registers a service worker that answers every /api/ request with its own fetch(), and a request made inside a service worker never reaches page.route. Blocking registration in the config puts them back in the page. The mocked dictation test now finishes in 1.6s rather than 7.5s, which is what a real model call costs. Whole suite: 204 passed / 96 failed in 15.8 minutes, now 289 passed / 11 failed in 6.8. The remaining eleven are spread across nine specs with no shared cause and are not touched here. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Dv6sqaY6Vq3ChZHMem3cnU
48 lines
2.9 KiB
HTML
48 lines
2.9 KiB
HTML
<!DOCTYPE html>
|
|
<!-- E2E test harness — loads the calculators component + JS in isolation
|
|
(no auth wall). Playwright points here instead of the full SPA.
|
|
All scripts are external because the app's CSP blocks inline scripts. -->
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>E2E harness — calculators</title>
|
|
<link rel="stylesheet" href="/css/styles.css">
|
|
<style>
|
|
body { margin: 0; padding: 16px; background: #f9fafb; }
|
|
#calculators-tab { max-width: 1100px; margin: 0 auto; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<section id="calculators-tab" class="tab-content active" data-component="calculators"></section>
|
|
<!-- Bedside used to live inside calculators; since the promotion to a top-level
|
|
tab, the harness now renders both components side-by-side so the bedside
|
|
smoke tests can find #bedside-age without having to click the old
|
|
calc-nav-pill (which no longer exists). -->
|
|
<section id="bedside-tab" class="tab-content active" data-component="bedside"></section>
|
|
|
|
<!-- calculators.js and drugs-loader.js are ES modules and must be loaded as
|
|
modules. Loaded with `defer` instead, the browser parses them as classic
|
|
scripts, throws "Cannot use import statement outside a module" before a
|
|
single line runs, and no click handler is ever attached: the pills render
|
|
from static HTML and do nothing. index.html has always had this right;
|
|
this page was left behind when the calculators were split into modules,
|
|
which is what 52 of the e2e failures were. Keep these in step with
|
|
index.html. -->
|
|
<script defer src="/js/calc-math.js"></script>
|
|
<script type="module" src="/js/drugs-loader.js"></script>
|
|
<script type="module" src="/js/calculators.js"></script>
|
|
<script type="module" src="/js/bedside/index.js"></script>
|
|
<script defer src="/js/e2e-bootstrap.js"></script>
|
|
|
|
<!-- Lightbox overlay — global in the real app, mirrored here so the
|
|
bedside lightbox smoke test can open/close it. -->
|
|
<div id="img-lightbox" style="display:none;position:fixed;inset:0;background:rgba(0,0,0,0.85);z-index:9999;align-items:center;justify-content:center;padding:20px;flex-direction:column;">
|
|
<div style="display:flex;align-items:center;gap:12px;margin-bottom:10px;color:white;max-width:95%;">
|
|
<div id="img-lightbox-title" style="flex:1;font-weight:600;font-size:14px;"></div>
|
|
<a id="img-lightbox-open" href="#" target="_blank" rel="noopener" style="color:#93c5fd;font-size:13px;"><i class="fas fa-up-right-from-square"></i> Open in new tab</a>
|
|
<button id="img-lightbox-close" type="button" style="background:rgba(255,255,255,0.15);color:white;border:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:14px;">Close</button>
|
|
</div>
|
|
<img id="img-lightbox-img" src="" alt="" style="max-width:95%;max-height:85vh;object-fit:contain;border-radius:6px;background:white;">
|
|
</div>
|
|
</body>
|
|
</html>
|