Why Synpress
The Problem at Hand
The Web3 tooling landscape is generally excellent for building frontends, backends, and smart contracts. Smart contract testing, in particular, is well-served by tools like Hardhat, Foundry, and Echidna. Backend testing benefits from the maturity of Web2 tools. However, frontend testing for Web3 dapps has lagged behind. Traditional Web2 frontend testing tools don’t adequately address the unique challenges of Web3, such as wallet interactions and blockchain-specific operations.
This gap in the tooling ecosystem led to the creation of Synpress in 2020, as one of the first Web3-native E2E testing libraries.
Synpress: Past, Present, and Future
Synpress has gained traction as a go-to solution for testing Web3 dapps. However, its initial design, focused primarily on Ethereum and MetaMask, became a limitation as the Web3 ecosystem expanded to include multiple blockchains and a wider variety of wallets.
Recognizing this, Synpress v4 was rewritten from the ground up. This major overhaul prioritized:
- Wallet and Blockchain Agnosticism: The core of Synpress is now designed to be independent of specific wallets and blockchains, paving the way for broader support.
- Developer Experience: A simple, powerful, and fully-typed API, comprehensive documentation, and support for leading testing frameworks.
- Stability: Extensive test coverage and a robust wallet integration API.
- Performance: Optimization for speed, including parallel testing capabilities and fast feedback loops.
Developer Experience
Synpress v4 offers a significantly improved developer experience:
- Playwright Support: Synpress v4 fully supports Playwright, including all of its features like parallelism and UI Mode.
- Cypress Support: Experimental support for Cypress.
- Simple, Typed API: A clean and intuitive API with full TypeScript support provides type safety and autocompletion, making test development easier and less error-prone.
- Comprehensive Documentation: The official documentation provides detailed guides, API references, and examples.
- Built-in Fixtures: Synpress provides several useful fixtures, like getting access to MetaMask API.
Stability
Synpress is built with stability as a core principle. The project includes:
- Extensive Test Coverage: A comprehensive suite of tests ensures the reliability and correctness of the library itself.
- Bullet-proof Wallet Integration API: Solid, type-safe interaction with wallets and dapps.
Performance
Synpress v4 is designed for speed:
- One-Time Browser Setup and Caching: Synpress allows you to define your wallet setup once. It then caches the browser state, dramatically reducing test execution time by eliminating repetitive setup steps. This unlocks the full potential of Playwright, including parallel test execution. This is the key differentiator and performance advantage of Synpress.
- Optimized for Speed: The library is optimized for fast feedback loops and efficient test execution.
While we’re still working on comprehensive performance benchmarks, early results and internal testing demonstrate that Synpress v4 is significantly faster than previous versions and competitive with leading Web2 testing frameworks. You can see an example of the performance gains in this tweet.
Key Integrations
- MetaMask: Deep integration with MetaMask for seamless testing of dApp interactions.
- Ethereum Wallet Mock: A built-in mock wallet for testing without a real wallet.
- Anvil: Easy integration with Anvil for spinning up local test networks.
Summary
Synpress v4 represents a significant advancement in Web3 frontend testing. By addressing the shortcomings of previous approaches and focusing on developer experience, stability, and performance, Synpress provides a powerful and efficient solution for building and testing robust Web3 dapps.