Overview
ThecreateWalletTest function creates a Playwright test configured with one or more wallet extensions. It returns a test function with custom fixtures for wallet interaction.
Function signature
ChromaTestOptions type
The options object accepts the following parameters:Array of wallet configurations to load. Defaults to
[{ type: 'polkadot-js' }] if not specified.Each WalletConfig has:type:'polkadot-js' | 'talisman' | 'metamask'downloadUrl: Optional custom download URL for the extension
Whether to run the browser in headless mode.
Slows down operations by the specified milliseconds. Useful for debugging.
Return value
Returns a Playwright test function with extended fixtures:Test-scoped page fixture with extension context
Test-scoped wallet instances based on your configuration
Worker-scoped browser context (persists across tests)
Worker-scoped map of wallet type to extension ID
Examples
Type safety
The function uses TypeScript const assertions to infer the exact wallet types you’ve configured:Worker-scoped fixtures
The browser context and extension IDs are worker-scoped, meaning they persist across all tests in a worker process. This improves performance by avoiding repeated extension loading.The
page and wallets fixtures are test-scoped and recreated for each test, but they reuse the worker-scoped browser context.Related
- Test fixtures - Detailed fixture documentation
- Wallet instances - Wallet method reference