Last active
March 17, 2022 15:42
-
-
Save maxhoheiser/0cf4ea2698610a17966407528c8e1a4d to your computer and use it in GitHub Desktop.
Example commands.js file for Synpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "@testing-library/cypress/add-commands"; | |
Cypress.Commands.add("login", () => { | |
cy.visit("/"); | |
cy.get("[data-cy=metamaskButton]").then((button) => { | |
const acceptAllAccount = true; | |
if (button.text() === "Connect Wallet") { | |
button.trigger("click"); | |
cy.acceptMetamaskAccess(acceptAllAccount).then((connected) => { | |
expect(connected).to.be.true; | |
}); | |
cy.confirmMetamaskSignatureRequest().then((confirmed) => { | |
expect(confirmed).to.be.true; | |
}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment