Skip to main content
Chroma provides first-class support for automated testing with popular Web3 wallet extensions. Each wallet is automatically downloaded, configured, and ready to use in your Playwright tests.

Supported wallets

Chroma currently supports three major wallet extensions:
WalletTypeVersionUse case
Polkadot-JSSubstrate0.62.6Polkadot and Substrate-based chains
TalismanMulti-chain3.2.0Both Polkadot and Ethereum chains
MetaMaskEVM13.17.0Ethereum and EVM-compatible chains

Quick start

To use wallets in your tests, specify them in the createWalletTest configuration:
import { createWalletTest } from '@avalix/chroma'

const test = createWalletTest({
  wallets: [
    { type: 'polkadot-js' },
    { type: 'talisman' },
    { type: 'metamask' }
  ]
})
Access wallets in your tests via the wallets fixture:
test('connect wallet', async ({ page, wallets }) => {
  await wallets['polkadot-js'].authorize()
})

Automatic extension management

Chroma automatically handles wallet extension setup:
  1. Download - Extensions are downloaded to .chroma/ directory
  2. Installation - Extensions are loaded into the browser context
  3. Configuration - Extensions are pre-configured for testing
Run npx @avalix/chroma download-extensions to download all wallet extensions before running tests.

Common workflows

All wallets support these core operations:

Import accounts

Each wallet provides methods to import test accounts:
await wallets['polkadot-js'].importMnemonic({
  seed: 'bottom drive obey lake curtain smoke basket hold race lonely fit walk',
  name: '// Alice'
})

Authorize dApp connections

Approve wallet connections to your dApp:
await wallets['polkadot-js'].authorize()

Approve transactions

Sign and approve transactions:
await wallets['polkadot-js'].approveTx({ password: 'h3llop0lkadot!' })

Reject transactions

Test transaction rejection flows:
await wallets['polkadot-js'].rejectTx()

Wallet-specific features

Talisman multi-chain support

Talisman supports both Polkadot and Ethereum chains:
// Import Polkadot account
await wallets.talisman.importPolkadotMnemonic({
  seed: 'bottom drive obey lake curtain smoke basket hold race lonely fit walk',
  name: 'DOT Account'
})

// Import Ethereum account
await wallets.talisman.importEthPrivateKey({
  privateKey: '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80',
  name: 'ETH Account'
})

MetaMask unlock

MetaMask requires unlocking after browser restart:
await wallets.metamask.unlock()

Extension configuration

Each wallet has specific configuration constants:
const POLKADOT_JS_CONFIG = {
  downloadUrl: 'https://github.com/polkadot-js/extension/releases/download/v0.62.6/master-chrome-build.zip',
  extensionName: 'polkadot-extension-0.62.6'
}

Best practices

Use test mnemonics and private keys only. Never use real funds or production credentials in automated tests.
  • Use consistent test accounts - Define test mnemonics as constants for reusability
  • Handle async operations - All wallet methods are async and return Promises
  • Test both approve and reject - Cover both happy paths and rejection scenarios
  • Wait for confirmation - Use Playwright’s waitFor to ensure transactions complete
  • Clean up after tests - Extensions are automatically cleaned up between test runs

Next steps

Polkadot-JS

Complete Polkadot-JS wallet API reference

Talisman

Complete Talisman wallet API reference

MetaMask

Complete MetaMask wallet API reference

Build docs developers (and LLMs) love