Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matstyler committed Apr 18, 2024
1 parent 4f67187 commit a7406fe
Showing 1 changed file with 44 additions and 23 deletions.
67 changes: 44 additions & 23 deletions wallets/metamask/test/e2e/metamask/connectToDapp.spec.ts
Original file line number Diff line number Diff line change
@@ -1,37 +1,58 @@
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(
'0x976ea74026e726554db657fa54763abd0c3a0aa9,0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
)
})
await expect(page.locator("#accounts")).toHaveText(
"0x70997970c51812dc3a010c7d01b50e0d17dc79c8,0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
);
});

0 comments on commit a7406fe

Please sign in to comment.