-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
33 changed files
with
515 additions
and
397 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,23 +1,38 @@ | ||
import { MetaMaskMock, testWithMetaMaskMock } from '@synthetixio/synpress' | ||
import { | ||
EthereumWalletMock, | ||
testWithEthereumWalletMock, | ||
} from "@synthetixio/synpress"; | ||
|
||
const test = testWithMetaMaskMock | ||
const test = testWithEthereumWalletMock; | ||
|
||
const { expect } = test | ||
const { expect } = test; | ||
|
||
test('should mock MetaMask in the Test Dapp', async ({ page }) => { | ||
await page.goto('/') | ||
test("should mock MetaMask in the Test Dapp", async ({ page, walletMock }) => { | ||
expect(await walletMock.getAllAccounts()).toHaveLength(1); | ||
|
||
await expect(page.locator('#accounts')).toHaveText('0xd73b04b0e696b0945283defa3eee453814758f1a') | ||
await page.locator("#connectButton").click(); | ||
|
||
await page.locator('#getAccounts').click() | ||
await expect(page.locator('#getAccountsResult')).toHaveText('0xd73b04b0e696b0945283defa3eee453814758f1a') | ||
}) | ||
await expect(page.locator("#accounts")).toHaveText( | ||
"0xd73b04b0e696b0945283defa3eee453814758f1a" | ||
); | ||
|
||
test('should add new account using MetaMask mock', async ({ page }) => { | ||
const metamask = new MetaMaskMock(page) | ||
await page.locator("#getAccounts").click(); | ||
await expect(page.locator("#getAccountsResult")).toHaveText( | ||
"0xd73b04b0e696b0945283defa3eee453814758f1a" | ||
); | ||
}); | ||
|
||
metamask.importWallet('candy maple cake sugar pudding cream honey rich smooth crumble sweet treat') | ||
await metamask.addNewAccount() | ||
test("should add new account using MetaMask mock", async ({ page }) => { | ||
const walletMock = new EthereumWalletMock(page); | ||
|
||
await expect(page.locator('#accounts')).toHaveText('0xd73b04b0e696b0945283defa3eee453814758f1a') | ||
}) | ||
await walletMock.importWallet( | ||
"candy maple cake sugar pudding cream honey rich smooth crumble sweet treat" | ||
); | ||
await walletMock.addNewAccount(); | ||
|
||
await page.locator("#connectButton").click(); | ||
|
||
await expect(page.locator("#accounts")).toHaveText( | ||
"0x6503D95e3F20389EE9496b277ABfFDb8eCCD2cc5,0xd73b04b0e696b0945283defa3eee453814758f1a" | ||
); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 +1,28 @@ | ||
import { defineWalletSetup } from '@synthetixio/synpress-core' | ||
import { getExtensionId, testWithSynpress } from '@synthetixio/synpress-fixtures' | ||
import { MetaMask, homePageSelectors, unlockForFixture } from '@synthetixio/synpress-metamask' | ||
import { MetaMaskMock, testWithMetaMaskMock } from '@synthetixio/synpress-metamask-mock' | ||
import { defineWalletSetup } from "@synthetixio/synpress-core"; | ||
import { | ||
getExtensionId, | ||
testWithSynpress, | ||
} from "@synthetixio/synpress-fixtures"; | ||
import { | ||
MetaMask, | ||
homePageSelectors, | ||
unlockForFixture, | ||
} from "@synthetixio/synpress-metamask"; | ||
import { | ||
EthereumWalletMock, | ||
testWithEthereumWalletMock, | ||
} from "@synthetixio/ethereum-wallet-mock"; | ||
|
||
export { | ||
// Framework fixtures | ||
testWithSynpress, | ||
testWithMetaMaskMock, | ||
testWithEthereumWalletMock, | ||
// API | ||
MetaMask, | ||
MetaMaskMock, | ||
EthereumWalletMock, | ||
// Helpers | ||
defineWalletSetup, | ||
getExtensionId, | ||
unlockForFixture, | ||
homePageSelectors | ||
} | ||
homePageSelectors, | ||
}; |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
wallets/metamask-mock/package.json → wallets/ethereum-wallet-mock/package.json
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
File renamed without changes.
Oops, something went wrong.