-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
24 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
import { MetaMask, defineWalletSetup, getExtensionId } from '@synthetixio/synpress' | ||
import 'dotenv/config' | ||
import { | ||
MetaMask, | ||
defineWalletSetup, | ||
getExtensionId, | ||
} from "@synthetixio/synpress"; | ||
import "dotenv/config"; | ||
|
||
const SEED_PHRASE = process.env.SEED_PHRASE | ||
const PASSWORD = process.env.WALLET_PASSWORD | ||
const SEED_PHRASE = process.env.SEED_PHRASE; | ||
const PASSWORD = process.env.WALLET_PASSWORD; | ||
|
||
export default defineWalletSetup(PASSWORD, async (context, walletPage) => { | ||
// This is a workaround for the fact that the MetaMask extension ID changes. | ||
// This workaround won't be needed in the near future! 😁 | ||
const extensionId = await getExtensionId(context, 'MetaMask') | ||
const extensionId = await getExtensionId(context, "MetaMask"); | ||
|
||
const metamask = new MetaMask(context, walletPage, PASSWORD, extensionId) | ||
const metamask = new MetaMask(context, walletPage, PASSWORD, extensionId); | ||
|
||
await metamask.importWallet(SEED_PHRASE) | ||
await metamask.importWallet(SEED_PHRASE); | ||
|
||
const page = await context.newPage() | ||
const page = await context.newPage(); | ||
|
||
// Go to a locally hosted MetaMask Test Dapp. | ||
await page.goto('http://localhost:9999') | ||
await page.goto("http://localhost:9999"); | ||
|
||
await page.locator('#connectButton').click() | ||
await page.locator("#connectButton").click(); | ||
|
||
await metamask.connectToDapp() | ||
}) | ||
await metamask.connectToDapp(); | ||
}); |