What is OnchainTestKit?
OnchainTestKit is an end-to-end testing framework that automates:- Wallet connections (MetaMask, Coinbase Wallet)
- Transaction flows and approvals
- Network switching
- Smart contract interactions
- Token swaps and minting
- Gas sponsorship testing
Why Use OnchainTestKit?
Testing blockchain applications manually is time-consuming and error-prone. OnchainTestKit provides:- Type Safety: Full TypeScript support with compile-time error checking
- Wallet Automation: Programmatic control over wallet interactions
- Parallel Testing: Run multiple tests simultaneously with isolated environments
- Network Management: Built-in support for local Anvil nodes and fork testing
- OnchainKit Integration: Designed to work seamlessly with OnchainKit components
Want to learn more?
Check out the full documentation for detailed guides on installation, configuration, and writing tests!Architecture
Key Features
Playwright Integration
Playwright Integration
Automate browser-based wallet and dApp interactions with the power of Playwright’s testing framework.
Multi-Wallet Support
Multi-Wallet Support
Built-in support for MetaMask and Coinbase Wallet, with an extensible architecture for adding more wallets.
Smart Action Handling
Smart Action Handling
Automate connect, transaction, signature, approval, and network switching flows with simple APIs.
Network Management
Network Management
Use local Anvil nodes or remote RPC endpoints, with dynamic port allocation for parallel test execution.
Type Safety
Type Safety
Full TypeScript support for all configuration and test APIs, catching errors at compile time.
Fluent Configuration
Fluent Configuration
Builder pattern for intuitive wallet and node setup, making configuration readable and maintainable.
Next Steps
- Install OnchainTestKit:
yarn add -D @coinbase/onchaintestkit
- Check out the OnchainTestKit repository
- See example tests
- Read the Cookbook examples for more test scenarios
- Access the full docs here