Skip to content

test(e2e): scaffold happy-path capture suite (Phase 1)#336

Merged
ionleu merged 1 commit into
developfrom
test/capture-happy-path
Jun 12, 2026
Merged

test(e2e): scaffold happy-path capture suite (Phase 1)#336
ionleu merged 1 commit into
developfrom
test/capture-happy-path

Conversation

@ionleu

@ionleu ionleu commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

First positive-assertion E2E for the extension. Sister suite to the existing non-interference.spec.ts; same persistent-context Chromium loader.

New fixtures under tests/e2e/playwright/fixtures/:

  • extension.tslaunchPersistentContext with --use-fake-ui/device-for-media-stream pre-armed (Phase 2 video doesn't need to touch this) + getExtensionId() that resolves the runtime ID from the SW URL.
  • auth.ts — seeds the auth-tokens-storage-key shape from packages/storage/lib/impl/auth/tokens.storage.ts so the popup opens past the login screen.
  • mock-api.tscontext.route() interceptors for POST /slices/draft, POST /slices/{id}/assets/{aid}, and POST /auth/refresh. Records every hit and exposes waitForAssetUpload().
  • host-page.html — minimal file:// fixture so the content script has a mount point.

New spec capture-screenshot-happy.spec.ts: drives popup → screenshot CTA → annotate (one rectangle on the fabric canvas) → submit, then asserts exactly one asset upload reached the mock with a multipart body.

Marked test.fixme until selectors are validated against a fresh build. Flip on by removing .fixme once a local run passes. Phase 2 (video + rrweb) will land on top of this fixture base; Phase 3 (real-backend soak) is a separate, optional suite.

Wiring:

  • Root: pnpm test:happy builds Chrome prod + runs the new spec.
  • tests/e2e: test:site now matches non-interference.spec.ts explicitly so the new spec doesn't run there.

Test plan

  • pnpm exec tsc --noEmit -p tests/e2e/playwright/tsconfig.json clean.
  • npx eslint tests/e2e/playwright/**/*.ts clean.
  • Run pnpm test:happy locally with test.fixme removed; tune selectors as needed; flip the fixme off in a follow-up.

Adds a Playwright-based positive-assertion harness for the
popup → screenshot → annotate → send flow. Sister suite to the existing
non-interference spec; same persistent-context loader pattern.

New fixtures under tests/e2e/playwright/fixtures/:
- extension.ts — launchPersistentContext with --use-fake-ui/device-for-
  media-stream pre-armed (Phase 2 video work won't have to touch this),
  plus a getExtensionId() helper that resolves the runtime ID off the
  service worker URL.
- auth.ts — seeds authTokensStorage via chrome.storage.local.set with
  the exact 'auth-tokens-storage-key' shape from
  packages/storage/lib/impl/auth/tokens.storage.ts so the popup opens
  past the login screen.
- mock-api.ts — context.route() interceptors for POST /slices/draft,
  POST /slices/{id}/assets/{aid}, and POST /auth/refresh. Records every
  hit and exposes waitForAssetUpload() so specs can assert on the upload
  payload without needing a real backend.
- host-page.html — minimal local fixture page served via file:// so the
  content script has a mount point.

New spec capture-screenshot-happy.spec.ts drives the full flow and
asserts exactly one asset upload reached the mock with a multipart body.
Marked test.fixme until the selector pass has been validated against a
fresh build — flip it on by removing .fixme once you've run it locally.

Wiring:
- Root: `pnpm test:happy` builds Chrome prod + runs the new spec.
- tests/e2e: test:site now matches non-interference.spec.ts explicitly
  so the new spec doesn't accidentally run under the old script.
@ionleu ionleu requested a review from LuminitaL as a code owner June 12, 2026 01:06
@ionleu ionleu merged commit 5eb292e into develop Jun 12, 2026
4 of 6 checks passed
@ionleu ionleu deleted the test/capture-happy-path branch June 12, 2026 01:46
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