Skip to content

Commit

Permalink
🧑‍💻 feat: Missing permissions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matstyler committed Feb 26, 2024
1 parent 6a65b9e commit aac5c8c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
4 changes: 4 additions & 0 deletions wallets/metamask/src/metamask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ export class MetaMask {
await this.settingsPage.disableEthSign()
}

async requestPermissions() {

}

/// -------------------------------------------
/// ---------- EXPERIMENTAL FEATURES ----------
/// -------------------------------------------
Expand Down
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')
})

0 comments on commit aac5c8c

Please sign in to comment.