vitest-dev / vitest-dev/vitest

Test Recorder / Codegen tab in UI for Browser Mode

Open
#9,530 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

p2-nice-to-have
Dominant language
TypeScript
Stars
17.1k
Forks
2k
Avg merge
1d 22h
Merged PRs (30d)
94

Description

Clear and concise description of the problem

As a developer using Vitest Browser Mode, I want a built-in way to record interactions and generate test steps similar to what playwright codegen offers.

The recorder/codegen UI could live as a dedicated tab in the Vitest UI.

Suggested solution

Rely on the existing tooling provided by the Playwright provider.

Much of the required functionality already exists and is exposed by Ivya (which is used by vitest browser).

Basic details

  • Add a new Recorder/Codegen tab in the Vitest UI with a simple code editor area that displays the generated steps, plus basic controls (record toggle, clear, copy).
  • When recording is enabled, attach a useCapture event listener to the test’s rendered container (Browser Mode test root) and record all events.
  • Filter recorded events to the relevant interaction events (click/type/change/etc.) and generate a locator-based code line using existing APIs:
    import { page } from 'vitest/browser'
    import { asLocator } from 'ivya'
    
    const selector = page.elementLocator(e.target).selector
    asLocator('javascript', selector).toString()
    // produces something like await page.getByRole(...).click()
    
  • Ability to commit the generated steps into an existing test or create a new test from the recording.

If this feels aligned with Vitest’s direction, I’d be happy to try drafting a PR.

Alternative

Attempt to just use the playwright codegen as is, and try to manipulate it so it will integrate well inside a vitest-browser test

Additional context

No response

Validations

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Vitest UI Browser Mode integration and the test’s rendered container, then inspect the existing useCapture listener and Playwright-provider APIs mentioned in the issue. Done means a Recorder/Codegen tab can capture relevant interactions, display locator-based generated steps, and support the requested clear, copy, toggle, and test-creation or commit workflows.

Written by the indexing model from the issue text.

Assessment

Tech stack
playwright, typescript
Domain
developer-experience, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.