-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into feat/multi-chain
- Loading branch information
Showing
14 changed files
with
255 additions
and
143 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// ChainSafe/dappeteer's metamask methods mostly doesn't not work out of box, fml | ||
|
||
// manually dismiss banner! | ||
// news popup keeps re-appearing AFTER some metamask actions | ||
// clue (dasanra's fork) -> https://github.com/dasanra/dappeteer/commit/3656360e4f891a3e7d1e80e77a40b2cfb83af2c8 | ||
export const checkAndCloseNewsPopOver = async (metamask) => { | ||
await metamask.page.waitFor(1000); | ||
const isPopOverOpen = await metamask.page.evaluate(() => { | ||
return document.querySelector(".whats-new-popup__popover") !== null; | ||
}); | ||
|
||
if (isPopOverOpen) { | ||
const closePopOverButton = await metamask.page.waitForSelector(".popover-header__button"); | ||
await closePopOverButton.click(); | ||
} | ||
await metamask.page.waitFor(1000); | ||
}; | ||
|
||
// https://github.com/ChainSafe/dappeteer/issues/67 | ||
export const confirmTransaction = async (metamask) => { | ||
await metamask.confirmTransaction(); | ||
await metamask.page.waitForSelector(".btn-primary:not([disabled])", { visible: true }); | ||
await metamask.page.click(".btn-primary:not([disabled])"); | ||
await checkAndCloseNewsPopOver(metamask); | ||
}; | ||
|
||
// manually approve all accounts! | ||
// https://github.com/ChainSafe/dappeteer/blob/master/src/metamask/approve.ts | ||
export const approveAllAccounts = async (metamask) => { | ||
await metamask.page.bringToFront(); | ||
await metamask.page.reload(); | ||
|
||
const checkbox = await metamask.page.waitForSelector(".permissions-connect-choose-account__header-check-box"); | ||
await checkbox.click(); | ||
|
||
const button = await metamask.page.waitForSelector("button.button.btn-primary"); | ||
await button.click(); | ||
|
||
const connectButton = await metamask.page.waitForSelector("button.button.btn-primary"); | ||
await connectButton.click(); | ||
}; |
Oops, something went wrong.