Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ jobs:

- name: Install Playwright Chromium
run: npx playwright install chromium
working-directory: packages/extension

- name: Run E2E tests
- name: Run CLI E2E tests
run: node dist/playwright-repl.js --replay examples/ --silent
working-directory: packages/cli

- name: Run extension E2E tests
run: npx playwright test
working-directory: packages/extension
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## v0.6.0 — Multi-file Replay & Log Reports

**2026-02-22**

### Features

- **Multi-file replay**: `--replay` now accepts multiple files and/or folders. Files run sequentially in a shared browser session; on failure, continues to the next file and reports a summary at the end.
```bash
playwright-repl --replay examples/ # all .pw files in folder
playwright-repl --replay a.pw b.pw c.pw # specific files
playwright-repl --replay examples/ extra.pw # mix folders and files
```
- **Replay log file**: Every multi-file replay writes a `replay-<timestamp>.log` with per-command OK/FAIL results and a summary. The log file is the test report.
- **Error tracking**: `isError` results from the engine (e.g., `verify-text` failures) are now correctly counted. Previously only thrown exceptions were tracked.

### Examples

- Added `localstorage-clear` cleanup to all TodoMVC examples (01–06) so they work in multi-file replay without state leaking between files.
- New `07-test-click-nth.pw` — tests `--nth` disambiguation on playwright.dev.
- New `08-localstorage.pw` — tests `localstorage-list`, `localstorage-clear`, and `reload` to verify storage commands work correctly.

### CI

- Added CLI E2E step to GitHub Actions: runs `playwright-repl --replay examples/` alongside unit tests.

### Tests

- 9 new unit tests for `resolveReplayFiles` and `runMultiReplayMode` (157 CLI tests total).
- 399 total tests across all packages (157 CLI + 82 core + 160 extension).

---

## v0.5.0 — Extension Mode & TypeScript

**2026-02-22**
Expand Down
4 changes: 4 additions & 0 deletions PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ The foundation — a persistent REPL connected to the Playwright MCP daemon.
- [ ] **#5 Convert to Playwright tests** — export `.pw` files as Playwright TypeScript test suites
- [ ] **#4 CSV/Excel/Markdown export** — save session data in tabular formats

### CI/CD

- [ ] **Reuse test workflow in release** — make `test.yml` callable via `workflow_call` so `release.yml` reuses it instead of duplicating steps (adds E2E tests + linting to release pipeline)

### Future Ideas

- [ ] Replace custom recorder with Playwright's recording infrastructure (battle-tested locator generation)
Expand Down
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ playwright-repl [options]
# Replay a recorded session
playwright-repl --replay session.pw

# Replay all .pw files in a folder
playwright-repl --replay examples/

# Replay multiple files
playwright-repl --replay a.pw b.pw c.pw

# Step through replay (pause between commands)
playwright-repl --replay session.pw --step

Expand Down Expand Up @@ -147,7 +153,7 @@ playwright-repl --extension --port 4000 # custom command server port
| `--extension` | Launch Chrome with side panel extension and command server |
| `--port <number>` | Command server port (default: `3000`) |
| `--config <file>` | Path to config file |
| `--replay <file>` | Replay a `.pw` session file |
| `--replay <files...>` | Replay `.pw` file(s) or folder(s) |
| `--record <file>` | Start REPL with recording to file |
| `--step` | Pause between commands during replay |
| `-q, --silent` | Suppress banner and status messages |
Expand Down Expand Up @@ -305,10 +311,15 @@ playwright-repl --replay my-test.pw
# Step-through (press Enter between commands)
playwright-repl --replay my-test.pw --step --headed

# Replay all .pw files in a folder (multi-file mode)
playwright-repl --replay examples/ --silent

# Or inside the REPL
pw> .replay my-test.pw
```

Multi-file replay runs all files sequentially, writes a `replay-<timestamp>.log` with per-command results, and prints a pass/fail summary. Exit code 0 if all pass, 1 if any fail.

#### File Format

`.pw` files are plain text — human-readable, diffable, version-controllable:
Expand Down Expand Up @@ -420,7 +431,7 @@ playwright-repl --connect 9222

## Examples

All examples use the [TodoMVC demo](https://demo.playwright.dev/todomvc/) and can be run directly:
Examples use the [TodoMVC demo](https://demo.playwright.dev/todomvc/) and [playwright.dev](https://playwright.dev/). All can be run directly or together via multi-file replay:

| File | Description |
|------|-------------|
Expand All @@ -430,6 +441,8 @@ All examples use the [TodoMVC demo](https://demo.playwright.dev/todomvc/) and ca
| [04-replay-session.pw](packages/cli/examples/04-replay-session.pw) | Replay with step-through |
| [05-ci-pipe.pw](packages/cli/examples/05-ci-pipe.pw) | CI smoke test |
| [06-edit-todo.pw](packages/cli/examples/06-edit-todo.pw) | Double-click to edit a todo |
| [07-test-click-nth.pw](packages/cli/examples/07-test-click-nth.pw) | `--nth` disambiguation on playwright.dev |
| [08-localstorage.pw](packages/cli/examples/08-localstorage.pw) | localStorage commands: list, clear, reload |

Try one:

Expand All @@ -442,6 +455,9 @@ playwright-repl --replay packages/cli/examples/04-replay-session.pw --step --hea

# Run as a CI smoke test (headless, silent)
playwright-repl --replay packages/cli/examples/05-ci-pipe.pw --silent

# Run all examples (multi-file replay with log report)
playwright-repl --replay packages/cli/examples/ --silent
```

## Monorepo Structure
Expand Down
5 changes: 2 additions & 3 deletions package-lock.json

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

3 changes: 3 additions & 0 deletions packages/cli/examples/01-add-todos.pw
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ verify-text "Buy groceries"
verify-text "Write tests"
verify-text "Deploy to production"
verify-text "3 items left"

# Cleanup
localstorage-clear
3 changes: 3 additions & 0 deletions packages/cli/examples/02-complete-and-filter.pw
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ click "All"
click "Clear completed"
verify-text "Write tests"
verify-text "Deploy to production"

# Cleanup
localstorage-clear
3 changes: 3 additions & 0 deletions packages/cli/examples/03-record-session.pw
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ check "Buy groceries"
verify-text "1 item left"
click "Clear completed"
verify-text "Write tests"

# Cleanup
localstorage-clear
3 changes: 3 additions & 0 deletions packages/cli/examples/04-replay-session.pw
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ check "Buy groceries"
verify-text "2 items left"
check "Write tests"
verify-text "1 item left"

# Cleanup
localstorage-clear
3 changes: 3 additions & 0 deletions packages/cli/examples/05-ci-pipe.pw
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ press Enter
verify-text "2 items left"
check "Buy groceries"
verify-text "1 item left"

# Cleanup
localstorage-clear
3 changes: 3 additions & 0 deletions packages/cli/examples/06-edit-todo.pw
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ press Control+a
type "Buy organic groceries"
press Enter
verify-text "Buy organic groceries"

# Cleanup
localstorage-clear
25 changes: 25 additions & 0 deletions packages/cli/examples/08-localstorage.pw
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Test localStorage commands
# App: https://demo.playwright.dev/todomvc/

goto https://demo.playwright.dev/todomvc/
fill "What needs to be done?" "Buy groceries"
press Enter
fill "What needs to be done?" "Write tests"
press Enter
verify-text "2 items left"

# Verify localStorage has data
localstorage-list

# Clear and verify empty
localstorage-clear
localstorage-list
reload

# After reload with empty storage, todos should be gone
fill "What needs to be done?" "Fresh todo"
press Enter
verify-text "1 item left"

# Cleanup
localstorage-clear
5 changes: 3 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playwright-repl",
"version": "0.5.0",
"version": "0.6.0",
"description": "Interactive REPL for Playwright browser automation — keyword-driven testing from your terminal",
"type": "module",
"bin": {
Expand All @@ -13,7 +13,8 @@
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc",
"test": "vitest run"
"test": "vitest run",
"test:e2e": "node dist/playwright-repl.js --replay examples/ --silent"
},
"keywords": [
"playwright",
Expand Down
15 changes: 13 additions & 2 deletions packages/cli/src/playwright-repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* playwright-repl [options]
* playwright-repl --replay session.pw
* playwright-repl --replay session.pw --step
* playwright-repl --replay file1.pw file2.pw
* playwright-repl --replay examples/
* playwright-repl --record my-test.pw
*/

Expand Down Expand Up @@ -43,7 +45,7 @@ Options:
--port <number> Extension server port (default: 6781)
--cdp-port <number> Chrome CDP port (default: 9222)
--config <file> Path to config file
--replay <file> Replay a .pw session file
--replay <files...> Replay .pw file(s) or folder(s)
--record <file> Start REPL with recording to file
--step Pause between commands during replay
-q, --silent Suppress banner and status messages
Expand Down Expand Up @@ -72,11 +74,20 @@ Examples:
playwright-repl --extension --cdp-port 9333 # custom CDP port
playwright-repl --replay login.pw # replay a session
playwright-repl --replay login.pw --step # step through replay
playwright-repl --replay tests/ # replay all .pw files in folder
playwright-repl --replay a.pw b.pw # replay multiple files
echo "open https://example.com" | playwright-repl # pipe commands
`);
process.exit(0);
}

// Collect replay targets: --replay value + any remaining positional args
const replayFiles: string[] = [];
if (args.replay) {
replayFiles.push(args.replay as string);
for (const a of args._ as string[]) replayFiles.push(String(a));
}

startRepl({
session: args.session as string,
headed: args.headed as boolean,
Expand All @@ -89,7 +100,7 @@ startRepl({
port: args.port ? parseInt(args.port as string, 10) : undefined,
cdpPort: args['cdp-port'] ? parseInt(args['cdp-port'] as string, 10) : undefined,
config: args.config as string,
replay: args.replay as string,
replay: replayFiles.length > 0 ? replayFiles : undefined,
record: args.record as string,
step: args.step as boolean,
silent: args.silent as boolean,
Expand Down
Loading