Skip to content

feat: playwright e2e tests for vscode extension#161

Merged
florintimbuc merged 32 commits intopablodelucca:mainfrom
NNTin:feat/playwright-e2e-tests-for-vscode-extension
Mar 24, 2026
Merged

feat: playwright e2e tests for vscode extension#161
florintimbuc merged 32 commits intopablodelucca:mainfrom
NNTin:feat/playwright-e2e-tests-for-vscode-extension

Conversation

@NNTin
Copy link
Contributor

@NNTin NNTin commented Mar 18, 2026

This is a smoke test. It starts the VS Code Extension and pressed on the "+ Agent" button. It is verified that a new terminal pops up.
This is a core behavior so we know if this flow doesn't work something fundamental has broken.

ca2a2272e031af72493ed2eec10e946650157ece.webm

Feel free reverting the commit "feat: revert this commit later, for now we will include video report in artifact". I left it in since I found it useful and no test artifact is being uploaded.

AI Summary below

Summary

  • Adds a complete Playwright end-to-end test infrastructure that validates the Pixel Agents extension inside a real VS Code/Electron instance
  • First test: clicking + Agent in the Pixel Agents webview spawns mock claude, creates a JSONL session file, and shows a Claude Code terminal tab
  • No real Claude CLI is required — a deterministic bash shim handles invocation

What's included

File Purpose
e2e/playwright.config.ts Playwright config — video on, trace on retry, 1 worker
e2e/global-setup.ts Downloads VS Code once via @vscode/test-electron, caches to .vscode-test/
e2e/helpers/launch.ts Launches VS Code with --extensionDevelopmentPath, isolated HOME+userDataDir, mock claude in PATH, records video
e2e/helpers/webview.ts Waits for the Pixel Agents webview iframe, clicks + Agent
e2e/fixtures/mock-claude Bash shim — parses --session-id, writes invocation log, creates .jsonl file
e2e/tests/agent-spawn.spec.ts First spec: asserts mock invoked, JSONL created, terminal tab visible
e2e/tsconfig.json Strict TypeScript config for e2e code

How to run

npm run build   # required first — tests load compiled dist/
npm run e2e     # headless (Linux: wraps with xvfb-run)
npm run e2e:headed
npm run e2e:debug

Test result

✓  clicking + Agent spawns mock claude and creates a JSONL session file (24.6s)
1 passed (26.0s)

Video recorded at test-results/e2e/videos/<test-name>/*.webm

Flakiness notes & mitigations

Risk Mitigation
VS Code slow to start 60 s workbench timeout + waitForSelector('.monaco-workbench')
Webview frame not yet attached getPixelAgentsFrame polls all frames every 500 ms for up to 30 s
Terminal tab rendering lag Text locator /Claude Code #\d+/ is resilient to aria-label changes
JSONL not created expect.poll retries for 20 s at 500 ms / 1 s intervals
Display unavailable on Linux xvfb-run --auto-servernum in the e2e script

🤖 Generated with Claude Code

NNTin and others added 7 commits March 18, 2026 19:30
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>
@florintimbuc florintimbuc added type: chore Dependencies, CI, build tooling, docs updates area: ci CI pipelines, testing infrastructure, GitHub Actions labels Mar 19, 2026
@NNTin NNTin force-pushed the feat/playwright-e2e-tests-for-vscode-extension branch from 124cc3a to a3657c8 Compare March 23, 2026 14:48
@NNTin NNTin force-pushed the feat/playwright-e2e-tests-for-vscode-extension branch from a3657c8 to 3f418f0 Compare March 23, 2026 14:52
@NNTin NNTin force-pushed the feat/playwright-e2e-tests-for-vscode-extension branch from 371f654 to a6900a8 Compare March 23, 2026 20:52
@florintimbuc florintimbuc merged commit 19408ec into pablodelucca:main Mar 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI pipelines, testing infrastructure, GitHub Actions type: chore Dependencies, CI, build tooling, docs updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants