Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
95da448
test recorder WIP
PoffM Sep 6, 2025
d8221ae
recorder WIP
PoffM Sep 6, 2025
ccbb6a0
recorder WIP
PoffM Sep 6, 2025
6be81a8
recorder WIP
PoffM Sep 7, 2025
9e75480
fix tests
PoffM Sep 7, 2025
6c79398
Merge branch 'main' into recorder
PoffM Sep 8, 2025
4d761ee
fix type error
PoffM Sep 8, 2025
1b8c433
recorder WIP
PoffM Sep 11, 2025
b06fb15
recorder WIP
PoffM Sep 11, 2025
598d1bd
Merge branch 'main' into recorder
PoffM Sep 11, 2025
426e182
recorder WIP
PoffM Sep 11, 2025
f1629c4
recorder WIP
PoffM Sep 12, 2025
590c04b
recorder WIP
PoffM Sep 13, 2025
5240724
recorder WIP
PoffM Sep 13, 2025
18653b0
recorder WIP
PoffM Sep 13, 2025
1172292
recorder WIP
PoffM Sep 17, 2025
ddbdc70
recorder WIP
PoffM Sep 17, 2025
9a19625
fix type error
PoffM Sep 17, 2025
9118176
recorder WIP
PoffM Sep 17, 2025
b6886f2
fix test
PoffM Sep 18, 2025
be8d745
recorder WIP
PoffM Sep 18, 2025
58183b9
recorder WIP
PoffM Sep 18, 2025
cf3144e
recorder WIP
PoffM Sep 18, 2025
48a98af
recorder WIP
PoffM Sep 18, 2025
428065d
recorder WIP
PoffM Sep 19, 2025
dc1d80a
recorder WIP
PoffM Sep 19, 2025
213bc53
recorder WIP
PoffM Sep 19, 2025
107ed76
recorder WIP
PoffM Sep 19, 2025
9edd848
recorder WIP
PoffM Sep 20, 2025
77269ac
Merge branch 'main' into recorder
PoffM Sep 20, 2025
81fbd01
recorder WIP
PoffM Sep 20, 2025
1e315c7
recorder WIP
PoffM Sep 20, 2025
716f361
recorder WIP
PoffM Sep 20, 2025
b3e701c
recorder WIP
PoffM Sep 21, 2025
031e72a
recorder WIP
PoffM Sep 21, 2025
54bb3b5
recorder WIP
PoffM Sep 22, 2025
9d744a1
recorder WIP
PoffM Sep 23, 2025
981386c
recorder WIP
PoffM Sep 23, 2025
bac990e
recorder WIP
PoffM Sep 25, 2025
2717b73
recorder WIP
PoffM Sep 25, 2025
eade3b7
recorder WIP
PoffM Sep 25, 2025
e9389d2
Merge branch 'main' into recorder
PoffM Oct 18, 2025
16fc756
re-add meta tag for forms
PoffM Oct 18, 2025
7022ec3
recorder WIP
PoffM Oct 18, 2025
c07443c
recorder WIP
PoffM Oct 19, 2025
a80ee75
dep updates
PoffM Oct 19, 2025
27a6b25
recorder WIP
PoffM Oct 19, 2025
48a3147
recorder WIP
PoffM Oct 19, 2025
e72cd93
recorder WIP
PoffM Oct 19, 2025
f859d02
recorder WIP
PoffM Oct 19, 2025
08d82c8
recorder WIP
PoffM Oct 19, 2025
a47abf5
recorder WIP
PoffM Oct 19, 2025
a862f0d
recorder wip
PoffM Oct 19, 2025
a2968f7
add resizable components from solid-ui
PoffM Oct 19, 2025
615289b
recorder WIP
PoffM Oct 20, 2025
ea2cf93
recorder WIP
PoffM Oct 20, 2025
b697edf
recorder WIP
PoffM Oct 20, 2025
4aed4ba
recorder WIP
PoffM Oct 20, 2025
3f85915
fix recorder test
PoffM Oct 20, 2025
aaefb45
recorder WIP
PoffM Oct 20, 2025
e8ac734
recorder WIP
PoffM Oct 20, 2025
e3d4954
recorder WIP
PoffM Oct 20, 2025
8715d99
[skip ci]
PoffM Oct 20, 2025
12d5b34
recoder WIP
PoffM Oct 22, 2025
5e88479
recorder WIP
PoffM Oct 22, 2025
1170de4
update pnpm
PoffM Oct 26, 2025
61dc9bc
recorder
PoffM Oct 26, 2025
6ca75fd
recorder
PoffM Oct 26, 2025
66bb6a0
eslint: allow 'test' block
PoffM Oct 26, 2025
9246e57
fix import
PoffM Oct 26, 2025
2fb61ff
recorder
PoffM Oct 26, 2025
77475d7
recorder
PoffM Oct 27, 2025
3e64b90
recorder
PoffM Oct 27, 2025
ce4a6e6
improve jest debug console text color
PoffM Oct 27, 2025
c95cbe7
recorder
PoffM Oct 27, 2025
2f33e9d
recorder
PoffM Oct 27, 2025
0ab1925
improve error messages
PoffM Oct 28, 2025
569b1f3
recorder
PoffM Oct 28, 2025
5e293ad
recorder
PoffM Oct 29, 2025
4137ca6
recorder
PoffM Oct 29, 2025
3f055bd
recorder
PoffM Oct 29, 2025
777d82f
recorder
PoffM Oct 29, 2025
af24709
recorder
PoffM Oct 29, 2025
b4c69d8
recorder
PoffM Oct 30, 2025
2426bfe
recorder
PoffM Oct 30, 2025
98ab84c
recorder
PoffM Oct 30, 2025
5b777e2
recorder
PoffM Oct 30, 2025
a0fa82a
recorder
PoffM Oct 30, 2025
618ee09
recorder
PoffM Oct 30, 2025
5f5bd7e
recorder
PoffM Oct 30, 2025
aae7630
recorder
PoffM Oct 30, 2025
8289e46
fix type error
PoffM Oct 30, 2025
653da6b
recorder
PoffM Oct 30, 2025
34e9c57
recorder
PoffM Oct 31, 2025
acea464
recorder
PoffM Nov 4, 2025
35bc3d1
recorder
PoffM Nov 4, 2025
60801ea
recorder tweaks
PoffM Nov 4, 2025
c9cfdde
recorder
PoffM Nov 4, 2025
440804c
recorder
PoffM Nov 4, 2025
3408332
recorder
PoffM Nov 8, 2025
d375d6c
recorder
PoffM Nov 8, 2025
e121a73
add changeset for recorder feature
PoffM Nov 8, 2025
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 .changeset/bumpy-feet-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"ui-test-visualizer": minor
---

Add "Record input as code" feature
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,7 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- run: pnpm run build

# Just run the "extension" tests to make sure the paths are detected correctly on Windows
- run: pnpm run --filter ./packages/extension test
13 changes: 12 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"sourceMaps": true
},
{
"name": "Bun Test Runner Example",
"name": "Bun + React Example",
"type": "extensionHost",
"request": "launch",
"args": [
Expand All @@ -100,6 +100,17 @@
"outFiles": ["${workspaceFolder}/build-dev/**/*.js"],
"sourceMaps": true
},
{
"name": "Bun + Solid Example",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/build-dev",
"${workspaceFolder}/examples/bun-solid"
],
"outFiles": ["${workspaceFolder}/build-dev/**/*.js"],
"sourceMaps": true
},
{
"name": "All examples",
"type": "extensionHost",
Expand Down
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,41 @@ This is a VSCode extension: no code changes should be required to watch your UI

- [Vitest](https://vitest.dev/) or [Jest v28+](https://jestjs.io/) or [Bun Test Runner](https://bun.com/docs/test/dom)
- Your test framework is auto-detected by walking up the directories from your test file until it finds `vitest.config.{ts,js}`, `vite.config.{ts,js}`, `jest.config.{ts,js,json}`, or `bun.lock`
- The [Bun VSCode extension](https://marketplace.visualstudio.com/items?itemName=oven.bun-vscode) is required for Bun tests
- [jsdom](https://github.com/jsdom/jsdom) or [happy-dom](https://github.com/capricorn86/happy-dom) test environment (what you're probably already using for UI in Vitest or Jest)

## Usage

### Visualizing tests

Click the "Visually Debug UI" button above your test. If there's no breakpoint in your test already, the extension will add one automatically. A side panel should open, and render your UI as you step through with the debugger.

### Record Input as Code

You can also write tests by recording your input as you interact with your UI.

**Project Requirements:**
- Test runner: Vitest, Jest, or Bun
- Testing libraries:
- `@testing-library/react` or `@solidjs/testing-library`
- `@testing-library/user-event`

Steps:

- *Optional*: Generate a starter test file for a React or Solid component by right-clicking the component name in the editor (e.g. MyForm) and clicking "Create UI test".

- Click the "Visually Debug UI" button to start your test

- Click "Step Over" until you get your UI into the state where you want to generate new code.

- Click the "Record input as code" button in the side panel, and you'll see the recorder panel appear.

- Click your UI elements, or change text inputs, and the extension will generate code for you to use in your test.

- Right+click to generate `expect` statements or other mouse events.

- The generated code is inserted into your test file when the test is ended or restarted.

## UI Framework Compatibility

Since this extension hooks into the DOM API directly, you should be able to use any DOM-based UI framework, including React, Solid, Angular, Vue, Svelte, jQuery, etc.
Expand Down Expand Up @@ -50,14 +79,14 @@ This extension could fail to auto-build your source CSS files, in which case you
- Vitest:
- Adds a `--require` argument to the Vitest command.
- Jest:
- Adds a `--setupFiles` argument to the Jest command in addition to any setupFiles you've already defined in your config.
- Adds a `--setupFiles` argument to the Jest command in addition to any setupFiles defined in your config.
- Bun:
- Adds a `--preload` argument to the `bun test` command in addition to any preloads defined in your bunfig.toml.

- **Replicates the test DOM into a real DOM**: The extension then replicates those method calls and their arguments in a VSCode WebView (the side panel), which renders your UI in a real Chromium DOM. This panel only shows a **replica** of the test DOM without your UI's Javascript, so you can't interact with it using the mouse or keyboard.

## Caveats

- **Can be slow to run until your first breakpoint**: Because of the code inserted at startup for watching the DOM and optionally loading your styles, your test can be slightly slower to startup than when debugging your tests normally with other test extensions.

- **Possible de-synchronization**: The visual DOM replica gets updated incrementally as your test runs, but accurate synchronization relies on this extension's code to correctly handle every possible DOM mutation that happens in your UI. The DOM replication code is pretty thorough, even accounting for weird cases involving nested Shadow DOMs and Web Component lifecycles, but it's still possible for the visual replica to get out of sync with your actual test DOM. If this happens, you can click the panel's Refresh button to re-sync it.

## Contributing / Extension Development
Expand Down
1 change: 1 addition & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ module.exports = config({
// Convenient for this project
'node/prefer-global/process': 'off',
'antfu/no-import-node-modules-by-path': 'off',
'test/consistent-test-it': 'off',
},
})
16 changes: 9 additions & 7 deletions examples/bun-react/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions examples/bun-react/bunfig.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[serve.static]
env = "BUN_PUBLIC_*"

[install]
linker = "isolated"

Expand Down
2 changes: 1 addition & 1 deletion examples/bun-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"devDependencies": {
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.1",
"@types/bun": "^1.3.0"
"bun-types": "^1.3.0"
}
}
4 changes: 2 additions & 2 deletions examples/bun-react/src/Counter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react'
import { useState } from 'react'

export function Counter() {
const [count, setCount] = useState(0)
Expand All @@ -14,7 +14,7 @@ export function Counter() {
return (
<div>
<h1>Counter</h1>
<p>Count: {count}</p>
<div>Count: {count}</div>
<button onClick={increment}>Increment</button>
<button onClick={decrement}>Decrement</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion examples/bun-react/test/basic.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ it('simple react testing library test', () => {
fireEvent.click(screen.getByText('Increment'))
fireEvent.click(screen.getByText('Decrement'))

expect(screen.getByText('Count: 1')).toBeTruthy()
expect(screen.getByText('Count: 1'))
})
4 changes: 3 additions & 1 deletion examples/bun-react/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
"noPropertyAccessFromIndexSignature": false,

"types": ["bun-types"]
},

"exclude": ["dist", "node_modules"]
Expand Down
34 changes: 34 additions & 0 deletions examples/bun-solid/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# dependencies (bun install)
node_modules

# output
out
dist
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store
15 changes: 15 additions & 0 deletions examples/bun-solid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# bun-solid

To install dependencies:

```bash
bun install
```

To run:

```bash
bun run index.ts
```

This project was created using `bun init` in bun v1.3.0. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
Loading
Loading