@synthetixio/synpress
.
cypress.config.ts
): The setup within your Cypress configuration file has changed. You now use configureSynpressForMetaMask
(or configureSynpressForEthereumWalletMock
) to integrate Synpress.
support/e2e.ts
): You now import specific command sets (synpressCommandsForMetaMask
or synpressCommandsForEthereumWalletMock
) instead of a global import.
before()
hook, which was a recommended approach, is now replaced with test isolation set to false
.
cypress run
command, but headed mode is currently required on CI.
*.setup.{ts,js,mjs}
) to define how the wallet should be pre-configured (importing a seed phrase, adding networks, etc.).
cypress
and @synthetixio/synpress
to their latest versions. Synpress v4 requires Cypress v13+.
cypress.config.ts
configureSynpressForMetaMask
function. If you were using the Ethereum Wallet Mock, use configureSynpressForEthereumWalletMock
instead.
src/cypress/support/e2e.ts
)synpressCommandsForMetaMask
and remove any previous global imports of Synpress commands.
Remove cy.visit('/')
, because it’s not needed, thanks to test isolation being set to false
.
mockEthereum
function and call it.
tsconfig.json
)tsconfig.json
is configured for Cypress and includes the necessary files:
"strict": true
is set in the compilerOptions
.
test/wallet-setup
. You can change this using the Synpress CLI.
*.setup.{ts,js,mjs}
(e.g., basic.setup.ts
, connected.setup.ts
).
defineWalletSetup
function to define the setup steps.
*.setup.{ts,js,mjs}
files..cache-synpress
directory.--headless
: Run the cache building process in headless mode (no browser window visible). Useful for local development to see what’s happening.--force
: Force a rebuild of the cache, even if a cache with the same hash already exists. Use this if you’ve made changes to your setup file or if you suspect the cache is corrupted.--debug
: Enables additional logging during the cache building, and preserves logs.[dir]
: Specify a custom directory containing the wallet setup files (defaults to test/wallet-setup
).xvfb-run
. See the “Known Issues” page in the Synpress documentation.v3 Command | v4 Command | Notes |
---|---|---|
cy.acceptMetamaskAccess() | cy.connectToDapp() | |
cy.confirmMetamaskTransaction() | cy.confirmTransaction() | Now supports optional gasSetting object for fine-grained gas control. |
cy.rejectMetamaskTransaction() | cy.rejectTransaction() | |
cy.switchMetamaskNetwork() | cy.switchNetwork() | |
cy.addMetamaskNetwork() | cy.addNetwork() | |
cy.importMetamaskAccount() | cy.importWallet() | Use for importing with a seed phrase. |
cy.createMetamaskAccount() | No direct equivalent | Use cy.addNewAccount instead. |
cy.getMetamaskWalletAddress() | cy.getAccountAddress() | |
cy.switchMetamaskAccount() | cy.switchAccount() | |
cy.getMetamaskBalance() | No direct equivalent | |
cy.importWalletFromPrivateKey | Use for importing from private key. | |
Not Available in v3 | cy.emptyAnvilNode() | Empties the Anvil node. |
Not Available in v3 | cy.approveNewNetwork() | Approves a new network in MetaMask. |
Not Available in v3 | cy.approveSwitchNetwork() | Approves switching to a different network in MetaMask. |
Not Available in v3 | cy.rejectNewNetwork() | Rejects a new network in MetaMask. |
Not Available in v3 | cy.rejectSwitchNetwork() | Rejects switching to a different network in MetaMask. |
Not Available in v3 | cy.deployToken() | Deploys a new token contract. |
Not Available in v3 | cy.addNewToken() | Adds a new token to MetaMask. |
Not Available in v3 | cy.approveTokenPermission() | Approves token spending permission in MetaMask. |
Not Available in v3 | cy.rejectTokenPermission() | Rejects token spending permission in MetaMask. |
Not Available in v3 | cy.toggleShowTestNetworks() | Toggles the display of test networks in MetaMask. |
Not Available in v3 | cy.toggleDismissSecretRecoveryPhraseReminder() | Toggles the dismissal of the secret recovery phrase reminder. |
Not Available in v3 | cy.providePublicEncryptionKey() | Provides a public encryption key. |
Not Available in v3 | cy.decrypt() | Decrypts a message. |
Not Available in v3 | cy.confirmSignature() | Confirms a signature request in MetaMask. |
Not Available in v3 | cy.rejectSignature() | Rejects a signature request in MetaMask. |
Not Available in v3 | cy.confirmTransactionAndWaitForMining() | Confirms a transaction and waits for it to be mined. |
Not Available in v3 | cy.openTransactionDetails() | Opens transaction details in MetaMask. |
Not Available in v3 | cy.closeTransactionDetails() | Closes transaction details in MetaMask. |
Not Available in v3 | cy.goBackToHomePage() | Goes back to MetaMask homepage. |
Not Available in v3 | cy.openSettings() | Opens MetaMask settings page. |
Not Available in v3 | cy.openSidebarMenu() | Opens a specific sidebar menu in MetaMask settings. |