sdk/js-sdk/notes/BROWSER-TEST-PLAN.md
This repo is an SDK for encrypting/decrypting data using 2 WASM modules (TFHE + TKMS).
The SDK always runs in multi-threaded mode — TFHE spawns Web Workers and requires
SharedArrayBuffer. This is the primary reason browser testing is necessary: we must
validate that WASM threading works correctly under real browser security constraints.
Validate the SDK's encrypt/decrypt functionality across all major browsers via Playwright, with a focus on multi-threaded WASM execution.
Cross-Origin-Opener-Policy: same-originCross-Origin-Embedder-Policy: require-corp.wasm files cannot be served. Test that it works, but don't optimize for its performance — the slowness is an accepted tradeoff.test:browser (automated), test:browser:manual (dev server)Each scenario is a self-contained page that reports pass/fail with step timings.
| Page | Description |
|---|---|
smoke-base64.html | createFhevmClient() + init() — proves WASM, workers, and FHE key download work using fallback base64 |
smoke-wasm.html | createFhevmClient() + init() — proves WASM, workers, and FHE key download work using native wasm files |
| (future) | Encrypt uint16 round-trip |
| (future) | Base64 WASM fallback loading |
| (future) | Worker termination and cleanup |
Minimal browser test using the real SDK API:
setFhevmRuntimeConfig()createFhevmClient({ chain: sepolia, provider })await client.init() — loads WASM, spawns workers, downloads global FHE keyIf this passes, the SDK works in the browser.
Browser tests live in a dedicated, self-contained directory, fully isolated from the SDK source:
test/browser/
├── index.html # Links to all test pages (for manual browsing)
├── vite.config.ts # Vite dev server config (COOP/COEP headers)
├── playwright.config.ts # Playwright config (browsers, timeouts)
├── pages/ # One HTML page per test scenario
│ ├── smoke-base64.html
│ └── ...
├── scripts/ # Test logic (one script per page)
│ ├── smoke-base64.ts
│ └── ...
└── specs/ # Playwright specs (one spec per page)
├── smoke-base64.spec.ts
└── ...
For visual debugging and performance inspection:
npm run test:browser:manual to start the Vite dev serverhttp://localhost:3333/test/browser/index.html in Safari or Chrome