This guide provides a streamlined setup process for integrating Cypress with Synpress to automate tests for Web3 dapps. While this covers the basic configuration, Synpress offers a wide range of advanced features for comprehensive testing.
Create a support file (src/cypress/support/e2e.ts):
Copy
// Import Synpress commands for MetaMaskimport { synpressCommandsForMetaMask } from '@synthetixio/synpress/cypress/support'// Handle uncaught exceptionsCypress.on('uncaught:exception', () => { // returning false here prevents Cypress from failing the test return false})// Initialize Synpress commandssynpressCommandsForMetaMask()// Visit the base URL before each testbefore(() => { cy.visit('/')})
Update your tsconfig.json to include Cypress types: