Files
nym/wasm/smolmix/tests/README.md
T
mfahampshire 43a1bd38e8 Max/smolmix wasm (#6784)
* Mod gitignore + license trimming + comment trimming

* Big rewrite

* SURB inputs + DNS button in internal-dev

* Make ipr addr optional

* Accidentatly omitted files from rewrite commit

* Makefile + readme

* Comment rewrite

* Optimisation comment

* Replace manual waker map with
      smoltcp built-ins + adaptive poll

* Comments

* Extract socket creation helpers into stream.rs

* Cleanup comments

* Comment

* Comment notes and restrict ciphersuites wrt rustls-rustcrypto

* Dep. hack fix for demo + add clearnet fetch() for contrast

* Stripped down devtester

* Fix Clippy arg (fatfingered deletion)

* CodeRabbit catches

* Cargofmt

* Review nits: bridge logs, fetch early-return, static port counter, copyright years, README + Cargo + headless.js tidying

* PHONY + taskset override, switch internal-dev/tests to pnpm, fix wasm-pack out-dir

* Gate codec tests behind the codec feature for no-default-features builds

* IPv6 addr/route on smoltcp iface + configurable DNS resolvers via TunnelOpts

* DNS GUI inputs, close stale WS on reconnect, worker init guards + ws-send warning, Playwright listener cleanup, pnpm-lock in internal-dev

* Fix lp -> lp-data after rebase

* Revert nym-lp/nym-lp-data feature-gating left over from rebase

* Lift getrandom wasm_js cfg to workspace .cargo/config.toml so cargo check -p smolmix-wasm works from any CWD

* temp will amend git message

* Auto-discover IPR when none specified + 'Use random IPR' checkbox in internal-dev

* smolmix_tracker + State machine + ready_tunnel gate + getTunnelState JS surface

* Mirror red display() entries to console.error

* Add left out package-lock

* Reactor clock + yield_now + atomic seq + gateway-storage errors

* setupMixTunnel gate + MTU 1980 + http::Uri cleanup

* Review pass + fix test + clippy

* restore axum 0.8 bump from borked earlier merge

* Feature gating (dns/fetch/socket) + TunnelOptsBuilder + pnpm bypass

* Cont. with review comments

* tokio Nofity reactor wakes + cancellation + setup polishing

* Notify wakes + inner pattern + close_notify + util

* Tunable tunnelopts

* Fix tired commit

* CI prep

* Lint + Clippy

* coderabbit u32 fix

* nits + runtime debugging + expose in internal-dev

* remove redudant default-features

* Remove more redundant default-features
2026-05-28 15:57:10 +00:00

4.4 KiB

smolmix-wasm Playwright Tests

Automated browser tests for the smolmix-wasm mixnet tunnel. Runs smoke tests and a full test suite (HTTPS cold/warm, stress httpbin) across Chromium, Firefox, and WebKit.

Prerequisites

  1. Build the WASM package and internal-dev harness:
# from repo root
make build-debug
cd wasm/smolmix/internal-dev && pnpm run build
  1. Install test dependencies and browser engines (first time only):
cd wasm/smolmix/tests
pnpm install
pnpm exec playwright install

Running Tests

Both suites use a hardcoded default IPR (see internal-dev/index.html and internal-dev/headless.js); no env var is required to run them. Override the default by exporting IPR_ADDRESS if you want to point at a different exit node:

export IPR_ADDRESS="6B6iuWX4bQP4GVA4Yq7XmZencaaGw6BaPY6xJWYSwsbF.6g6LRx1fgU2Q2A4ZPKonYHtfBARh1GPMe1LtXk6vpRR8@q2A2cbooyC16YJzvdYaSMH9X3cSiieZNtfBr8cE8Fi1"

Pick any combination of projects to run:

pnpm exec playwright test --project=smoke-chromium
pnpm exec playwright test --project=suite-firefox
pnpm exec playwright test --project=smoke-webkit --project=suite-webkit
pnpm exec playwright test                          # all 6 projects

Available projects: smoke-chromium, smoke-firefox, smoke-webkit, suite-chromium, suite-firefox, suite-webkit.

Test Structure

Smoke

Loads the internal-dev page, fills in the IPR address, clicks setup, and verifies the tunnel connects without errors. Quick connectivity check (~30s).

Suite

Loads headless.html which auto-runs three tests in sequence:

Test What it measures
Smoke (cold HTTPS) Full pipeline: DNS + TCP + TLS + HTTP
HTTPS GET (warm) Pooled connection reuse (HTTP only)
Stress httpbin Mixed-size concurrent requests (serialised per-origin)

Runs twice — once per traffic configuration:

  1. No cover traffic, no Poisson — baseline performance
  2. With cover traffic + Poisson distribution — realistic mixnet conditions

Pass criteria:

  • Smoke and HTTPS warm must pass
  • Stress httpbin >= 80% success rate

Manual Headless Testing

Run the headless test runner directly in a browser without Playwright:

cd wasm/smolmix/internal-dev && pnpm start

Then open:

  • http://localhost:9000/headless.html — no cover, no Poisson (default)
  • http://localhost:9000/headless.html?cover=true&poisson=true — with cover + Poisson

URL parameters:

Param Default Description
ipr hardcoded default IPR exit node address
cover false Enable cover traffic
poisson false Enable Poisson dummy traffic
count 10 Stress test request count

Timeouts

  • Smoke: 3 minutes (tunnel setup ~10s, connectivity check ~20s)
  • Suite: 10 minutes per config (mixnet round-trips are ~1-2s each)

Known Issues

Playwright Firefox hangs at IPR connect on Arch/Manjaro

Playwright ships a forked Firefox build (Mozilla's "Juggler" patches) to enable remote control. On Arch-family hosts (Manjaro confirmed) this bundled Firefox hangs indefinitely at the IPR connect handshake step, in both headed and headless modes. The bug is unique to the playwright Firefox build; the same URL loads fine in the system Firefox installation.

The smoke and suite tests reach [ipr] sending connect handshake and then stall until the playwright timeout fires. Topology fetches against validator.nymtech.net succeed; the gateway WSS connection or its message flow is where it dies. Adding firefoxUserPrefs for timer throttling, DoH, captive portal probes, and IndexedDB persistence does not help.

You cannot point executablePath at the system Firefox; playwright's Firefox binary must speak the Juggler protocol, which mainline Firefox does not.

Workaround: run chromium locally; skip firefox, or run it from a CI image whose playwright Firefox binary is built for that platform.

pnpm exec playwright test --project=smoke-chromium

Playwright Webkit missing libraries on Arch/Manjaro

Playwright bundles libwebkit2gtk and a chain of GTK/glib/icu/freetype deps expecting Ubuntu library layouts. On Arch-family hosts those library versions or paths differ and webkit fails to launch. Same class of bug as the Firefox hang, different symptom.

Workaround: run webkit tests from a CI image (or container) with the Ubuntu-shaped library layout playwright expects.