Files
bridge/pkg/ui
zeekay 778ff148c3 feat(pkg/bridge): add @luxfi/bridge SDK + publish workflow
Rationalize the bridge workspace around one canonical SDK entry:

  - @luxfi/bridge        (NEW)  public SDK consumers import
  - @luxbridge/*          private workspace internals
  - @luxfi/{core,threshold,utila} generic Lux building-block libs

@luxfi/bridge re-exports mountBridge(), <Bridge />, BridgeConfig, and
BrandConfig. The runtime lazy-imports @luxbridge/app as the actual UI
implementation. Mirrors the mountExchange() pattern from
@partner/exchange — declarative config-in, brand metadata applied
to document, React tree rendered into #bridge-root.

Workspace housekeeping:
  - pkg/settings: 0.1.0 -> 1.0.0, marked private
  - pkg/ui (ui-automation), app/server, app/bridge3: marked private
  - app/explorer: 0.1.0 -> 1.0.0
  - root bridge package: 1.0.0 -> 1.1.0
  - app/bridge: add main/types/exports so the SDK can dynamic-import the App component

Publish workflow at .github/workflows/publish.yml fires on v* tag push,
runs pnpm publish -r --access public --no-git-checks. pnpm skips
private packages automatically. Public packages: @luxfi/bridge, @luxfi/core,
@luxfi/threshold, @luxfi/utila.
2026-05-21 14:02:03 -07:00
..
2025-08-03 15:52:32 -05:00
2025-08-03 15:52:32 -05:00

Bridge UI Automation

Automated UI testing for the Lux Bridge using Selenium WebDriver and TypeScript.

Overview

This test suite validates the complete bridge flow including:

  • Wallet connection (MetaMask, WalletConnect, etc.)
  • Network selection and switching
  • Token selection and amount input
  • Cross-chain transfers with MPC signatures
  • Transaction status tracking
  • Error handling

Quick Start

  1. Install dependencies:

    npm install
    
  2. Set up test wallets:

    npm run setup:wallets
    
  3. Run all tests:

    npm test
    

Test Scenarios

Core Bridge Flow

  • Connect wallet
  • Select source network and token
  • Select destination network
  • Enter amount and recipient
  • Approve token (if needed)
  • Initiate bridge transfer
  • Monitor transaction status
  • Verify completion on destination

MPC Integration Tests

  • Key generation coordination
  • Signature generation for transfers
  • Threshold signature validation
  • Node failure recovery

Error Scenarios

  • Insufficient balance
  • Network errors
  • MPC node failures
  • Invalid addresses
  • Gas estimation failures

Running Tests

Command Description
npm test Run all tests
npm run test:smoke Quick smoke tests
npm run test:mpc MPC-specific tests
npm run test:networks Network switching tests
npm run test:tokens Token transfer tests

Configuration

Create a .env.test file:

# Test wallet credentials
TEST_WALLET_PRIVATE_KEY=your_test_wallet_key
TEST_WALLET_ADDRESS=your_test_wallet_address

# Bridge endpoints
BRIDGE_UI_URL=http://localhost:3000
BRIDGE_API_URL=http://localhost:5000

# MPC nodes
MPC_NODE_URLS=http://localhost:6000,http://localhost:6001,http://localhost:6002

# Test networks
TEST_NETWORKS=ethereum,bsc,polygon,lux

MPC Testing

The MPC integration tests validate:

  1. Key Generation: Distributed key generation across nodes
  2. Signing: Threshold signature generation
  3. Recovery: Node failure and recovery scenarios
  4. Performance: Signature generation time

Writing Tests

Example test structure:

import { BridgeTestHelper } from './helpers/bridge-helper';

describe('Bridge Transfer Flow', () => {
  let bridge: BridgeTestHelper;

  beforeEach(async () => {
    bridge = new BridgeTestHelper();
    await bridge.initialize();
  });

  it('should complete cross-chain transfer', async () => {
    // Connect wallet
    await bridge.connectWallet('metamask');
    
    // Select networks
    await bridge.selectSourceNetwork('ethereum');
    await bridge.selectDestinationNetwork('bsc');
    
    // Configure transfer
    await bridge.selectToken('USDC');
    await bridge.enterAmount('100');
    await bridge.enterRecipient(TEST_RECIPIENT);
    
    // Execute transfer
    await bridge.approveToken();
    const txId = await bridge.initiateBridge();
    
    // Monitor completion
    await bridge.waitForCompletion(txId);
    
    // Verify on destination
    const balance = await bridge.getDestinationBalance('USDC');
    expect(balance).toBeGreaterThan(99); // Account for fees
  });
});

CI/CD Integration

Tests run automatically on:

  • Pull requests
  • Commits to main branch
  • Before deployment

GitHub Actions workflow included in .github/workflows/bridge-tests.yml