-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Onboarding add custom default ETH Mainnet (#8723)
## **Description** New test for adding a custom default ETH Mainnet during Onboarding after MMM has been installed on device. Added this test as part of the Regression tests. ## **Related issues** Fixes: MetaMask/mobile-planning#1455 ## **Manual testing steps** On local machine run on this branch... Android: `yarn test:e2e:android:debug:single ./e2e/specs/onboarding/add-custom-eth-mainnet.spec.js` iOS: `yarn test:e2e:ios:debug:single ./e2e/specs/onboarding/add-custom-eth-mainnet.spec.js` On bitrise run `pr_regression_e2e_pipeline` on this branch. Above steps should pass. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** Regression tests: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/27207577-3107-4fdb-b0b7-56561831c263 Smoke tests: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/6d64d3b0-8537-4c24-8b98-a832bfdd4211 https://github.com/MetaMask/metamask-mobile/assets/6626407/c3311213-42d1-4843-b672-510a3da8d2c0 <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've clearly explained what problem this PR is solving and how it is solved. - [x] I've linked related issues - [x] I've included manual testing steps - [x] I've included screenshots/recordings if applicable - [x] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] 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. - [x] I’ve properly set the pull request status: - [x] In case it's not yet "ready for review", I've set it to "draft". - [x] In case it's "ready for review", I've changed it from "draft" to "non-draft". ## **Pre-merge reviewer checklist** - [x] 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.
- Loading branch information
1 parent
c02483c
commit 9103133
Showing
9 changed files
with
158 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Matchers from '../../utils/Matchers'; | ||
import Gestures from '../../utils/Gestures'; | ||
import NetworksView from '../Settings/NetworksView'; | ||
import { | ||
CustomDefaultNetworkIDs, | ||
CustomDefaultNetworkTexts, | ||
} from '../../selectors/Onboarding/CustomDefaultNetwork.selectors'; | ||
|
||
class DefaultNetworkView { | ||
get useThisNetworkButton() { | ||
return device.getPlatform() === 'ios' | ||
? Matchers.getElementByID( | ||
CustomDefaultNetworkIDs.USE_THIS_NETWORK_BUTTON_ID, | ||
) | ||
: Matchers.getElementByLabel( | ||
CustomDefaultNetworkTexts.USE_THIS_NETWORK_BUTTON_TEXT, | ||
); | ||
} | ||
|
||
async tapUseThisNetworkButton() { | ||
await Gestures.waitAndTap(this.useThisNetworkButton); | ||
await Gestures.waitAndTap(this.useThisNetworkButton); | ||
} | ||
|
||
async typeRpcURL(rpcURL) { | ||
await (await NetworksView.rpcURLInput).clearText(); | ||
await NetworksView.typeInRpcUrl(rpcURL); | ||
} | ||
} | ||
|
||
export default new DefaultNetworkView(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import messages from '../../../locales/languages/en.json'; | ||
|
||
export const CustomDefaultNetworkIDs = { | ||
USE_THIS_NETWORK_BUTTON_ID: 'use-this-network', | ||
}; | ||
|
||
export const CustomDefaultNetworkTexts = { | ||
USE_THIS_NETWORK_BUTTON_TEXT: messages.app_settings.networks_default_cta, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export const MetaMetricsOptInSelectorsIDs = { | ||
OPTIN_METRICS_TITLE_ID: 'optin-metrics-title-id', | ||
OPTIN_METRICS_NO_THANKS_BUTTON_ID: 'optin-metrics-no-thanks-button-id', | ||
OPTIN_METRICS_I_AGREE_BUTTON_ID: 'optin-metrics-i-agree-button-id', | ||
OPTIN_METRICS_PRIVACY_POLICY_DESCRIPTION_CONTENT_1_ID: | ||
'optin-metrics-privacy-policy-description', | ||
OPTIN_METRICS_HERE_DEFAULT_NETWORK_ID: 'optin-metrics-default-network-id', | ||
DEFAULT_NETWORK_RPC_URL: 'default-network-rpc-url', | ||
DEFAULT_NETWORK_USE_THIS_NETWORK_BUTTON_ID: | ||
'default-network-use-this-button-id', | ||
METAMETRICS_OPT_IN_CONTAINER_ID: 'meta-metrics-container', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { Regression } from '../../tags'; | ||
import OnboardingCarouselView from '../../pages/Onboarding/OnboardingCarouselView'; | ||
import OnboardingView from '../../pages/Onboarding/OnboardingView'; | ||
import Assertions from '../../utils/Assertions'; | ||
import MetaMetricsOptIn from '../../pages/Onboarding/MetaMetricsOptInView'; | ||
import DefaultNetworkView from '../../pages/Onboarding/DefaultNetworkView'; | ||
import TermsOfUseModal from '../../pages/modals/TermsOfUseModal'; | ||
import CreatePasswordView from '../../pages/Onboarding/CreatePasswordView'; | ||
import EnableAutomaticSecurityChecksView from '../../pages/EnableAutomaticSecurityChecksView'; | ||
import SkipAccountSecurityModal from '../../pages/modals/SkipAccountSecurityModal'; | ||
import WalletView from '../../pages/WalletView'; | ||
import ProtectYourWalletView from '../../pages/Onboarding/ProtectYourWalletView'; | ||
import NetworksView from '../../pages/Settings/NetworksView'; | ||
import Accounts from '../../../wdio/helpers/Accounts'; | ||
import { DEFAULT_MAINNET_CUSTOM_NAME } from '../../../app/constants/network'; | ||
import Networks from '../../resources/networks.json'; | ||
|
||
const validAccount = Accounts.getValidAccount(); | ||
|
||
describe(Regression('Add custom default ETH Mainnet'), () => { | ||
beforeAll(async () => { | ||
await device.launchApp(); | ||
}); | ||
|
||
it('should navigate to edit custom default ETH Mainnet from Opt-In screen', async () => { | ||
await OnboardingCarouselView.tapOnGetStartedButton(); | ||
await OnboardingView.tapCreateWallet(); | ||
await Assertions.checkIfVisible(MetaMetricsOptIn.container); | ||
}); | ||
|
||
it('should not edit default network with invalid RPC', async () => { | ||
await MetaMetricsOptIn.tapEditDefaultNetworkHere(); | ||
await DefaultNetworkView.typeRpcURL('https//rpc.mevblocker.io'); | ||
await Assertions.checkIfVisible(NetworksView.rpcWarningBanner); | ||
}); | ||
|
||
it('should edit default ETH Mainnet with valid RPC', async () => { | ||
await DefaultNetworkView.typeRpcURL( | ||
Networks.EthereumMainCustom.providerConfig.rpcUrl, | ||
); | ||
await DefaultNetworkView.tapUseThisNetworkButton(); | ||
await Assertions.checkIfVisible(MetaMetricsOptIn.container); | ||
}); | ||
|
||
it('should show custom default ETH Mainnet as active', async () => { | ||
await MetaMetricsOptIn.tapAgreeButton(); | ||
await TermsOfUseModal.tapScrollEndButton(); | ||
await TermsOfUseModal.tapAgreeCheckBox(); | ||
await TermsOfUseModal.tapAcceptButton(); | ||
await CreatePasswordView.enterPassword(validAccount.password); | ||
await CreatePasswordView.reEnterPassword(validAccount.password); | ||
await CreatePasswordView.tapIUnderstandCheckBox(); | ||
await CreatePasswordView.tapCreatePasswordButton(); | ||
await ProtectYourWalletView.tapOnRemindMeLaterButton(); | ||
await SkipAccountSecurityModal.tapIUnderstandCheckBox(); | ||
await SkipAccountSecurityModal.tapSkipButton(); | ||
await EnableAutomaticSecurityChecksView.tapNoThanks(); | ||
await WalletView.isNetworkNameVisible(DEFAULT_MAINNET_CUSTOM_NAME); | ||
}); | ||
}); |