feat(browser): support dom snapshot trace view#10102
Open
hi-ogawa wants to merge 152 commits intovitest-dev:mainfrom
Open
feat(browser): support dom snapshot trace view#10102hi-ogawa wants to merge 152 commits intovitest-dev:mainfrom
hi-ogawa wants to merge 152 commits intovitest-dev:mainfrom
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
…ip-builtin-trace-system
… safe)
- store { serialized, nodeId } as snapshot payload in BrowserTraceEntry
- takeSnapshot() passes explicit Mirror to snapshot(), resolves ivya selector → nodeId
- TraceView.vue uses mirror.getNode(nodeId) after rebuild() instead of querySelector
- removes CSS selector approach which breaks for shadow DOM elements
- drops __vitest_css_from_element__ global (no longer needed)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- use getBoundingClientRect + position:fixed overlay div instead of inline styles - snapshot DOM is untouched; overlay is purely visual - use requestAnimationFrame to ensure layout before reading rect - credit Playwright's highlight.ts as reference for the technique - mirror.getNode(selectorId) for shadow DOM-safe element lookup Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- add __vitest_recordBrowserTrace server command (mirrors annotateTraces pattern)
- resolves stack → location via parseStacktrace in one batch server-side
- calls _testRun.recordArtifact directly, no browser-side recordArtifact
- BrowserTraceEntry gains location?: { file, line, column }
- TraceView shows clickable source location per step via openLocation composable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move browser traces out of the report card into the top panel layout and allow the trace viewer to open without browser orchestrator state. Keep BrowserIframe visible during browser orchestration by splitting the top pane when a trace is active. Co-authored-by: Codex <noreply@openai.com>
Wrap the trace viewer in a dedicated pane with a header and close action, and rename the component to TraceViewPane for consistency with the split layout. Co-authored-by: Codex <noreply@openai.com>
hi-ogawa
commented
Apr 17, 2026
| text: 'Playwright Traces', | ||
| link: '/guide/browser/playwright-traces', | ||
| docFooterText: 'Playwright Traces | Browser Mode', | ||
| }, |
Collaborator
Author
There was a problem hiding this comment.
New trace view took over the page, so I rename the playwright trace. Not sure if we should keep the sidebar though.
hi-ogawa
commented
Apr 17, 2026
hi-ogawa
commented
Apr 17, 2026
hi-ogawa
commented
Apr 18, 2026
Co-authored-by: Codex <noreply@openai.com>
AriPerkkio
reviewed
Apr 22, 2026
| pseudoClassIds: Record<PsudoClassName, number[]> | ||
| } | ||
|
|
||
| const PSUDO_CLASS_NAMES = [':hover', ':focus', ':focus-within'] as const |
Member
There was a problem hiding this comment.
Any reason why :active is not here? User might want to see what the snapshot looked like when button was pressed (and some annoying box shadow was rendered 🙃). Atm with Vitest it's really difficult to make button pressed for specific time, but that might change in #8190.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Please read docs for overview https://deploy-preview-10102--vitest-dev.netlify.app/guide/browser/trace-view
There are quite a few TODOs scattered in this PR. I made a tracking issue intended as follow-up but please feel free to bring it up as this PR's review if anything worth addressing or discussing early:
Demo
Screenshot
VITE_FAIL_TEST=true pnpm -C examples/lit test --browser.traceView --browser.headless --uiVITE_FAIL_TEST=true pnpm -C examples/lit test --browser.traceViewTODO
test.browser.traceView: true--browser.headless --uion watch--browser.headless --reporter htmlon non watchtest/ui(verifies trace view is actually visible)pnpm -C test/ui test trace.spec.tstest/browser(verifies trace artifacts recording)packages/ui(component level interaction)pnpm test:chromium --browser.traceView --uipnpm -C packages/vuetify/ test:browser --browser.traceView --ui --watch --standalone__vitest_click -> vitest:clickPlease don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.