From aac5c8cbc627d63368d7439e8614001b3fb18710 Mon Sep 17 00:00:00 2001 From: matstyler Date: Mon, 26 Feb 2024 22:45:58 +0100 Subject: [PATCH] :technologist: feat: Missing permissions tests --- wallets/metamask/src/metamask.ts | 4 ++++ .../test/e2e/metamask/approvePermission.spec.ts | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/wallets/metamask/src/metamask.ts b/wallets/metamask/src/metamask.ts index 7268c0304..bb691b522 100644 --- a/wallets/metamask/src/metamask.ts +++ b/wallets/metamask/src/metamask.ts @@ -384,6 +384,10 @@ export class MetaMask { await this.settingsPage.disableEthSign() } + async requestPermissions() { + + } + /// ------------------------------------------- /// ---------- EXPERIMENTAL FEATURES ---------- /// ------------------------------------------- diff --git a/wallets/metamask/test/e2e/metamask/approvePermission.spec.ts b/wallets/metamask/test/e2e/metamask/approvePermission.spec.ts index 02a2b04cb..9377394bd 100644 --- a/wallets/metamask/test/e2e/metamask/approvePermission.spec.ts +++ b/wallets/metamask/test/e2e/metamask/approvePermission.spec.ts @@ -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 }) => { @@ -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') +})