Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
0dfa175
wip: builtin trace system
hi-ogawa Apr 8, 2026
1e08082
wip: de-slop
hi-ogawa Apr 8, 2026
250e24c
wip: de-slop
hi-ogawa Apr 8, 2026
625a3ba
refactor: de slop
hi-ogawa Apr 8, 2026
55f840f
refactor: rename
hi-ogawa Apr 8, 2026
d212deb
refactor: de slop
hi-ogawa Apr 8, 2026
bbcc1b5
wip: fix global
hi-ogawa Apr 9, 2026
45addf2
wip: snapshot and rebuild
hi-ogawa Apr 9, 2026
c1f91f2
fix: bundle and lazy load rrweb-snapshot
hi-ogawa Apr 9, 2026
f133f04
wip: delay page.mark(function) trace
hi-ogawa Apr 9, 2026
0889f0e
refactor: remove dup types
hi-ogawa Apr 9, 2026
2fb9330
chore: todo
hi-ogawa Apr 9, 2026
5775533
fix: trace action
hi-ogawa Apr 9, 2026
71e2b80
Merge branch 'main' into wip-builtin-trace-system
hi-ogawa Apr 9, 2026
076d29c
chore: todo
hi-ogawa Apr 9, 2026
965f518
wip: trace action with selector
hi-ogawa Apr 9, 2026
2522b94
fix: record snapshot with css selector
hi-ogawa Apr 9, 2026
33d81d4
Merge remote-tracking branch 'origin/wip-builtin-trace-system' into w…
hi-ogawa Apr 9, 2026
ca7bf2a
wip: use rrweb Mirror for element highlight (nodeId-based, shadow DOM…
hi-ogawa Apr 9, 2026
846e940
refactor: de slop
hi-ogawa Apr 9, 2026
91f0bcb
wip: overlay-based element highlight in TraceView
hi-ogawa Apr 9, 2026
f755239
chore: ignore html
hi-ogawa Apr 9, 2026
7a1db8b
refactor: nit
hi-ogawa Apr 9, 2026
f5e5c33
wip: server-side stack resolution + source location in TraceView
hi-ogawa Apr 9, 2026
95b314f
chore: todo
hi-ogawa Apr 10, 2026
ef35e94
feat(ui): start trace viewer layout
hi-ogawa Apr 10, 2026
0dfff60
feat(ui): add trace view pane header
hi-ogawa Apr 10, 2026
cf105a3
chore: todo
hi-ogawa Apr 10, 2026
31002de
chore: todo
hi-ogawa Apr 10, 2026
9f6db30
feat(ui): default trace layout to bottom
hi-ogawa Apr 10, 2026
63057c1
chore: todo
hi-ogawa Apr 10, 2026
8cee41f
wip: link code view -> trace view
hi-ogawa Apr 10, 2026
8f2e5fe
Revert "wip: link code view -> trace view"
hi-ogawa Apr 10, 2026
ef4fc52
chore: todo
hi-ogawa Apr 10, 2026
c0d9054
feat(browser): record trace artifact per attempt
hi-ogawa Apr 10, 2026
b3bd803
fix(ui): sync trace step on location click
hi-ogawa Apr 10, 2026
b446889
feat(ui): show trace selectors in step list
hi-ogawa Apr 10, 2026
049c9e1
chore: remove todo
hi-ogawa Apr 10, 2026
9edfde2
feat(browser): add traceView workflow state
hi-ogawa Apr 10, 2026
ba3bc5d
wip: auto open trace
hi-ogawa Apr 10, 2026
89f56d6
chore: lint
hi-ogawa Apr 10, 2026
8092086
test: check env.TEST_BROWSER for ui open
hi-ogawa Apr 10, 2026
23e34f1
test: remove stale config
hi-ogawa Apr 10, 2026
6ceda6b
wip: add html reporter by default
hi-ogawa Apr 10, 2026
38aa974
fix: force traceView -> ui on watch
hi-ogawa Apr 10, 2026
51736a4
chore: remove todo
hi-ogawa Apr 10, 2026
a11a34c
fix: cli config
hi-ogawa Apr 10, 2026
345fc36
Merge branch 'main' into wip-builtin-trace-system
hi-ogawa Apr 10, 2026
f9e2c11
Merge remote-tracking branch 'origin/wip-builtin-trace-system' into w…
hi-ogawa Apr 10, 2026
1d6647a
test: dog-fooding in packages/ui
hi-ogawa Apr 10, 2026
2de7ac2
deslop
hi-ogawa Apr 10, 2026
e14bf26
chore: todo
hi-ogawa Apr 10, 2026
d1d44ec
deslop
hi-ogawa Apr 10, 2026
ab5c12a
test: other providers in packages/ui
hi-ogawa Apr 10, 2026
108f7bd
docs: wip trace-view-v2
hi-ogawa Apr 10, 2026
7660820
docs: draft trace-view guide for browser.traceView
hi-ogawa Apr 10, 2026
782af47
docs: add rrweb link in trace-view guide
hi-ogawa Apr 10, 2026
6dbe6aa
wip docs
hi-ogawa Apr 10, 2026
bc4d016
fix: fix webdriverio selector highlight
hi-ogawa Apr 10, 2026
434a05b
fix: preview provide also works (somehow)
hi-ogawa Apr 10, 2026
de0464b
docs: todo
hi-ogawa Apr 11, 2026
9029255
docs: improve framing of trace-view-v2 guide
hi-ogawa Apr 11, 2026
2531ed1
docs: cross-link browser UI model with trace-view-v2 guide
hi-ogawa Apr 11, 2026
c9c70e1
docs: restructure trace-view-v2 and add screenshots
hi-ogawa Apr 11, 2026
7fa86d3
docs: tweak
hi-ogawa Apr 11, 2026
1a87005
docs: fix dead links in trace-view-v2 and add browser.traceView confi…
hi-ogawa Apr 11, 2026
324df4f
wip: remove auto config logic
hi-ogawa Apr 12, 2026
7784acd
docs: clarify trace view setup
hi-ogawa Apr 12, 2026
4c4fd32
docs: simplify trace view workflow guidance
hi-ogawa Apr 12, 2026
5820b2c
chore: todo
hi-ogawa Apr 12, 2026
b390c24
docs: tweak
hi-ogawa Apr 12, 2026
186ec08
docs: expand trace view setup examples
hi-ogawa Apr 12, 2026
273c1be
fix: fix browserIframe remount on trace select
hi-ogawa Apr 12, 2026
d5a947a
Merge branch 'main' into wip-builtin-trace-system
hi-ogawa Apr 14, 2026
e58dd00
wip: SerializedRootConfig
hi-ogawa Apr 14, 2026
9ca27c6
fix/refactor: pass serializeRootConfig to UI
hi-ogawa Apr 14, 2026
d180500
fix: fix traceView condition
hi-ogawa Apr 14, 2026
82c10cd
nit
hi-ogawa Apr 14, 2026
ee4af34
wip: add vitest:onAfterRetryTask
hi-ogawa Apr 14, 2026
5261be2
todo
hi-ogawa Apr 15, 2026
f41d703
test: update snap
hi-ogawa Apr 15, 2026
1d188f6
todo
hi-ogawa Apr 15, 2026
811f7ec
docs: deslop
hi-ogawa Apr 15, 2026
21565b1
docs(browser): clarify browser runner shared state
hi-ogawa Apr 15, 2026
c1cad46
refactor(browser): store trace runtime on browser state
hi-ogawa Apr 15, 2026
8533e97
deslop
hi-ogawa Apr 15, 2026
fc6957e
test: wip e2e
hi-ogawa Apr 15, 2026
f93229e
test: e2e html reporter
hi-ogawa Apr 15, 2026
072c0f4
test: basic e2e
hi-ogawa Apr 15, 2026
54363ac
test: dig deeper
hi-ogawa Apr 15, 2026
5f101c5
Merge branch 'main' into wip-builtin-trace-system
hi-ogawa Apr 16, 2026
f82c207
test: test trace artifact recording
hi-ogawa Apr 16, 2026
1599e84
resolve todo
hi-ogawa Apr 16, 2026
a40a451
fix: fix retry/repeats counter
hi-ogawa Apr 16, 2026
34f50c7
fix: tweak retry/repeat combination label
hi-ogawa Apr 16, 2026
52aa365
Revert "wip: SerializedRootConfig"
hi-ogawa Apr 16, 2026
2a4f9ba
Revert "fix/refactor: pass serializeRootConfig to UI"
hi-ogawa Apr 16, 2026
5529764
Merge branch 'main' into wip-builtin-trace-system
hi-ogawa Apr 16, 2026
05f3f83
test: cleanup
hi-ogawa Apr 16, 2026
9f92842
test: update wdio
hi-ogawa Apr 16, 2026
3e4bd08
chore: revert auto config
hi-ogawa Apr 16, 2026
b9824f6
test(browser): expand trace fidelity fixtures
hi-ogawa Apr 16, 2026
58fd527
chore: comment
hi-ogawa Apr 16, 2026
bf3ced0
todo
hi-ogawa Apr 16, 2026
2fa7b14
feat(browser): preserve trace viewport and scroll
hi-ogawa Apr 16, 2026
5dca079
feat(browser): expose trace view fidelity options
hi-ogawa Apr 16, 2026
e8f8932
docs(browser): document trace view fidelity options
hi-ogawa Apr 16, 2026
af901e0
docs(browser): clarify trace view resource limits
hi-ogawa Apr 16, 2026
cf75cc0
feat(browser): add trace view status metadata
hi-ogawa Apr 17, 2026
36997e9
feat(browser): add trace view timing
hi-ogawa Apr 17, 2026
b822426
chore(browser): format trace action names
hi-ogawa Apr 17, 2026
9147e78
chore(browser): move browser timing helper
hi-ogawa Apr 17, 2026
1570b54
fix(browser): add trace lifecycle location fallback
hi-ogawa Apr 17, 2026
03d8d55
resolve todo
hi-ogawa Apr 17, 2026
8a3c0c7
feat(ui): make trace view panes resizable
hi-ogawa Apr 17, 2026
afadd8e
refactor(browser): use trace attempts as active state
hi-ogawa Apr 17, 2026
fac078a
chore: tweak split pane
hi-ogawa Apr 17, 2026
86ead20
docs(browser): update trace view behavior notes
hi-ogawa Apr 17, 2026
209dc3d
fix(ui): isolate trace replay background
hi-ogawa Apr 17, 2026
d17c1ee
fix(ui): refine trace replay pane fallback
hi-ogawa Apr 17, 2026
50e6be9
docs(browser): update trace view screenshots
hi-ogawa Apr 17, 2026
97ae085
docs(browser): credit trace view screenshot component
hi-ogawa Apr 17, 2026
a35c8d4
fix(browser): avoid stale trace lifecycle stack
hi-ogawa Apr 17, 2026
f354f56
comment
hi-ogawa Apr 17, 2026
335991a
deslop
hi-ogawa Apr 17, 2026
e01de4f
refactor(ui): simplify trace view state
hi-ogawa Apr 17, 2026
84fd25e
refactor(ui): share trace attempt label
hi-ogawa Apr 17, 2026
0d3e913
deslop
hi-ogawa Apr 17, 2026
943eaf2
deslop
hi-ogawa Apr 17, 2026
faba504
is this vue?
hi-ogawa Apr 17, 2026
44393de
docs(browser): promote built-in trace view guide
hi-ogawa Apr 17, 2026
e518880
docs: tweak
hi-ogawa Apr 17, 2026
11c191e
cleanup
hi-ogawa Apr 17, 2026
b9a15c0
test: demo hover on replay interaction time
hi-ogawa Apr 17, 2026
44bac4d
wip: snapshot hover and focus
hi-ogawa Apr 17, 2026
7ec898e
fix: patch for :focus replay
hi-ogawa Apr 17, 2026
fab84de
fix: support :fucus-within
hi-ogawa Apr 17, 2026
148850b
chore: lint
hi-ogawa Apr 17, 2026
657bc0f
chore: just patch esm
hi-ogawa Apr 17, 2026
4da7d3a
test: test stylesheet
hi-ogawa Apr 17, 2026
454c7be
fix: auto reload active trace view on re-run
hi-ogawa Apr 18, 2026
b8ff16a
Merge branch 'main' into wip-builtin-trace-system
hi-ogawa Apr 20, 2026
15d6b22
test: e2e trace viewport and pseudo states
hi-ogawa Apr 20, 2026
7e66ae2
test: e2e css-link and image
hi-ogawa Apr 20, 2026
e6976a0
test: e2e window scroll
hi-ogawa Apr 21, 2026
ddb5c95
resolve todo
hi-ogawa Apr 21, 2026
4bf707d
test: restore file
hi-ogawa Apr 21, 2026
6f4394b
test: update snap
hi-ogawa Apr 21, 2026
6a78968
test: update trace explorer item helper
hi-ogawa Apr 21, 2026
55bf6ed
tweak ui
hi-ogawa Apr 21, 2026
35f9987
tweak ui
hi-ogawa Apr 21, 2026
0c11f7f
docs: cleanup
hi-ogawa Apr 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,11 @@ export default ({ mode }: { mode: string }) => {
link: '/guide/browser/trace-view',
docFooterText: 'Trace View | Browser Mode',
},
{
text: 'Playwright Traces',
link: '/guide/browser/playwright-traces',
docFooterText: 'Playwright Traces | Browser Mode',
},
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New trace view took over the page, so I rename the playwright trace. Not sure if we should keep the sidebar though.

{
text: 'ARIA Snapshots',
link: '/guide/browser/aria-snapshots',
Expand Down
2 changes: 2 additions & 0 deletions docs/config/browser/trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ outline: deep

Capture a trace of your browser test runs. You can preview traces with [Playwright Trace Viewer](https://trace.playwright.dev/).

See [Playwright Traces](/guide/browser/playwright-traces) for the full workflow.

This options supports the following values:

- `'on'` - capture trace for all tests. (not recommended as it's performance heavy)
Expand Down
70 changes: 70 additions & 0 deletions docs/config/browser/traceview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
title: browser.traceView | Config
outline: deep
---

# browser.traceView <Badge type="warning" text="Experimental" /> <Version>5.0.0</Version>

- **Type:** `boolean | { enabled?: boolean; recordCanvas?: boolean; inlineImages?: boolean }`
- **CLI:** `--browser.traceView`
- **Default:** `false`

Enable trace-view collection for browser tests. Vitest captures DOM snapshots for browser interactions and can show them in the browser UI, Vitest UI, or HTML reporter when those surfaces are enabled — no external tools required.

```ts
export default defineConfig({
test: {
browser: {
traceView: true,
},
},
})
```

Use the object form to enable additional snapshot fidelity options:

```ts
export default defineConfig({
test: {
browser: {
traceView: {
enabled: true,
inlineImages: true,
recordCanvas: true,
},
},
},
})
```

| Option | Default | Description |
| --- | --- | --- |
| `enabled` | `false` | Enables Vitest trace-view artifact collection. |
| `inlineImages` | `false` | Inlines loaded `<img>` pixels into snapshots for more portable replay, useful in the HTML reporter. |
| `recordCanvas` | `false` | Captures canvas pixels in snapshots. |

## browser.traceView.enabled {#traceview-enabled}

- **Type:** `boolean`
- **Default:** `false`
- **CLI:** `--browser.traceView.enabled`

Enables Vitest trace-view artifact collection.

## browser.traceView.inlineImages {#traceview-inlineimages}

- **Type:** `boolean`
- **Default:** `false`
- **CLI:** `--browser.traceView.inlineImages`

Inlines loaded `<img>` pixels into snapshots for more portable replay, useful in the HTML reporter.

## browser.traceView.recordCanvas {#traceview-recordcanvas}

- **Type:** `boolean`
- **Default:** `false`
- **CLI:** `--browser.traceView.recordCanvas`

Captures canvas pixels in snapshots. This enables a weaker replay iframe sandbox because rrweb needs scripts to redraw canvas data.

See [Trace View](/guide/browser/trace-view) for full documentation.
2 changes: 2 additions & 0 deletions docs/guide/browser/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,8 @@ Since Vitest 3.2, if you don't have the `browser` option in your config but spec

By default, Vitest will automatically open the browser UI for development. Your tests will run inside an iframe in the center. You can configure the viewport by selecting the preferred dimensions, calling `page.viewport` inside the test, or setting default values in [the config](/config/browser/viewport).

For an alternative debugging model that captures DOM snapshots for every test instead of showing a live iframe, see [Trace View](/guide/browser/trace-view).

## Headless

Headless mode is another option available in the browser mode. In headless mode, the browser runs in the background without a user interface, which makes it useful for running automated tests. The headless option in Vitest can be set to a boolean value to enable or disable headless mode.
Expand Down
126 changes: 126 additions & 0 deletions docs/guide/browser/playwright-traces.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Playwright Traces

Vitest Browser Mode supports generating Playwright's [trace files](https://playwright.dev/docs/trace-viewer#viewing-remote-traces). To enable tracing, you need to set the [`trace`](/config/browser/trace) option in the `test.browser` configuration.

::: warning
Generating trace files is only available when using the [Playwright provider](/config/browser/playwright).
:::

::: code-group
```ts [vitest.config.js]
import { defineConfig } from 'vitest/config'
import { playwright } from '@vitest/browser-playwright'

export default defineConfig({
test: {
browser: {
provider: playwright(),
trace: 'on',
},
},
})
```
```bash [CLI]
vitest --browser.trace=on
```
:::

By default, Vitest will generate a trace file for each test. You can also configure it to only generate traces on test failures by setting `trace` to `'on-first-retry'`, `'on-all-retries'` or `'retain-on-failure'`. The files will be saved in `__traces__` folder next to your test files. The name of the trace includes the project name, the test name, the [`repeats`](/api/test#repeats) count and [`retry`](/api/test#retry) count:

```
chromium-my-test-0-0.trace.zip
^^^^^^^^ project name
^^^^^^ test name
^ repeat count
^ retry count
```

To change the output directory, you can set the `tracesDir` option in the `test.browser.trace` configuration. This way all traces will be stored in the same directory, grouped by the test file.

```ts [vitest.config.js]
import { defineConfig } from 'vitest/config'
import { playwright } from '@vitest/browser-playwright'

export default defineConfig({
test: {
browser: {
provider: playwright(),
trace: {
mode: 'on',
// the path is relative to the root of the project
tracesDir: './playwright-traces',
},
},
},
})
```

The traces are available in reporters as [annotations](/guide/test-annotations). For example, in the HTML reporter, you can find the link to the trace file in the test details.

## Trace markers

You can add explicit named markers to make the trace timeline easier to read:

```ts
import { page } from 'vitest/browser'

document.body.innerHTML = `
<button type="button">Sign in</button>
`

await page.getByRole('button', { name: 'Sign in' }).mark('sign in button rendered')
```

Both `page.mark(name)` and `locator.mark(name)` are available.

You can also group multiple operations under one marker with `page.mark(name, callback)`:

```ts
await page.mark('sign in flow', async () => {
await page.getByRole('textbox', { name: 'Email' }).fill('john@example.com')
await page.getByRole('textbox', { name: 'Password' }).fill('secret')
await page.getByRole('button', { name: 'Sign in' }).click()
})
```

You can also wrap reusable helpers with [`vi.defineHelper()`](/api/vi#vi-defineHelper) so trace entries point to where the helper is called, not its internals:

```ts
import { vi } from 'vitest'
import { page } from 'vitest/browser'

const myRender = vi.defineHelper(async (content: string) => {
document.body.innerHTML = content
await page.elementLocator(document.body).mark('render helper')
})

test('renders content', async () => {
await myRender('<button>Hello</button>') // trace points to this line
})
```

## Preview

To open the trace file, you can use the Playwright Trace Viewer. Run the following command in your terminal:

```bash
npx playwright show-trace "path-to-trace-file"
```

This will start the Trace Viewer and load the specified trace file.

Alternatively, you can open the Trace Viewer in your browser at https://trace.playwright.dev and upload the trace file there.

<img alt="Trace Viewer showing the trace timeline and rendered component" img-light src="/trace-viewer-light.png">
<img alt="Trace Viewer showing the trace timeline and rendered component" img-dark src="/trace-viewer-dark.png">

## Source Location

When you open a trace, you'll notice that Vitest groups browser interactions and links them back to the exact line in your test that triggered them. This happens automatically for:

- `expect.element(...)` assertions
- Interactive actions like `click`, `fill`, `type`, `hover`, `selectOptions`, `upload`, `dragAndDrop`, `tab`, `keyboard`, `wheel`, and screenshots

Under the hood, Playwright still records its own low-level action events as usual. Vitest wraps them with source-location groups so you can jump straight from the trace timeline to the relevant line in your test.

For anything not covered automatically, you can use `page.mark()` or `locator.mark()` to add your own trace groups — see [Trace markers](#trace-markers) above.
Loading
Loading