Skip to content

Commit

Permalink
Merge branch 'main' into signing_hardware_wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
jpuri authored Jan 15, 2025
2 parents 014f1ee + faf5340 commit c7b4564
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/components/UI/PermissionsSummary/PermissionsSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,13 @@ const PermissionsSummary = ({
</TextComponent>
<View style={styles.permissionRequestAccountInfo}>
<View style={styles.permissionRequestAccountName}>
<TextComponent numberOfLines={1} ellipsizeMode="tail">
<TextComponent
testID={
PermissionSummaryBottomSheetSelectorsIDs.ACCOUNT_PERMISSION_CONTAINER
}
numberOfLines={1}
ellipsizeMode="tail"
>
<TextComponent variant={TextVariant.BodySM}>
{getAccountLabel()}
</TextComponent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ exports[`PermissionsSummary should render correctly 1`] = `
"lineHeight": 22,
}
}
testID="permission-summary-account-text"
>
<Text
accessibilityRole="text"
Expand Down
12 changes: 12 additions & 0 deletions e2e/pages/Browser/PermissionSummaryBottomSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
Original file line number Diff line number Diff line change
@@ -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,
);
},
);
});
},
);

0 comments on commit c7b4564

Please sign in to comment.