From 9cf7bfd7e9468a95100ce9ad23346755461297f8 Mon Sep 17 00:00:00 2001 From: SamuelSalas Date: Thu, 26 Sep 2024 17:20:10 -0600 Subject: [PATCH] Remove depricated tests and page object files related --- e2e/pages/ContractNickNameView.js | 44 ---- e2e/pages/Onboarding/DefaultNetworkView.js | 29 --- e2e/pages/Onboarding/MetaMetricsOptInView.js | 9 - .../add-edit-custom-eth-mainnet.failing.js | 115 ---------- .../quarantine/contract-nickname.failing.js | 207 ------------------ 5 files changed, 404 deletions(-) delete mode 100644 e2e/pages/ContractNickNameView.js delete mode 100644 e2e/pages/Onboarding/DefaultNetworkView.js delete mode 100644 e2e/specs/quarantine/add-edit-custom-eth-mainnet.failing.js delete mode 100644 e2e/specs/quarantine/contract-nickname.failing.js diff --git a/e2e/pages/ContractNickNameView.js b/e2e/pages/ContractNickNameView.js deleted file mode 100644 index c466a4f0531..00000000000 --- a/e2e/pages/ContractNickNameView.js +++ /dev/null @@ -1,44 +0,0 @@ -import TestHelpers from '../helpers'; -import { ContractNickNameViewSelectorsIDs } from '../selectors/ContractNickNameView.selectors'; - -export default class ContractNickNameView { - static async typeContractNickName(nickName) { - if (device.getPlatform() === 'android') { - await TestHelpers.replaceTextInField( - ContractNickNameViewSelectorsIDs.NAME_INPUT, - nickName, - ); - await element( - by.id(ContractNickNameViewSelectorsIDs.NAME_INPUT), - ).tapReturnKey(); - } else { - await TestHelpers.typeTextAndHideKeyboard( - ContractNickNameViewSelectorsIDs.NAME_INPUT, - nickName, - ); - } - } - - static async clearNickName() { - await TestHelpers.replaceTextInField( - ContractNickNameViewSelectorsIDs.NAME_INPUT, - '', - ); - } - - static async tapConfirmButton() { - await TestHelpers.waitAndTap( - ContractNickNameViewSelectorsIDs.CONFIRM_BUTTON, - ); - } - - static async isVisible() { - await TestHelpers.checkIfVisible( - ContractNickNameViewSelectorsIDs.CONTAINER, - ); - } - - static async isContractNickNameInInputBoxVisible(nickName) { - await TestHelpers.checkIfElementWithTextIsVisible(nickName); - } -} diff --git a/e2e/pages/Onboarding/DefaultNetworkView.js b/e2e/pages/Onboarding/DefaultNetworkView.js deleted file mode 100644 index 13bb5930ef0..00000000000 --- a/e2e/pages/Onboarding/DefaultNetworkView.js +++ /dev/null @@ -1,29 +0,0 @@ -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); - } - - async typeRpcURL(rpcURL) { - await (await NetworksView.rpcURLInput).clearText(); - await NetworksView.typeInRpcUrl(rpcURL); - } -} - -export default new DefaultNetworkView(); diff --git a/e2e/pages/Onboarding/MetaMetricsOptInView.js b/e2e/pages/Onboarding/MetaMetricsOptInView.js index a2c0ab960a1..e2b8d678af8 100644 --- a/e2e/pages/Onboarding/MetaMetricsOptInView.js +++ b/e2e/pages/Onboarding/MetaMetricsOptInView.js @@ -36,15 +36,6 @@ class MetaMetricsOptIn { await Gestures.swipe(this.optInMetricsContent, 'up', 'fast', 0.9); await Gestures.waitAndTap(this.noThanksButton); } - - async tapEditDefaultNetworkHere() { - await Gestures.swipe(this.optInMetricsContent, 'up', 'fast', 0.9); - if (device.getPlatform() === 'ios') { - await Gestures.tapAtPoint(this.container, { x: 333, y: 534 }); - } else { - await Gestures.tapAtPoint(this.optInMetricsContent, { x: 15, y: 570 }); - } - } } export default new MetaMetricsOptIn(); diff --git a/e2e/specs/quarantine/add-edit-custom-eth-mainnet.failing.js b/e2e/specs/quarantine/add-edit-custom-eth-mainnet.failing.js deleted file mode 100644 index 95fb09f997a..00000000000 --- a/e2e/specs/quarantine/add-edit-custom-eth-mainnet.failing.js +++ /dev/null @@ -1,115 +0,0 @@ -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 OnboardingSuccessView from '../../pages/Onboarding/OnboardingSuccessView'; -import EnableAutomaticSecurityChecksView from '../../pages/EnableAutomaticSecurityChecksView'; -import SkipAccountSecurityModal from '../../pages/modals/SkipAccountSecurityModal'; -import WalletView from '../../pages/wallet/WalletView'; -import ProtectYourWalletView from '../../pages/Onboarding/ProtectYourWalletView'; -import NetworksView from '../../pages/Settings/NetworksView'; -import Accounts from '../../../wdio/helpers/Accounts'; -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 ExperienceEnhancerModal from '../../pages/modals/ExperienceEnhancerModal'; - -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( - CustomNetworks.EthereumMainCustom.providerConfig.rpcUrlInvalid, - ); - await Assertions.checkIfVisible(NetworksView.rpcWarningBanner); - }); - - it('should edit default ETH Mainnet with valid RPC', async () => { - await DefaultNetworkView.typeRpcURL( - CustomNetworks.EthereumMainCustom.providerConfig.rpcUrl, - ); - await DefaultNetworkView.tapUseThisNetworkButton(); - await Assertions.checkIfVisible(MetaMetricsOptIn.container); - }); - - it('should complete creating wallet', 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 OnboardingSuccessView.tapDone(); - await EnableAutomaticSecurityChecksView.tapNoThanks(); - await OnboardingWizardModal.tapNoThanksButton(); - await ExperienceEnhancerModal.tapIagree(); - }); - - it('should show custom default ETH Mainnet as active', async () => { - await Assertions.checkIfElementToHaveText( - WalletView.navbarNetworkText, - CustomNetworks.EthereumMainCustom.providerConfig.nickname, - ); - }); - - 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 Assertions.checkIfElementToHaveText( - WalletView.navbarNetworkText, - CustomNetworks.Sepolia.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 Assertions.checkIfElementToHaveText( - WalletView.navbarNetworkText, - CustomNetworks.Sepolia.providerConfig.nickname, - ); - }); -}); diff --git a/e2e/specs/quarantine/contract-nickname.failing.js b/e2e/specs/quarantine/contract-nickname.failing.js deleted file mode 100644 index 5e042bd4f6a..00000000000 --- a/e2e/specs/quarantine/contract-nickname.failing.js +++ /dev/null @@ -1,207 +0,0 @@ -'use strict'; -import ImportWalletView from '../../pages/Onboarding/ImportWalletView'; -import OnboardingView from '../../pages/Onboarding/OnboardingView'; -import OnboardingCarouselView from '../../pages/Onboarding/OnboardingCarouselView'; - -import ContractNickNameView from '../../pages/ContractNickNameView'; -import SendView from '../../pages/Send/SendView'; -import MetaMetricsOptIn from '../../pages/Onboarding/MetaMetricsOptInView'; -import WalletView from '../../pages/wallet/WalletView'; -import EnableAutomaticSecurityChecksView from '../../pages/EnableAutomaticSecurityChecksView'; -import LoginView from '../../pages/LoginView'; - -import ContactsView from '../../pages/Settings/Contacts/ContactsView'; -import SettingsView from '../../pages/Settings/SettingsView'; - -import NetworkListModal from '../../pages/modals/NetworkListModal'; -import OnboardingWizardModal from '../../pages/modals/OnboardingWizardModal'; -import NetworkEducationModal from '../../pages/modals/NetworkEducationModal'; -import SecurityAndPrivacy from '../../pages/Settings/SecurityAndPrivacy/SecurityAndPrivacyView'; - -import TestHelpers from '../../helpers'; -import { acceptTermOfUse } from '../../viewHelper'; -import Accounts from '../../../wdio/helpers/Accounts'; -import TabBarComponent from '../../pages/TabBarComponent'; -import WalletActionsModal from '../../pages/modals/WalletActionsModal'; -import ContractApprovalModal from '../../pages/modals/ContractApprovalModal'; -import CommonView from '../../pages/CommonView'; -import Assertions from '../../utils/Assertions'; -import { CustomNetworks } from '../../resources/networks.e2e'; - -describe('Adding Contract Nickname', () => { - const APPROVAL_DEEPLINK_URL = - 'https://metamask.app.link/send/0x326C977E6efc84E512bB9C30f76E30c160eD06FB@5/approve?address=0x178e3e6c9f547A00E33150F7104427ea02cfc747&uint256=5e8'; - const CONTRACT_NICK_NAME_TEXT = 'Ace RoMaIn'; - - //FIXME Deep linking to a contract address does not work on a sim. - - let validAccount; - - beforeAll(() => { - validAccount = Accounts.getValidAccount(); - }); - - beforeEach(() => { - jest.setTimeout(150000); - }); - - it('should import via seed phrase and validate in settings', async () => { - await Assertions.checkIfVisible(OnboardingCarouselView.container); - await OnboardingCarouselView.tapOnGetStartedButton(); - - await Assertions.checkIfVisible(OnboardingView.container); - await OnboardingView.tapImportWalletFromSeedPhrase(); - - await Assertions.checkIfVisible(MetaMetricsOptIn.container); - await MetaMetricsOptIn.tapAgreeButton(); - - await acceptTermOfUse(); - await Assertions.checkIfVisible(ImportWalletView.container); - }); - - it('should attempt to import wallet with invalid secret recovery phrase', async () => { - await ImportWalletView.enterSecretRecoveryPhrase(validAccount.seedPhrase); - await ImportWalletView.enterPassword(validAccount.password); - await ImportWalletView.reEnterPassword(validAccount.password); - await Assertions.checkIfVisible(WalletView.container); - }); - - it('Should dismiss Automatic Security checks screen', async () => { - await TestHelpers.delay(3500); - await EnableAutomaticSecurityChecksView.isVisible(); - await EnableAutomaticSecurityChecksView.tapNoThanks(); - }); - - it('should dismiss the onboarding wizard', async () => { - // dealing with flakiness on bitrise. - await TestHelpers.delay(1000); - try { - await Assertions.checkIfVisible(OnboardingWizardModal.stepOneContainer); - await OnboardingWizardModal.tapNoThanksButton(); - await Assertions.checkIfNotVisible( - OnboardingWizardModal.stepOneContainer, - ); - } catch { - // - } - }); - - it('should switch to SEPOLIA', async () => { - await WalletView.tapNetworksButtonOnNavBar(); - await NetworkListModal.changeNetworkTo( - CustomNetworks.Sepolia.providerConfig.nickname, - ); - await Assertions.checkIfElementToHaveText( - WalletView.navbarNetworkText, - CustomNetworks.Sepolia.providerConfig.nickname, - ); - await TestHelpers.delay(1500); - }); - - it('should dismiss network education modal', async () => { - await Assertions.checkIfVisible(NetworkEducationModal.container); - await NetworkEducationModal.tapGotItButton(); - await Assertions.checkIfNotVisible(NetworkEducationModal.container); - }); - it('should go to the Privacy and settings view', async () => { - await TabBarComponent.tapSettings(); - await SettingsView.tapSecurityAndPrivacy(); - - await SecurityAndPrivacy.scrollToTurnOnRememberMe(); - await TestHelpers.delay(3000); - }); - - it('should enable remember me', async () => { - await Assertions.checkIfToggleIsOff(SecurityAndPrivacy.rememberMeToggle); - await SecurityAndPrivacy.tapTurnOnRememberMeToggle(); - await Assertions.checkIfToggleIsOn(SecurityAndPrivacy.rememberMeToggle); - - await TestHelpers.delay(1500); - }); - - it('should relaunch the app then enable remember me', async () => { - // Relaunch app - await TestHelpers.relaunchApp(); - await LoginView.isVisible(); - await LoginView.toggleRememberMe(); - - await LoginView.enterPassword(validAccount.password); - await Assertions.checkIfVisible(WalletView.container); - }); - - it('should deep link to the approval modal', async () => { - await TestHelpers.openDeepLink(APPROVAL_DEEPLINK_URL); - await TestHelpers.delay(3000); - await Assertions.checkIfVisible(ContractApprovalModal.container); - }); - - it('should add a nickname to the contract', async () => { - await ContractApprovalModal.tapAddNickName(); - - await ContractNickNameView.isVisible(); - await ContractNickNameView.typeContractNickName(CONTRACT_NICK_NAME_TEXT); - await ContractNickNameView.isContractNickNameInInputBoxVisible( - CONTRACT_NICK_NAME_TEXT, - ); - await ContractNickNameView.tapConfirmButton(); - }); - - it('should edit the contract nickname', async () => { - await ContractApprovalModal.tapEditNickName(); - - await ContractNickNameView.isContractNickNameInInputBoxVisible( - CONTRACT_NICK_NAME_TEXT, - ); - await ContractNickNameView.clearNickName(); - await ContractNickNameView.typeContractNickName('Ace'); - await ContractNickNameView.tapConfirmButton(); - - await ContractApprovalModal.tapToCopyContractAddress(); - await ContractApprovalModal.tapRejectButton(); - }); - - it('should verify contract does not appear in contacts view', async () => { - // Check that we are on the wallet screen - await Assertions.checkIfVisible(WalletView.container); - await TabBarComponent.tapSettings(); - await SettingsView.tapContacts(); - - await Assertions.checkIfVisible(ContactsView.container); - await ContactsView.isContactAliasVisible('Ace'); - }); - - it('should return to the send view', async () => { - // Open Drawer - await CommonView.tapBackButton(); - - await TabBarComponent.tapActions(); - await WalletActionsModal.tapSendButton(); - // Make sure view with my accounts visible - await Assertions.checkIfVisible(SendView.CurrentAccountElement); - }); - - it('should verify the contract nickname does not appear in send flow', async () => { - await Assertions.checkIfTextIsNotDisplayed('Ace'); - }); - - it('should deep link to the approval modal and approve transaction', async () => { - await TestHelpers.openDeepLink(APPROVAL_DEEPLINK_URL); - await TestHelpers.delay(3000); - await Assertions.checkIfVisible(ContractApprovalModal.container); - - await ContractApprovalModal.tapApproveButton(); - await Assertions.checkIfNotVisible(ContractApprovalModal.container); - }); - - it('should go to the send view again', async () => { - await TabBarComponent.tapActions(); - await WalletActionsModal.tapSendButton(); - // Make sure view with my accounts visible - //TODO: Update SendView.isMyAccountsVisible, this method does not exist - //await SendView.isMyAccountsVisible(); - }); - - it('should verify the contract nickname does not appear in recents', async () => { - await Assertions.checkIfTextIsNotDisplayed('Ace'); - }); -});