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:
Wallet Type Version Use case Polkadot-JS Substrate 0.62.6 Polkadot and Substrate-based chains Talisman Multi-chain 3.2.0 Both Polkadot and Ethereum chains MetaMask EVM 13.17.0 Ethereum 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:
Download - Extensions are downloaded to .chroma/ directory
Installation - Extensions are loaded into the browser context
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:
Polkadot-JS
Talisman
MetaMask
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:
Polkadot-JS
Talisman
MetaMask
await wallets [ 'polkadot-js' ]. authorize ()
Approve transactions
Sign and approve transactions:
Polkadot-JS
Talisman
MetaMask
await wallets [ 'polkadot-js' ]. approveTx ({ password: 'h3llop0lkadot!' })
Reject transactions
Test transaction rejection flows:
Polkadot-JS
Talisman
MetaMask
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 requires unlocking after browser restart:
await wallets . metamask . unlock ()
Extension configuration
Each wallet has specific configuration constants:
Polkadot-JS
Talisman
MetaMask
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'
}
const TALISMAN_CONFIG = {
downloadUrl: 'https://github.com/avalix-labs/polkadot-wallets/raw/refs/heads/main/talisman/talisman-3.2.0.zip' ,
extensionName: 'talisman-extension-3.2.0'
}
const METAMASK_CONFIG = {
downloadUrl: 'https://github.com/MetaMask/metamask-extension/releases/download/v13.17.0/metamask-flask-chrome-13.17.0-flask.0.zip' ,
extensionName: 'metamask-extension-13.17.0'
}
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