Files
zeekay f627f20da1 e2e: Playwright smoke + multi-tenant specs for tenant bridge SPA
Env-parametric specs covering bridge.lux.network (and bridge.zoo.network
+ future tenants). Mirrors the wider Lux e2e env routing convention:

  E2E_ENV=local (default) → http://localhost:3001 (auto-boots vite preview)
  E2E_ENV=dev             → https://bridge.lux-dev.network
  E2E_ENV=test            → https://bridge.lux-test.network
  E2E_ENV=main            → https://bridge.lux.network
  BRIDGE_TENANT=zoo       → https://bridge.zoo.network (mainnet only)

smoke.spec.ts (6 cases, ~16s):
  1. Renders, title matches brand, SVG brand logo from @luxfi/logo
  2. From-chain selector has ≥ 2 options
  3. From-asset selector has ≥ 2 options after switching to Ethereum
     (default chain Lux only has the native LUX asset)
  4. Connect-wallet button visible + clickable (no real wallet connect)
  5. Typing an amount updates the "You receive" estimate via useSwap
  6. Production gate: served HTML + JS bundles free of `DEADBEEF`
     (the dev-only stub MPC display address)

multi-tenant.spec.ts (skips unless E2E_ENV=main):
  - For each tenant in the registry, probe DNS, navigate, assert
    document.title and the --brand-primary CSS variable set by
    applyBrandMetadata reflect the tenant's pinned brand block.

Playwright config auto-boots `vite preview` on :3001 from app/bridge/
when E2E_ENV=local, so `pnpm test:smoke` is one-step after `pnpm build`.
README documents the build prereq and the runner contract.

Out of scope (TODOs in code):
  - Real wallet connect (Playwright wallet mocking is a separate PR)
  - Real backend swap submit (prod backend not reliably reachable from CI)
  - Visual regression / screenshot diffs (separate PR)
2026-05-21 17:00:58 -07:00

3.7 KiB

bridge e2e

Playwright smoke + multi-tenant specs for the @luxfi/bridge tenant SPA.

One spec, four environments (local / dev / test / main). Mirrors the env-parametric pattern from the wider Lux e2e infra.

Layout

e2e/
├── package.json                minimal Playwright deps
├── playwright.config.ts        env-aware base URL + auto-boot vite preview on local
├── tsconfig.json
├── tests/
│   ├── smoke.spec.ts           render, brand, selectors, wallet button, quote, prod gate
│   └── multi-tenant.spec.ts    cross-tenant brand-routing assertions (E2E_ENV=main only)
└── README.md                   this file

Quick start (local)

# 1. From repo root, install workspace deps once.
pnpm install

# 2. Build the tenant SPA — `vite preview` requires a built dist/.
cd app/bridge && pnpm build

# 3. Install browsers + run.
cd ../../e2e
pnpm install
pnpm install:browsers      # one-time chromium download
pnpm test:smoke            # boots `vite preview` on :3001 automatically

The webServer block in playwright.config.ts boots pnpm preview on :3001 from app/bridge/dist/. If you want to point at vite dev instead, set E2E_BASE_URL=http://localhost:3001 and run pnpm --filter @luxbridge/lux-tenant dev in a separate shell first.

Run against deployed envs

E2E_ENV=dev  pnpm test:smoke    # https://bridge.lux-dev.network
E2E_ENV=test pnpm test:smoke    # https://bridge.lux-test.network
E2E_ENV=main pnpm test:smoke    # https://bridge.lux.network

Tenant override:

BRIDGE_TENANT=zoo E2E_ENV=main pnpm test:smoke
# → https://bridge.zoo.network

Add custom base URL (e.g. PR preview deploy):

E2E_BASE_URL=https://pr-123--lux-bridge.preview.network pnpm test:smoke

Multi-tenant spec

E2E_ENV=main pnpm test:multi-tenant

Runs only against E2E_ENV=main. Each tenant (Lux, Zoo, future) probes the production DNS first and skips if the deployment isn't live. Asserts:

  • <title> contains the tenant brand name (Lux Bridge, Zoo Bridge)
  • <html> has --brand-primary set to the tenant's pinned hex color

Add a new tenant by appending one entry to TENANTS in tests/multi-tenant.spec.ts — no other changes needed.

What this does NOT cover

  • Real wallet connect — the stub useWallet resolves to a dev-only display address (0xLUXBRIDGE…DEADBEEF) gated behind import.meta.env.DEV. Real threshold-MPC wallet integration (Phase 3 R3) needs Playwright wallet mocking, which is heavy enough to warrant its own PR.
  • Real backend swap submit — the prod bridge API isn't always reachable from CI (rate-limited / behind WAF). Add a separate tests/backend.spec.ts with a fixture wallet + signed quote when the test harness is ready.
  • Visual regression / screenshots — see follow-up PR.

CI

- name: bridge smoke
  run: |
    pnpm install --frozen-lockfile
    cd app/bridge && pnpm build
    cd ../../e2e && pnpm install && pnpm install:browsers
    E2E_ENV=${{ matrix.env }} pnpm test:smoke

Recommended matrix: [dev, test]. Mainnet smoke is opt-in via workflow_dispatch to avoid hammering production on every push.

Conventions

  • One file per concern: smoke.spec.ts is the standard tenant render check, multi-tenant.spec.ts is the cross-tenant brand contract.
  • No hostnames in spec bodies — playwright.config.ts owns env routing.
  • No shared auth state — bridge mainnet is unauthenticated (wallet connect is purely client-side); no need for storageState.
  • Selectors prefer aria-label over visible text, matching the actual ChainSelector / AssetInput / WalletConnect component contracts in pkg/bridge/src/app/components/.