Skip to content

Commit

Permalink
ci: create ci workflow for multichain flow (#12425)
Browse files Browse the repository at this point in the history
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR addresses the new flows introduced with the updated network
chain permissions functionality. The goal is to ensure comprehensive
automated test coverage for these changes, reducing the risk of bugs
found later in the development process.

Key things to note here:
breakdown of the CI workflows:

- Smoke Pipeline: This pipeline runs all E2E tests with an enabled
multichain flag. This ensures that engineers actively validate the new
MC flows as part of their workflow. By default, the smoke pipeline runs
on pull requests, allowing us to catch any issues with the MC flow
before changes are merged into the main branch. We plan to make the
smoke E2E pipeline a required step before merging PRs soon.

- Regression Pipeline: This pipeline runs E2E tests with the multichain
flag disabled. It ensures that existing functionality remains stable
without the MC changes. The regression pipeline is scheduled to run
every four hours against the main branch, providing frequent and
consistent validation of the baseline functionality.


## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.

---------

Co-authored-by: NidhiKJha <menidhikjha@gmail.com>
Co-authored-by: EtherWizard33 <eric.lamontagne@consensys.net>
Co-authored-by: Nidhi Kumari <nidhi.kumari@consensys.net>
Co-authored-by: EtherWizard33 <165834542+EtherWizard33@users.noreply.github.com>
  • Loading branch information
5 people authored Nov 28, 2024
1 parent a4f928a commit d71de20
Show file tree
Hide file tree
Showing 24 changed files with 636 additions and 186 deletions.
24 changes: 15 additions & 9 deletions app/components/UI/PermissionsSummary/PermissionsSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import { SDKSelectorsIDs } from '../../../../e2e/selectors/Settings/SDK.selector
import { useSelector } from 'react-redux';
import { selectProviderConfig } from '../../../selectors/networkController';
import { useNetworkInfo } from '../../../selectors/selectedNetworkController';
import { ConnectedAccountsSelectorsIDs } from '../../../../e2e/selectors/Browser/ConnectedAccountModal.selectors';
import { PermissionSummaryBottomSheetSelectorsIDs } from '../../../../e2e/selectors/Browser/PermissionSummaryBottomSheet.selectors';

const PermissionsSummary = ({
currentPageInformation,
Expand Down Expand Up @@ -176,13 +178,9 @@ const PermissionsSummary = ({
}

const renderEndAccessory = () => (
<View>
<View testID={SDKSelectorsIDs.CONNECTION_DETAILS_BUTTON}>
{isAlreadyConnected ? (
<Icon
size={IconSize.Md}
name={IconName.ArrowRight}
testID={CommonSelectorsIDs.BACK_ARROW_BUTTON}
/>
<Icon size={IconSize.Md} name={IconName.ArrowRight} />
) : (
<View style={styles.editTextContainer}>
<TextComponent
Expand Down Expand Up @@ -274,7 +272,7 @@ const PermissionsSummary = ({
function renderAccountPermissionsRequestInfoCard() {
return (
<TouchableOpacity onPress={handleEditAccountsButtonPress}>
<View style={styles.accountPermissionRequestInfoCard}>
<View style={styles.accountPermissionRequestInfoCard} testID={PermissionSummaryBottomSheetSelectorsIDs.CONTAINER}>
<Avatar
variant={AvatarVariant.Icon}
style={styles.walletIcon}
Expand Down Expand Up @@ -324,7 +322,12 @@ const PermissionsSummary = ({

function renderNetworkPermissionsRequestInfoCard() {
return (
<TouchableOpacity onPress={handleEditNetworksButtonPress}>
<TouchableOpacity
onPress={handleEditNetworksButtonPress}
testID={
ConnectedAccountsSelectorsIDs.NAVIGATE_TO_EDIT_NETWORKS_PERMISSIONS_BUTTON
}
>
<View style={styles.networkPermissionRequestInfoCard}>
<Avatar
style={styles.dataIcon}
Expand Down Expand Up @@ -405,7 +408,7 @@ const PermissionsSummary = ({
<View style={styles.mainContainer}>
<View>
{renderHeader()}
<View style={styles.title}>
<View style={styles.title} testID={PermissionSummaryBottomSheetSelectorsIDs.NETWORK_PERMISSIONS_CONTAINER}>
<TextComponent variant={TextVariant.HeadingSM}>
{isNonDappNetworkSwitch
? strings('permissions.title_add_network_permission')
Expand Down Expand Up @@ -434,6 +437,9 @@ const PermissionsSummary = ({
<View style={styles.disconnectAllContainer}>
<Button
variant={ButtonVariants.Secondary}
testID={
ConnectedAccountsSelectorsIDs.DISCONNECT_ALL_ACCOUNTS_NETWORKS
}
label={strings('accounts.disconnect_all')}
onPress={toggleRevokeAllPermissionsModal}
startIconName={IconName.Logout}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ exports[`PermissionsSummary should render correctly 1`] = `
"marginTop": 8,
}
}
testID="permission-network-permissions-container"
>
<Text
accessibilityRole="text"
Expand Down Expand Up @@ -149,6 +150,7 @@ exports[`PermissionsSummary should render correctly 1`] = `
"marginTop": 8,
}
}
testID="permission-summary-container"
>
<View
style={
Expand Down Expand Up @@ -400,7 +402,9 @@ exports[`PermissionsSummary should render correctly 1`] = `
</View>
</View>
</View>
<View>
<View
testID="connection-details-button"
>
<SvgMock
color="#141618"
height={20}
Expand All @@ -411,14 +415,14 @@ exports[`PermissionsSummary should render correctly 1`] = `
"width": 20,
}
}
testID="back-arrow-button"
width={20}
/>
</View>
</View>
</TouchableOpacity>
<TouchableOpacity
onPress={[Function]}
testID="navigate_to_edit_networks_permissions_button"
>
<View
style={
Expand Down Expand Up @@ -549,7 +553,9 @@ exports[`PermissionsSummary should render correctly 1`] = `
</View>
</View>
</View>
<View>
<View
testID="connection-details-button"
>
<SvgMock
color="#141618"
height={20}
Expand All @@ -560,7 +566,6 @@ exports[`PermissionsSummary should render correctly 1`] = `
"width": 20,
}
}
testID="back-arrow-button"
width={20}
/>
</View>
Expand Down Expand Up @@ -605,6 +610,7 @@ exports[`PermissionsSummary should render correctly 1`] = `
"paddingHorizontal": 16,
}
}
testID="disconnect_all"
>
<SvgMock
color="#d73847"
Expand Down Expand Up @@ -892,6 +898,7 @@ exports[`PermissionsSummary should render correctly for network switch 1`] = `
"marginTop": 8,
}
}
testID="permission-network-permissions-container"
>
<Text
accessibilityRole="text"
Expand All @@ -911,6 +918,7 @@ exports[`PermissionsSummary should render correctly for network switch 1`] = `
</View>
<TouchableOpacity
onPress={[Function]}
testID="navigate_to_edit_networks_permissions_button"
>
<View
style={
Expand Down Expand Up @@ -1111,6 +1119,7 @@ exports[`PermissionsSummary should render correctly for network switch 1`] = `
"paddingHorizontal": 16,
}
}
testID="disconnect_all"
>
<SvgMock
color="#d73847"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import { useNavigation } from '@react-navigation/native';
import Routes from '../../../../constants/navigation/Routes';
import { isMultichainVersion1Enabled } from '../../../../util/networks';
import Checkbox from '../../../../component-library/components/Checkbox';
import { ConnectedAccountsSelectorsIDs } from '../../../../../e2e/selectors/Browser/ConnectedAccountModal.selectors';

const AccountConnectMultiSelector = ({
accounts,
Expand Down Expand Up @@ -266,6 +267,7 @@ const AccountConnectMultiSelector = ({
<Button
variant={ButtonVariants.Primary}
label={strings('accounts.disconnect')}
testID={ConnectedAccountsSelectorsIDs.DISCONNECT}
onPress={toggleRevokeAllAccountPermissionsModal}
isDanger
size={ButtonSize.Lg}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import UntypedEngine from '../../../../core/Engine';
import Logger from '../../../../util/Logger';
import { useStyles } from '../../../../component-library/hooks';
import styleSheet from './AccountPermissionsConfirmRevokeAll.styles';
import { ConnectedAccountsSelectorsIDs } from '../../../../../e2e/selectors/Browser/ConnectedAccountModal.selectors';

interface AccountPermissionsConfirmRevokeAllProps {
route: {
Expand Down Expand Up @@ -97,6 +98,9 @@ const AccountPermissionsConfirmRevokeAll = (
size={ButtonSize.Lg}
variant={ButtonVariants.Primary}
onPress={revokeAllAccounts}
testID={
ConnectedAccountsSelectorsIDs.CONFIRM_DISCONNECT_NETWORKS_BUTTON
}
isDanger
/>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ exports[`AccountPermissionsConfirmRevokeAll renders correctly 1`] = `
"paddingHorizontal": 16,
}
}
testID="confirm_disconnect_networks"
>
<Text
accessibilityRole="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ const AccountPermissionsConnected = ({
AccountPermissionsScreens.PermissionsSummary,
);
}}
testID={ConnectedAccountsSelectorsIDs.MANAGE_PERMISSIONS}
width={ButtonWidthTypes.Full}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ exports[`AccountPermissions with feature flags ON should render AccountPermissio
"paddingHorizontal": 16,
}
}
testID="manage_permissions"
>
<Text
accessibilityRole="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import Engine from '../../../../core/Engine';
import { PermissionKeys } from '../../../../core/Permissions/specifications';
import { CaveatTypes } from '../../../../core/Permissions/constants';
import { getNetworkImageSource } from '../../../../util/networks';
import { ConnectedAccountsSelectorsIDs } from '../../../../../e2e/selectors/Browser/ConnectedAccountModal.selectors';
import Logger from '../../../../util/Logger';

const NetworkConnectMultiSelector = ({
Expand Down Expand Up @@ -239,6 +240,10 @@ const NetworkConnectMultiSelector = ({
<Checkbox
style={styles.selectAllContainer}
label={strings('networks.select_all')}
testID={ConnectedAccountsSelectorsIDs.SELECT_ALL_NETWORKS_BUTTON}
accessibilityLabel={
ConnectedAccountsSelectorsIDs.SELECT_ALL_NETWORKS_BUTTON
}
isIndeterminate={areSomeNetworksSelectedButNotAll}
isChecked={areAllNetworksSelected}
onPress={onPress}
Expand Down Expand Up @@ -294,6 +299,9 @@ const NetworkConnectMultiSelector = ({
<Button
variant={ButtonVariants.Primary}
label={strings('common.disconnect')}
testID={
ConnectedAccountsSelectorsIDs.DISCONNECT_NETWORKS_BUTTON
}
onPress={toggleRevokeAllNetworkPermissionsModal}
isDanger
size={ButtonSize.Lg}
Expand Down
65 changes: 54 additions & 11 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ pipelines:
stages:
- create_build_qa_android: {}
- app_upgrade_test_stage: {}
multichain_e2e_pipeline:
stages:
- build_multichain_e2e_ios_android_stage: {}
- run_multichain_e2e_ios_android_stage: {}
# Pipeline for Flask
create_flask_release_builds_pipeline:
stages:
Expand Down Expand Up @@ -131,6 +135,15 @@ stages:
workflows:
- ios_e2e_build: {}
- android_e2e_build: {}
build_multichain_e2e_ios_android_stage:
abort_on_fail: true
workflows:
- build_ios_multichain_e2e: {}
- build_android_multichain_e2e: {}
run_multichain_e2e_ios_android_stage:
workflows:
- run_tag_multichain_ios: {}
- run_tag_multichain_android: {}
run_smoke_e2e_ios_android_stage:
workflows:
- run_ios_api_specs: {}
Expand All @@ -146,10 +159,12 @@ stages:
# - run_tag_smoke_swaps_android: {}
- run_tag_smoke_core_ios: {}
- run_tag_smoke_core_android: {}
- run_tag_multichain_ios: {}
- run_tag_multichain_android: {}
build_regression_e2e_ios_android_stage:
workflows:
- ios_e2e_build: {}
- android_e2e_build: {}
- ios_build_regression_tests: {}
- android_build_regression_tests: {}
run_regression_e2e_ios_android_stage:
workflows:
- ios_run_regression_tests: {}
Expand Down Expand Up @@ -475,6 +490,8 @@ workflows:
ios_build_regression_tests:
envs:
- TEST_SUITE: 'Regression'
- MM_MULTICHAIN_V1_ENABLED: false
- MM_CHAIN_PERMISSIONS: false
after_run:
- ios_e2e_build
ios_run_regression_tests:
Expand All @@ -489,6 +506,8 @@ workflows:
machine_type_id: elite-xl
envs:
- TEST_SUITE: 'Regression'
- MM_MULTICHAIN_V1_ENABLED: false
- MM_CHAIN_PERMISSIONS: false
after_run:
- android_e2e_build
android_run_regression_tests:
Expand All @@ -515,6 +534,17 @@ workflows:
- TEST_TYPE: 'upgrade'
after_run:
- wdio_android_e2e_test
build_ios_multichain_e2e:
after_run:
- ios_e2e_build
# - android_e2e_build
build_android_multichain_e2e:
meta:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: elite-xl
after_run:
- android_e2e_build
run_android_app_launch_times_appium_test:
envs:
- TEST_TYPE: 'performance'
Expand Down Expand Up @@ -634,7 +664,7 @@ workflows:
- ios_api_specs
run_tag_smoke_core_ios:
envs:
- TEST_SUITE_FOLDER: './e2e/spec/*/**/*'
- TEST_SUITE_FOLDER: './e2e/specs/*/**/*'
- TEST_SUITE_TAG: '.*SmokeCore.*'
after_run:
- ios_e2e_test
Expand All @@ -644,7 +674,23 @@ workflows:
stack: linux-docker-android-22.04
machine_type_id: elite-xl
envs:
- TEST_SUITE_FOLDER: './e2e/spec/*/**/*'
- TEST_SUITE_FOLDER: './e2e/specs/*/**/*'
- TEST_SUITE_TAG: '.*SmokeCore.*'
after_run:
- android_e2e_test
run_tag_multichain_ios:
envs:
- TEST_SUITE_FOLDER: './e2e/specs/multichain/*'
- TEST_SUITE_TAG: '.*SmokeCore.*'
after_run:
- ios_e2e_test
run_tag_multichain_android:
meta:
bitrise.io:
stack: linux-docker-android-22.04
machine_type_id: elite-xl
envs:
- TEST_SUITE_FOLDER: './e2e/specs/multichain/*'
- TEST_SUITE_TAG: '.*SmokeCore.*'
after_run:
- android_e2e_test
Expand Down Expand Up @@ -945,11 +991,6 @@ workflows:
- content: |-
#!/usr/bin/env bash
./scripts/cache/setup-ccache.sh
if [ "$TEST_SUITE" = "Regression" ]; then
TEST_SUITE="Regression"
else
TEST_SUITE="Smoke"
fi
node -v
export METAMASK_ENVIRONMENT='local'
export METAMASK_BUILD_TYPE='main'
Expand Down Expand Up @@ -1598,10 +1639,10 @@ app:
PORTFOLIO_VIEW: false
- opts:
is_expand: false
MM_MULTICHAIN_V1_ENABLED: false
MM_MULTICHAIN_V1_ENABLED: true
- opts:
is_expand: false
MM_CHAIN_PERMISSIONS: false
MM_CHAIN_PERMISSIONS: true
- opts:
is_expand: false
MM_PERMISSIONS_SETTINGS_V1_ENABLED: false
Expand Down Expand Up @@ -1692,3 +1733,5 @@ trigger_map:
pipeline: pr_smoke_e2e_pipeline
- tag: 'v*.*.*-RC-*'
pipeline: release_e2e_pipeline
- push_branch: test-multichain-e2e-ci-workflow
pipeline: pr_regression_e2e_pipeline
Loading

0 comments on commit d71de20

Please sign in to comment.