Skip to content

Commit

Permalink
✨ feat: Synpress with MetaMask mock (#1123)
Browse files Browse the repository at this point in the history
* ✨ feat: Synpress with metamask mock

* fix: cleanup

* fix: dependencies

* fix: e2e test

* fix: refreshed PPOM testing scenarios
  • Loading branch information
matstyler authored Apr 8, 2024
1 parent 46390a6 commit 2519a8b
Show file tree
Hide file tree
Showing 25 changed files with 1,143 additions and 7 deletions.
23 changes: 23 additions & 0 deletions examples/new-dawn/test/e2e/00_mock.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { MetaMaskMock, testWithMetaMaskMock } from '@synthetixio/synpress'

const test = testWithMetaMaskMock

const { expect } = test

test('should mock MetaMask in the Test Dapp', async ({ page }) => {
await page.goto('/')

await expect(page.locator('#accounts')).toHaveText('0xd73b04b0e696b0945283defa3eee453814758f1a')

await page.locator('#getAccounts').click()
await expect(page.locator('#getAccountsResult')).toHaveText('0xd73b04b0e696b0945283defa3eee453814758f1a')
})

test('should add new account using MetaMask mock', async ({ page }) => {
const metamask = new MetaMaskMock(page)

metamask.importWallet('candy maple cake sugar pudding cream honey rich smooth crumble sweet treat')
await metamask.addNewAccount()

await expect(page.locator('#accounts')).toHaveText('0xd73b04b0e696b0945283defa3eee453814758f1a')
})
2 changes: 1 addition & 1 deletion packages/tsconfig/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2022"],
"lib": ["ES2022", "DOM"],
"moduleResolution": "bundler",
"module": "ES2022",
"verbatimModuleSyntax": true,
Expand Down
Loading

0 comments on commit 2519a8b

Please sign in to comment.