diff --git a/app/components/UI/PermissionsSummary/PermissionsSummary.tsx b/app/components/UI/PermissionsSummary/PermissionsSummary.tsx index cf998ed53a2..aa177bf84e7 100644 --- a/app/components/UI/PermissionsSummary/PermissionsSummary.tsx +++ b/app/components/UI/PermissionsSummary/PermissionsSummary.tsx @@ -291,7 +291,13 @@ const PermissionsSummary = ({ - + {getAccountLabel()} diff --git a/e2e/pages/Browser/PermissionSummaryBottomSheet.js b/e2e/pages/Browser/PermissionSummaryBottomSheet.js index 9668f35ef4f..1d9e94379b2 100644 --- a/e2e/pages/Browser/PermissionSummaryBottomSheet.js +++ b/e2e/pages/Browser/PermissionSummaryBottomSheet.js @@ -23,6 +23,18 @@ class PermissionSummaryBottomSheet { ); } + get ethereumMainnetText() { + return Matchers.getElementByText( + PermissionSummaryBottomSheetSelectorsText.ETHEREUM_MAINNET_LABEL, + ); + } + + get accountPermissionLabelContainer() { + return Matchers.getElementByID( + PermissionSummaryBottomSheetSelectorsIDs.ACCOUNT_PERMISSION_CONTAINER, + ); + } + async swipeToDismissModal() { await Gestures.swipe(this.container, 'down', 'fast'); } diff --git a/e2e/selectors/Browser/PermissionSummaryBottomSheet.selectors.js b/e2e/selectors/Browser/PermissionSummaryBottomSheet.selectors.js index 308f2e12963..4ebebd5dce7 100644 --- a/e2e/selectors/Browser/PermissionSummaryBottomSheet.selectors.js +++ b/e2e/selectors/Browser/PermissionSummaryBottomSheet.selectors.js @@ -3,9 +3,12 @@ import enContent from '../../../locales/languages/en.json'; export const PermissionSummaryBottomSheetSelectorsIDs = { CONTAINER: 'permission-summary-container', NETWORK_PERMISSIONS_CONTAINER: 'permission-network-permissions-container', + ACCOUNT_PERMISSION_CONTAINER: 'permission-summary-account-text', }; export const PermissionSummaryBottomSheetSelectorsText = { CONNECTED_ACCOUNTS_TEXT: enContent.accounts.connected_accounts_title, ADD_NETWORK_PERMISSION: enContent.permissions.title_add_network_permission, + ETHEREUM_MAINNET_LABEL: 'Ethereum Main Network', + ACCOUNT_ONE_LABEL: 'Account 1', }; diff --git a/e2e/specs/multichain/permission-system-summary-default-permissions.spec.js b/e2e/specs/multichain/permission-system-summary-default-permissions.spec.js new file mode 100644 index 00000000000..55a6a5fefeb --- /dev/null +++ b/e2e/specs/multichain/permission-system-summary-default-permissions.spec.js @@ -0,0 +1,63 @@ +'use strict'; +import TestHelpers from '../../helpers'; +import { SmokeMultiChainPermissions } from '../../tags'; +import Browser from '../../pages/Browser/BrowserView'; +import TabBarComponent from '../../pages/wallet/TabBarComponent'; +import ConnectedAccountsModal from '../../pages/Browser/ConnectedAccountsModal'; +import FixtureBuilder from '../../fixtures/fixture-builder'; +import { withFixtures } from '../../fixtures/fixture-helper'; +import { loginToApp } from '../../viewHelper'; +import Assertions from '../../utils/Assertions'; +import PermissionSummaryBottomSheet from '../../pages/Browser/PermissionSummaryBottomSheet'; +import { PermissionSummaryBottomSheetSelectorsText } from '../../selectors/Browser/PermissionSummaryBottomSheet.selectors'; + +describe( + SmokeMultiChainPermissions('Permission System - Default Permissions'), + () => { + beforeAll(async () => { + jest.setTimeout(150000); + await TestHelpers.reverseServerPort(); + }); + + it('should display default account and chain permissions in permission summary', async () => { + // Test setup with fixtures + await withFixtures( + { + dapp: true, + fixture: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .withChainPermission() // Initialize with Ethereum mainnet only + .build(), + restartDevice: true, + }, + async () => { + // Step 1: Initial app setup + await loginToApp(); + await TabBarComponent.tapBrowser(); + await Browser.navigateToTestDApp(); + + // Step 2: Navigate to permissions management + await Browser.tapNetworkAvatarButtonOnBrowser(); + await ConnectedAccountsModal.tapManagePermissionsButton(); + + // Step 3: Verify account permissions + const accountLabelElement = + await PermissionSummaryBottomSheet.accountPermissionLabelContainer; + const accountLabelAttributes = + await accountLabelElement.getAttributes(); + const accountLabel = accountLabelAttributes.label; + + await Assertions.checkIfTextMatches( + accountLabel, + PermissionSummaryBottomSheetSelectorsText.ACCOUNT_ONE_LABEL, + ); + + // Step 4: Verify chain permissions + await Assertions.checkIfVisible( + PermissionSummaryBottomSheet.ethereumMainnetText, + ); + }, + ); + }); + }, +);