cloudflare / cloudflare/sandbox-sdk

Add E2E test coverage for preview URL routing

Open
#389 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
1.1k
Forks
114
Avg merge
22h 42m
Merged PRs (30d)
14

Description

The `proxyToSandbox()` → `sandbox.fetch()` path (preview URL routing for WebSocket upgrades) has no E2E test coverage. A `this` binding bug in the `getSandbox()` proxy went undetected because:

- Unit tests mock the stub, so `this` binding issues don't manifest
- Existing WebSocket E2E tests use `wsConnect()` (already in `enhancedMethods`), not preview URLs

A unit test for the proxy contract has been added, but an E2E test that actually hits a preview URL would catch routing, token validation, and port switching issues end-to-end.

**Blocked on**: The E2E test worker runs on `.workers.dev` which doesn't support `exposePort()`. The test infrastructure needs a custom domain with wildcard DNS before this test can be added.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.