Skip to content

feat(ui): add deterministic visual-smoke fixture + DOM contract for BrowserPanel renderer chrome #819

Closed

Description

@Astro-Han

Context

From the #546 Artifact pane + browser panel closure audit. BrowserPanel (apps/desktop/src/renderer/browser-panel.tsx) is the renderer chrome over a native Electron WebContentsView; the native page itself can't be captured in a deterministic fixture, but the chrome — toolbar (back / forward / reload-stop / close enabled/disabled states), address bar, empty state, loading marker, address-validation toast — is renderer DOM.

Today the browser surface is covered only by:

  • main-side tests (browser-logic, browser-view-manager, browser-session, browser-tools);
  • the smoke:browser real-Electron automation smoke (observe -> act CDP round trip).

The renderer chrome states have no deterministic visual or DOM/computed-style coverage, so layout/a11y regressions in the chrome (e.g. the narrow-layout defect fixed in #818) can only be caught by manual real-window smoke.

Proposal

Add a deterministic visual-smoke fixture scenario that seeds a session with a live browser view (via the existing browser:live / liveBrowserSessionIds path) driving a loopback fixture page (the smoke:browser script already hosts one), so the renderer chrome can be screenshotted in the empty / loading / loaded / nav states at 1280px and 990px, light/dark, motion/reduced. Add a DOM/computed-style contract test (symmetric to artifact-pane-layout.test.ts) locking the chrome invariants that don't need a screenshot:

  • back/forward buttons :disabled track canGoBack / canGoForward;
  • reload/stop icon swaps with loading;
  • address bar snaps to the live URL on blur when not editing;
  • empty state present when !hasPage.

Out of scope

  • Capturing the native WebContentsView pixel content (not feasible in a fixture; the chrome is the testable surface).
  • Automation / observe-act behavior (already covered by smoke:browser).

Acceptance

  • A browser-* visual-smoke fixture exists and is exercised by visual-smoke-fixture.test.ts.
  • Screenshot baseline (stable subset candidate) for the chrome states at 1280/990 x light/dark.
  • DOM/computed-style contract test locks the toolbar enabled/disabled + loading-swap + empty-state invariants.

Refs #546.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions