Skip to content

URL-Persisted Trace Selection and Focused Trace and Snapshot Views #10769

Closed

Description

@hi-ogawa

Spin off from #10156.
related https://discord.com/channels/917386801235247114/1506590920085082173/1507215808529436682

The motivation is my word and the overall iteration loop is mostly working. Having URL persisted mode looks like a quick win to boost the ergonomics. Haven't verified the technicality though. The following is AI-assisted write up:

Motivation

Trace View's HTML report can support a concrete visual UI iteration workflow:

  1. A developer or agent edits a UI and runs a browser scenario once.
  2. Vitest generates .vitest/index.html with the captured DOM snapshots.
  3. A human reloads the local report and continues reviewing the design. (Side note, as shown in discord link above, vscode can now renders index.html from filesystem, so no dedicated server is needed.)

Watch mode already supports this workflow by refreshing Trace View when tests rerun, but supporting a similar iteration mechanism through one-shot HTML reports is equally important. One reason is that when an agent drives the changes, a workflow based on one-shot commands is simpler and more robust than managing a long-running watch process and browser session.

The current report adds friction to that one-shot loop because reloading loses the selected test and trace entry. In addition, the full Vitest UI uses excessive space when the reviewer only needs a trace or DOM snapshot of a specific moment for design review.

This proposes URL-backed trace selection and focused-view state to preserve continuity across regenerated reports while making exact local and CI views directly shareable.

Proposed Features

1. Persist Trace Selection in the URL

Encode the selected test, attempt, and trace target, either a step or mark, in the report URL. Selecting a trace entry should update the URL, and reloading the report should restore that selection.

For example:

index.html#/?test=<test-id>&attempt=0:0&step=12

A mark name could identify a stable target across regenerated traces, while a step index could preserve an exact selection within a specific trace.

2. Focused Trace and Snapshot Views

Provide links from the main Trace View to:

  • A focused trace view centered on the step list and DOM snapshot.
  • A snapshot-only view containing only the selected DOM snapshot.

For example, the same trace selection could open in either mode:

index.html#/?test=<test-id>&attempt=0:0&step=12&mode=trace
index.html#/?test=<test-id>&attempt=0:0&step=12&mode=snapshot

Reloading or sharing either URL should restore the same focused view.

Follow-ups

  • Agent integration: Expose machine-readable trace targets so agents can return direct links. This can be designed separately in connection with AI-friendly tooling #10634.
  • Automatic reload: Detect when a local HTML report is regenerated and reload it while preserving the selected focused view.
  • VS Code integration: If the proposed vscode.window.openBrowserTab API stabilizes, the Vitest extension could open a generated .vitest/index.html#... trace or snapshot URL directly, with an HTTP-served URL as a fallback when direct file loading is unavailable.

These follow-ups can reuse the report's normal URL navigation, but none is part of this proposal.

Related issue: #10156.

Activity

  1. self-assigned this
    on Jul 14, 2026
  2. added
    feat: browserIssues and PRs related to the browser runner
    p2-nice-to-haveNot breaking anything but nice to have (priority)
    on Jul 14, 2026
  3. removed their assignment
    on Sep 1, 2026
  4. locked and limited conversation to collaborators on Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerp2-nice-to-haveNot breaking anything but nice to have (priority)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions