Skip to content

Instantly share code, notes, and snippets.

@maxhoheiser
Created March 30, 2022 09:40
Show Gist options
  • Save maxhoheiser/1fd33e000f8d10db2031f3fd8b418ca2 to your computer and use it in GitHub Desktop.
Save maxhoheiser/1fd33e000f8d10db2031f3fd8b418ca2 to your computer and use it in GitHub Desktop.
Cypress.Commands.add("disconnectAllAccountsFromAllDapps", () => {
cy.visit(`/`);
cy.get("[data-cy=metamaskButton]").then(($btn) => {
if ($btn.text() !== "Connect Wallet") {
cy.switchToAccount(1);
cy.disconnectMetamaskWalletFromDapp().should("be.true");
cy.switchMetamaskAccount(2).should("be.true");
cy.disconnectMetamaskWalletFromDapp().should("be.true");
cy.switchMetamaskAccount(3).should("be.true");
cy.disconnectMetamaskWalletFromDapp().should("be.true");
cy.visit("/");
cy.findByRole("button", { name: /connect wallet/i }).should("be.visible");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment