Skip to content

refactor(console): integration tests for pages, a short browser lane - #1455

Merged
V3RON merged 44 commits into
task/1434from
refactor/console-tests
Nov 8, 2026
Merged

V3RON merged 44 commits into
task/1434from
refactor/console-tests

Conversation

@V3RON

@V3RON V3RON commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What

Page behaviour moves from the Playwright lane to DOM tests (ui/**/*.dom.test.tsx, vitest project ui-dom, happy-dom, React Testing Library). The browser lane keeps only what needs a real daemon or a real browser engine. The render harness is now pnpm console:screenshots, a script that writes pictures and checks nothing.

  • Browser tests: 264 → 41 (Playwright --list, Chromium), 23 → 9 spec files.
  • DOM tests: 195 in 20 files. They run in about 8 s.
  • Lane wall time (each spec file run on its own, --workers=4, times added up): about 1,244 s → about 211 s. "Before" is measured on origin/task/1434 (a903859), reusing workers.spec 90 s, renders.spec 536 s and update.spec 9 s. The machine had six demo daemons running; a rerun under heavy load took 257 s.
  • CI: console shards 4 → 2 (src/test-lanes.test.ts minimum changed to match).
  • Lines: e2e/console/ 12,860 → 5,023; DOM tests add 5,566 plus a 386-line harness.

The DOM harness

  • ui/src/test/console.tsx: renders the whole App against a fake fetch route table. Routes it doesn't know answer 404 and are recorded in unanswered. It also has a fake event stream (events.push, events.drop), a fixed Date, and optional fake timers.
  • ui/src/test/fixtures.ts: answer builders typed by the contract.
  • ui/src/test/setup.ts: cleanup. happy-dom lays nothing out, so it also makes clientWidth the window width; without that the narrow-table column priority drops every column.
  • ui/src/test/tab.ts: one helper that hides and shows the tab.
  • vitest.config.ts: css: true, so the console's own sheets apply. The Fleet page draws a table and a narrow list and hides one with CSS. A toast past the limit is hidden by CSS too.
  • No product code changed. No seam was needed.

Per spec file

Spec file (before) Browser before Browser after DOM tests now covering it Why the browser tests left stay
actions 9 0 app/actions 9, fleet (in-flight) release-from-inspector journey → journeys
activity 19 0 activity 19 scrolling and the 10,000-event feed → feed (virtual scroll)
baselines 5 0 baselines 7 —
big-fleet 1 0 app/idle 8 (one per page) —
breakpoints 2 13 in breakpoints — geometry, overflow and breakpoints need layout; layout, 360px and parts of shell, leases and workers were folded in
daemon-start-failure 1 1 — starts a real daemon on a held port
inbox 14 0 inbox 14, app/inbox-count 1 —
layout 4 0 — moved into breakpoints
leases 23 0 leases 18 pane vs drawer, table not moving, long-id wrap → breakpoints
long-lists 21 0 leases-paging 12 10,000-row feed → feed; CSP and axe → browser-checks
overview 15 0 overview 15 CLI-granted lease on an open Overview → journeys
proxy-sign-in 10 0 app/proxy-sign-in 10 real JWT proxy journey → sign-in
queue 7 0 queue 5 —
renders 37 0 — now pnpm console:screenshots
screen 3 1 streaming 6 a real capture program, socket and frames
search 8 0 app/search 9 —
shell 14 0 app/shell 11, app/toasts 2 reference geometry, icons, theme colours → breakpoints, colours; axe → browser-checks; keyboard → keyboard
sign-in 15 4 app/sign-in 12 real tokens and the real daemon's refusals, fonts and hosts the page asks, the real proxy
update 2 0 update 2 —
usage 5 0 usage 5 —
views 11 0 spread over the page files CSP and <style> → browser-checks; computed colours → colours; keyboard → keyboard
workers-gateway-stops-mid-fetch 8 0 — these reproduced #642 in the removed workers-answers.ts helpers. The new stubs answer fixed JSON and never call route.fetch, so the race is gone
workers 30 0 fleet 8, worker-page 22 slot sizes and ring colours → colours; rings above the cards and the ⋯ padding → breakpoints
new: browser-checks — 3 — CSP, <style>, axe in both themes on every page and open surface
new: colours — 4 — computed colours and sizes
new: feed — 7 — the virtual-scroll feed
new: journeys — 5 — real-daemon round trips: grant, release, drain, a . lease id, older events and no join token
new: keyboard — 3 — focus through Base UI menus, dialogs and drawers; Tab order on every page

Claims the earlier run dropped, weakened or broke, and what this PR does

  • Broken merge between the side branches. The proxy-sign-in branch removed the proxied fixture, but the shell-geometry test folded into breakpoints still used it (TS2339 on push). It now starts its own proxied daemon. The simplified proxy also lost its sign-out address, so the proxy case no longer drew a Sign out icon; the address is back.
  • Unused exports left behind (every, inspector, opensDrawer, OLD_PROTOCOL, mintJoinToken) made the push hook fail, so only the first commit had been pushed. They are now private. The unused e2e/console/tab.ts is deleted.
  • CI's Fallow flagged three functions this branch added (the harness fetch, the breakpoints overflow probe, the screenshot script). Each is now split into small steps.
  • Axe on Overview at 390 px in both themes (from shell.spec) had been dropped. It runs again inside browser-checks.
  • Specs wrote screenshots into docs/. breakpoints saved PNGs as a side effect. That is now the screenshot script's job only.
  • The Settings page was in no browser check. NAV gained Settings, so CSP, axe, 360 px, keyboard and sign-in cover it.
  • Ported to the new task/1434 UI, not weakened:
    • Fleet is a grouped table with a narrow list, so the "Needs attention" region became a group row. Quick-action buttons are gone; Undrain is a menu entry.
    • Fleet slots are a meter with n / m. The "squares through ten" claim moved to the worker page's side card, the only place that still draws squares, in both DOM and colours.
    • The worker page has no subtitle and no read-age note, and holders are text. The disk panel on Baselines and the "N waiting" count on Queue are gone.
    • A refused stream shows its words where the picture goes, not as an alert. A stale baseline's reason is in a hover popover.
    • Light pills are darker. The sidebar toggle moved to the foot, which changed the Tab order.
  • Dropped on purpose, proven elsewhere:
    • Overview's "same figures after a stop and start with events pruned" is a daemon claim. e2e/usage-projection.test.ts covers it over HTTP; the DOM Overview test checks that the tiles equal GET /v1/stats.
    • Activity's "matches simlock events --since 1h" is covered by e2e/event-history.test.ts plus the DOM feed tests.
    • The render harness's self-checks (pixel-matcher cases, two-capture comparisons, fixture-page assertions) checked the harness itself, which is gone.

Kept although the DOM tests cover the UI side: sign-in refusing agent, worker and unknown tokens checks the real daemon's status codes end to end, so the console's messages are known to match what the daemon sends.

Known limits

  • happy-dom keeps a :empty match after text arrives. The search's "No results for …" line is therefore asserted present, not visible; the browser search state in browser-checks draws it.
  • These CI failures are already red on task/1434 and come from its files, not this branch:
    • Fallow: tiles, EventList, SideCard, overrideFor, and the views colour test now in colours.
    • Format: ui/src/screens/settings/settings.css.
    • Real proxy: its Fleet page now draws each worker twice, a table and a narrow list.
  • origin/task/1434 moved four times during this work (last merged: 1d8df7d). Several of its own browser specs are stale against its UI (Settings in the nav, the foot toggle, the removed disk panel); this branch deletes or ports them.

Verification

  • pnpm exec vitest run --project ui-dom: 195 passed, about 8 s.
  • Every kept browser spec run on its own in Chromium (--workers=4): all 41 pass.
  • pnpm console:screenshots: 44 dark captures and 13 light ones in docs/internal/console-redesign/current/. 2-fleet and light/settings were opened and checked.
  • pnpm test:changed: the only failures are daemon tests that bind port 4701, which the demo daemons on this machine hold (EADDRINUSE). The same tests fail alone and touch no file this PR changes.

Written by an agent.

@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

V3RON added 28 commits November 8, 2026 18:17
…-tests

# Conflicts:
#	e2e/console/baselines.spec.ts
#	e2e/console/layout.spec.ts
#	e2e/console/leases.spec.ts
#	e2e/console/update.spec.ts
#	e2e/console/views.spec.ts
#	e2e/console/workers-gateway-stops-mid-fetch.spec.ts
#	e2e/console/workers.spec.ts
The two-capture pixel comparison in renders.spec.ts is gone with its
helpers; screenshots.ts writes the same pictures once, under its own
Playwright config, and the breakpoints spec no longer writes images.
V3RON added 15 commits November 8, 2026 19:48
…ed worker page a dozen devices

The shell geometry spec checks the proxy session's Sign out icon, which
the console draws only when the daemon names a sign-out address; the
worker page lost its subtitle and tiles, so one device no longer
overflows a 500px window.
…eal daemon or engine, screenshots on demand

The lane is down to a few dozen tests, so CI runs it in two shards.
…-tests

# Conflicts:
#	e2e/console/baselines.spec.ts
#	e2e/console/queue.spec.ts
…the foot sidebar toggle and the darker light pills
… screenshot script into small steps, and drop the unused tab helper
…-tests

# Conflicts:
#	e2e/console/overview.spec.ts
#	e2e/console/render-checks.ts
# Conflicts:
#	e2e/console/render-fixtures.ts
#	e2e/console/views.spec.ts
@V3RON
V3RON merged commit b154898 into task/1434 Nov 8, 2026
14 checks passed
@V3RON
V3RON deleted the refactor/console-tests branch November 8, 2026 20:12
@V3RON

V3RON commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Folded into #1454: task/1434 was fast-forwarded to this branch (b154898), so the stack merges the test refactor with the redesign. Its description is copied into #1454.

Written by an agent.

V3RON added a commit that referenced this pull request Nov 9, 2026
…light theme (#1434) (#1454)

Closes #1434

### Status

The redesigned pages (Overview, Inbox, Fleet, worker, streaming, Leases,
Queue, Baselines, Activity, Usage, Settings), breakpoints, the light
theme, and the console test refactor (single-page browser specs moved to
DOM tests). Supersedes stage PRs #1447 to #1452 and #1455.

## Done when

- [x] Every Tests line is covered at its named seam; relevant model/unit
tests and touched Chromium page specs pass. The browser lane uses faked
drivers, not native hardware. — unit, ui-dom and the touched Chromium
specs pass; the lane runs on the fake driver
- [x] Capture this stage's pages through `pnpm test:console
--project=chromium e2e/console/renders.spec.ts` (page-specific --grep
permitted). Compare current PNGs to all eight reference states plus
Inbox, Queue, Usage, sign-in and not found; record the explicit
Baselines filter/link amendment, then inspect every other non-data
difference and fix/rerun until none remain except the explicit
Baselines/Fleet, preserved-collapse header-control and evidence-backed
WCAG-AA colour amendments recorded in PLAN. The PR includes paired
images for each reference page and lists remaining data differences;
no-render pages include current images. Do not commit generated current/
or prototype/screens/. — superseded by the maintainer: captures come
from `pnpm console:screenshots`; every page compared to its render and
reviewed live in the demo
- [x] Check the same pages at 1440×900, 1280×800 and 390×844: no
horizontal page scroll, card escape or text collision. Axe in both light
and dark has no WCAG AA violations and actually evaluates color
contrast. Per-page verification is required in this stage, not deferred
to stage 7. — `breakpoints.spec.ts` and `browser-checks.spec.ts` cover
every page in both themes
- [x] Update website pages describing this stage in the same change.
Ownership: Own final consolidation, intros, screenshots and cross-page
navigation; preserve per-stage factual edits. Run `pnpm --dir website
install && pnpm --dir website build && node
website/scripts/check-openapi.mjs` when the website changes. —
`console.mdx` and `gateway/fleet-console.mdx` describe the final pages;
website build and OpenAPI check pass
- [x] Every page/state has dark/light evidence at the integrated head;
DESIGN/manual/website agree, unused DS and WorkersTable are removed
after import search, and hook/CI Fallow results are clean. Whole-feature
stack remains intact for the parent merge gate. — dark and light
captures at the head; DESIGN.md, `ui/AGENTS.md` and the website agree;
Fallow clean in hooks and CI

## Assumptions

none

## Review

Spec review: 0 blocking, 2 fixed, 0 notes. Code review: 0 blocking, 9
fixed, 2 notes. Claims review: 0 blocking, 4 fixed, 0 notes.
Rounds: 3. Tokens: 62.7M.
Assessment: complete

*Written by an agent.*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant