-
-
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
1 changed file
with
23 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,37 @@ | ||
import { testWithSynpress } from "@synthetixio/synpress-fixtures"; | ||
import { MetaMask, unlockForFixture } from "../../../src"; | ||
import { testWithSynpress } from '@synthetixio/synpress-fixtures' | ||
import { MetaMask, unlockForFixture } from '../../../src' | ||
|
||
import basicSetup from "../wallet-setup/basic.setup"; | ||
import basicSetup from '../wallet-setup/basic.setup' | ||
|
||
const test = testWithSynpress(basicSetup, unlockForFixture); | ||
const test = testWithSynpress(basicSetup, unlockForFixture) | ||
|
||
const { expect } = test; | ||
const { expect } = test | ||
|
||
test("should connect wallet to dapp", async ({ | ||
context, | ||
page, | ||
extensionId, | ||
}) => { | ||
const metamask = new MetaMask( | ||
context, | ||
page, | ||
basicSetup.walletPassword, | ||
extensionId | ||
); | ||
test('should connect wallet to dapp', async ({ context, page, extensionId }) => { | ||
const metamask = new MetaMask(context, page, basicSetup.walletPassword, extensionId) | ||
|
||
await page.goto("/"); | ||
await page.goto('/') | ||
|
||
await page.locator("#connectButton").click(); | ||
await page.locator('#connectButton').click() | ||
|
||
await metamask.connectToDapp(); | ||
await metamask.connectToDapp() | ||
|
||
await expect(page.locator("#accounts")).toHaveText( | ||
"0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" | ||
); | ||
}); | ||
await expect(page.locator('#accounts')).toHaveText('0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266') | ||
}) | ||
|
||
test("should connect multiple wallets to dapp", async ({ | ||
context, | ||
page, | ||
metamaskPage, | ||
extensionId, | ||
}) => { | ||
const metamask = new MetaMask( | ||
context, | ||
metamaskPage, | ||
basicSetup.walletPassword, | ||
extensionId | ||
); | ||
test('should connect multiple wallets to dapp', async ({ context, page, metamaskPage, extensionId }) => { | ||
const metamask = new MetaMask(context, metamaskPage, basicSetup.walletPassword, extensionId) | ||
|
||
await metamask.addNewAccount("Account x2"); | ||
await metamask.addNewAccount("Account x3"); | ||
await metamask.addNewAccount('Account x2') | ||
await metamask.addNewAccount('Account x3') | ||
|
||
await page.goto("/"); | ||
await page.locator("#connectButton").click(); | ||
await page.goto('/') | ||
await page.locator('#connectButton').click() | ||
|
||
// "accounts" param is order agnostic | ||
await metamask.connectToDapp(["Account x2", "Account 1"]); | ||
await metamask.connectToDapp(['Account x2', 'Account 1']) | ||
|
||
await expect(page.locator("#accounts")).toHaveText( | ||
"0x70997970c51812dc3a010c7d01b50e0d17dc79c8,0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266" | ||
); | ||
}); | ||
await expect(page.locator('#accounts')).toHaveText( | ||
'0x70997970c51812dc3a010c7d01b50e0d17dc79c8,0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266' | ||
) | ||
}) |