Skip to content

Commit

Permalink
🧑‍💻 feat: Missing permissions tests (#1108)
Browse files Browse the repository at this point in the history
* 🧑‍💻 feat: Missing permissions tests

* fix: cleanup

* fix connectToDapp tests
  • Loading branch information
matstyler authored Feb 27, 2024
1 parent 6a65b9e commit 21e8efa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion wallets/metamask/test/e2e/metamask/approvePermission.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { testWithMetaMask } from '../testWithMetaMask'

const test = testWithMetaMask

const { describe } = test
const { describe, expect } = test

describe('with default gas setting', () => {
test('should approve tokens with the default limit by default', async ({ page, metamask, deployToken }) => {
Expand Down Expand Up @@ -78,3 +78,18 @@ describe('with custom gas setting', () => {
})
})
})

test('should request permissions', async ({ page, metamask }) => {
await page.locator('#revokeAccountsPermission').click()
await page.locator('#getPermissions').click()

const noPermission = await page.locator('#permissionsResult').innerText()
expect(noPermission).toBe('No permissions found.')

await page.locator('#requestPermissions').click()

await metamask.connectToDapp()

const requestedPermissions = await page.locator('#permissionsResult').innerText()
expect(requestedPermissions).toBe('eth_accounts')
})
2 changes: 1 addition & 1 deletion wallets/metamask/test/e2e/metamask/connectToDapp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ test('should connect multiple wallets to dapp', async ({ context, page, metamask
await metamask.connectToDapp(['Account x2', 'Account 1'])

await expect(page.locator('#accounts')).toHaveText(
'0x90f79bf6eb2c4f870365e785982e1f101e93b906,0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
'0x70997970c51812dc3a010c7d01b50e0d17dc79c8,0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266'
)
})

0 comments on commit 21e8efa

Please sign in to comment.