5.0 KiB
5.0 KiB
swap-testing-e2e-cloakbrowser — tasks
- 1. Add
cloakbrowser: ^0.3.28as a direct dep inpackages/testing/testing-e2e/package.json(skip the root testing catalog for now to avoid entanglement with concurrent root-package.jsonwork). - 2. Add
./cloakserveand./presetsto the package exports map; update description. - 3. Add
CLOAK_*error codes:- Append
LAUNCH_FAILED,BINARY_MISSING,PROXY_INVALIDtosrc/errors/codes.tsregistry under domainCLOAK. - Add
CloakLaunchErrorclass tosrc/errors/testing-e2e-error.ts. - Add
classifyCloakError(err)+wrapCloakError(err, context?)helpers. - Co-located
.md+ tests covering all three codes + the classifier + the wrapper remediation hints.
- Append
- 4. Refactor
src/extension-fixture/launch-with-extension.ts:- Drop
chromium: BrowserTypeparameter. - Accept optional
launchPersistentContextinjector (default:cloakbrowser's, resolved via dynamicimportwith cache +_resetDefaultLauncherCachetest hook). - Forward
launchOptions(proxy / humanize / geoip / …) untouched. - Wrap launcher errors with
wrapCloakError. - Update tests +
.md; updatelaunch-with-extension.types.ts.
- Drop
- 5. Override
browserworker fixture insidesrc/fixtures/extended-test.ts:- Add
cloak: CloakOptionsworker option (Playwrightoption: true) with{ headless: true }default. - Extract
launchBrowserWithCloak(opts, injectedLaunch?)as a unit-testable helper backed bycloakbrowser.launch. - Override
browserfixture to call the helper;apiContextdepends on Playwright's built-inplaywrightfixture (notbrowser) so API-only tests never start Chromium. - Wrap errors with
wrapCloakError. - Update tests (source-level pins + runtime classifier tests) +
.md.
- Add
- 6. Add
src/cloakserve/:cloakserve-options.types.tswithCloakServeFingerprint+CloakServeConnectOptions.build-cloakserve-url.ts— pure URL builder with camelCase → kebab-case mapping.cloakserve-connect.ts—connectCloakServe(options, chromium?)wrappingchromium.connectOverCDP; lazy@playwright/testimport +_resetCloakServeChromiumCachehook; errors wrapped inCloakLaunchError.index.tsbarrel with explicit named exports (rule 10)..mdper impl file + tests covering URL building, default base URL, kebab-case mapping, boolean stringification, error classification, lazy import caching.
- 7. Add
src/presets/:STEALTH_DEFAULT_CLOAK,STEALTH_HEADED_CLOAKfrozen presets.stealthMax(proxy)+stealthMaxHeadless(proxy)factory presets matching the upstream "Recommended config for anti-bot sites" block..md+ tests.
- 8. Extend
tests/no-disallowed.test.tswith patterns flaggingwaitForTimeoutandwait_for_timeoutcalls insrc/. - 9. Add
docker/bundle:Dockerfile.cloakserveextendingcloakhq/cloakbrowser, installing the Kasada / Akamai font set, defaulting tocloakserve, healthcheck on/json/version.Dockerfile.managerextendingcloakhq/cloakbrowser-manager,/datavolume, healthcheck on/api/status.docker-compose.yml— both services bound to127.0.0.1; manager behind themanagercompose profile;cloakprofilesnamed volume..env.exampleforCLOAKBROWSER_TAG,MANAGER_TAG,MANAGER_AUTH_TOKEN.docker/README.mdoperator playbook.
- 10. Update
src/index.tsbarrel: re-export new cloakserve symbols, presets, and CLOAK error helpers. - 11. Update vite externals +
vite.config.tsentries for the new subpath modules. - 12. Rewrite
README.md— stealth swap summary, binary download note, humanize/proxy/geoip features, worked examples (extendedTest, cloakserve, presets, Docker, extension fixture). - 13. Add
tests/dep-graph.test.tsassertion thatcloakbrowseris a direct dep. - 14. Pre-publish gate:
bunx turbo lint typecheck test --filter=@suaveplan/testing-e2egreen;bunx turbo test:coverage --filter=@suaveplan/testing-e2eat 100% on all metrics;bun run docs:check100%. - 15. On ship (post-merge): fold delta into
openspec/specs/testing-e2e/spec.md; archive change folder underopenspec/archive/<date>-swap-testing-e2e-cloakbrowser/.
0. Pre-flight (non-negotiable)
- 0.1 Confirm clean working tree (
git statusreports nothing) and no in-flight worktrees with uncommitted work (git worktree listthengit statusin each) - 0.2 If any worktrees exist under
.claude/worktrees/, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (git worktree remove) before opening a new one — code that has been lost twice on main is the failure mode this guards against. - 0.3 Confirm the package set in
MANIFEST.mdmatchesfind packages -maxdepth 3 -name package.jsoncount. Drift here means a prior change archived without regenerating the manifest.