Repository navigation
Description
Follow-up issue for the built-in browser trace view introduced in:
The MVP intentionally keeps browser.traceView focused on trace collection, replay, and basic debugging. This issue tracks post-MVP follow-ups that were discussed during the PR or discovered immediately after it landed, but left out because they need broader architecture, product, or fidelity decisions.
MVP Scope Summary
The MVP delivers the core loop:
- collect trace entries for actions,
expect.element, marks, and lifecycle events - record status, timing, selectors, source locations, DOM snapshots, viewport, and scroll state
- show traces in Browser UI, Vitest UI, and HTML reporter
- support failed-step highlighting, selector highlight when resolvable, retries/repeats, and basic replay fidelity
Follow-Up Areas
- Replay fidelity
- Workflow defaults and entry points
- Viewer UI additions
- Artifact lifecycle and transport
Replay Fidelity
For deeper background on the current DOM snapshot/replay landscape and rrweb/Playwright/Cypress trade-offs, see: https://gist.github.com/hi-ogawa/402813e81847cfa5ed2b593256737d75
What replay should preserve beyond the current DOM-snapshot MVP, including resource fidelity, pseudo-state, and replay safety.
ℹ️ Extend snapshot fidelity coverage
Current MVP behavior:
- Trace view captures DOM shape, form state, viewport, scroll state, same-origin readable CSS, optional loaded image pixels, and optional canvas pixels.
- Some resources remain URL-backed.
Known follow-ups:
- Constructable/adopted stylesheets are not preserved.
- CSS background images and font files referenced from CSS remain URL-backed.
- Snapshot capture currently reflects resource readiness at snapshot time, so late-loading images or stylesheets can be absent from replay if they were not yet loaded/readable when the snapshot was taken.
- External image/resource fixtures should be made deterministic.
- Existing external stylesheet/font tests are currently fixture-quality placeholders rather than strong fidelity tests.
- Viewport/scroll replay needs dedicated UI e2e coverage.
- Snapshot-time pseudo-state is still limited and should continue to be treated as replay polish rather than the core contract.
Why this is post-MVP:
- The MVP documents the fidelity boundary and provides useful replay for normal component tests.
- Snapshot-time readiness is also a defensible default for MVP: in many cases users should explicitly await the state they want to inspect, and current tests already rely on that pattern for resources such as images.
- Full resource capture is broader than trace-view UI and may require a general resource store or attachment strategy.
Possible direction:
- Add deterministic CORS/non-CORS fixtures.
- Add real font and external stylesheet fixtures.
- Evaluate a resource store for CSS subresources, fonts, and external assets.
- Add UI e2e coverage for viewport/scroll replay.
- Continue improving high-value pseudo-state metadata where it materially improves debugging without redefining the replay contract.
Relevant files / fixtures:
packages/browser/src/client/tester/trace.tstest/browser/fixtures/trace/exotic.test.tstest/browser/fixtures/trace/resources.test.tstest/browser/fixtures/trace/styles.test.tstest/browser/fixtures/trace/viewport.test.ts
ℹ️ Sanitize replayed scripts without weakening the default sandbox
Current MVP behavior:
- Default replay uses a sandbox without
allow-scripts. - This is intentional.
- If the rebuilt snapshot contains script nodes, the browser can log blocked script execution warnings.
Why this is post-MVP:
- The warning is noisy but does not break the core replay workflow.
- Sanitizing serialized script nodes safely requires preserving enough DOM shape and rrweb node identity while preventing execution.
Possible direction:
- Make script nodes inert for non-
recordCanvastraces before replay. - Keep the current stronger sandbox by default.
- Avoid using
srcdocas a fake fix; it likely changes the warning source label rather than the execution behavior.
What not to do:
- Do not weaken the default iframe sandbox except for documented
recordCanvasreplay needs.
Relevant files:
packages/ui/client/components/trace/TraceView.vue
Workflow Defaults and Entry Points
How users enable trace view and land in the right workflow/surface.
ℹ️ Decide trace-view workflow defaults / presets
Current MVP behavior:
browser.traceViewonly enables collection and trace-view UI surfaces where they are already available.- Users explicitly choose the surrounding workflow.
Examples:
# Watch mode, normal browser UI. Trace viewer appears next to the live browser view.
pnpm test --browser.traceView
# Watch mode, pure Vitest UI. Browser/tester runs in a separate headless browser.
pnpm test --browser.traceView --browser.headless --ui
# Watch mode, pure Vitest UI plus a separate headed browser driver window.
pnpm test --browser.traceView --browser.headless=false --browser.ui=false --ui
# Static HTML reporter.
pnpm test --browser.traceView --browser.headless --reporter=html
pnpm dlx serve ./html/Why this is post-MVP:
- An earlier, more opinionated direction treated
--browser.traceViewas a trace-first preset. - That was reverted for MVP so trace view stays additive and users specify each variant explicitly.
- Reintroducing presets would be a product/config decision, not a collector/viewer correctness fix.
Possible direction:
- Keep the explicit current behavior but improve docs around the workflow matrix.
- Add a dedicated preset/alias later if trace-first workflows are common enough.
- Consider whether watch mode and run mode should have different trace-view convenience behavior.
- Avoid silently changing browser headed/headless defaults without a clear migration story.
What not to do:
- Do not make
--browser.traceViewimply headless/UI/reporter presets without an explicit product decision.
Relevant files / docs:
packages/vitest/src/node/config/resolveConfig.tsdocs/guide/browser/trace-view.md
ℹ️ Revisit tall viewport size being default (Improve trace viewer replay ergonomics for large/tall viewports)
Current MVP behavior:
- The replay iframe uses the captured browser viewport size, which default size being tall
414x896targeted for current browser live view iframe layout in the UI. - This is faithful, but tall/mobile-shaped default viewports can make the trace pane feel like nested scrolling UI.
Why this is post-MVP:
- This is mainly a workflow/default-experience question.
- Changing runtime viewport defaults would affect test behavior.
- Any viewer-side scaling or layout treatment should be designed without compromising faithful replay.
Possible direction:
- Add zoom or scale-to-fit controls to the replay pane.
- Keep captured viewport dimensions as the source of truth.
- Reuse ideas from existing BrowserIframe viewport controls where appropriate.
- Consider whether different trace-view workflows should present large captured viewports differently by default.
What not to do:
- Do not change browser runtime viewport defaults just to improve trace pane ergonomics.
Relevant files:
packages/browser/src/client/tester/trace.tspackages/ui/client/components/trace/TraceView.vue
Viewer UI Additions
Higher-level viewer capabilities beyond the MVP replay pane, including features that may require metadata or transport changes under the hood.
ℹ️ Add editor-to-trace reverse navigation
Current MVP behavior:
- Selecting a trace step already opens its source location in the Editor tab when available.
Post-MVP direction:
- Show trace markers in the source editor and let users jump from a source line back to matching trace steps.
Why this is post-MVP:
- This is viewer/editor UX work, not a trace data contract gap in the MVP.
- It couples trace-view state to the global CodeMirror lifecycle and custom gutter setup.
- A prior prototype showed the idea is feasible but too much UI/editor architecture for MVP.
Possible direction:
- Build an index of
file -> line -> stepIndexesfor the active trace. - Add CodeMirror gutter markers for the active trace.
- Clicking a marker selects or cycles trace steps for that line.
- Revisit after trace pane state and layout are stable.
Relevant files / history:
packages/ui/client/components/trace/TraceView.vuepackages/ui/client/composables/trace-view.ts- prior prototype:
8cee41fc3and revert8f2e5fec6
ℹ️ Preserve original locator selectors for trace metadata
Current MVP behavior:
- Trace entries use the selector available at record time.
- For provider-specific paths, especially WebDriverIO, that selector may already be lowered from the user-facing locator into an internal/provider-specific selector.
Known symptoms:
- WebDriverIO shadow DOM marks can surface
selectorResolution: "error"when lowered selectors such as>>>...are used for snapshot lookup. - Some WebDriverIO failed actions can throw before the provider command trace recording path starts, so the failed action entry is missing and only the lifecycle failure is recorded.
Why this is post-MVP:
- The user-facing reason to do this is better trace-view correctness and usability.
- Fixing this properly requires separating trace metadata from provider command payloads.
- A narrow parser workaround would hide the symptom while preserving the wrong coupling.
Possible direction:
- Add explicit trace metadata to command/action paths.
- Separate user-facing
selectorfromsnapshotSelector. - Preserve locator intent on locator instances before provider lowering.
- Add a WebDriverIO failed-resolution wrapper so failures before command execution still produce action trace metadata.
What not to do:
- Do not special-case WebDriverIO
>>>stripping as the main selector fix. - Do not make
args[0]a stronger trace metadata contract.
Relevant files:
packages/browser/src/client/tester/tester-utils.tspackages/browser/src/client/tester/trace.tspackages/browser/src/client/tester/locators/index.tstest/browser/fixtures/trace/expect.test.tstest/browser/fixtures/trace/exotic.test.ts
ℹ️ Stream trace entries incrementally in watch mode so replay can look live/in-progress
Current MVP behavior:
- In watch mode, the trace view updates from attempt-complete trace artifacts rather than from a continuously advancing in-progress trace stream.
Why this is post-MVP:
- The main motivation is viewer UX, not just transport efficiency.
- A more live/in-progress trace view, similar to Playwright's UI, changes how the viewer consumes and updates trace state while a run is still happening.
- That may still require transport changes, but the product goal here is the watch-mode experience rather than payload/storage policy by itself.
Possible direction:
- Stream trace entries incrementally during watch mode.
- Let the trace pane render partial/in-progress replay instead of waiting for the attempt-complete payload.
- Decide whether run mode should keep the simpler attempt-end artifact path.
- Keep this distinct from retention and storage policy work.
ℹ️ Model nested trace groups
Current MVP behavior:
page.mark(name, fn)records the grouped mark at the end, while inner actions are recorded individually.- Nested grouping is not represented in the trace-view step model.
Why this is post-MVP:
- The motivating feature is the trace-view step list and grouping UX, even though it likely requires richer trace metadata under the hood.
- The flat step list is sufficient for MVP debugging.
Possible direction:
- Add parent/child or span metadata to trace entries.
- Render collapsible groups in the step list.
- Decide how timing and failure status roll up to group rows.
Relevant files:
packages/browser/src/client/tester/context.tstest/browser/fixtures/trace/mark.test.ts
Artifact Lifecycle and Transport
How trace-view artifacts should be retained, stored, and transported once traces become larger or more policy-sensitive.
ℹ️ Add a trace-view retention policy
Current MVP behavior:
browser.traceViewrecords and reports trace-view artifacts according to its enabled mode.- It does not yet model Playwright-style retention policies such as
retain-on-failure.
Why this is post-MVP:
- Retention policy is a product/API decision.
- The MVP focuses on making trace collection and replay useful first.
- Retention changes affect artifact lifecycle, reporter behavior, and possibly storage/memory strategy.
Possible direction:
- Add retention modes for trace-view artifacts.
- Consider parity or deliberate difference from
browser.trace. - Decide how retries/repeats interact with retention.
Relevant files:
packages/browser/src/client/tester/runner.ts
ℹ️ Reduce memory pressure from snapshot accumulation
Current MVP behavior:
- Trace entries and DOM snapshots accumulate in browser memory until the current attempt finishes.
- The full trace artifact is sent at attempt end.
Why this is post-MVP:
- The current approach is simple and reliable for MVP-sized traces.
- Reducing payload pressure would touch the collector, browser command transport, artifact shape, and reporter assumptions.
- This is separate from the viewer-UX goal of showing a live/in-progress trace stream during watch mode.
Possible direction:
- Flush entries incrementally and clear local snapshot data after acknowledgement if payload size becomes a problem.
- Store trace artifacts as files/attachments instead of large inline artifact payloads if payload size becomes a problem.
- Add stress tests for long tests and large snapshots before changing transport.
Relevant files:
packages/browser/src/client/tester/trace.tspackages/runner/src/types/tasks.ts

Activity
hi-ogawa commentedon Apr 28, 2026
More items go here:
Snapshot tester iframe document from orchestrator runtimerrweb-snapshotrepeatitively for each test file.with trivial test, trace view adds +25ms
hi-ogawa commentedon Apr 29, 2026
ℹ️ Snapshot and highlight multiply resolved selector nodes
Trace snapshots currently resolve a locator to a single mirror ID, so ambiguous selectors can only highlight one element or fail to provide useful visual context. Since trace data is diagnostic rather than part of runtime locator strictness, collection could use
querySelectorAllto record all matching mirror IDs, keepselectorIdas a compatibility fallback, and addselectorIdsfor the viewer to highlight every matched element. This would make failed or ambiguous locator traces easier to inspect without changing action/expect behavior.Details
Right now trace is using:
So the snapshot can record only one
selectorId. That is fine for action/expect paths where a locator should generally resolve to one element, but trace visualization is diagnostic. If a locator is ambiguous, showing all matched nodes is more useful than recording"missing"or only one target.A clean model would be:
or keep
"matched"and infer multiplicity fromselectorIds.length > 1. I’d prefer an explicit resolution state if tests/UI will care:Then trace collection can do:
The compatibility question matters. Existing viewer code may only know
selectorId, so keepingselectorId = ids[0]while addingselectorIdsis a low-risk migration. Later UI can draw multiple highlights.One important caveat: this should not replace strict runtime behavior. Actions should still fail on ambiguous locators if that is their contract. Trace can be more permissive because it is debugging state, not performing the user action.
This also helps provider mismatch cases: if the provider says “too many matches” or fails to pick one, trace can still show exactly what Vitest’s semantic selector matched in the DOM snapshot. That would make failure traces much more actionable.
hi-ogawa commentedon May 10, 2026
ℹ️ Display aria tree snapshot
Trace view currently centers on DOM replay snapshots. Add an Aria view so a selected trace step can also show the accessible tree for that moment.
This is a natural extension of existing browser diagnostics:
ARIA tree:sectionThe value is not primarily that aria snapshots are cheaper than DOM replay. They may or may not be. The value is that they answer a different question:
Proposal
Add an Aria diagnostic view alongside Replay for selected trace steps.
Current trace view is a two-pane UI: the left pane lists steps with metadata, and the right pane shows DOM replay for the selected step. Aria view could extend the right pane with multiple views:
The simplest version does not need to record a separate aria snapshot. If a DOM replay snapshot exists, the UI can rebuild it into the iframe and derive the aria tree from that reconstructed DOM. This shifts aria generation to view time and avoids extra trace payload.
If no DOM snapshot is available, the Aria view can explain that accessible-tree data is unavailable for the selected step.
Capture Options
There are two possible models:
Derive aria tree from DOM replay snapshot at view time.
indeterminate, closed shadow roots, runtime component state not reflected into DOM/attributes, and CSS effects from pseudo states outside the set Vitest preserves for trace replay.Capture aria snapshots during test execution.
If captured aria snapshots become necessary, keep DOM replay snapshots and aria snapshots independent:
This starts with a flat config shape and avoids nested typing/migration questions.
Possible initial/default direction:
on-failureon-failureoralwaysalwaysThe important part is not to assume DOM and aria snapshots have the same cost or diagnostic value.
Relationship To Failure-Gated DOM Snapshots
This is complementary to failure-gated DOM snapshots. DOM replay can be reserved for failure points, while an Aria view derived from those snapshots provides another diagnostic surface for locator/assertion failures without adding recording-time work.
Longer term, trace view can be treated as a step timeline plus pluggable captures:
Suggested Initial Scope
ivya/ariacapture/render pathariaSnapshotconfig until there is a clear needReferences and open questions
References:
Notes:
:hover.hi-ogawa commentedon May 13, 2026
ℹ️ Provide a way to inspect trace after run
Something like https://github.com/microsoft/playwright/blob/62d1ea1ae5726324844a233e88bf7a13661fcf61/packages/playwright-core/src/tools/trace/SKILL.md
AriPerkkio commentedon May 13, 2026
Currently trace view does not capture contents of iframes. In order to do this, we would need to execute
rrweb-snapshotand CSS pseudo-state selector query inside the iframe context.Accessing iframe context requires server side Playwright
page.frames()+frame.evaluate()APIs. As Vitest currently operates DOM snapshot capturing on client side context, this would require additional client->server->client calls. So something like:{ snapshot, pseudoClassIds }[]to client side: https://github.com/chromaui/chromatic-e2e/blob/%40chromatic-com/playwright%400.14.0/packages/playwright/src/takeSnapshot.ts#L42-L44result.serialized: https://github.com/chromaui/chromatic-e2e/blob/%40chromatic-com/playwright%400.14.0/packages/playwright/src/takeSnapshot.ts#L63-L65rrweb-snapshot: https://github.com/chromaui/chromatic-e2e/blob/%40chromatic-com/playwright%400.14.0/packages/shared/storybook-config/preview.ts#L100Reference implementation:
AriPerkkio commentedon May 15, 2026
Improve how nested marks are shown 💡
When actions that produce marks are nested, trace view should indicate this nesting. It should probably collapse all child marks inside the parent one by default. When clicking the parent mark, child marks are shown with some indentation.
This is what is currently shown. It's not clear that
tabcontains bothclickandtab:sheremet-va commentedon May 23, 2026
Two questions:
hi-ogawa commentedon May 25, 2026
The questions is unclear. Auto linking directly between github reporter and html reporter artifact URL sounds difficult because artifact URL can be known only after
actions/upload-artifactstep.Untested but it's possible in my mind. This is tracked in #10156 (comment).
beanscg commentedon Jun 10, 2026
hi-ogawa commentedon Oct 7, 2026
Status update before closing this issue. Each remaining item is now either tracked in its own issue or PR, or deferred without tracking.
Done
layout=tracemode (#11190)Tracked separately
Deferred, not tracked
These can get their own issue when a concrete need comes up.
Not planned
layout=tracein #11190