test(e2e): scaffold happy-path capture suite (Phase 1)#336
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ts—launchPersistentContextwith--use-fake-ui/device-for-media-streampre-armed (Phase 2 video doesn't need to touch this) +getExtensionId()that resolves the runtime ID from the SW URL.auth.ts— seeds theauth-tokens-storage-keyshape frompackages/storage/lib/impl/auth/tokens.storage.tsso the popup opens past the login screen.mock-api.ts—context.route()interceptors forPOST /slices/draft,POST /slices/{id}/assets/{aid}, andPOST /auth/refresh. Records every hit and exposeswaitForAssetUpload().host-page.html— minimalfile://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.fixmeuntil selectors are validated against a fresh build. Flip on by removing.fixmeonce 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:
pnpm test:happybuilds Chrome prod + runs the new spec.tests/e2e:test:sitenow matchesnon-interference.spec.tsexplicitly so the new spec doesn't run there.Test plan
pnpm exec tsc --noEmit -p tests/e2e/playwright/tsconfig.jsonclean.npx eslint tests/e2e/playwright/**/*.tsclean.pnpm test:happylocally withtest.fixmeremoved; tune selectors as needed; flip the fixme off in a follow-up.