From fd2f042372442ad556aa83d23a62a2c04735dbb9 Mon Sep 17 00:00:00 2001 From: EtherWizard33 Date: Fri, 20 Dec 2024 18:31:42 +0300 Subject: [PATCH] test: wip, can't select Account 1 label or it's ID --- .../PermissionsSummary/PermissionsSummary.tsx | 8 +++- .../Browser/PermissionSummaryBottomSheet.js | 13 ++--- .../PermissionSummaryBottomSheet.selectors.js | 3 ++ ...system-summary-default-permissions.spec.js | 48 +++++++++++++++++++ 4 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 e2e/specs/multichain/permission-system-summary-default-permissions.spec.js diff --git a/app/components/UI/PermissionsSummary/PermissionsSummary.tsx b/app/components/UI/PermissionsSummary/PermissionsSummary.tsx index cf998ed53a2..26d2ec9806d 100644 --- a/app/components/UI/PermissionsSummary/PermissionsSummary.tsx +++ b/app/components/UI/PermissionsSummary/PermissionsSummary.tsx @@ -271,6 +271,7 @@ const PermissionsSummary = ({ }, [networkAvatars, isAlreadyConnected]); function renderAccountPermissionsRequestInfoCard() { + console.log('>>> getAccountLabel()', getAccountLabel() === 'Account 1'); return ( - + {getAccountLabel()} diff --git a/e2e/pages/Browser/PermissionSummaryBottomSheet.js b/e2e/pages/Browser/PermissionSummaryBottomSheet.js index 9668f35ef4f..5f122cece55 100644 --- a/e2e/pages/Browser/PermissionSummaryBottomSheet.js +++ b/e2e/pages/Browser/PermissionSummaryBottomSheet.js @@ -11,15 +11,16 @@ class PermissionSummaryBottomSheet { PermissionSummaryBottomSheetSelectorsIDs.CONTAINER, ); } - get addNetworkPermissionContainer() { - return Matchers.getElementByID( - PermissionSummaryBottomSheetSelectorsIDs.NETWORK_PERMISSIONS_CONTAINER, + + get ethereumMainnetText() { + return Matchers.getElementByText( + PermissionSummaryBottomSheetSelectorsText.ETHEREUM_MAINNET_TEXT, ); } - get connectedAccountsText() { - return Matchers.getElementByText( - PermissionSummaryBottomSheetSelectorsText.CONNECTED_ACCOUNTS_TEXT, + get accountPermissionText() { + return Matchers.getElementByID( + PermissionSummaryBottomSheetSelectorsIDs.ACCOUNT_PERMISSION_TEXT, ); } diff --git a/e2e/selectors/Browser/PermissionSummaryBottomSheet.selectors.js b/e2e/selectors/Browser/PermissionSummaryBottomSheet.selectors.js index 308f2e12963..96dee1a8747 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_TEXT: '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_TEXT: 'Ethereum Main Network', + ACCOUNT_ONE_TEXT: '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..6cfa3b27cfa --- /dev/null +++ b/e2e/specs/multichain/permission-system-summary-default-permissions.spec.js @@ -0,0 +1,48 @@ +'use strict'; +import TestHelpers from '../../helpers'; +import { SmokeMultiChain } 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'; + +describe(SmokeMultiChain('MultiChain Permissions System:'), () => { + beforeAll(async () => { + jest.setTimeout(150000); + await TestHelpers.reverseServerPort(); + }); + + fit('should display default chain and account in permission summary', async () => { + await withFixtures( + { + dapp: true, + fixture: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .withChainPermission() // Initialize with only Ethereum mainnet + .build(), + restartDevice: true, + }, + async () => { + await loginToApp(); + await TabBarComponent.tapBrowser(); + await Browser.navigateToTestDApp(); + + // Open permissions modal + await Browser.tapNetworkAvatarButtonOnBrowser(); + await ConnectedAccountsModal.tapManagePermissionsButton(); + + // Verify default permissions + await Assertions.checkIfVisible( + PermissionSummaryBottomSheet.ethereumMainnetText, + ); + await Assertions.checkIfVisible( + PermissionSummaryBottomSheet.accountPermissionText, + ); + }, + ); + }); +});