Skip to content

Nothing tests the dashboard page's JavaScript

Id: TD-PPagop-26072606 · Legacy-id: TD26072606 · Status: resolved · Filed: 2026-07-26 · Resolved: 2026-08-01 · Ref: #147

test/ covers the Publisher thoroughly and the page not at all. The ~1,265 lines of inline JavaScript in dashboard/index.html — every panel, badge, filter and the in-place refresh — have no automated test of any kind, so the only thing standing between a rendering bug and an operator is someone opening the page and recognising that what it says is wrong. That is a weak guard precisely where the page is most useful, because the reader has no independent view of the state to check it against: a badge that says the wrong thing confidently reads exactly like one that says the right thing. docs/DASHBOARD-SPEC.md’s verification list asks for a headless render with no thrown errors, which catches a page that breaks and nothing about a page that lies.

The Outcome column’s “Ended” on a running cycle (#94) is what this costs. It shipped, and stayed shipped, because no test could have caught it and reading cycle_json’s ladder in isolation makes it look correct — the bug only exists in the gap between a rule written for finished cycles and a column that renders unfinished ones. A test naming the case would have failed the day it was written.

Fix: a test/dashboard-render.test.sh in the repository’s own idiom — bash, asserting on output — that feeds fixture DASHBOARD_DATA files through the page’s script and greps the rendered result for the cells under test. It needs a DOM, and neither a browser nor jsdom is a dependency this repository should take on for it; a ~50-line stub (createElement/createTextNode/appendChild, a serialiser) run under node is enough for panels that only ever build trees, which is all of them. Guard it the way render-crontab.test.sh guards supercronic — skip with a printed note when node is absent — so the suite still passes on a host without it.

Two things to settle when writing it. Fixtures should be checked-in JSON rather than generated, except for timestamps, which have to be relative to now or every “3m ago” assertion rots. And the stub is a maintenance liability if it grows to chase the page: keep it to the tree-building subset and let a test that needs more be the argument for a real headless browser in CI instead.

That argument now has one live example. #96’s pull-request hover card is the page’s first behaviour that is not tree-building: it turns on pointer and focus events, measures an element’s box, and positions itself against the viewport. None of that is reachable from the stub above, so it is worth deciding deliberately whether this entry’s fix covers it or stops short of it, rather than discovering the gap when the card lands in the wrong place. Until then the card is guarded only by the headless render of the verification list — which, as above, catches a page that breaks and nothing about a page that lies.

Filed 2026-07-26, out of #94; scope noted from #96.