Overview
Most supported wallets are designed for production use and require manual user interaction for security. The Mnemonic provider removes these security constraints, making it ideal for:- End-to-end (E2E) testing
- CI/CD pipelines
- Test automation
Configuration
Add the Mnemonic provider to your WalletManager configuration:Session persistence
By default, the Mnemonic provider does not persist sessions to localStorage. This means:- The mnemonic must be re-entered after page reloads
- The wallet disconnects when closing/reloading the page
- Sessions cannot be resumed automatically
End-to-end testing
The Mnemonic provider enables automated E2E testing with frameworks like Playwright, Cypress, or Selenium. It enables automated wallet connections and transaction signing without requiring manual user interaction.Set up your test framework
Install your preferred testing framework and configure it for your application.
Handle the mnemonic prompt
The Mnemonic wallet prompts for a 25-word passphrase. Configure your test to provide this automatically.
Example test
Here’s a basic example using Playwright that demonstrates connecting to the wallet and verifying the connection:Mocking node responses
To create reliable and predictable tests, it’s recommended to mock responses from the Algorand node. This prevents tests from failing due to network issues or rate limits, and allows testing specific scenarios:Best practices
When using the Mnemonic provider for testing:Test account security
Generate dedicated test accounts that will never be used in production. Consider these accounts compromised as their mnemonics are stored in test files.Mock API responses
Mock responses from the Algorand node to:- Prevent overwhelming API providers with test requests
- Create predictable test scenarios
- Test error handling
- Speed up test execution
Test organization
Structure tests to cover different wallet operations:- Connection/disconnection flows
- Account switching
- Transaction signing
- Error handling
- Network switching
CI/CD integration
The Mnemonic provider works well in CI/CD pipelines since it doesn’t require user interaction. Consider:- Storing test mnemonics securely (e.g., in CI environment variables)
- Running tests against LocalNet (sandbox) or a private network
- Including wallet tests in your automated test suite
For complete testing examples, including mocking strategies and common test scenarios, see the E2E test examples in the repository.