@playwright-repl/runner
v0.26.1
Published
Playwright test utilities — bridge-mode compilation, node detection, and CLI subcommands
Downloads
426
Readme
@playwright-repl/runner
Drop-in replacement for npx playwright test — 2.8x faster for browser-only tests.
Performance
pw test compiles tests with esbuild and executes them directly in the browser via the Dramaturg Chrome extension's service worker (serviceWorker.evaluate()). This bypasses the Playwright test runner overhead (worker startup, TypeScript compilation, fixture setup).
Node-mode tests that need server-side APIs fall back to the standard Playwright test runner automatically.
Quick Start
npm install -D @playwright-repl/runnerReplace npx playwright test with pw test:
pw test # run all tests
pw test todomvc/ # run tests in a folder
pw test --headless # headless modeHow It Works
- Compile — esbuild bundles the test with a lightweight shim replacing
@playwright/test - Launch — Chromium starts with the Dramaturg extension via
launchPersistentContext - Execute — compiled test sent to the service worker via
serviceWorker.evaluate() - Results — pass/fail returned directly, no test runner process needed
Tests that use Node-only APIs (fs, net, child_process) are detected by static analysis and fall back to standard Playwright automatically.
pw Commands
pw test [files...] # run Playwright tests (fast path)
pw repl # interactive REPL with keyword + JS support
pw repl --headless # headless REPL for scripting
pw repl --port 9222 # connect to existing Chrome via CDPpw repl
Interactive REPL with keyword commands and JavaScript support. Launches Chromium with the extension by default.
pw> goto https://example.com
pw> await page.title()
Example Domain
(5ms)
pw> await page.locator('a').count()
1
(12ms)CI Setup
- name: Install
run: npm ci
- name: Install browsers
run: npx playwright install --with-deps chromium
- name: Run tests
run: npx pw test --headlessCompatibility
Works with standard @playwright/test tests. No changes needed to your test files.
Supported: All Playwright test features — fixtures, assertions, test.describe, test.beforeEach, etc.
Automatic fallback: Tests that use Node-only APIs automatically fall back to standard Playwright.
Development
cd packages/runner
pnpm run build
pnpm run test