Skip to content

Instantly share code, notes, and snippets.

@maxhoheiser
Last active March 17, 2022 15:42
Show Gist options
  • Save maxhoheiser/0cf4ea2698610a17966407528c8e1a4d to your computer and use it in GitHub Desktop.
Save maxhoheiser/0cf4ea2698610a17966407528c8e1a4d to your computer and use it in GitHub Desktop.
Example commands.js file for Synpress
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