← All posts
·playwrightclitutorial

Generate a Playwright test from your terminal with hover run

You want a Playwright test for your login flow, and you would rather type a command than click a widget in the page. hover run does that. You give it a sentence and a URL, it drives a real Chrome, and it writes the spec.

What you need

One package, plus a coding-agent CLI you already have:

npm i -D @hover-dev/core @hover-dev/cli

CLI mode needs only the engine. There's no setup step and no bundler config, because nothing gets injected into a page. If claude or codex is on your PATH, you're ready.

Run it

hover run "log in with alice@example.com / demo1234, then add a todo named 'verify hover'" \
  --url http://localhost:5173 --save login

hover run launches an isolated debug Chrome if one isn't already up, opens your URL, and streams the agent as it works:

◇ hover run · claude · sonnet
│
◇ Chrome
│  reusing debug Chrome on :9222
│
◇ log in with alice@example.com…
│  → browser_navigate
│  → browser_click
│
◆ Done · 11 turns · $0.05
│  ✓ saved __vibe_tests__/login.spec.ts
╰─ review it, then hover optimize login to polish

The Chrome it drives is real and visible, not headless. The first run on a flow behind auth stops at the login wall: log in once in that window, run the command again, and the profile keeps your session for next time.

What you get

--save login writes __vibe_tests__/login.spec.ts, a plain @playwright/test file with semantic locators. It runs in CI with npx playwright test, no agent and no key. Drop --save to watch a run without keeping it.

A few flags worth knowing:

  • --url <devUrl> opens and drives that page. Pass it every time.
  • --agent <id> / --model <m> override the agent and model (HOVER_AGENT / HOVER_MODEL work too).
  • --cwd <path> targets one app in a monorepo.

Record mode, the Fix prompt, and voice stay in the widget. The rest of the workflow runs from a shell. After a save, polish the spec with hover optimize login.

Read the CLI reference →

Try Hover on your own app.

One command adds the widget to your dev server. Author tests with AI, ship plain Playwright.

npx @hover-dev/cli setup