Skip to content

test(e2e): Playwright smoke test loading the unpacked extension#16

Merged
DCCA merged 1 commit into
mainfrom
test/e2e-extension-smoke
Jun 27, 2026
Merged

test(e2e): Playwright smoke test loading the unpacked extension#16
DCCA merged 1 commit into
mainfrom
test/e2e-extension-smoke

Conversation

@DCCA

@DCCA DCCA commented Jun 27, 2026

Copy link
Copy Markdown
Owner

What

An end-to-end smoke test that launches real Chromium (new headless) with the unpacked dist/ loaded (--load-extension) and exercises the page-side parts of one-click capture that browser automation can drive:

  • Extension loads — service worker registers; manifest has no default_popup and includes the downloads permission.
  • On-page capture notice — driven through the real injected content script via SB_CAPTURE_BEGIN / SB_SET_OVERLAY / SB_CAPTURE_END: shows (display:flex, correct text), hides cleanly (display:none — the leak fix), and is removed from the DOM.
  • Editor page rendersCapture Page and Copy for Claude Code buttons are visible.

How it's wired

  • @playwright/test devDep + npm run test:e2e (builds dist/, then playwright test).
  • playwright.config.ts (testDir: tests/e2e); vitest.config.ts scopes unit tests to tests/**/*.test.ts so vitest ignores the .spec.ts.
  • Playwright artifacts gitignored; command documented in CLAUDE.md.

Deliberately excluded from npm run check and CI — it needs downloaded browsers + new-headless. Run locally after a one-time npx playwright install chromium.

Verification

  • npm run test:e2e3 passed.
  • Unit gate unaffected: npm run check green (vitest still 7 unit files, no e2e), npm audit --audit-level=high → 0 vulnerabilities, format:check clean.

🤖 Generated with Claude Code

Adds an end-to-end smoke test that launches real Chromium (new headless)
with dist/ loaded via --load-extension and asserts the parts of one-click
capture that are automatable without the browser toolbar: the extension /
service worker loads (no popup, downloads permission), the on-page capture
notice shows → hides → is removed (driven through the real content script
with SB_CAPTURE_* messages), and the editor page renders.

- @playwright/test devDep + `npm run test:e2e` (builds dist, then runs).
- playwright.config.ts (testDir tests/e2e); vitest scoped to *.test.ts so it
  ignores the spec.
- gitignore Playwright artifacts; document the command in CLAUDE.md.

Deliberately excluded from `npm run check`/CI (needs downloaded browsers +
new-headless); run locally after `npx playwright install chromium`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@DCCA
DCCA force-pushed the test/e2e-extension-smoke branch from 61e6de9 to d0a2c1f Compare June 27, 2026 21:36
@DCCA

DCCA commented Jun 27, 2026

Copy link
Copy Markdown
Owner Author

Review (independent subagent + applied fixes)

Verdict: ship. No blockers. Verified by running the gates: npm run test (7 unit files, 54 pass — e2e .spec.ts correctly excluded via vitest.config.ts), typecheck/lint/build clean, npm audit --audit-level=high → 0 vulns, npm run test:e2e → 3 pass. Confirmed e2e is genuinely out of npm run check and CI.

Applied the two worthwhile nits:

  • Hardened send() to retry until the content script receives the message (it registers at document_idle, so the first send could race page load) and to throw clearly if it never arrives — folds in the "assert tab exists" suggestion.
  • Added vitest.config.ts + playwright.config.ts to tsconfig.json include so typecheck covers them too.

Re-ran after the changes: e2e 3/3, typecheck/lint/unit/format all green.

@DCCA
DCCA merged commit 6bc2f47 into main Jun 27, 2026
2 checks passed
@DCCA
DCCA deleted the test/e2e-extension-smoke branch June 27, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant