diff --git a/e2e/pages/Settings/NetworksView.js b/e2e/pages/Settings/NetworksView.js index 21fd71eae8d..39c0f90d7d6 100644 --- a/e2e/pages/Settings/NetworksView.js +++ b/e2e/pages/Settings/NetworksView.js @@ -106,6 +106,10 @@ class NetworkView { return Matchers.getElementByText(NetworkViewSelectorsText.REMOVE_NETWORK); } + get saveButton() { + return Matchers.getElementByText(NetworkViewSelectorsText.SAVE_BUTTON); + } + async getnetworkName(networkName) { return Matchers.getElementByText(networkName); } @@ -175,6 +179,16 @@ class NetworkView { // Because in bitrise the keyboard is blocking the "Add" CTA await Gestures.waitAndTap(this.chainIdLabel); } + + async tapSave() { + device.getPlatform() === 'ios' + ? await (async () => { + //swipe to dismiss iOS keypad + await Gestures.swipe(this.chainIDInput, 'up', 'fast', 0.3); + await Gestures.doubleTap(this.saveButton); + })() + : await Gestures.waitAndTap(this.saveButton); + } } export default new NetworkView(); diff --git a/e2e/resources/blacklistURLs.json b/e2e/resources/blacklistURLs.json index 0501e0db685..1d1dec71849 100644 --- a/e2e/resources/blacklistURLs.json +++ b/e2e/resources/blacklistURLs.json @@ -12,6 +12,7 @@ ".*stale.*", ".*phishing-detection.metafi.codefi.network/.*", ".*phishing-detection.cx.metamask.io/.*", + ".*eth.llamarpc.com/.*", ".*token-api.metaswap.codefi.network/.*" ] } diff --git a/e2e/resources/networks.e2e.js b/e2e/resources/networks.e2e.js index 5f3f1029d32..e10e9fdbaf9 100644 --- a/e2e/resources/networks.e2e.js +++ b/e2e/resources/networks.e2e.js @@ -76,7 +76,9 @@ const CustomNetworks = { providerConfig: { type: 'rpc', chainId: '0x1', + rpcUrlInvalid: 'https//rpc.mevblocker.io', rpcUrl: 'https://eth.llamarpc.com', + rpcUrlAlt: 'https://rpc.mevblocker.io', nickname: 'Ethereum Main Custom', ticker: 'ETH', }, diff --git a/e2e/selectors/Settings/NetworksView.selectors.js b/e2e/selectors/Settings/NetworksView.selectors.js index a24dd3fb44d..cd6d2e06ab7 100644 --- a/e2e/selectors/Settings/NetworksView.selectors.js +++ b/e2e/selectors/Settings/NetworksView.selectors.js @@ -28,4 +28,5 @@ export const NetworkViewSelectorsText = { POPULAR_NETWORK_TAB: enContent.app_settings.popular, NO_MATCHING_SEARCH_RESULTS: enContent.networks.no_match, EMPTY_POPULAR_NETWORKS: enContent.networks.empty_popular_networks, + SAVE_BUTTON: enContent.app_settings.network_save, }; diff --git a/e2e/specs/onboarding/add-custom-eth-mainnet.spec.js b/e2e/specs/onboarding/add-edit-custom-eth-mainnet.spec.js similarity index 53% rename from e2e/specs/onboarding/add-custom-eth-mainnet.spec.js rename to e2e/specs/onboarding/add-edit-custom-eth-mainnet.spec.js index c0d41a6bdaf..eab2746fd40 100644 --- a/e2e/specs/onboarding/add-custom-eth-mainnet.spec.js +++ b/e2e/specs/onboarding/add-edit-custom-eth-mainnet.spec.js @@ -13,8 +13,14 @@ 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 { CustomNetworks } from '../../resources/networks.e2e'; +import TabBarComponent from '../../pages/TabBarComponent'; +import SettingsView from '../../pages/Settings/SettingsView'; +import NetworkListModal from '../../pages/modals/NetworkListModal'; +import OnboardingWizardModal from '../../pages/modals/OnboardingWizardModal'; +import ProtectYourWalletModal from '../../pages/modals/ProtectYourWalletModal'; +import WhatsNewModal from '../../pages/modals/WhatsNewModal'; +import TestHelpers from '../../helpers'; const validAccount = Accounts.getValidAccount(); @@ -31,7 +37,9 @@ describe(Regression('Add custom default ETH Mainnet'), () => { it('should not edit default network with invalid RPC', async () => { await MetaMetricsOptIn.tapEditDefaultNetworkHere(); - await DefaultNetworkView.typeRpcURL('https//rpc.mevblocker.io'); + await DefaultNetworkView.typeRpcURL( + CustomNetworks.EthereumMainCustom.providerConfig.rpcUrlInvalid, + ); await Assertions.checkIfVisible(NetworksView.rpcWarningBanner); }); @@ -43,7 +51,7 @@ describe(Regression('Add custom default ETH Mainnet'), () => { await Assertions.checkIfVisible(MetaMetricsOptIn.container); }); - it('should show custom default ETH Mainnet as active', async () => { + it('should complete creating wallet', async () => { await MetaMetricsOptIn.tapAgreeButton(); await TermsOfUseModal.tapScrollEndButton(); await TermsOfUseModal.tapAgreeCheckBox(); @@ -57,6 +65,59 @@ describe(Regression('Add custom default ETH Mainnet'), () => { await SkipAccountSecurityModal.tapSkipButton(); await OnboardingSuccessView.tapDone(); await EnableAutomaticSecurityChecksView.tapNoThanks(); - await WalletView.isNetworkNameVisible(DEFAULT_MAINNET_CUSTOM_NAME); + await OnboardingWizardModal.tapNoThanksButton(); + }); + + it('should show custom default ETH Mainnet as active', async () => { + await WalletView.isNetworkNameVisible( + CustomNetworks.EthereumMainCustom.providerConfig.nickname, + ); + }); + + it('should tap to close the whats new modal if displayed', async () => { + // dealing with flakiness on bitrise. + await TestHelpers.delay(2500); + try { + await WhatsNewModal.isVisible(); + await WhatsNewModal.tapCloseButton(); + } catch { + // + } + }); + + it('should navigate to Settings > Networks', async () => { + await Assertions.checkIfVisible(ProtectYourWalletModal.collapseWalletModal); + await ProtectYourWalletModal.tapRemindMeLaterButton(); + await SkipAccountSecurityModal.tapIUnderstandCheckBox(); + await SkipAccountSecurityModal.tapSkipButton(); + await TabBarComponent.tapSettings(); + await SettingsView.scrollToContactSupportButton(); + await SettingsView.tapNetworks(); + await Assertions.checkIfVisible(NetworksView.networkContainer); + }); + + it('should edit custom default mainnet and land on Wallet view', async () => { + await NetworksView.tapNetworkByName( + CustomNetworks.EthereumMainCustom.providerConfig.nickname, + ); + await NetworksView.clearRpcInputBox(); + await NetworksView.typeInRpcUrl( + CustomNetworks.EthereumMainCustom.providerConfig.rpcUrlAlt, + ); + await NetworksView.tapSave(); + await WalletView.isConnectedNetwork( + CustomNetworks.EthereumMainCustom.providerConfig.nickname, + ); + }); + + it('should show Ethereum Main Custom on added network list', async () => { + await WalletView.tapNetworksButtonOnNavBar(); + await NetworkListModal.changeNetworkTo( + CustomNetworks.EthereumMainCustom.providerConfig.nickname, + true, //setting this made this step work for iOS + ); + await WalletView.isConnectedNetwork( + CustomNetworks.EthereumMainCustom.providerConfig.nickname, + ); }); });