You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: playwright e2e tests for vscode extension (#161)
* feat: add Playwright e2e infrastructure for VS Code extension testing
Adds a complete end-to-end test setup using Playwright's Electron API to
validate the Pixel Agents extension inside a real VS Code instance.
- e2e/playwright.config.ts — config with video, trace, 1-worker isolation
- e2e/global-setup.ts — downloads VS Code via @vscode/test-electron
- e2e/helpers/launch.ts — launches VS Code with isolated HOME + mock PATH
- e2e/helpers/webview.ts — waits for the webview frame, clicks + Agent
- e2e/fixtures/mock-claude — deterministic claude shim: creates JSONL file,
logs invocation; no real Claude CLI required
- e2e/tests/agent-spawn.spec.ts — first spec: click + Agent → assert mock called,
JSONL session file created, terminal tab visible
- e2e/tsconfig.json — strict TypeScript config for test code
NPM scripts added: e2e (xvfb-run headless), e2e:headed, e2e:debug
CONTRIBUTING.md updated with running instructions, artifact paths, mock docs
test-results/ and playwright-report/ added to .gitignore
Test passes locally in 25 s; video recording confirmed at
test-results/e2e/videos/<test-name>/*.webm
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* feat: revert this commit later, for now we will include video report in artifact
* test: enlarge panel for e2e webview
* feat: enable tests in pipeline
* feat: add debugging help for e2e test
* ci: install Playwright with deps and chromium
* revert: add debugging help for e2e test
This reverts commit 52096c0.
* fix: cross-platform e2e fixes for Playwright tests on macOS
* fix: Windows e2e support, add mock-claude.cmd
* feat: enable matrix CI run
* fix: resolve e2e failures across CI platforms
* fix: prevent Windows CI installs from failing
* fix: e2e:headed broke
* revert: fix: e2e:headed broke
This reverts commit bcffe69.
* chore: dropping support for headed
* docs: dropped support for headed
* fix: using cached vscode-test
* fix: wrong path for cache
* feat: restore and cache .vscode-test. First run will always say cache not found
* fix: poisoned cache, retrying with new
* feat: caching playwright as well
* fix: flaky test step in macos ci
* fix: e2e dynamic VS Code cache key, keychain cleanup
* fix: e2e avoid stale row selection
* fix: e2e macos display palette
* ci: skip PR title check for Dependabot, restrict badge updates to main repo
* ci: skip PR title check for Dependabot, restrict badge updates to main repo
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Florin Timbuc <florin@sowild.design>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,6 +94,49 @@ These conventions are enforced by custom ESLint rules (`eslint-rules/pixel-agent
94
94
95
95
These rules are set to `warn` — they won't block your PR but will flag violations for cleanup.
96
96
97
+
## End-to-End Tests
98
+
99
+
The `e2e/` directory contains Playwright tests that launch a real VS Code instance with the extension loaded in development mode.
100
+
101
+
### Running e2e tests locally
102
+
103
+
```bash
104
+
# Build the extension first (tests load the compiled output)
105
+
npm run build
106
+
107
+
# Runs the e2e test
108
+
npm run e2e
109
+
110
+
# Step-by-step debug mode
111
+
npm run e2e:debug
112
+
```
113
+
114
+
On the first run, `@vscode/test-electron` will download a stable VS Code release into `.vscode-test/` (≈200 MB). Subsequent runs reuse the cache.
115
+
116
+
### Artifacts
117
+
118
+
All test artifacts are written to `test-results/e2e/`:
119
+
120
+
| Path | Contents |
121
+
|---|---|
122
+
|`test-results/e2e/videos/<test-name>/`|`.webm` screen recording for every test |
123
+
|`playwright-report/e2e/`| Playwright HTML report (`npx playwright show-report playwright-report/e2e`) |
124
+
|`test-results/e2e/*.png`| Final screenshots saved on failure |
125
+
126
+
On failure, the test output prints the path to the video for that run.
127
+
128
+
### Mock claude
129
+
130
+
Tests never invoke the real `claude` CLI. Instead, a bash script at `e2e/fixtures/mock-claude` is copied into an isolated `bin/` directory and prepended to `PATH` before VS Code starts.
131
+
132
+
The mock:
133
+
1. Parses `--session-id <uuid>` from its arguments.
134
+
2. Appends a line to `$HOME/.claude-mock/invocations.log` so tests can assert it was called.
135
+
3. Creates `$HOME/.claude/projects/<project-hash>/<session-id>.jsonl` with a minimal init line so the extension's file-watcher can detect the session.
136
+
4. Sleeps for 30 s (keeps the terminal alive) then exits.
137
+
138
+
Each test runs with an isolated `HOME` and `--user-data-dir`, so no test state leaks between runs or into your real VS Code profile.
139
+
97
140
## Submitting a Pull Request
98
141
99
142
1. Fork the repo and create a feature branch from `main`
0 commit comments