Skip to content

Commit

Permalink
Merge branch 'main' into feat/preinstalled-mobile-snaps
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathansoufer authored May 7, 2024
2 parents eff8ee9 + 0683565 commit c197911
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 4 deletions.
14 changes: 14 additions & 0 deletions e2e/pages/Settings/NetworksView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
1 change: 1 addition & 0 deletions e2e/resources/blacklistURLs.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
".*stale.*",
".*phishing-detection.metafi.codefi.network/.*",
".*phishing-detection.cx.metamask.io/.*",
".*eth.llamarpc.com/.*",
".*token-api.metaswap.codefi.network/.*"
]
}
2 changes: 2 additions & 0 deletions e2e/resources/networks.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down
1 change: 1 addition & 0 deletions e2e/selectors/Settings/NetworksView.selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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);
});

Expand All @@ -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();
Expand All @@ -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,
);
});
});

0 comments on commit c197911

Please sign in to comment.