Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(3615): E2E to check the labels displaying the default account and chai… #12830

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,
);
},
);
});
},
);
Loading