diff --git a/app/components/UI/CollectibleContracts/index.test.tsx b/app/components/UI/CollectibleContracts/index.test.tsx index 8ed9f29a830..93e0ba1a9c3 100644 --- a/app/components/UI/CollectibleContracts/index.test.tsx +++ b/app/components/UI/CollectibleContracts/index.test.tsx @@ -14,11 +14,11 @@ import * as allSelectors from '../../../../app/reducers/collectibles/index.js'; import { cleanup, waitFor } from '@testing-library/react-native'; import Engine from '../../../core/Engine'; -import TestHelpers from '../../../../e2e/helpers'; import { createMockAccountsControllerState } from '../../../util/test/accountsControllerTestUtils'; import { RootState } from '../../../reducers'; import { mockNetworkState } from '../../../util/test/network'; import { CHAIN_IDS } from '@metamask/transaction-controller'; +import Utilities from '../../../../e2e/utils/Utilities'; jest.mock('@react-navigation/native', () => { const actualReactNavigation = jest.requireActual('@react-navigation/native'); @@ -482,8 +482,7 @@ describe('CollectibleContracts', () => { await act(async () => { await refreshControl.props.onRefresh(); }); - - await TestHelpers.delay(1000); + await Utilities.delay(1000); expect(spyOnUpdateNftMetadata).toHaveBeenCalledTimes(0); expect(spyOnDetectNfts).toHaveBeenCalledTimes(1); diff --git a/e2e/api-specs/ConfirmationsRejectionRule.js b/e2e/api-specs/ConfirmationsRejectionRule.js index 35924379d6e..dad695d8bd9 100644 --- a/e2e/api-specs/ConfirmationsRejectionRule.js +++ b/e2e/api-specs/ConfirmationsRejectionRule.js @@ -1,7 +1,6 @@ import { device } from 'detox'; import { addToQueue } from './helpers'; import paramsToObj from '@open-rpc/test-coverage/build/utils/params-to-obj'; -import TestHelpers from '../helpers'; import Matchers from '../utils/Matchers'; import Gestures from '../utils/Gestures'; import ConnectBottomSheet from '../pages/Browser/ConnectBottomSheet'; @@ -13,6 +12,7 @@ import fs from 'fs'; import Assertions from '../utils/Assertions'; import PermissionSummaryBottomSheet from '../pages/Browser/PermissionSummaryBottomSheet'; +import Utilities from '../utils/Utilities'; const getBase64FromPath = async (path) => { const data = await fs.promises.readFile(path); @@ -67,7 +67,7 @@ export default class ConfirmationsRejectRule { await Assertions.checkIfNotVisible( PermissionSummaryBottomSheet.container, ); - await TestHelpers.delay(3000); + await Utilities.delay(3000); try { await Assertions.checkIfVisible(SpamFilterModal.title); @@ -138,7 +138,7 @@ export default class ConfirmationsRejectRule { resolve, reject, task: async () => { - await TestHelpers.delay(3000); + await Utilities.delay(3000); const imagePath = await device.takeScreenshot( `afterRequest-${this.getTitle()}`, ); @@ -150,7 +150,7 @@ export default class ConfirmationsRejectRule { type: 'image', }); let cancelButton; - await TestHelpers.delay(3000); + await Utilities.delay(3000); if (this.allCapsCancel.includes(call.methodName)) { await AssetWatchBottomSheet.tapCancelButton(); } else { diff --git a/e2e/api-specs/helpers.js b/e2e/api-specs/helpers.js index 9204a096d04..b5ad4820c3f 100644 --- a/e2e/api-specs/helpers.js +++ b/e2e/api-specs/helpers.js @@ -1,5 +1,5 @@ -import TestHelpers from '../helpers'; import { v4 as uuid } from 'uuid'; +import Utilities from '../utils/Utilities'; export const taskQueue = []; let isProcessing = false; @@ -32,7 +32,7 @@ const pollResult = async (driver, generatedKey) => { addToQueue({ name: 'pollResult', task: async () => { - await TestHelpers.delay(500); + await Utilities.delay(500); const text = await driver.runScript( (el, g) => window[g], [generatedKey], diff --git a/e2e/fixtures/fixture-helper.js b/e2e/fixtures/fixture-helper.js index b8df26fcb3c..86db12a5588 100644 --- a/e2e/fixtures/fixture-helper.js +++ b/e2e/fixtures/fixture-helper.js @@ -6,10 +6,14 @@ import GanacheSeeder from '../../app/util/test/ganache-seeder'; import axios from 'axios'; import path from 'path'; import createStaticServer from '../create-static-server'; -import { DEFAULT_MOCKSERVER_PORT, getFixturesServerPort, getLocalTestDappPort, getMockServerPort } from './utils'; +import { + DEFAULT_MOCKSERVER_PORT, + getFixturesServerPort, + getLocalTestDappPort, + getMockServerPort, +} from './utils'; import Utilities from '../utils/Utilities'; import { device } from 'detox'; -import TestHelpers from '../helpers'; import { startMockServer, stopMockServer } from '../api-mocking/mock-server'; export const DEFAULT_DAPP_SERVER_PORT = 8085; @@ -170,7 +174,7 @@ export async function withFixtures(options, testSuite) { // Due to the fact that the app was already launched on `init.js`, it is necessary to // launch into a fresh installation of the app to apply the new fixture loaded perviously. if (restartDevice) { - await TestHelpers.launchApp({ + await Utilities.launchApp({ delete: true, launchArgs: { fixtureServerPort: `${getFixturesServerPort()}`, diff --git a/e2e/helpers.js b/e2e/helpers.js index 5add2ff7db9..3f1672f2358 100644 --- a/e2e/helpers.js +++ b/e2e/helpers.js @@ -9,6 +9,9 @@ import Utilities from './utils/Utilities'; import { resolveConfig } from 'detox/internals'; export default class TestHelpers { + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async waitAndTap(elementId, timeout, index) { await waitFor(element(by.id(elementId))) .toBeVisible() @@ -18,7 +21,9 @@ export default class TestHelpers { .atIndex(index || 0) .tap(); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async waitAndTapText(text, timeout) { await waitFor(element(by.text(text))) .toBeVisible() @@ -26,79 +31,114 @@ export default class TestHelpers { return element(by.text(text)).tap(); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static tap(elementId) { return element(by.id(elementId)).tap(); } + /** + * @deprecated Use Guestures Class to accomplish this. + */ static tapByDescendentTestID(parentElement, ChildElement) { return element( by.id(parentElement).withDescendant(by.id(ChildElement)), ).tap(); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static tapByText(text, index) { return element(by.text(text)) .atIndex(index || 0) .tap(); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static doubleTapByText(text, index) { return element(by.text(text)) .atIndex(index || 0) .multiTap(2); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static tapAtPoint(elementId, point) { return element(by.id(elementId)).tap(point); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static tapItemAtIndex(elementID, index) { return element(by.id(elementID)) .atIndex(index || 0) .tap(); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static tapItemAtIndexByLabel(elementID, index) { return element(by.label(elementID, index)) .atIndex(index || 0) .tap(); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async typeText(elementId, text) { await TestHelpers.tap(elementId); return element(by.id(elementId)).typeText(text); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async typeNumbers(elementId, text, submitLabel) { await element(by.id(elementId)).replaceText(text.replace('\n', '')); return element(by.label(submitLabel)).atIndex(0).tap(); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async typeTextAndHideKeyboard(elementId, text) { if (device.getPlatform() === 'android') { await TestHelpers.clearField(elementId); } await TestHelpers.typeText(elementId, text + '\n'); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async clearField(elementId) { return element(by.id(elementId)).replaceText(''); } + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async tapAndLongPress(elementId) { await TestHelpers.tap(elementId); return element(by.id(elementId)).longPress(2000); } + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async tapAndLongPressAtIndex(elementId, index) { return element(by.id(elementId)) .atIndex(index || 0) .longPress(2000); } + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async replaceTextInField(elementId, text) { return element(by.id(elementId)).replaceText(text); } + /** + * @deprecated Use Guestures Class to accomplish this. + */ static tapAlertWithButton(text, index) { if (device.getPlatform() === 'android') { @@ -109,6 +149,10 @@ export default class TestHelpers { return element(by.label(text)).atIndex(0).tap(); } + + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async waitAndTapByLabel(text, timeout, index) { await waitFor(element(by.label(text))) .toBeVisible() @@ -118,12 +162,16 @@ export default class TestHelpers { .atIndex(index || 0) .tap(); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async tapWebviewElement(elementId) { // this method only words on android: https://wix.github.io/Detox/docs/api/webviews/ return web.element(by.web.id(elementId)).tap(); } - + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async swipe(elementId, direction, speed, percentage, xStart, yStart) { await element(by.id(elementId)).swipe( direction, @@ -133,18 +181,30 @@ export default class TestHelpers { yStart, ); } + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async swipeByLabel(elementId, direction, speed, percentage) { await element(by.label(elementId)).swipe(direction, speed, percentage); } + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async swipeByText(text, direction, speed, percentage) { await element(by.text(text)).atIndex(0).swipe(direction, speed, percentage); } + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async scrollTo(scrollViewId, edge) { await element(by.id(scrollViewId)).scrollTo(edge); } + /** + * @deprecated Use Guestures Class to accomplish this. + */ static async scrollUpTo(elementId, distance, direction) { await element(by.id(elementId)).scroll(distance, direction); } @@ -161,22 +221,34 @@ export default class TestHelpers { }); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async checkIfVisible(elementId) { return await waitFor(element(by.id(elementId))) .toBeVisible() .withTimeout(15000); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async checkIfNotVisible(elementId) { return await waitFor(element(by.id(elementId))) .not.toBeVisible() .withTimeout(10000); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async checkIfElementWithTextIsNotVisible(text) { return await expect(element(by.text(text)).atIndex(0)).not.toBeVisible(); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async checkIfElementNotToHaveText(elementId, text) { await waitFor(element(by.id(elementId))) .toBeVisible() @@ -185,6 +257,9 @@ export default class TestHelpers { return expect(element(by.id(elementId))).not.toHaveText(text); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async checkIfExists(elementId) { await waitFor(element(by.id(elementId))) .toBeVisible() @@ -192,6 +267,9 @@ export default class TestHelpers { return expect(element(by.id(elementId))).toExist(); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async checkIfHasText(elementId, text) { await waitFor(element(by.id(elementId))) .toBeVisible() @@ -200,25 +278,41 @@ export default class TestHelpers { return expect(element(by.id(elementId))).toHaveText(text); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async checkIfElementWithTextIsVisible(text, index) { return await waitFor(element(by.text(text)).atIndex(index || 0)) .toBeVisible() .withTimeout(10000); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async checkIfElementByTextIsVisible(text, timeout = 25000) { return await waitFor(element(by.text(text))) .toBeVisible() .withTimeout(timeout); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async checkIfElementHasString(elementID, text) { return expect(element(by.id(elementID))).toString(text); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static checkIfToggleIsOn(elementID) { return expect(element(by.id(elementID))).toHaveToggleValue(true); } + + /** + * @deprecated Use Assertion Class to accomplish this. + */ static checkIfToggleIsOff(elementID) { return expect(element(by.id(elementID))).toHaveToggleValue(false); } @@ -240,6 +334,9 @@ export default class TestHelpers { }); } // Detox has no waits for webview elements visibility. Here is the custom one. + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async waitForWebElementToBeVisibleById(elementId, timeout = 15000) { const start = Date.now(); while (Date.now() - start < timeout) { @@ -253,6 +350,9 @@ export default class TestHelpers { } throw new Error('Element with ' + elementId + ' not found'); } + /** + * @deprecated Use Assertion Class to accomplish this. + */ static async retry(maxAttempts, testLogic) { for (let attempt = 1; attempt <= maxAttempts; attempt++) { @@ -293,7 +393,9 @@ export default class TestHelpers { } static async launchAppForDebugBuild(platform, launchOptions) { - const deepLinkUrl = this.getDeepLinkUrl(this.getDevLauncherPackagerUrl(platform)); + const deepLinkUrl = this.getDeepLinkUrl( + this.getDevLauncherPackagerUrl(platform), + ); if (platform === 'ios') { await device.launchApp(launchOptions); @@ -304,15 +406,16 @@ export default class TestHelpers { return device.launchApp({ url: deepLinkUrl, - ...launchOptions + ...launchOptions, }); } static getDeepLinkUrl(url) { - return `expo-metamask://expo-development-client/?url=${encodeURIComponent(url)}`; + return `expo-metamask://expo-development-client/?url=${encodeURIComponent( + url, + )}`; } - static getDevLauncherPackagerUrl(platform) { return `http://localhost:8081/index.bundle?platform=${platform}&dev=true&minify=false&disableOnboarding=1`; } diff --git a/e2e/pages/Browser/BrowserView.js b/e2e/pages/Browser/BrowserView.js index bca647e9332..e9223b8c838 100644 --- a/e2e/pages/Browser/BrowserView.js +++ b/e2e/pages/Browser/BrowserView.js @@ -1,4 +1,3 @@ -import TestHelpers from '../../helpers'; import { TEST_DAPP_LOCAL_URL } from './TestDApp'; import { BrowserViewSelectorsIDs, @@ -10,7 +9,7 @@ import { BrowserURLBarSelectorsIDs } from '../../selectors/Browser/BrowserURLBar import { AddBookmarkViewSelectorsIDs } from '../../selectors/Browser/AddBookmarkView.selectors'; import Gestures from '../../utils/Gestures'; import Matchers from '../../utils/Matchers'; - +import Utilities from '../../utils/Utilities'; class Browser { get searchButton() { return Matchers.getElementByID(BrowserViewSelectorsIDs.SEARCH_BUTTON); @@ -185,7 +184,7 @@ class Browser { } async waitForBrowserPageToLoad() { - await TestHelpers.delay(5000); + await Utilities.delay(5000); } async navigateToTestDApp() { diff --git a/e2e/pages/Browser/ConnectedAccountsModal.js b/e2e/pages/Browser/ConnectedAccountsModal.js index 7940907e56b..38c2b905d81 100644 --- a/e2e/pages/Browser/ConnectedAccountsModal.js +++ b/e2e/pages/Browser/ConnectedAccountsModal.js @@ -4,7 +4,7 @@ import { } from '../../selectors/Browser/ConnectedAccountModal.selectors'; import Matchers from '../../utils/Matchers'; import Gestures from '../../utils/Gestures'; -import TestHelpers from '../../helpers'; +import Utilities from '../../utils/Utilities'; class ConnectedAccountsModal { get permissionsButton() { @@ -89,7 +89,7 @@ class ConnectedAccountsModal { } async tapManagePermissionsButton() { - await TestHelpers.delay(4000); + await Utilities.delay(4000); await Gestures.waitAndTap(this.managePermissionsButton); } diff --git a/e2e/pages/Browser/PortfolioHomePage.js b/e2e/pages/Browser/PortfolioHomePage.js index 9bdd49988fa..1b824b2a1a4 100644 --- a/e2e/pages/Browser/PortfolioHomePage.js +++ b/e2e/pages/Browser/PortfolioHomePage.js @@ -2,7 +2,7 @@ import { BrowserViewSelectorsIDs } from '../../selectors/Browser/BrowserView.sel import { PortfolioPageSelectorsXpath } from '../../selectors/Browser/PortfolioPage.selectors'; import Gestures from '../../utils/Gestures'; import Matchers from '../../utils/Matchers'; -import TestHelpers from '../../helpers'; +import Utilities from '../../utils/Utilities'; class PortfolioHomePage { get connectWalletButton() { @@ -27,12 +27,12 @@ class PortfolioHomePage { } async tapConnectMetaMask() { - await TestHelpers.delay(1000); + await Utilities.delay(1000); await Gestures.tapWebElement(this.connectWalletButton); } async closePrivacyModal() { - await TestHelpers.delay(1000); + await Utilities.delay(1000); await Gestures.tapWebElement(this.closeIconPrivacyModal); } diff --git a/e2e/pages/Browser/TestDApp.js b/e2e/pages/Browser/TestDApp.js index 8810cda9ea0..95f3f9f8658 100644 --- a/e2e/pages/Browser/TestDApp.js +++ b/e2e/pages/Browser/TestDApp.js @@ -1,4 +1,3 @@ -import TestHelpers from '../../helpers'; import { getLocalTestDappPort } from '../../fixtures/utils'; import { BrowserViewSelectorsIDs } from '../../selectors/Browser/BrowserView.selectors'; @@ -9,6 +8,7 @@ import enContent from '../../../locales/languages/en.json'; import Browser from '../Browser/BrowserView'; import Gestures from '../../utils/Gestures'; import Matchers from '../../utils/Matchers'; +import Utilities from '../../utils/Utilities'; export const TEST_DAPP_LOCAL_URL = `http://localhost:${getLocalTestDappPort()}`; const CONFIRM_BUTTON_TEXT = enContent.confirmation_modal.confirm_cta; @@ -228,7 +228,7 @@ class TestDApp { await Browser.navigateToURL( `${TEST_DAPP_LOCAL_URL}?scrollTo=''&contract=${contractAddress}`, ); - await TestHelpers.delay(3000); // should have a better assertion that waits until the webpage loads + await Utilities.delay(3000); // should have a better assertion that waits until the webpage loads } async switchChainFromTestDapp() { diff --git a/e2e/pages/Network/NetworkListModal.js b/e2e/pages/Network/NetworkListModal.js index caff4fc622f..f905c244bbb 100644 --- a/e2e/pages/Network/NetworkListModal.js +++ b/e2e/pages/Network/NetworkListModal.js @@ -4,8 +4,8 @@ import { } from '../../selectors/Network/NetworkListModal.selectors'; import Matchers from '../../utils/Matchers'; import Gestures from '../../utils/Gestures'; -import TestHelpers from '../../helpers'; import { NetworksViewSelectorsIDs } from '../../selectors/Settings/NetworksView.selectors'; +import Utilities from '../../utils/Utilities'; class NetworkListModal { get networkScroll() { @@ -71,7 +71,7 @@ class NetworkListModal { async changeNetworkTo(networkName, custom) { const elem = this.getCustomNetwork(networkName, custom); await Gestures.waitAndTap(elem); - await TestHelpers.delay(3000); + await Utilities.delay(3000); } async scrollToBottomOfNetworkList() { diff --git a/e2e/pages/Network/NetworkNonPemittedBottomSheet.js b/e2e/pages/Network/NetworkNonPemittedBottomSheet.js index fc336070b4f..a0a71685f8d 100644 --- a/e2e/pages/Network/NetworkNonPemittedBottomSheet.js +++ b/e2e/pages/Network/NetworkNonPemittedBottomSheet.js @@ -8,7 +8,6 @@ import { NetworkNonPemittedBottomSheetSelectorsIDs, NetworkNonPemittedBottomSheetSelectorsText, } from '../../selectors/Network/NetworkNonPemittedBottomSheet.selectors'; -import TestHelpers from '../../helpers'; class NetworkNonPemittedBottomSheet { get addThisNetworkTitle() { diff --git a/e2e/pages/Send/SendView.js b/e2e/pages/Send/SendView.js index 6fb5711c8f6..b775f62ffcd 100644 --- a/e2e/pages/Send/SendView.js +++ b/e2e/pages/Send/SendView.js @@ -1,8 +1,7 @@ -import TestHelpers from '../../helpers'; import Gestures from '../../utils/Gestures'; import Matchers from '../../utils/Matchers'; import { SendViewSelectorsIDs } from '../../selectors/SendFlow/SendView.selectors'; - +import Utilities from '../../utils/Utilities'; class SendView { get cancelButton() { return Matchers.getElementByID(SendViewSelectorsIDs.SEND_CANCEL_BUTTON); @@ -66,10 +65,9 @@ class SendView { async tapAddAddressToAddressBook() { await Gestures.waitAndTap(this.addAddressButton); } - async removeAddress() { await Gestures.waitAndTap(this.removeAddressButton); - await TestHelpers.delay(1000); + await Utilities.delay(1000); } } export default new SendView(); diff --git a/e2e/pages/Settings/SecurityAndPrivacy/ChangePasswordView.js b/e2e/pages/Settings/SecurityAndPrivacy/ChangePasswordView.js index b30391d33e9..95d420cb6a0 100644 --- a/e2e/pages/Settings/SecurityAndPrivacy/ChangePasswordView.js +++ b/e2e/pages/Settings/SecurityAndPrivacy/ChangePasswordView.js @@ -1,4 +1,3 @@ -import TestHelpers from '../../../helpers'; import { RESET_PASSWORD_CONFIRM_INPUT_BOX_ID, RESET_PASSWORD_ANDROID_TERM_CHECKBOX_ID, @@ -8,7 +7,7 @@ import { ChangePasswordViewSelectorsText } from '../../../selectors/Settings/Sec import Matchers from '../../../utils/Matchers'; import Gestures from '../../../utils/Gestures'; - +import Utilities from '../../../utils/Utilities'; class ChangePasswordView { get title() { return Matchers.getElementByText( @@ -49,7 +48,7 @@ class ChangePasswordView { await Gestures.waitAndTap(this.iosUnderstandCheck); } else { // Tap by the I understand text - await TestHelpers.delay(1000); + await Utilities.delay(1000); await Gestures.waitAndTap(this.androidUnderstandCheck); } } diff --git a/e2e/pages/wallet/AccountListBottomSheet.js b/e2e/pages/wallet/AccountListBottomSheet.js index 951eb4d2865..56c999b77fa 100644 --- a/e2e/pages/wallet/AccountListBottomSheet.js +++ b/e2e/pages/wallet/AccountListBottomSheet.js @@ -7,11 +7,12 @@ import { WalletViewSelectorsIDs } from '../../selectors/wallet/WalletView.select import { ConnectAccountBottomSheetSelectorsIDs } from '../../selectors/Browser/ConnectAccountBottomSheet.selectors'; import Matchers from '../../utils/Matchers'; import Gestures from '../../utils/Gestures'; -import TestHelpers from '../../helpers'; - +import Utilities from '../../utils/Utilities'; class AccountListBottomSheet { get accountList() { - return Matchers.getElementByID(AccountListBottomSheetSelectorsIDs.ACCOUNT_LIST_ID); + return Matchers.getElementByID( + AccountListBottomSheetSelectorsIDs.ACCOUNT_LIST_ID, + ); } get accountTypeLabel() { @@ -60,7 +61,10 @@ class AccountListBottomSheet { } getMultiselectElement(index) { - return Matchers.getElementByID(CellComponentSelectorsIDs.MULTISELECT, index); + return Matchers.getElementByID( + CellComponentSelectorsIDs.MULTISELECT, + index, + ); } getSelectWithMenuElement(index) { @@ -102,9 +106,8 @@ class AccountListBottomSheet { async swipeToDismissAccountsModal() { await Gestures.swipe(this.title, 'down', 'fast', 0.6); - await TestHelpers.delay(2000); + await Utilities.delay(2000); } - async tapYesToRemoveImportedAccountAlertButton() { await Gestures.waitAndTap(this.removeAccountAlertText); } diff --git a/e2e/pages/wallet/EditAccountNameView.js b/e2e/pages/wallet/EditAccountNameView.js index eb3b23db8fa..0fabce4f8ea 100644 --- a/e2e/pages/wallet/EditAccountNameView.js +++ b/e2e/pages/wallet/EditAccountNameView.js @@ -4,16 +4,25 @@ import { EditAccountNameSelectorIDs } from '../../selectors/wallet/EditAccountNa class EditAccountNameView { get saveButton() { - return Matchers.getElementByID(EditAccountNameSelectorIDs.EDIT_ACCOUNT_NAME_SAVE); + return Matchers.getElementByID( + EditAccountNameSelectorIDs.EDIT_ACCOUNT_NAME_SAVE, + ); } get accountNameInput() { - return Matchers.getElementByID(EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT); + return Matchers.getElementByID( + EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, + ); } async tapSave() { await Gestures.waitAndTap(this.saveButton); } + + async updateAccountName(accountName) { + await Gestures.clearField(EditAccountNameView.accountNameInput); + await Gestures.typeTextAndHideKeyboard(this.accountNameInput, accountName); + } } export default new EditAccountNameView(); diff --git a/e2e/specs/accounts/aes/encryption-with-key.spec.js b/e2e/specs/accounts/aes/encryption-with-key.spec.js index a63dcf7bb04..b76a76d0efc 100644 --- a/e2e/specs/accounts/aes/encryption-with-key.spec.js +++ b/e2e/specs/accounts/aes/encryption-with-key.spec.js @@ -1,5 +1,4 @@ import { SmokeAccounts } from '../../../tags'; -import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; import TabBarComponent from '../../../pages/wallet/TabBarComponent'; @@ -15,6 +14,7 @@ import { } from '../../../fixtures/fixture-helper'; import { getFixturesServerPort } from '../../../fixtures/utils'; import FixtureServer from '../../../fixtures/fixture-server'; +import Utilities from '../../../utils/Utilities'; const fixtureServer = new FixtureServer(); @@ -30,11 +30,11 @@ describe( beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); diff --git a/e2e/specs/accounts/aes/encryption-with-password.spec.js b/e2e/specs/accounts/aes/encryption-with-password.spec.js index b9722aa5165..66dc48adbd4 100644 --- a/e2e/specs/accounts/aes/encryption-with-password.spec.js +++ b/e2e/specs/accounts/aes/encryption-with-password.spec.js @@ -1,5 +1,4 @@ import { SmokeAccounts } from '../../../tags'; -import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; import TabBarComponent from '../../../pages/wallet/TabBarComponent'; @@ -15,6 +14,7 @@ import { } from '../../../fixtures/fixture-helper'; import { getFixturesServerPort } from '../../../fixtures/utils'; import FixtureServer from '../../../fixtures/fixture-server'; +import Utilities from '../../../utils/Utilities'; const fixtureServer = new FixtureServer(); @@ -28,11 +28,11 @@ describe( beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); diff --git a/e2e/specs/accounts/aes/salt-generation.spec.js b/e2e/specs/accounts/aes/salt-generation.spec.js index 81c3bcbe990..e9ae8d7ebed 100644 --- a/e2e/specs/accounts/aes/salt-generation.spec.js +++ b/e2e/specs/accounts/aes/salt-generation.spec.js @@ -1,5 +1,4 @@ import { SmokeAccounts } from '../../../tags'; -import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; import TabBarComponent from '../../../pages/wallet/TabBarComponent'; @@ -15,6 +14,7 @@ import { } from '../../../fixtures/fixture-helper'; import { getFixturesServerPort } from '../../../fixtures/utils'; import FixtureServer from '../../../fixtures/fixture-server'; +import Utilities from '../../../utils/Utilities'; const fixtureServer = new FixtureServer(); @@ -23,11 +23,11 @@ describe(SmokeAccounts('AES Crypto - Salt generation'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); diff --git a/e2e/specs/accounts/auto-lock.spec.js b/e2e/specs/accounts/auto-lock.spec.js index 8ea93c0c3b0..940de657126 100644 --- a/e2e/specs/accounts/auto-lock.spec.js +++ b/e2e/specs/accounts/auto-lock.spec.js @@ -1,7 +1,6 @@ 'use strict'; import { Regression } from '../../tags.js'; -import TestHelpers from '../../helpers.js'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { loadFixture, @@ -18,18 +17,19 @@ import AutoLockModal from '../../pages/Settings/SecurityAndPrivacy/AutoLockModal import Assertions from '../../utils/Assertions.js'; import WalletView from '../../pages/wallet/WalletView.js'; import LoginView from '../../pages/wallet/LoginView.js'; +import Utilities from '../../utils/Utilities.js'; const fixtureServer = new FixtureServer(); describe(Regression('Auto-Lock'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder() .withImportedAccountKeyringController() .build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); @@ -41,7 +41,7 @@ describe(Regression('Auto-Lock'), () => { it('backgrounds then relaunches without needing password on default auto-lock setting', async () => { await device.sendToHome(); - await TestHelpers.launchApp(); + await Utilities.launchApp(); await Assertions.checkIfVisible(WalletView.container); }); @@ -53,7 +53,7 @@ describe(Regression('Auto-Lock'), () => { await AutoLockModal.tapAutoLockImmediately(); await TabBarComponent.tapWallet(); await device.sendToHome(); - await TestHelpers.launchApp(); + await Utilities.launchApp(); await Assertions.checkIfNotVisible(WalletView.container); await Assertions.checkIfVisible(LoginView.container); }); diff --git a/e2e/specs/accounts/change-account-name.spec.js b/e2e/specs/accounts/change-account-name.spec.js index 179ba7039d5..d8a51c9a9d2 100644 --- a/e2e/specs/accounts/change-account-name.spec.js +++ b/e2e/specs/accounts/change-account-name.spec.js @@ -7,20 +7,18 @@ import { stopFixtureServer, defaultGanacheOptions, } from '../../fixtures/fixture-helper'; -import TestHelpers from '../../helpers'; import FixtureServer from '../../fixtures/fixture-server'; import { getFixturesServerPort } from '../../fixtures/utils'; import { Regression } from '../../tags.js'; import WalletView from '../../pages/wallet/WalletView'; import AccountActionsBottomSheet from '../../pages/wallet/AccountActionsBottomSheet'; import EditAccountNameView from '../../pages/wallet/EditAccountNameView'; -import { EditAccountNameSelectorIDs } from '../../selectors/wallet/EditAccountName.selectors'; -import Gestures from '../../utils/Gestures'; import Assertions from '../../utils/Assertions'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; import SettingsView from '../../pages/Settings/SettingsView'; import LoginView from '../../pages/wallet/LoginView'; import AccountListBottomSheet from '../../pages/wallet/AccountListBottomSheet'; +import Utilities from '../../utils/Utilities.js'; const fixtureServer = new FixtureServer(); const NEW_ACCOUNT_NAME = 'Edited Name'; @@ -30,14 +28,14 @@ const IMPORTED_ACCOUNT_INDEX = 1; describe(Regression('Change Account Name'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder() .withGanacheNetwork() .withImportedAccountKeyringController() .build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ ganacheOptions: defaultGanacheOptions, launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); @@ -52,13 +50,11 @@ describe(Regression('Change Account Name'), () => { // Open account actions and edit account name await TabBarComponent.tapWallet(); await WalletView.tapIdenticon(); - await AccountListBottomSheet.tapEditAccountActionsAtIndex(MAIN_ACCOUNT_INDEX); - await AccountActionsBottomSheet.tapEditAccount(); - await Gestures.clearField(EditAccountNameView.accountNameInput); - await TestHelpers.typeTextAndHideKeyboard( - EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, - NEW_ACCOUNT_NAME, + await AccountListBottomSheet.tapEditAccountActionsAtIndex( + MAIN_ACCOUNT_INDEX, ); + await AccountActionsBottomSheet.tapEditAccount(); + EditAccountNameView.updateAccountName(NEW_ACCOUNT_NAME); await EditAccountNameView.tapSave(); // Verify updated name @@ -92,13 +88,12 @@ describe(Regression('Change Account Name'), () => { // Edit imported account name await WalletView.tapIdenticon(); - await AccountListBottomSheet.tapEditAccountActionsAtIndex(IMPORTED_ACCOUNT_INDEX); - await AccountActionsBottomSheet.tapEditAccount(); - await Gestures.clearField(EditAccountNameView.accountNameInput); - await TestHelpers.typeTextAndHideKeyboard( - EditAccountNameSelectorIDs.ACCOUNT_NAME_INPUT, - NEW_IMPORTED_ACCOUNT_NAME, + await AccountListBottomSheet.tapEditAccountActionsAtIndex( + IMPORTED_ACCOUNT_INDEX, ); + await AccountActionsBottomSheet.tapEditAccount(); + + await EditAccountNameView.updateAccountName(NEW_IMPORTED_ACCOUNT_NAME); await EditAccountNameView.tapSave(); // Verify updated name diff --git a/e2e/specs/accounts/error-boundary-srp-backup.spec.js b/e2e/specs/accounts/error-boundary-srp-backup.spec.js index 667bd1b21a5..54ea6ed8af8 100644 --- a/e2e/specs/accounts/error-boundary-srp-backup.spec.js +++ b/e2e/specs/accounts/error-boundary-srp-backup.spec.js @@ -9,16 +9,16 @@ import { defaultGanacheOptions, } from '../../fixtures/fixture-helper'; import { SmokeAccounts } from '../../tags'; -import TestHelpers from '../../helpers'; import Assertions from '../../utils/Assertions'; import RevealSecretRecoveryPhrase from '../../pages/Settings/SecurityAndPrivacy/RevealSecretRecoveryPhrase'; import ErrorBoundaryView from '../../pages/ErrorBoundaryView/ErrorBoundaryView'; +import Utilities from '../../utils/Utilities'; const PASSWORD = '123123123'; describe(SmokeAccounts('Error Boundary Screen'), () => { beforeAll(async () => { jest.setTimeout(2500000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should trigger error boundary screen to reveal SRP', async () => { diff --git a/e2e/specs/accounts/import-wallet-account.spec.js b/e2e/specs/accounts/import-wallet-account.spec.js index 499e7a75bb1..29f36f30bab 100644 --- a/e2e/specs/accounts/import-wallet-account.spec.js +++ b/e2e/specs/accounts/import-wallet-account.spec.js @@ -8,7 +8,7 @@ import Assertions from '../../utils/Assertions'; import AddAccountBottomSheet from '../../pages/wallet/AddAccountBottomSheet'; import CommonView from '../../pages/CommonView'; import SuccessImportAccountView from '../../pages/importAccount/SuccessImportAccountView'; -import TestHelpers from '../../helpers'; +import Utilities from '../../utils/Utilities'; describe(SmokeAccounts('Import account via private to wallet'), () => { // This key is for testing private key import only @@ -18,7 +18,7 @@ describe(SmokeAccounts('Import account via private to wallet'), () => { beforeAll(async () => { jest.setTimeout(200000); - await TestHelpers.launchApp(); + await Utilities.launchApp(); }); it('should import wallet and go to the wallet view', async () => { diff --git a/e2e/specs/accounts/imported-account-remove-and-import.spec.js b/e2e/specs/accounts/imported-account-remove-and-import.spec.js index 89d3f65e312..b154b31e37b 100644 --- a/e2e/specs/accounts/imported-account-remove-and-import.spec.js +++ b/e2e/specs/accounts/imported-account-remove-and-import.spec.js @@ -18,6 +18,7 @@ import Assertions from '../../utils/Assertions.js'; import { AccountListBottomSheetSelectorsText } from '../../selectors/wallet/AccountListBottomSheet.selectors.js'; import AddAccountBottomSheet from '../../pages/wallet/AddAccountBottomSheet.js'; import SuccessImportAccountView from '../../pages/importAccount/SuccessImportAccountView'; +import Utilities from '../../utils/Utilities.js'; const fixtureServer = new FixtureServer(); // This key is for testing private key import only @@ -30,13 +31,13 @@ describe( Regression('removes and reimports an account using a private key'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder() .withImportedAccountKeyringController() .build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); @@ -53,7 +54,9 @@ describe( // Remove the imported account await AccountListBottomSheet.longPressAccountAtIndex(ACCOUNT_INDEX); await AccountListBottomSheet.tapYesToRemoveImportedAccountAlertButton(); - await Assertions.checkIfNotVisible(AccountListBottomSheet.accountTypeLabel); + await Assertions.checkIfNotVisible( + AccountListBottomSheet.accountTypeLabel, + ); // Import account again await AccountListBottomSheet.tapAddAccountButton(); diff --git a/e2e/specs/accounts/reveal-private-key.spec.js b/e2e/specs/accounts/reveal-private-key.spec.js index 843ad3b1d62..df65bbfbd84 100644 --- a/e2e/specs/accounts/reveal-private-key.spec.js +++ b/e2e/specs/accounts/reveal-private-key.spec.js @@ -20,6 +20,7 @@ import { RevealSeedViewSelectorsText } from '../../selectors/Settings/SecurityAn import WalletView from '../../pages/wallet/WalletView.js'; import AccountActionsBottomSheet from '../../pages/wallet/AccountActionsBottomSheet.js'; import AccountListBottomSheet from '../../pages/wallet/AccountListBottomSheet.js'; +import Utilities from '../../utils/Utilities.js'; const fixtureServer = new FixtureServer(); // These keys are from the fixture and are used to test the reveal private key functionality @@ -35,13 +36,13 @@ describe(Regression('reveal private key'), () => { const INCORRECT_PASSWORD = 'wrongpassword'; beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder() .withImportedAccountKeyringController() .build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); diff --git a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js b/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js index bc45b0d798e..6a12fd4c5b3 100644 --- a/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js +++ b/e2e/specs/accounts/reveal-secret-recovery-phrase.spec.js @@ -23,6 +23,7 @@ import { } from '../../fixtures/fixture-helper.js'; import { getFixturesServerPort } from '../../fixtures/utils.js'; import Assertions from '../../utils/Assertions.js'; +import Utilities from '../../utils/Utilities.js'; const fixtureServer = new FixtureServer(); const PASSWORD = '123123123'; @@ -32,11 +33,11 @@ const QUIZ_QUESTION_2 = 2; describe(SmokeAccounts('Secret Recovery Phrase Reveal from Settings'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().withDefaultFixture().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); diff --git a/e2e/specs/assets/import-tokens-via-asset-watcher.spec.js b/e2e/specs/assets/import-tokens-via-asset-watcher.spec.js index 101270cb70e..0fd1e4368d0 100644 --- a/e2e/specs/assets/import-tokens-via-asset-watcher.spec.js +++ b/e2e/specs/assets/import-tokens-via-asset-watcher.spec.js @@ -1,6 +1,5 @@ ('use strict'); import { SmokeAssets } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { @@ -14,13 +13,14 @@ import TestDApp from '../../pages/Browser/TestDApp'; import Assertions from '../../utils/Assertions'; import AssetWatchBottomSheet from '../../pages/Transactions/AssetWatchBottomSheet'; import WalletView from '../../pages/wallet/WalletView'; +import Utilities from '../../utils/Utilities'; const ERC20_CONTRACT = SMART_CONTRACTS.HST; describe(SmokeAssets('Asset Watch:'), () => { beforeAll(async () => { jest.setTimeout(170000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('Should Import ERC20 Token via Dapp', async () => { @@ -46,7 +46,7 @@ describe(SmokeAssets('Asset Watch:'), () => { await TestDApp.navigateToTestDappWithContract({ contractAddress: hstAddress, }); - await TestHelpers.delay(3000); // Because loading the dapp is slow on CI + await Utilities.delay(3000); // Because loading the dapp is slow on CI await TestDApp.tapAddERC20TokenToWalletButton(); await Assertions.checkIfVisible(AssetWatchBottomSheet.container); diff --git a/e2e/specs/assets/import-tokens.spec.js b/e2e/specs/assets/import-tokens.spec.js index ce1eda3c925..6645ad694ca 100644 --- a/e2e/specs/assets/import-tokens.spec.js +++ b/e2e/specs/assets/import-tokens.spec.js @@ -1,6 +1,5 @@ 'use strict'; import { SmokeAssets } from '../../tags'; -import TestHelpers from '../../helpers'; import WalletView from '../../pages/wallet/WalletView'; import ImportTokensView from '../../pages/wallet/ImportTokenFlow/ImportTokensView'; import FixtureBuilder from '../../fixtures/fixture-builder'; @@ -14,16 +13,17 @@ import FixtureServer from '../../fixtures/fixture-server'; import { loginToApp } from '../../viewHelper'; import ConfirmAddAssetView from '../../pages/wallet/ImportTokenFlow/ConfirmAddAsset'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; const fixtureServer = new FixtureServer(); describe(SmokeAssets('Import Tokens'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); @@ -39,7 +39,7 @@ describe(SmokeAssets('Import Tokens'), () => { await ImportTokensView.tapOnToken(); // taps the first token in the returned list await ImportTokensView.tapOnNextButton(); - await TestHelpers.delay(500); + await Utilities.delay(500); await Assertions.checkIfVisible(ConfirmAddAssetView.container); await ConfirmAddAssetView.tapOnConfirmButton(); @@ -51,12 +51,12 @@ describe(SmokeAssets('Import Tokens'), () => { it('should cancel add a token via token autocomplete', async () => { await WalletView.tapImportTokensButton(); await ImportTokensView.searchToken('SNX'); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await ImportTokensView.tapOnToken(); - await TestHelpers.delay(500); + await Utilities.delay(500); await ImportTokensView.tapOnNextButton(); - await TestHelpers.delay(500); + await Utilities.delay(500); await Assertions.checkIfVisible(ConfirmAddAssetView.container); await ConfirmAddAssetView.tapOnCancelButton(); @@ -70,13 +70,13 @@ describe(SmokeAssets('Import Tokens'), () => { }); it('should add a token via token footer link', async () => { - await TestHelpers.delay(2000); // Wait for the footer link to be visible + await Utilities.delay(2000); // Wait for the footer link to be visible await WalletView.tapImportTokensFooterLink(); await ImportTokensView.searchToken('SNX'); await ImportTokensView.tapOnToken(); // taps the first token in the returned list await ImportTokensView.tapOnNextButton(); - await TestHelpers.delay(500); + await Utilities.delay(500); await Assertions.checkIfVisible(ConfirmAddAssetView.container); await ConfirmAddAssetView.tapOnConfirmButton(); diff --git a/e2e/specs/assets/multichain/asset-list.spec.js b/e2e/specs/assets/multichain/asset-list.spec.js index 042723d44d9..0771bb9042e 100644 --- a/e2e/specs/assets/multichain/asset-list.spec.js +++ b/e2e/specs/assets/multichain/asset-list.spec.js @@ -14,11 +14,11 @@ import { loginToApp } from '../../../viewHelper'; import Assertions from '../../../utils/Assertions'; import TokenOverview from '../../../pages/wallet/TokenOverview'; import NetworkEducationModal from '../../../pages/Network/NetworkEducationModal'; -import TestHelpers from '../../../helpers'; import SendView from '../../../pages/Send/SendView'; import QuoteView from '../../../pages/swaps/QuoteView'; import TabBarComponent from '../../../pages/wallet/TabBarComponent'; +import Utilities from '../../../utils/Utilities'; const fixtureServer = new FixtureServer(); @@ -28,11 +28,11 @@ const BNB_NAME = 'BNB'; describe(SmokeAssets('Import Tokens'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().withPopularNetworks().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); @@ -73,7 +73,7 @@ describe(SmokeAssets('Import Tokens'), () => { const bnb = WalletView.tokenInWallet('BNB'); await Assertions.checkIfVisible(bnb); await WalletView.tapOnToken('BNB'); - await TestHelpers.delay(5000); + await Utilities.delay(5000); await TokenOverview.tapSwapButton(); await Assertions.checkIfVisible(NetworkEducationModal.container); diff --git a/e2e/specs/assets/nft-details.spec.js b/e2e/specs/assets/nft-details.spec.js index ae425fab058..5d5a69639de 100644 --- a/e2e/specs/assets/nft-details.spec.js +++ b/e2e/specs/assets/nft-details.spec.js @@ -1,7 +1,6 @@ 'use strict'; import { SmokeAssets } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { @@ -13,13 +12,14 @@ import WalletView from '../../pages/wallet/WalletView'; import ImportNFTView from '../../pages/wallet/ImportNFTFlow/ImportNFTView'; import Assertions from '../../utils/Assertions'; import enContent from '../../../locales/languages/en.json'; +import Utilities from '../../utils/Utilities'; describe(SmokeAssets('NFT Details page'), () => { const NFT_CONTRACT = SMART_CONTRACTS.NFTS; const TEST_DAPP_CONTRACT = 'TestDappNFTs'; beforeAll(async () => { jest.setTimeout(170000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('show nft details', async () => { diff --git a/e2e/specs/assets/nft-detection-modal.spec.js b/e2e/specs/assets/nft-detection-modal.spec.js index 4baed64af7b..d18880fad2a 100644 --- a/e2e/specs/assets/nft-detection-modal.spec.js +++ b/e2e/specs/assets/nft-detection-modal.spec.js @@ -6,17 +6,17 @@ import { withFixtures, defaultGanacheOptions, } from '../../fixtures/fixture-helper'; -import TestHelpers from '../../helpers'; import Assertions from '../../utils/Assertions'; import NftDetectionModal from '../../pages/wallet/NftDetectionModal'; import { SmokeAssets } from '../../tags'; import { NftDetectionModalSelectorsText } from '../../selectors/wallet/NftDetectionModal.selectors'; +import Utilities from '../../utils/Utilities'; describe(SmokeAssets('NFT Detection Modal'), () => { beforeAll(async () => { jest.setTimeout(170000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('show nft detection modal after user switches to mainnet and taps cancel when nft detection toggle is off', async () => { @@ -35,7 +35,7 @@ describe(SmokeAssets('NFT Detection Modal'), () => { await Assertions.checkIfVisible(NftDetectionModal.container); // fix flaky test: toast should desapear to get access to cancel button - await TestHelpers.delay(5000); + await Utilities.delay(5000); await NftDetectionModal.tapCancelButton(); // Check that we are on the wallet screen diff --git a/e2e/specs/assets/token-detection-import-all.spec.js b/e2e/specs/assets/token-detection-import-all.spec.js index 2a36bca5eb1..cd36d500032 100644 --- a/e2e/specs/assets/token-detection-import-all.spec.js +++ b/e2e/specs/assets/token-detection-import-all.spec.js @@ -4,9 +4,9 @@ import { SmokeAssets } from '../../tags'; import WalletView from '../../pages/wallet/WalletView'; import DetectedTokensView from '../../pages/wallet/DetectedTokensView'; import Assertions from '../../utils/Assertions'; -import TestHelpers from '../../helpers'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { withFixtures } from '../../fixtures/fixture-helper'; +import Utilities from '../../utils/Utilities'; const ETHEREUM_NAME = 'Ethereum'; const USDC_NAME = 'USDC'; @@ -14,7 +14,7 @@ const USDC_NAME = 'USDC'; describe(SmokeAssets('Import all tokens detected'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should import all tokens detected automatically', async () => { diff --git a/e2e/specs/browser/browser-tests.spec.js b/e2e/specs/browser/browser-tests.spec.js index c0db051ce26..baa336a69c1 100644 --- a/e2e/specs/browser/browser-tests.spec.js +++ b/e2e/specs/browser/browser-tests.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { SmokeCore } from '../../tags'; import { loginToApp } from '../../viewHelper'; import FixtureBuilder from '../../fixtures/fixture-builder'; @@ -14,16 +13,17 @@ import Assertions from '../../utils/Assertions'; import ExternalSites from '../../resources/externalsites.json'; import Browser from '../../pages/Browser/BrowserView'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; +import Utilities from '../../utils/Utilities'; const fixtureServer = new FixtureServer(); describe(SmokeCore('Browser Tests'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); @@ -45,7 +45,7 @@ describe(SmokeCore('Browser Tests'), () => { }); it('should connect to the test dapp', async () => { - await TestHelpers.delay(3000); + await Utilities.delay(3000); // Tap on search in bottom navbar await Browser.tapUrlInputBox(); await Browser.navigateToURL(ExternalSites.TEST_DAPP); @@ -68,21 +68,21 @@ describe(SmokeCore('Browser Tests'), () => { // it('should tap on the test dapp in favorites on the home page', async () => { // await Browser.tapHomeButton(); // // Wait for page to load - // await TestHelpers.delay(3000); + // await Utilities.delay(3000); // await Browser.tapDappInFavorites(); // await Assertions.checkIfTextIsDisplayed('metamask.github.io'); // // } // }); it('should test invalid URL', async () => { - await TestHelpers.delay(2000); + await Utilities.delay(2000); await Browser.tapBottomSearchBar(); // Clear text & Navigate to URL await Browser.navigateToURL(ExternalSites.INVALID_URL); await Browser.waitForBrowserPageToLoad(); await Browser.tapReturnHomeButton(); // Check that we are on the browser screen - await TestHelpers.delay(1500); + await Utilities.delay(1500); }); it('should test phishing sites', async () => { @@ -94,6 +94,6 @@ describe(SmokeCore('Browser Tests'), () => { await Browser.tapBackToSafetyButton(); // Check that we are on the browser screen - await TestHelpers.delay(1500); + await Utilities.delay(1500); }); }); diff --git a/e2e/specs/confirmations/advanced-gas-fees.mock.spec.js b/e2e/specs/confirmations/advanced-gas-fees.mock.spec.js index 2d2d0c76321..857600d190d 100644 --- a/e2e/specs/confirmations/advanced-gas-fees.mock.spec.js +++ b/e2e/specs/confirmations/advanced-gas-fees.mock.spec.js @@ -12,9 +12,9 @@ import { } from '../../fixtures/fixture-helper'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; import WalletActionsBottomSheet from '../../pages/wallet/WalletActionsBottomSheet'; -import TestHelpers from '../../helpers'; import Assertions from '../../utils/Assertions'; import { mockEvents } from '../../api-mocking/mock-config/mock-events'; +import Utilities from '../../utils/Utilities'; const VALID_ADDRESS = '0xebe6CcB6B55e1d094d9c58980Bc10Fed69932cAb'; @@ -22,15 +22,12 @@ describe(SmokeConfirmations('Advanced Gas Fees and Priority Tests'), () => { let mockServer; beforeAll(async () => { jest.setTimeout(170000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should edit priority gas settings and send ETH', async () => { - - const testSpecificMock = { - GET: [ - mockEvents.GET.suggestedGasFeesApiGanache - ], + const testSpecificMock = { + GET: [mockEvents.GET.suggestedGasFeesApiGanache], }; await withFixtures( { @@ -46,9 +43,9 @@ describe(SmokeConfirmations('Advanced Gas Fees and Priority Tests'), () => { await Assertions.checkIfVisible(WalletView.container); //Tap send Icon - await TestHelpers.delay(2000); + await Utilities.delay(2000); await TabBarComponent.tapActions(); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await WalletActionsBottomSheet.tapSendButton(); await SendView.inputAddress(VALID_ADDRESS); diff --git a/e2e/specs/confirmations/approve-custom-erc20.spec.js b/e2e/specs/confirmations/approve-custom-erc20.spec.js index ed24c9c3c6a..e70172383c2 100644 --- a/e2e/specs/confirmations/approve-custom-erc20.spec.js +++ b/e2e/specs/confirmations/approve-custom-erc20.spec.js @@ -1,6 +1,5 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { @@ -14,6 +13,7 @@ import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts'; import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBottomSheet'; import Assertions from '../../utils/Assertions'; import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors'; +import Utilities from '../../utils/Utilities'; const HST_CONTRACT = SMART_CONTRACTS.HST; @@ -21,7 +21,7 @@ describe(SmokeConfirmations('ERC20 tokens'), () => { beforeAll(async () => { jest.setTimeout(170000); if (device.getPlatform() === 'android') { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); } }); diff --git a/e2e/specs/confirmations/approve-default-erc20.spec.js b/e2e/specs/confirmations/approve-default-erc20.spec.js index ca7a2889a0f..a8c14a78134 100644 --- a/e2e/specs/confirmations/approve-default-erc20.spec.js +++ b/e2e/specs/confirmations/approve-default-erc20.spec.js @@ -1,6 +1,5 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { @@ -16,6 +15,7 @@ import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBot import Assertions from '../../utils/Assertions'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; import TestDApp from '../../pages/Browser/TestDApp'; +import Utilities from '../../utils/Utilities'; const HST_CONTRACT = SMART_CONTRACTS.HST; const EXPECTED_TOKEN_AMOUNT = '7'; @@ -24,10 +24,9 @@ describe(SmokeConfirmations('ERC20 tokens'), () => { beforeAll(async () => { jest.setTimeout(170000); if (device.getPlatform() === 'android') { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); } }); - it('approve default ERC20 token amount from a dapp', async () => { await withFixtures( { diff --git a/e2e/specs/confirmations/approve-erc721.spec.js b/e2e/specs/confirmations/approve-erc721.spec.js index d06a16d4909..6a1d0f067d8 100644 --- a/e2e/specs/confirmations/approve-erc721.spec.js +++ b/e2e/specs/confirmations/approve-erc721.spec.js @@ -1,7 +1,6 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; @@ -14,13 +13,14 @@ import { import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts'; import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; describe(SmokeConfirmations('ERC721 tokens'), () => { const NFT_CONTRACT = SMART_CONTRACTS.NFTS; beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('approve an ERC721 token from a dapp', async () => { @@ -47,7 +47,7 @@ describe(SmokeConfirmations('ERC721 tokens'), () => { }); // Approve NFT await TestDApp.tapApproveERC721TokenButton(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await TestDApp.tapApproveButton(); // Navigate to the activity screen await TabBarComponent.tapActivity(); diff --git a/e2e/specs/confirmations/batch-transfer-erc1155.spec.js b/e2e/specs/confirmations/batch-transfer-erc1155.spec.js index b7ed8494d16..bb392bd3944 100644 --- a/e2e/specs/confirmations/batch-transfer-erc1155.spec.js +++ b/e2e/specs/confirmations/batch-transfer-erc1155.spec.js @@ -1,7 +1,6 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; @@ -16,14 +15,14 @@ import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/Activi import Assertions from '../../utils/Assertions'; import { ContractApprovalBottomSheetSelectorsText } from '../../selectors/Browser/ContractApprovalBottomSheet.selectors'; import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBottomSheet'; +import Utilities from '../../utils/Utilities'; describe(SmokeConfirmations('ERC1155 token'), () => { const ERC1155_CONTRACT = SMART_CONTRACTS.ERC1155; beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); - it('batch transfer ERC1155 tokens', async () => { await withFixtures( { diff --git a/e2e/specs/confirmations/increase-allowance-erc20.spec.js b/e2e/specs/confirmations/increase-allowance-erc20.spec.js index 674f700925c..63d749fdefc 100644 --- a/e2e/specs/confirmations/increase-allowance-erc20.spec.js +++ b/e2e/specs/confirmations/increase-allowance-erc20.spec.js @@ -1,6 +1,5 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { @@ -14,13 +13,14 @@ import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts'; import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBottomSheet'; import Assertions from '../../utils/Assertions'; import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors'; +import Utilities from '../../utils/Utilities'; const HST_CONTRACT = SMART_CONTRACTS.HST; describe(SmokeConfirmations('ERC20 - Increase Allowance'), () => { beforeAll(async () => { if (device.getPlatform() === 'android') { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); } }); diff --git a/e2e/specs/confirmations/send-erc20-with-dapp.spec.js b/e2e/specs/confirmations/send-erc20-with-dapp.spec.js index 5f345d6c81e..2602b9fde3f 100644 --- a/e2e/specs/confirmations/send-erc20-with-dapp.spec.js +++ b/e2e/specs/confirmations/send-erc20-with-dapp.spec.js @@ -1,6 +1,5 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { @@ -16,13 +15,14 @@ import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/Activi import TabBarComponent from '../../pages/wallet/TabBarComponent'; import TestDApp from '../../pages/Browser/TestDApp'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; const HST_CONTRACT = SMART_CONTRACTS.HST; describe(SmokeConfirmations('ERC20 tokens'), () => { beforeAll(async () => { jest.setTimeout(170000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('send an ERC20 token from a dapp', async () => { @@ -48,11 +48,11 @@ describe(SmokeConfirmations('ERC20 tokens'), () => { await TestDApp.navigateToTestDappWithContract({ contractAddress: hstAddress, }); - await TestHelpers.delay(3000); + await Utilities.delay(3000); // Transfer ERC20 tokens await TestDApp.tapERC20TransferButton(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); // Tap confirm button await TestDApp.tapConfirmButton(); diff --git a/e2e/specs/confirmations/send-erc721.spec.js b/e2e/specs/confirmations/send-erc721.spec.js index 53ed096a6d7..6760a307a42 100644 --- a/e2e/specs/confirmations/send-erc721.spec.js +++ b/e2e/specs/confirmations/send-erc721.spec.js @@ -1,7 +1,6 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; @@ -14,13 +13,14 @@ import { import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts'; import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; describe(SmokeConfirmations('ERC721 tokens'), () => { const NFT_CONTRACT = SMART_CONTRACTS.NFTS; beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('send an ERC721 token from a dapp', async () => { @@ -47,9 +47,8 @@ describe(SmokeConfirmations('ERC721 tokens'), () => { contractAddress: nftsAddress, }); // Transfer NFT - await TestDApp.tapNFTTransferButton(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await TestDApp.tapConfirmButton(); diff --git a/e2e/specs/confirmations/send-eth.spec.js b/e2e/specs/confirmations/send-eth.spec.js index c94eff9f852..13c754aa2b7 100644 --- a/e2e/specs/confirmations/send-eth.spec.js +++ b/e2e/specs/confirmations/send-eth.spec.js @@ -1,7 +1,6 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import AmountView from '../../pages/Send/AmountView'; import SendView from '../../pages/Send/SendView'; @@ -16,6 +15,8 @@ import { defaultGanacheOptions, } from '../../fixtures/fixture-helper'; import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts'; +import Utilities from '../../utils/Utilities'; +import Assertions from '../../utils/Assertions'; describe(SmokeConfirmations('Send ETH'), () => { const TOKEN_NAME = enContent.unit.eth; @@ -23,7 +24,7 @@ describe(SmokeConfirmations('Send ETH'), () => { beforeAll(async () => { jest.setTimeout(2500000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should send ETH to an EOA from inside the wallet', async () => { @@ -48,10 +49,7 @@ describe(SmokeConfirmations('Send ETH'), () => { await TransactionConfirmationView.tapConfirmButton(); await TabBarComponent.tapActivity(); - - await TestHelpers.checkIfElementByTextIsVisible( - `${AMOUNT} ${TOKEN_NAME}`, - ); + await Assertions.checkIfTextIsDisplayed(`${AMOUNT} ${TOKEN_NAME}`); }, ); }); @@ -83,10 +81,7 @@ describe(SmokeConfirmations('Send ETH'), () => { await TransactionConfirmationView.tapConfirmButton(); await TabBarComponent.tapActivity(); - - await TestHelpers.checkIfElementByTextIsVisible( - `${AMOUNT} ${TOKEN_NAME}`, - ); + await Assertions.checkIfTextIsDisplayed(`${AMOUNT} ${TOKEN_NAME}`); }, ); }); diff --git a/e2e/specs/confirmations/send-failing-contract.spec.js b/e2e/specs/confirmations/send-failing-contract.spec.js index dac0b112d01..ee6b598e25e 100644 --- a/e2e/specs/confirmations/send-failing-contract.spec.js +++ b/e2e/specs/confirmations/send-failing-contract.spec.js @@ -1,7 +1,6 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; @@ -15,22 +14,20 @@ import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts'; import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors'; import Assertions from '../../utils/Assertions'; import { mockEvents } from '../../api-mocking/mock-config/mock-events'; +import Utilities from '../../utils/Utilities'; describe(SmokeConfirmations('Failing contracts'), () => { const FAILING_CONTRACT = SMART_CONTRACTS.FAILING; beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('sends a failing contract transaction', async () => { - - const testSpecificMock = { - GET: [ - mockEvents.GET.suggestedGasFeesApiGanache - ], - }; + const testSpecificMock = { + GET: [mockEvents.GET.suggestedGasFeesApiGanache], + }; await withFixtures( { dapp: true, @@ -54,10 +51,10 @@ describe(SmokeConfirmations('Failing contracts'), () => { await TestDApp.navigateToTestDappWithContract({ contractAddress: failingAddress, }); - + // Send a failing transaction await TestDApp.tapSendFailingTransactionButton(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await TestDApp.tapConfirmButton(); @@ -66,10 +63,10 @@ describe(SmokeConfirmations('Failing contracts'), () => { // Assert the failed transaction is displayed await Assertions.checkIfTextIsDisplayed( - ActivitiesViewSelectorsText.SMART_CONTRACT_INTERACTION + ActivitiesViewSelectorsText.SMART_CONTRACT_INTERACTION, ); await Assertions.checkIfTextIsDisplayed( - ActivitiesViewSelectorsText.FAILED_TEXT + ActivitiesViewSelectorsText.FAILED_TEXT, ); }, ); diff --git a/e2e/specs/confirmations/send-to-contract-address.spec.js b/e2e/specs/confirmations/send-to-contract-address.spec.js index ddcbad62bc9..2a6b075b2f2 100644 --- a/e2e/specs/confirmations/send-to-contract-address.spec.js +++ b/e2e/specs/confirmations/send-to-contract-address.spec.js @@ -7,7 +7,6 @@ import TransactionConfirmationView from '../../pages/Send/TransactionConfirmView import { loginToApp } from '../../viewHelper'; import WalletActionsBottomSheet from '../../pages/wallet/WalletActionsBottomSheet'; -import TestHelpers from '../../helpers'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { withFixtures, @@ -21,13 +20,13 @@ import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/Activi import TabBarComponent from '../../pages/wallet/TabBarComponent'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; const HST_CONTRACT = SMART_CONTRACTS.HST; - describe(SmokeConfirmations('Send to contract address'), () => { beforeAll(async () => { jest.setTimeout(170000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should send ETH to a contract from inside the wallet', async () => { diff --git a/e2e/specs/confirmations/set-approval-for-all-erc1155.spec.js b/e2e/specs/confirmations/set-approval-for-all-erc1155.spec.js index 8e646db9efd..1f880569ced 100644 --- a/e2e/specs/confirmations/set-approval-for-all-erc1155.spec.js +++ b/e2e/specs/confirmations/set-approval-for-all-erc1155.spec.js @@ -1,7 +1,6 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; @@ -16,12 +15,13 @@ import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/Activi import Assertions from '../../utils/Assertions'; import { ContractApprovalBottomSheetSelectorsText } from '../../selectors/Browser/ContractApprovalBottomSheet.selectors'; import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBottomSheet'; +import Utilities from '../../utils/Utilities'; describe(SmokeConfirmations('ERC1155 token'), () => { const ERC1155_CONTRACT = SMART_CONTRACTS.ERC1155; beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('approve all ERC1155 tokens', async () => { diff --git a/e2e/specs/confirmations/set-approve-for-all-erc721.spec.js b/e2e/specs/confirmations/set-approve-for-all-erc721.spec.js index 114850fb627..3432c0758a9 100644 --- a/e2e/specs/confirmations/set-approve-for-all-erc721.spec.js +++ b/e2e/specs/confirmations/set-approve-for-all-erc721.spec.js @@ -1,7 +1,6 @@ 'use strict'; import { SmokeConfirmations } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; @@ -16,12 +15,13 @@ import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/Activi import Assertions from '../../utils/Assertions'; import { ContractApprovalBottomSheetSelectorsText } from '../../selectors/Browser/ContractApprovalBottomSheet.selectors'; import ContractApprovalBottomSheet from '../../pages/Browser/ContractApprovalBottomSheet'; +import Utilities from '../../utils/Utilities'; describe(SmokeConfirmations('ERC721 token'), () => { const NFT_CONTRACT = SMART_CONTRACTS.NFTS; beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('approve all ERC721 tokens', async () => { diff --git a/e2e/specs/confirmations/signatures/ethereum-sign.spec.js b/e2e/specs/confirmations/signatures/ethereum-sign.spec.js index b51be2c81b6..09518218300 100644 --- a/e2e/specs/confirmations/signatures/ethereum-sign.spec.js +++ b/e2e/specs/confirmations/signatures/ethereum-sign.spec.js @@ -10,14 +10,14 @@ import { defaultGanacheOptions, } from '../../../fixtures/fixture-helper'; import { SmokeConfirmations } from '../../../tags'; -import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; +import Utilities from '../../../utils/Utilities'; describe(SmokeConfirmations('Ethereum Sign'), () => { beforeAll(async () => { jest.setTimeout(2500000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('Sign in with Ethereum', async () => { diff --git a/e2e/specs/confirmations/signatures/personal-sign.spec.js b/e2e/specs/confirmations/signatures/personal-sign.spec.js index 4fc37496141..99214b3148b 100644 --- a/e2e/specs/confirmations/signatures/personal-sign.spec.js +++ b/e2e/specs/confirmations/signatures/personal-sign.spec.js @@ -10,9 +10,9 @@ import { defaultGanacheOptions, } from '../../../fixtures/fixture-helper'; import { SmokeConfirmations } from '../../../tags'; -import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; +import Utilities from '../../../utils/Utilities'; describe(SmokeConfirmations('Personal Sign'), () => { const testSpecificMock = { @@ -21,7 +21,7 @@ describe(SmokeConfirmations('Personal Sign'), () => { beforeAll(async () => { jest.setTimeout(2500000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should sign personal message', async () => { diff --git a/e2e/specs/confirmations/signatures/security-alert-signatures.mock.spec.js b/e2e/specs/confirmations/signatures/security-alert-signatures.mock.spec.js index 77f0f3b3721..2975e361aae 100644 --- a/e2e/specs/confirmations/signatures/security-alert-signatures.mock.spec.js +++ b/e2e/specs/confirmations/signatures/security-alert-signatures.mock.spec.js @@ -6,16 +6,16 @@ import SigningBottomSheet from '../../../pages/Browser/SigningBottomSheet'; import TestDApp from '../../../pages/Browser/TestDApp'; import FixtureBuilder from '../../../fixtures/fixture-builder'; import { withFixtures } from '../../../fixtures/fixture-helper'; -import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; import ConfirmationView from '../../../pages/Confirmation/ConfirmationView'; import { SmokeConfirmations } from '../../../tags'; +import Utilities from '../../../utils/Utilities'; describe(SmokeConfirmations('Security Alert API - Signature'), () => { beforeAll(async () => { jest.setTimeout(2500000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); const defaultFixture = new FixtureBuilder() diff --git a/e2e/specs/confirmations/signatures/typed-sign-v3.spec.js b/e2e/specs/confirmations/signatures/typed-sign-v3.spec.js index 26cf84334ae..43782c06e71 100644 --- a/e2e/specs/confirmations/signatures/typed-sign-v3.spec.js +++ b/e2e/specs/confirmations/signatures/typed-sign-v3.spec.js @@ -10,9 +10,9 @@ import { defaultGanacheOptions, } from '../../../fixtures/fixture-helper'; import { SmokeConfirmations } from '../../../tags'; -import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; +import Utilities from '../../../utils/Utilities'; describe(SmokeConfirmations('Typed Sign V3'), () => { const testSpecificMock = { @@ -21,7 +21,7 @@ describe(SmokeConfirmations('Typed Sign V3'), () => { beforeAll(async () => { jest.setTimeout(2500000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should sign typed V3 message', async () => { diff --git a/e2e/specs/confirmations/signatures/typed-sign-v4.spec.js b/e2e/specs/confirmations/signatures/typed-sign-v4.spec.js index c82b6e7a17b..ac2fa0ff8bc 100644 --- a/e2e/specs/confirmations/signatures/typed-sign-v4.spec.js +++ b/e2e/specs/confirmations/signatures/typed-sign-v4.spec.js @@ -10,9 +10,9 @@ import { defaultGanacheOptions, } from '../../../fixtures/fixture-helper'; import { SmokeConfirmations } from '../../../tags'; -import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; +import Utilities from '../../../utils/Utilities'; describe(SmokeConfirmations('Typed Sign V4'), () => { const testSpecificMock = { @@ -21,7 +21,7 @@ describe(SmokeConfirmations('Typed Sign V4'), () => { beforeAll(async () => { jest.setTimeout(2500000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should sign typed V4 message', async () => { diff --git a/e2e/specs/confirmations/signatures/typed-sign.spec.js b/e2e/specs/confirmations/signatures/typed-sign.spec.js index c6b9cfed353..9cb282cef08 100644 --- a/e2e/specs/confirmations/signatures/typed-sign.spec.js +++ b/e2e/specs/confirmations/signatures/typed-sign.spec.js @@ -10,9 +10,9 @@ import { defaultGanacheOptions, } from '../../../fixtures/fixture-helper'; import { SmokeConfirmations } from '../../../tags'; -import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; +import Utilities from '../../../utils/Utilities'; describe(SmokeConfirmations('Typed Sign'), () => { const testSpecificMock = { @@ -21,7 +21,7 @@ describe(SmokeConfirmations('Typed Sign'), () => { beforeAll(async () => { jest.setTimeout(2500000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should sign typed message', async () => { diff --git a/e2e/specs/confirmations/suggested-gas-api.mock.spec.js b/e2e/specs/confirmations/suggested-gas-api.mock.spec.js index e2038a25b55..34f55a7c9d3 100644 --- a/e2e/specs/confirmations/suggested-gas-api.mock.spec.js +++ b/e2e/specs/confirmations/suggested-gas-api.mock.spec.js @@ -19,9 +19,9 @@ import ImportAccountView from '../../pages/importAccount/ImportAccountView.js'; import Accounts from '../../../wdio/helpers/Accounts.js'; import { withFixtures } from '../../fixtures/fixture-helper.js'; import FixtureBuilder from '../../fixtures/fixture-builder.js'; -import TestHelpers from '../../helpers.js'; import SuccessImportAccountView from '../../pages/importAccount/SuccessImportAccountView.js'; import { mockEvents } from '../../api-mocking/mock-config/mock-events.js'; +import Utilities from '../../utils/Utilities.js'; describe( Regression( @@ -31,7 +31,7 @@ describe( let mockServer; beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); mockServer = await startMockServer({ GET: [mockEvents.GET.suggestedGasFeesMainNetError], }); diff --git a/e2e/specs/identity/account-syncing/sync-after-adding-custom-name-account.spec.js b/e2e/specs/identity/account-syncing/sync-after-adding-custom-name-account.spec.js index 98931feee82..d172c0859ab 100644 --- a/e2e/specs/identity/account-syncing/sync-after-adding-custom-name-account.spec.js +++ b/e2e/specs/identity/account-syncing/sync-after-adding-custom-name-account.spec.js @@ -10,7 +10,6 @@ import { } from '../../../api-mocking/mock-server'; import { accountsSyncMockResponse } from './mockData'; import { importWalletWithRecoveryPhrase } from '../../../viewHelper'; -import TestHelpers from '../../../helpers'; import WalletView from '../../../pages/wallet/WalletView'; import AccountListBottomSheet from '../../../pages/wallet/AccountListBottomSheet'; import Assertions from '../../../utils/Assertions'; @@ -19,6 +18,7 @@ import AccountActionsBottomSheet from '../../../pages/wallet/AccountActionsBotto import { mockIdentityServices } from '../utils/mocks'; import { SmokeIdentity } from '../../../tags'; import { USER_STORAGE_FEATURE_NAMES } from '@metamask/profile-sync-controller/sdk'; +import Utilities from '../../../utils/Utilities'; describe(SmokeIdentity('Account syncing'), () => { const NEW_ACCOUNT_NAME = 'My third account'; @@ -26,7 +26,7 @@ describe(SmokeIdentity('Account syncing'), () => { beforeAll(async () => { jest.setTimeout(200000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const mockServer = await startMockServer(); @@ -51,8 +51,7 @@ describe(SmokeIdentity('Account syncing'), () => { return JSON.parse(decryptedAccountName).n; }), ); - - await TestHelpers.launchApp({ + await Utilities.launchApp({ newInstance: true, delete: true, }); @@ -81,7 +80,7 @@ describe(SmokeIdentity('Account syncing'), () => { await AccountListBottomSheet.tapAddAccountButton(); await AddAccountBottomSheet.tapCreateAccount(); await AccountListBottomSheet.swipeToDismissAccountsModal(); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await WalletView.tapCurrentMainWalletAccountActions(); await AccountListBottomSheet.tapEditAccountActionsAtIndex(2); @@ -94,7 +93,7 @@ describe(SmokeIdentity('Account syncing'), () => { }); it('retrieves same accounts after importing the same SRP', async () => { - await TestHelpers.launchApp({ + await Utilities.launchApp({ newInstance: true, delete: true, }); diff --git a/e2e/specs/identity/account-syncing/sync-after-onboarding.spec.js b/e2e/specs/identity/account-syncing/sync-after-onboarding.spec.js index 4930a9cf1be..a01f429e1d9 100644 --- a/e2e/specs/identity/account-syncing/sync-after-onboarding.spec.js +++ b/e2e/specs/identity/account-syncing/sync-after-onboarding.spec.js @@ -10,13 +10,13 @@ import { } from '../../../api-mocking/mock-server'; import { accountsSyncMockResponse } from './mockData'; import { importWalletWithRecoveryPhrase } from '../../../viewHelper'; -import TestHelpers from '../../../helpers'; import WalletView from '../../../pages/wallet/WalletView'; import AccountListBottomSheet from '../../../pages/wallet/AccountListBottomSheet'; import Assertions from '../../../utils/Assertions'; import { mockIdentityServices } from '../utils/mocks'; import { SmokeIdentity } from '../../../tags'; import { USER_STORAGE_FEATURE_NAMES } from '@metamask/profile-sync-controller/sdk'; +import Utilities from '../../../utils/Utilities'; describe(SmokeIdentity('Account syncing'), () => { beforeAll(async () => { @@ -37,9 +37,8 @@ describe(SmokeIdentity('Account syncing'), () => { ); jest.setTimeout(200000); - await TestHelpers.reverseServerPort(); - - await TestHelpers.launchApp({ + await Utilities.reverseServerPort(); + await Utilities.launchApp({ newInstance: true, delete: true, }); diff --git a/e2e/specs/multichain/permission-system-summary-default-permissions.spec.js b/e2e/specs/multichain/permission-system-summary-default-permissions.spec.js index 55a6a5fefeb..1f380483ef6 100644 --- a/e2e/specs/multichain/permission-system-summary-default-permissions.spec.js +++ b/e2e/specs/multichain/permission-system-summary-default-permissions.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { SmokeMultiChainPermissions } from '../../tags'; import Browser from '../../pages/Browser/BrowserView'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; @@ -10,13 +9,14 @@ import { loginToApp } from '../../viewHelper'; import Assertions from '../../utils/Assertions'; import PermissionSummaryBottomSheet from '../../pages/Browser/PermissionSummaryBottomSheet'; import { PermissionSummaryBottomSheetSelectorsText } from '../../selectors/Browser/PermissionSummaryBottomSheet.selectors'; +import Utilities from '../../utils/Utilities'; describe( SmokeMultiChainPermissions('Permission System - Default Permissions'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should display default account and chain permissions in permission summary', async () => { diff --git a/e2e/specs/multichain/permissions/accounts/permission-system-revoke-multiple.spec.js b/e2e/specs/multichain/permissions/accounts/permission-system-revoke-multiple.spec.js index b73885b0910..2dee290accb 100644 --- a/e2e/specs/multichain/permissions/accounts/permission-system-revoke-multiple.spec.js +++ b/e2e/specs/multichain/permissions/accounts/permission-system-revoke-multiple.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../../../helpers'; import Browser from '../../../../pages/Browser/BrowserView'; import AccountListBottomSheet from '../../../../pages/wallet/AccountListBottomSheet'; import TabBarComponent from '../../../../pages/wallet/TabBarComponent'; @@ -12,13 +11,14 @@ import FixtureBuilder from '../../../../fixtures/fixture-builder'; import { withFixtures } from '../../../../fixtures/fixture-helper'; import Assertions from '../../../../utils/Assertions'; import { SmokeMultiChainPermissions } from '../../../../tags'; +import Utilities from '../../../../utils/Utilities'; const AccountTwoText = 'Account 2'; describe(SmokeMultiChainPermissions('Account Permission Management'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('revokes all account permissions simultaneously', async () => { @@ -41,7 +41,7 @@ describe(SmokeMultiChainPermissions('Account Permission Management'), () => { await Browser.navigateToTestDApp(); await Browser.tapNetworkAvatarButtonOnBrowser(); await Assertions.checkIfVisible(ConnectedAccountsModal.title); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await Assertions.checkIfNotVisible(ToastModal.notificationTitle); await ConnectedAccountsModal.tapConnectMoreAccountsButton(); diff --git a/e2e/specs/multichain/permissions/accounts/permission-system-revoke-single.spec.js b/e2e/specs/multichain/permissions/accounts/permission-system-revoke-single.spec.js index d1c5a2f8002..1d67313fc44 100644 --- a/e2e/specs/multichain/permissions/accounts/permission-system-revoke-single.spec.js +++ b/e2e/specs/multichain/permissions/accounts/permission-system-revoke-single.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../../../helpers'; import { SmokeMultiChainPermissions } from '../../../../tags'; import Browser from '../../../../pages/Browser/BrowserView'; import TabBarComponent from '../../../../pages/wallet/TabBarComponent'; @@ -9,11 +8,12 @@ import FixtureBuilder from '../../../../fixtures/fixture-builder'; import { withFixtures } from '../../../../fixtures/fixture-helper'; import { loginToApp } from '../../../../viewHelper'; import Assertions from '../../../../utils/Assertions'; +import Utilities from '../../../../utils/Utilities'; describe(SmokeMultiChainPermissions('Account Permission Management'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('revokes dapp access for single account while maintaining other connections', async () => { diff --git a/e2e/specs/multichain/permissions/chains/permission-system-add-non-permitted.spec.js b/e2e/specs/multichain/permissions/chains/permission-system-add-non-permitted.spec.js index a33b641f342..26e5d16c749 100644 --- a/e2e/specs/multichain/permissions/chains/permission-system-add-non-permitted.spec.js +++ b/e2e/specs/multichain/permissions/chains/permission-system-add-non-permitted.spec.js @@ -4,7 +4,6 @@ import WalletView from '../../../../pages/wallet/WalletView'; import NetworkListModal from '../../../../pages/Network/NetworkListModal'; import NetworkEducationModal from '../../../../pages/Network/NetworkEducationModal'; import Assertions from '../../../../utils/Assertions'; -import TestHelpers from '../../../../helpers'; import FixtureBuilder from '../../../../fixtures/fixture-builder'; import { stopFixtureServer, @@ -17,6 +16,7 @@ import TabBarComponent from '../../../../pages/wallet/TabBarComponent'; import NetworkNonPemittedBottomSheet from '../../../../pages/Network/NetworkNonPemittedBottomSheet'; import ConnectedAccountsModal from '../../../../pages/Browser/ConnectedAccountsModal'; import NetworkConnectMultiSelector from '../../../../pages/Browser/NetworkConnectMultiSelector'; +import Utilities from '../../../../utils/Utilities'; const fixtureServer = new FixtureServer(); const SEPOLIA = CustomNetworks.Sepolia.providerConfig.nickname; @@ -25,7 +25,7 @@ describe( SmokeMultiChainPermissions('Chain Permission System, non-permitted chain, '), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); beforeEach(() => { @@ -55,12 +55,11 @@ describe( await NetworkListModal.scrollToBottomOfNetworkList(); await NetworkListModal.changeNetworkTo(SEPOLIA); await NetworkEducationModal.tapGotItButton(); - // Verify bottom sheet appears await TabBarComponent.tapBrowser(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await Browser.navigateToTestDApp(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await Assertions.checkIfVisible( NetworkNonPemittedBottomSheet.addThisNetworkTitle, ); @@ -93,7 +92,7 @@ describe( // Verify no bottom sheet appears await TabBarComponent.tapBrowser(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await Browser.navigateToTestDApp(); await Assertions.checkIfNotVisible( NetworkNonPemittedBottomSheet.addThisNetworkTitle, @@ -124,7 +123,7 @@ describe( // Add network permission await TabBarComponent.tapBrowser(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await Browser.navigateToTestDApp(); await NetworkNonPemittedBottomSheet.tapAddThisNetworkButton(); @@ -166,19 +165,19 @@ describe( // Verify bottom sheet appears and choose from permitted networks await TabBarComponent.tapBrowser(); - await TestHelpers.delay(3000); // Wait for the browser to load + await Utilities.delay(3000); // Wait for the browser to load await Browser.navigateToTestDApp(); - await TestHelpers.delay(3000); // Wait for the toast to disappear + await Utilities.delay(3000); // Wait for the toast to disappear await Assertions.checkIfVisible( NetworkNonPemittedBottomSheet.addThisNetworkTitle, ); - await TestHelpers.delay(3000); // still waiting for the toast to disappear + await Utilities.delay(3000); // still waiting for the toast to disappear await NetworkNonPemittedBottomSheet.tapChooseFromPermittedNetworksButton(); // Select Sepolia from permitted networks await NetworkNonPemittedBottomSheet.tapSepoliaNetworkName(); await NetworkEducationModal.tapGotItButton(); - await TestHelpers.delay(3000); // another toast to wait for, after switching to Sepolia + await Utilities.delay(3000); // another toast to wait for, after switching to Sepolia // Verify network switched to Sepolia await TabBarComponent.tapWallet(); @@ -211,12 +210,12 @@ describe( // Verify bottom sheet appears and navigate to edit permissions await TabBarComponent.tapBrowser(); - await TestHelpers.delay(3000); // Wait for the browser to load + await Utilities.delay(3000); // Wait for the browser to load await Browser.navigateToTestDApp(); await Assertions.checkIfVisible( NetworkNonPemittedBottomSheet.addThisNetworkTitle, ); - await TestHelpers.delay(3000); // Wait for the toast to disappear + await Utilities.delay(3000); // Wait for the toast to disappear await NetworkNonPemittedBottomSheet.tapChooseFromPermittedNetworksButton(); await NetworkNonPemittedBottomSheet.tapEditPermissionsButton(); @@ -224,12 +223,12 @@ describe( await NetworkNonPemittedBottomSheet.tapLineaSepoliaNetworkName(); await NetworkConnectMultiSelector.tapUpdateButton(); // await NetworkEducationModal.tapGotItButton(); // commeting this line for now, for some reason the e2e recordings dont currently show a got it modal here - await TestHelpers.delay(3000); // Wait for the toast to disappear + await Utilities.delay(3000); // Wait for the toast to disappear // Select Linea Sepolia from permitted networks await NetworkNonPemittedBottomSheet.tapLineaSepoliaNetworkName(); await NetworkEducationModal.tapGotItButton(); - await TestHelpers.delay(3000); // Wait for the toast to disappear + await Utilities.delay(3000); // Wait for the toast to disappear // Verify network switched to Linea Sepolia await TabBarComponent.tapWallet(); diff --git a/e2e/specs/multichain/permissions/chains/permission-system-dapp-chain-switch-grant.spec.js b/e2e/specs/multichain/permissions/chains/permission-system-dapp-chain-switch-grant.spec.js index f0b8c0f4dc6..d1539dad96b 100644 --- a/e2e/specs/multichain/permissions/chains/permission-system-dapp-chain-switch-grant.spec.js +++ b/e2e/specs/multichain/permissions/chains/permission-system-dapp-chain-switch-grant.spec.js @@ -1,7 +1,6 @@ 'use strict'; import FixtureBuilder from '../../../../fixtures/fixture-builder'; import { withFixtures } from '../../../../fixtures/fixture-helper'; -import TestHelpers from '../../../../helpers'; import Browser from '../../../../pages/Browser/BrowserView'; import ConnectBottomSheet from '../../../../pages/Browser/ConnectBottomSheet'; import TestDApp from '../../../../pages/Browser/TestDApp'; @@ -14,11 +13,12 @@ import Assertions from '../../../../utils/Assertions'; import { loginToApp } from '../../../../viewHelper'; import ConnectedAccountsModal from '../../../../pages/Browser/ConnectedAccountsModal'; import NetworkConnectMultiSelector from '../../../../pages/Browser/NetworkConnectMultiSelector'; +import Utilities from '../../../../utils/Utilities'; describe(SmokeMultiChainPermissions('Chain Permission System'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); describe('When a dApp requests to switch to a new chain', () => { diff --git a/e2e/specs/multichain/permissions/chains/permission-system-discard-changes.spec.js b/e2e/specs/multichain/permissions/chains/permission-system-discard-changes.spec.js index fdbdcc39402..70110473150 100644 --- a/e2e/specs/multichain/permissions/chains/permission-system-discard-changes.spec.js +++ b/e2e/specs/multichain/permissions/chains/permission-system-discard-changes.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../../../helpers'; import { SmokeMultiChainPermissions } from '../../../../tags'; import Browser from '../../../../pages/Browser/BrowserView'; import TabBarComponent from '../../../../pages/wallet/TabBarComponent'; @@ -10,11 +9,12 @@ import { loginToApp } from '../../../../viewHelper'; import Assertions from '../../../../utils/Assertions'; import NetworkConnectMultiSelector from '../../../../pages/Browser/NetworkConnectMultiSelector'; import NetworkNonPemittedBottomSheet from '../../../../pages/Network/NetworkNonPemittedBottomSheet'; +import Utilities from '../../../../utils/Utilities'; describe(SmokeMultiChainPermissions('Chain Permission Management'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('preserves original chain permissions when user cancels modification', async () => { diff --git a/e2e/specs/multichain/permissions/chains/permission-system-initial-connection.spec.js b/e2e/specs/multichain/permissions/chains/permission-system-initial-connection.spec.js index 5e0659c1e57..67d089e44e4 100644 --- a/e2e/specs/multichain/permissions/chains/permission-system-initial-connection.spec.js +++ b/e2e/specs/multichain/permissions/chains/permission-system-initial-connection.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../../../helpers'; import { SmokeMultiChainPermissions } from '../../../../tags'; import Browser from '../../../../pages/Browser/BrowserView'; import TabBarComponent from '../../../../pages/wallet/TabBarComponent'; @@ -12,11 +11,12 @@ import Assertions from '../../../../utils/Assertions'; import ConnectBottomSheet from '../../../../pages/Browser/ConnectBottomSheet'; import NetworkNonPemittedBottomSheet from '../../../../pages/Network/NetworkNonPemittedBottomSheet'; import NetworkConnectMultiSelector from '../../../../pages/Browser/NetworkConnectMultiSelector'; +import Utilities from '../../../../utils/Utilities'; describe(SmokeMultiChainPermissions('Chain Permission Management'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); describe('Initial Connection Flow', () => { @@ -53,7 +53,7 @@ describe(SmokeMultiChainPermissions('Chain Permission Management'), () => { // Initial setup: Login and navigate to test dapp await loginToApp(); await TabBarComponent.tapBrowser(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await Assertions.checkIfVisible(Browser.browserScreenID); await Browser.navigateToTestDApp(); diff --git a/e2e/specs/multichain/permissions/chains/permission-system-remove.spec.js b/e2e/specs/multichain/permissions/chains/permission-system-remove.spec.js index 6c927a02e8f..53013106236 100644 --- a/e2e/specs/multichain/permissions/chains/permission-system-remove.spec.js +++ b/e2e/specs/multichain/permissions/chains/permission-system-remove.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../../../helpers'; import { SmokeMultiChainPermissions } from '../../../../tags'; import Browser from '../../../../pages/Browser/BrowserView'; import TabBarComponent from '../../../../pages/wallet/TabBarComponent'; @@ -17,11 +16,12 @@ import TestDApp from '../../../../pages/Browser/TestDApp'; import NetworkEducationModal from '../../../../pages/Network/NetworkEducationModal'; import ConnectBottomSheet from '../../../../pages/Browser/ConnectBottomSheet'; import PermissionSummaryBottomSheet from '../../../../pages/Browser/PermissionSummaryBottomSheet'; +import Utilities from '../../../../utils/Utilities'; describe(SmokeMultiChainPermissions('Chain Permission Management'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('handles permission cleanup when removing a connected chain', async () => { diff --git a/e2e/specs/multichain/permissions/chains/permission-system-revoke-single.spec.js b/e2e/specs/multichain/permissions/chains/permission-system-revoke-single.spec.js index 5129d70bdaa..87c4ab40cb3 100644 --- a/e2e/specs/multichain/permissions/chains/permission-system-revoke-single.spec.js +++ b/e2e/specs/multichain/permissions/chains/permission-system-revoke-single.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../../../helpers'; import { SmokeMultiChainPermissions } from '../../../../tags'; import Browser from '../../../../pages/Browser/BrowserView'; import TabBarComponent from '../../../../pages/wallet/TabBarComponent'; @@ -9,11 +8,12 @@ import FixtureBuilder from '../../../../fixtures/fixture-builder'; import { withFixtures } from '../../../../fixtures/fixture-helper'; import { loginToApp } from '../../../../viewHelper'; import Assertions from '../../../../utils/Assertions'; +import Utilities from '../../../../utils/Utilities'; describe(SmokeMultiChainPermissions('Chain Permission Management'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('removes chain access permission while maintaining account connections', async () => { diff --git a/e2e/specs/multichain/permissions/chains/permission-system-update-permissions.spec.js b/e2e/specs/multichain/permissions/chains/permission-system-update-permissions.spec.js index ebd1c583dd3..f5175c5dcbf 100644 --- a/e2e/specs/multichain/permissions/chains/permission-system-update-permissions.spec.js +++ b/e2e/specs/multichain/permissions/chains/permission-system-update-permissions.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../../../helpers'; import { SmokeMultiChainPermissions } from '../../../../tags'; import Browser from '../../../../pages/Browser/BrowserView'; import TabBarComponent from '../../../../pages/wallet/TabBarComponent'; @@ -15,11 +14,12 @@ import WalletView from '../../../../pages/wallet/WalletView'; import NetworkEducationModal from '../../../../pages/Network/NetworkEducationModal'; import PermissionSummaryBottomSheet from '../../../../pages/Browser/PermissionSummaryBottomSheet'; import { NetworkNonPemittedBottomSheetSelectorsText } from '../../../../selectors/Network/NetworkNonPemittedBottomSheet.selectors'; +import Utilities from '../../../../utils/Utilities'; describe(SmokeMultiChainPermissions('Chain Permission Management'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it.skip('allows simultaneous granting and revoking of multiple chain permissions', async () => { await withFixtures( @@ -82,12 +82,12 @@ describe(SmokeMultiChainPermissions('Chain Permission Management'), () => { async () => { await loginToApp(); await TabBarComponent.tapBrowser(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await Browser.navigateToTestDApp(); // adding delay, // on artifact recording it shows the toast is stuck, and looks like tapNetworkAvatar is tapped but bottom sheet not coming up yet grey overlay usually behind the bottom sheet was showing, and recording stopped there, yet toast was stuck on screen for 15 seconds anduntil end of recording - await TestHelpers.delay(3000); + await Utilities.delay(3000); // Open network permissions menu await Browser.tapNetworkAvatarButtonOnBrowser(); @@ -100,10 +100,9 @@ describe(SmokeMultiChainPermissions('Chain Permission Management'), () => { // Handle network education modal and close bottom sheet await NetworkEducationModal.tapGotItButton(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await PermissionSummaryBottomSheet.swipeToDismissModal(); - await TestHelpers.delay(3000); - + await Utilities.delay(3000); // Verify network switched to Sepolia in wallet view await TabBarComponent.tapWallet(); await Assertions.checkIfVisible(WalletView.container); diff --git a/e2e/specs/networks/add-custom-rpc.spec.js b/e2e/specs/networks/add-custom-rpc.spec.js index d0d53ce26a5..fdc5ee237dd 100644 --- a/e2e/specs/networks/add-custom-rpc.spec.js +++ b/e2e/specs/networks/add-custom-rpc.spec.js @@ -1,6 +1,5 @@ 'use strict'; -import TestHelpers from '../../helpers'; -import { SmokeCore } from '../../tags'; +import { Regression } from '../../tags'; import NetworkView from '../../pages/Settings/NetworksView'; import WalletView from '../../pages/wallet/WalletView'; import ToastModal from '../../pages/wallet/ToastModal'; @@ -17,16 +16,17 @@ import { getFixturesServerPort } from '../../fixtures/utils'; import FixtureServer from '../../fixtures/fixture-server'; import Assertions from '../../utils/Assertions'; import { CustomNetworks } from '../../resources/networks.e2e'; +import Utilities from '../../utils/Utilities'; const fixtureServer = new FixtureServer(); -describe('Custom RPC Tests', () => { +describe(Regression('Custom RPC Tests'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); @@ -55,7 +55,7 @@ describe('Custom RPC Tests', () => { await NetworkView.tapRpcDropDownButton(); await NetworkView.tapAddRpcButton(); - await TestHelpers.delay(200); + await Utilities.delay(200); await NetworkView.typeInRpcUrl('abc'); // Input incorrect RPC URL await Assertions.checkIfVisible(NetworkView.rpcWarningBanner); await NetworkView.clearRpcInputBox(); @@ -192,7 +192,7 @@ describe('Custom RPC Tests', () => { // delete Gnosis network await NetworkListModal.deleteNetwork(); - await TestHelpers.delay(200); + await Utilities.delay(200); await NetworkListModal.tapDeleteButton(); diff --git a/e2e/specs/networks/add-popular-networks.spec.js b/e2e/specs/networks/add-popular-networks.spec.js index 6d7df8a9c44..d7ab0414b83 100644 --- a/e2e/specs/networks/add-popular-networks.spec.js +++ b/e2e/specs/networks/add-popular-networks.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { Regression } from '../../tags'; import NetworkAddedBottomSheet from '../../pages/Network/NetworkAddedBottomSheet'; import NetworkApprovalBottomSheet from '../../pages/Network/NetworkApprovalBottomSheet'; @@ -9,11 +8,11 @@ import { withFixtures } from '../../fixtures/fixture-helper'; import WalletView from '../../pages/wallet/WalletView'; import NetworkListModal from '../../pages/Network/NetworkListModal'; import Assertions from '../../utils/Assertions'; - +import Utilities from '../../utils/Utilities'; describe(Regression('Add all popular networks'), () => { beforeAll(async () => { jest.setTimeout(170000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it(`Add all popular networks to verify the empty list content`, async () => { diff --git a/e2e/specs/networks/connect-test-network.spec.js b/e2e/specs/networks/connect-test-network.spec.js index 86b98f1d6c0..444329d8f3a 100644 --- a/e2e/specs/networks/connect-test-network.spec.js +++ b/e2e/specs/networks/connect-test-network.spec.js @@ -4,7 +4,6 @@ import WalletView from '../../pages/wallet/WalletView'; import NetworkListModal from '../../pages/Network/NetworkListModal'; import NetworkEducationModal from '../../pages/Network/NetworkEducationModal'; import Assertions from '../../utils/Assertions'; -import TestHelpers from '../../helpers'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { loadFixture, @@ -14,17 +13,18 @@ import { import { getFixturesServerPort } from '../../fixtures/utils'; import FixtureServer from '../../fixtures/fixture-server'; import { CustomNetworks } from '../../resources/networks.e2e'; +import Utilities from '../../utils/Utilities'; const fixtureServer = new FixtureServer(); const ETHEREUM = 'Ethereum Main Network'; describe(Regression('Connect to a Test Network'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); diff --git a/e2e/specs/networks/networks-search.spec.js b/e2e/specs/networks/networks-search.spec.js index 9c976dbcc53..66dab0c8e7a 100644 --- a/e2e/specs/networks/networks-search.spec.js +++ b/e2e/specs/networks/networks-search.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { SmokeCore } from '../../tags'; import { loginToApp } from '../../viewHelper'; @@ -9,13 +8,14 @@ import Assertions from '../../utils/Assertions'; import { PopularNetworksList } from '../../resources/networks.e2e'; import WalletView from '../../pages/wallet/WalletView'; import NetworkListModal from '../../pages/Network/NetworkListModal'; +import Utilities from '../../utils/Utilities'; const SHORT_HAND_NETWORK_TEXT = 'Ava'; const INVALID_NETWORK_TEXT = 'cccM'; describe(SmokeCore('Networks Search'), () => { beforeAll(async () => { jest.setTimeout(170000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it(`Remove ${PopularNetworksList.Avalanche.providerConfig.nickname} network from the list, ensuring its absent in search results`, async () => { @@ -40,8 +40,7 @@ describe(SmokeCore('Networks Search'), () => { // delete avalanche network await NetworkListModal.deleteNetwork(); - - await TestHelpers.delay(2000); + await Utilities.delay(2000); await NetworkListModal.tapDeleteButton(); await Assertions.checkIfVisible( diff --git a/e2e/specs/onboarding/onboarding-wizard-opt-in.spec.js b/e2e/specs/onboarding/onboarding-wizard-opt-in.spec.js index 4d98c0f3051..25313d8cb55 100644 --- a/e2e/specs/onboarding/onboarding-wizard-opt-in.spec.js +++ b/e2e/specs/onboarding/onboarding-wizard-opt-in.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { Regression } from '../../tags'; import ProtectYourWalletView from '../../pages/Onboarding/ProtectYourWalletView'; import CreatePasswordView from '../../pages/Onboarding/CreatePasswordView'; @@ -20,6 +19,7 @@ import TabBarComponent from '../../pages/wallet/TabBarComponent'; import CommonView from '../../pages/CommonView'; import Assertions from '../../utils/Assertions'; import ExperienceEnhancerBottomSheet from '../../pages/Onboarding/ExperienceEnhancerBottomSheet'; +import Utilities from '../../utils/Utilities'; const PASSWORD = '12345678'; @@ -28,7 +28,7 @@ describe( () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.launchApp(); + await Utilities.launchApp(); }); it('should be able to opt-in of the onboarding-wizard', async () => { @@ -57,14 +57,16 @@ describe( }); it('Should dismiss Automatic Security checks screen', async () => { - await TestHelpers.delay(3500); - await Assertions.checkIfVisible(EnableAutomaticSecurityChecksView.container); + await Utilities.delay(3500); + await Assertions.checkIfVisible( + EnableAutomaticSecurityChecksView.container, + ); await EnableAutomaticSecurityChecksView.tapNoThanks(); }); it('should dismiss the onboarding wizard', async () => { // dealing with flakiness on bitrise. - await TestHelpers.delay(1000); + await Utilities.delay(1000); try { await Assertions.checkIfVisible(OnboardingWizardModal.stepOneContainer); await OnboardingWizardModal.tapNoThanksButton(); @@ -78,9 +80,11 @@ describe( it('should dismiss the marketing consent bottom sheet', async () => { // dealing with flakiness on bitrise. - await TestHelpers.delay(1000); + await Utilities.delay(1000); try { - await Assertions.checkIfVisible(ExperienceEnhancerBottomSheet.container); + await Assertions.checkIfVisible( + ExperienceEnhancerBottomSheet.container, + ); await ExperienceEnhancerBottomSheet.tapIAgree(); } catch { /* eslint-disable no-console */ @@ -93,7 +97,7 @@ describe( await Assertions.checkIfVisible( ProtectYourWalletModal.collapseWalletModal, ); - await TestHelpers.delay(1000); + await Utilities.delay(1000); await ProtectYourWalletModal.tapRemindMeLaterButton(); await SkipAccountSecurityModal.tapIUnderstandCheckBox(); await SkipAccountSecurityModal.tapSkipButton(); @@ -104,20 +108,20 @@ describe( await TabBarComponent.tapSettings(); await SettingsView.tapSecurityAndPrivacy(); await SecurityAndPrivacy.scrollToMetaMetrics(); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await Assertions.checkIfToggleIsOn(SecurityAndPrivacy.metaMetricsToggle); }); it('should disable metametrics', async () => { await SecurityAndPrivacy.tapMetaMetricsToggle(); - await TestHelpers.delay(1500); + await Utilities.delay(1500); await CommonView.tapOkAlert(); await Assertions.checkIfToggleIsOff(SecurityAndPrivacy.metaMetricsToggle); }); it('should relaunch the app and log in', async () => { // Relaunch app - await TestHelpers.relaunchApp(); + await Utilities.relaunchApp(); await Assertions.checkIfVisible(LoginView.container); await LoginView.enterPassword(PASSWORD); await Assertions.checkIfVisible(WalletView.container); @@ -125,7 +129,7 @@ describe( it('should dismiss the onboarding wizard after logging in', async () => { // dealing with flakiness on bitrise. - await TestHelpers.delay(1000); + await Utilities.delay(1000); try { await Assertions.checkIfVisible(OnboardingWizardModal.stepOneContainer); await OnboardingWizardModal.tapNoThanksButton(); diff --git a/e2e/specs/onboarding/term-of-use.spec.js b/e2e/specs/onboarding/term-of-use.spec.js index 7eb74a49097..e5ce86be56c 100644 --- a/e2e/specs/onboarding/term-of-use.spec.js +++ b/e2e/specs/onboarding/term-of-use.spec.js @@ -1,16 +1,16 @@ import TermsOfUseModal from '../../pages/Onboarding/TermsOfUseModal'; -import TestHelpers from '../../helpers'; import OnboardingCarouselView from '../../pages/Onboarding/OnboardingCarouselView'; import OnboardingView from '../../pages/Onboarding/OnboardingView'; import MetaMetricsOptIn from '../../pages/Onboarding/MetaMetricsOptInView'; import ImportWalletView from '../../pages/Onboarding/ImportWalletView'; import Assertions from '../../utils/Assertions'; import { Regression } from '../../tags'; +import Utilities from '../../utils/Utilities'; describe(Regression('Term of Use Modal'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.launchApp(); + await Utilities.launchApp(); }); it('should displayed Term of Use when first launching app', async () => { @@ -25,7 +25,7 @@ describe(Regression('Term of Use Modal'), () => { }); it('should prevent attempts to bypass term of use', async () => { - await TestHelpers.relaunchApp(); + await Utilities.relaunchApp(); await Assertions.checkIfVisible(OnboardingCarouselView.container); await OnboardingCarouselView.tapOnGetStartedButton(); await Assertions.checkIfVisible(OnboardingView.container); @@ -42,7 +42,7 @@ describe(Regression('Term of Use Modal'), () => { }); it('should restart app after accepting terms', async () => { - await TestHelpers.relaunchApp(); + await Utilities.relaunchApp(); await Assertions.checkIfVisible(OnboardingCarouselView.container); await OnboardingCarouselView.tapOnGetStartedButton(); await Assertions.checkIfVisible(OnboardingView.container); diff --git a/e2e/specs/permission-systems/permission-system-delete-wallet.spec.js b/e2e/specs/permission-systems/permission-system-delete-wallet.spec.js index e9e61348447..3ac26e5711b 100644 --- a/e2e/specs/permission-systems/permission-system-delete-wallet.spec.js +++ b/e2e/specs/permission-systems/permission-system-delete-wallet.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { Regression } from '../../tags'; import OnboardingView from '../../pages/Onboarding/OnboardingView'; import ProtectYourWalletView from '../../pages/Onboarding/ProtectYourWalletView'; @@ -21,13 +20,14 @@ import ProtectYourWalletModal from '../../pages/Onboarding/ProtectYourWalletModa import OnboardingSuccessView from '../../pages/Onboarding/OnboardingSuccessView'; import Assertions from '../../utils/Assertions'; import ToastModal from '../../pages/wallet/ToastModal'; +import Utilities from '../../utils/Utilities'; const PASSWORD = '12345678'; describe(Regression('Permission System'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should no longer be connected to the dapp after deleting wallet', async () => { @@ -49,7 +49,7 @@ describe(Regression('Permission System'), () => { await Browser.tapNetworkAvatarButtonOnBrowser(); await Assertions.checkIfVisible(ConnectedAccountsModal.title); await ConnectedAccountsModal.scrollToBottomOfModal(); - await TestHelpers.delay(2000); + await Utilities.delay(2000); //go to settings then security & privacy await TabBarComponent.tapSettings(); @@ -67,16 +67,15 @@ describe(Regression('Permission System'), () => { await DeleteWalletModal.typeDeleteInInputBox(); await DeleteWalletModal.tapDeleteMyWalletButton(); await Assertions.checkIfNotVisible(DeleteWalletModal.container); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await Assertions.checkIfVisible(OnboardingView.container); if (device.getPlatform() === 'ios') { await Assertions.checkIfVisible(ToastModal.notificationTitle); await Assertions.checkIfNotVisible(ToastModal.notificationTitle); } else { - await TestHelpers.delay(3000); + await Utilities.delay(3000); } await OnboardingView.tapCreateWallet(); - // Create new wallet await Assertions.checkIfVisible(MetaMetricsOptIn.container); await MetaMetricsOptIn.tapAgreeButton(); diff --git a/e2e/specs/permission-systems/permission-system-revoking-multiple-accounts.spec.js b/e2e/specs/permission-systems/permission-system-revoking-multiple-accounts.spec.js index ffc7834d0a7..5a2513f4058 100644 --- a/e2e/specs/permission-systems/permission-system-revoking-multiple-accounts.spec.js +++ b/e2e/specs/permission-systems/permission-system-revoking-multiple-accounts.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import Browser from '../../pages/Browser/BrowserView'; import AccountListBottomSheet from '../../pages/wallet/AccountListBottomSheet'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; @@ -12,13 +11,14 @@ import FixtureBuilder from '../../fixtures/fixture-builder'; import { withFixtures } from '../../fixtures/fixture-helper'; import Assertions from '../../utils/Assertions'; import { Regression } from '../../tags'; +import Utilities from '../../utils/Utilities'; const AccountTwoText = 'Account 2'; describe(Regression('Permission System:'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should connect multiple accounts and revoke them', async () => { @@ -41,7 +41,7 @@ describe(Regression('Permission System:'), () => { await Browser.navigateToTestDApp(); await Browser.tapNetworkAvatarButtonOnBrowser(); await Assertions.checkIfVisible(ConnectedAccountsModal.title); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await Assertions.checkIfNotVisible(ToastModal.notificationTitle); await ConnectedAccountsModal.tapConnectMoreAccountsButton(); @@ -52,11 +52,10 @@ describe(Regression('Permission System:'), () => { } await AccountListBottomSheet.tapAccountIndex(0); await AccountListBottomSheet.tapConnectAccountsButton(); - // should revoke accounts await Browser.tapNetworkAvatarButtonOnBrowser(); await ConnectedAccountsModal.tapPermissionsButton(); - await TestHelpers.delay(1500); + await Utilities.delay(1500); await ConnectedAccountsModal.tapDisconnectAllButton(); await Assertions.checkIfNotVisible(ToastModal.notificationTitle); diff --git a/e2e/specs/quarantine/create-wallet-account.failing.js b/e2e/specs/quarantine/create-wallet-account.failing.js index fc8656244bd..5b8cd841ad3 100644 --- a/e2e/specs/quarantine/create-wallet-account.failing.js +++ b/e2e/specs/quarantine/create-wallet-account.failing.js @@ -4,15 +4,15 @@ import WalletView from '../../pages/wallet/WalletView'; import { importWalletWithRecoveryPhrase } from '../../viewHelper'; import AccountListBottomSheet from '../../pages/wallet/AccountListBottomSheet'; import Assertions from '../../utils/Assertions'; -import TestHelpers from '../../helpers'; import AddAccountBottomSheet from '../../pages/wallet/AddAccountBottomSheet'; +import Utilities from '../../utils/Utilities'; const AccountTwoText = 'Account 2'; describe(SmokeAccounts('Create wallet account'), () => { beforeAll(async () => { jest.setTimeout(200000); - await TestHelpers.launchApp(); + await Utilities.launchApp(); }); it('should import wallet and go to the wallet view', async () => { diff --git a/e2e/specs/quarantine/deeplinks.failing.js b/e2e/specs/quarantine/deeplinks.failing.js index d6062727acb..647225ce8aa 100644 --- a/e2e/specs/quarantine/deeplinks.failing.js +++ b/e2e/specs/quarantine/deeplinks.failing.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { Regression } from '../../tags'; import ConnectBottomSheet from '../../pages/Browser/ConnectBottomSheet'; @@ -20,6 +19,7 @@ import Accounts from '../../../wdio/helpers/Accounts'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; import Assertions from '../../utils/Assertions'; import { PopularNetworksList } from '../../resources/networks.e2e'; +import Utilities from '../../utils/Utilities'; //const BINANCE_RPC_URL = 'https://bsc-dataseed1.binance.org'; @@ -56,7 +56,7 @@ describe(Regression('Deep linking Tests'), () => { await SettingsView.tapSecurityAndPrivacy(); await SecurityAndPrivacy.scrollToTurnOnRememberMe(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); }); it('should enable remember me', async () => { @@ -67,20 +67,20 @@ describe(Regression('Deep linking Tests'), () => { it('should relaunch the app then enable remember me', async () => { // Relaunch app - await TestHelpers.relaunchApp(); + await Utilities.relaunchApp(); await Assertions.checkIfVisible(LoginView.container); await LoginView.toggleRememberMeSwitch(); await LoginView.enterPassword(validAccount.password); await Assertions.checkIfVisible(WalletView.container); }); - it('should deep link to Binance Smart Chain & show a network not found error message', async () => { - await TestHelpers.openDeepLink(BINANCE_DEEPLINK_URL); - await TestHelpers.delay(3000); - await TestHelpers.checkIfElementWithTextIsVisible(networkNotFoundText); - await TestHelpers.checkIfElementWithTextIsVisible(networkErrorBodyMessage); - await CommonView.tapOKAlertButton(); - }); + // it('should deep link to Binance Smart Chain & show a network not found error message', async () => { + // await Utilities.openDeepLink(BINANCE_DEEPLINK_URL); + // await Utilities.delay(3000); + // await Utilities.checkIfElementWithTextIsVisible(networkNotFoundText); + // await Utilities.checkIfElementWithTextIsVisible(networkErrorBodyMessage); + // await CommonView.tapOKAlertButton(); + // }); it('should go to settings then networks', async () => { await TabBarComponent.tapSettings(); @@ -91,7 +91,7 @@ describe(Regression('Deep linking Tests'), () => { it('should add BSC network', async () => { // Tap on Add Network button - await TestHelpers.delay(3000); + await Utilities.delay(3000); await NetworkView.tapAddNetworkButton(); await Assertions.checkIfVisible(NetworkView.networkContainer); @@ -123,7 +123,7 @@ describe(Regression('Deep linking Tests'), () => { ); await NetworkApprovalBottomSheet.tapApproveButton(); - await TestHelpers.delay(1000); + await Utilities.delay(1000); await Assertions.checkIfVisible(NetworkAddedBottomSheet.switchNetwork); await NetworkAddedBottomSheet.tapSwitchToNetwork(); @@ -136,20 +136,20 @@ describe(Regression('Deep linking Tests'), () => { }); it('should deep link to the send flow on matic', async () => { - await TestHelpers.openDeepLink(POLYGON_DEEPLINK_URL); //FIXME: this is failing on iOS simulator + await Utilities.openDeepLink(POLYGON_DEEPLINK_URL); //FIXME: this is failing on iOS simulator - await TestHelpers.delay(4500); + await Utilities.delay(4500); await Assertions.checkIfVisible( TransactionConfirmationView.transactionViewContainer, ); //TODO: Update isNetworkNameVisible method //await TransactionConfirmationView.isNetworkNameVisible('Polygon Mainnet'); - await TestHelpers.delay(1500); + await Utilities.delay(1500); await TransactionConfirmationView.tapCancelButton(); }); it('should deep link to the send flow on BSC', async () => { - await TestHelpers.openDeepLink(BINANCE_DEEPLINK_URL); - await TestHelpers.delay(4500); + await Utilities.openDeepLink(BINANCE_DEEPLINK_URL); + await Utilities.delay(4500); await Assertions.checkIfVisible( TransactionConfirmationView.transactionViewContainer, ); @@ -158,8 +158,8 @@ describe(Regression('Deep linking Tests'), () => { }); it('should deep link to the send flow on Goerli and submit the transaction', async () => { - await TestHelpers.openDeepLink(GOERLI_DEEPLINK_URL); - await TestHelpers.delay(4500); + await Utilities.openDeepLink(GOERLI_DEEPLINK_URL); + await Utilities.delay(4500); await Assertions.checkIfVisible( TransactionConfirmationView.transactionViewContainer, ); @@ -176,8 +176,8 @@ describe(Regression('Deep linking Tests'), () => { }); it('should deep link to the send flow on mainnet', async () => { - await TestHelpers.openDeepLink(ETHEREUM_DEEPLINK_URL); - await TestHelpers.delay(4500); + await Utilities.openDeepLink(ETHEREUM_DEEPLINK_URL); + await Utilities.delay(4500); await Assertions.checkIfVisible( TransactionConfirmationView.transactionViewContainer, @@ -190,13 +190,13 @@ describe(Regression('Deep linking Tests'), () => { }); it('should deep link to a dapp (Sushi swap)', async () => { - await TestHelpers.openDeepLink(DAPP_DEEPLINK_URL); - await TestHelpers.delay(4500); + await Utilities.openDeepLink(DAPP_DEEPLINK_URL); + await Utilities.delay(4500); await Assertions.checkIfVisible(ConnectBottomSheet.container); await ConnectBottomSheet.tapConnectButton(); - await TestHelpers.checkIfElementWithTextIsVisible('app.sushi.com', 0); + await Utilities.checkIfElementWithTextIsVisible('app.sushi.com', 0); await Assertions.checkIfVisible(Browser.browserScreenID); await Assertions.checkIfNotVisible(ConnectBottomSheet.container); diff --git a/e2e/specs/quarantine/permission-system-removing-imported-account.failing.js b/e2e/specs/quarantine/permission-system-removing-imported-account.failing.js index 8306e6182c6..7297cb32369 100644 --- a/e2e/specs/quarantine/permission-system-removing-imported-account.failing.js +++ b/e2e/specs/quarantine/permission-system-removing-imported-account.failing.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { Regression } from '../../tags'; import WalletView from '../../pages/wallet/WalletView'; import ImportAccountView from '../../pages/importAccount/ImportAccountView'; @@ -18,6 +17,7 @@ import { importWalletWithRecoveryPhrase } from '../../viewHelper'; import AddAccountBottomSheet from '../../pages/wallet/AddAccountBottomSheet'; import Assertions from '../../utils/Assertions'; import SuccessImportAccountView from '../../pages/importAccount/SuccessImportAccountView'; +import Utilities from '../../utils/Utilities'; const SEPOLIA = 'Sepolia'; @@ -36,19 +36,19 @@ describe( }); it('should navigate to browser', async () => { - await TestHelpers.delay(2000); + await Utilities.delay(2000); await TabBarComponent.tapBrowser(); await Assertions.checkIfVisible(Browser.browserScreenID); }); it('should trigger connect modal in the test dapp', async () => { - await TestHelpers.delay(3000); + await Utilities.delay(3000); //TODO: Create goToTestDappAndTapConnectButton method. // await TestDApp.goToTestDappAndTapConnectButton(); }); it('should go to multiconnect in the connect account modal', async () => { - await TestHelpers.delay(3000); + await Utilities.delay(3000); await ConnectBottomSheet.tapConnectMultipleAccountsButton(); }); @@ -82,11 +82,11 @@ describe( }); it('should set the imported account as primary account', async () => { - await TestHelpers.delay(1500); + await Utilities.delay(1500); }); it('should navigate to wallet view', async () => { - await TestHelpers.delay(1500); + await Utilities.delay(1500); await TabBarComponent.tapWallet(); await Assertions.checkIfVisible(WalletView.container); }); @@ -102,7 +102,7 @@ describe( it('should return to browser', async () => { //await AccountListView.swipeToDimssAccountsModal(); - await TestHelpers.delay(4500); + await Utilities.delay(4500); await TabBarComponent.tapBrowser(); // Check that we are on the browser screen await Assertions.checkIfVisible(Browser.browserScreenID); diff --git a/e2e/specs/quarantine/security-alert-send-eth.mock.failing.js b/e2e/specs/quarantine/security-alert-send-eth.mock.failing.js index b3e346fc460..40d406ff913 100644 --- a/e2e/specs/quarantine/security-alert-send-eth.mock.failing.js +++ b/e2e/specs/quarantine/security-alert-send-eth.mock.failing.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import AmountView from '../../pages/Send/AmountView'; import SendView from '../../pages/Send/SendView'; @@ -12,13 +11,14 @@ import { withFixtures } from '../../fixtures/fixture-helper'; import { mockEvents } from '../../api-mocking/mock-config/mock-events'; import Assertions from '../../utils/Assertions'; import { SmokeConfirmations } from '../../tags'; +import Utilities from '../../utils/Utilities'; describe(SmokeConfirmations('Security Alert API - Send flow'), () => { const BENIGN_ADDRESS_MOCK = '0x50587E46C5B96a3F6f9792922EC647F13E6EFAE4'; beforeAll(async () => { jest.setTimeout(2500000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); const defaultFixture = new FixtureBuilder().withSepoliaNetwork().build(); diff --git a/e2e/specs/quarantine/send-to-contact.failing.js b/e2e/specs/quarantine/send-to-contact.failing.js index 8e5427cab2e..7062c99d572 100644 --- a/e2e/specs/quarantine/send-to-contact.failing.js +++ b/e2e/specs/quarantine/send-to-contact.failing.js @@ -16,10 +16,10 @@ import { stopFixtureServer, } from '../../fixtures/fixture-helper'; import { CustomNetworks } from '../../resources/networks.e2e'; -import TestHelpers from '../../helpers'; import FixtureServer from '../../fixtures/fixture-server'; import { getFixturesServerPort } from '../../fixtures/utils'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; const fixtureServer = new FixtureServer(); @@ -28,7 +28,7 @@ describe(SmokeConfirmations('Send ETH'), () => { const AMOUNT = '0.12345'; beforeEach(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder() .withNetworkController(CustomNetworks.Tenderly) .withAddressBookController({ diff --git a/e2e/specs/ramps/deeplink-to-buy-flow-with-unsupported-network.spec.js b/e2e/specs/ramps/deeplink-to-buy-flow-with-unsupported-network.spec.js index 329df8acd11..fac3f9399bf 100644 --- a/e2e/specs/ramps/deeplink-to-buy-flow-with-unsupported-network.spec.js +++ b/e2e/specs/ramps/deeplink-to-buy-flow-with-unsupported-network.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import { withFixtures } from '../../fixtures/fixture-helper'; @@ -15,10 +14,11 @@ import NetworkApprovalBottomSheet from '../../pages/Network/NetworkApprovalBotto import NetworkEducationModal from '../../pages/Network/NetworkEducationModal'; import NetworkListModal from '../../pages/Network/NetworkListModal'; import { PopularNetworksList } from '../../resources/networks.e2e'; +import Utilities from '../../utils/Utilities'; describe(SmokeRamps('Buy Crypto Deeplinks'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); beforeEach(async () => { diff --git a/e2e/specs/ramps/deeplink-to-buy-flow.spec.js b/e2e/specs/ramps/deeplink-to-buy-flow.spec.js index df9a62b634e..1254f6de056 100644 --- a/e2e/specs/ramps/deeplink-to-buy-flow.spec.js +++ b/e2e/specs/ramps/deeplink-to-buy-flow.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import { withFixtures } from '../../fixtures/fixture-helper'; @@ -15,9 +14,10 @@ import Assertions from '../../utils/Assertions'; import { PopularNetworksList } from '../../resources/networks.e2e'; import NetworkEducationModal from '../../pages/Network/NetworkEducationModal'; +import Utilities from '../../utils/Utilities'; describe(SmokeRamps('Buy Crypto Deeplinks'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); beforeEach(async () => { diff --git a/e2e/specs/ramps/deeplink-to-sell-flow.spec.js b/e2e/specs/ramps/deeplink-to-sell-flow.spec.js index 78b35489d04..a955f73b17d 100644 --- a/e2e/specs/ramps/deeplink-to-sell-flow.spec.js +++ b/e2e/specs/ramps/deeplink-to-sell-flow.spec.js @@ -4,7 +4,6 @@ import { loginToApp } from '../../viewHelper'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { withFixtures } from '../../fixtures/fixture-helper'; -import TestHelpers from '../../helpers'; import SellGetStartedView from '../../pages/Ramps/SellGetStartedView'; import { SmokeRamps } from '../../tags'; @@ -15,10 +14,11 @@ import NetworkAddedBottomSheet from '../../pages/Network/NetworkAddedBottomSheet import NetworkEducationModal from '../../pages/Network/NetworkEducationModal'; import NetworkListModal from '../../pages/Network/NetworkListModal'; import { PopularNetworksList } from '../../resources/networks.e2e'; +import Utilities from '../../utils/Utilities'; describe(SmokeRamps('Sell Crypto Deeplinks'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); beforeEach(async () => { diff --git a/e2e/specs/ramps/offramp.spec.js b/e2e/specs/ramps/offramp.spec.js index dab60443aba..ed7b3c23805 100644 --- a/e2e/specs/ramps/offramp.spec.js +++ b/e2e/specs/ramps/offramp.spec.js @@ -9,7 +9,6 @@ import { stopFixtureServer, } from '../../fixtures/fixture-helper'; import { CustomNetworks } from '../../resources/networks.e2e'; -import TestHelpers from '../../helpers'; import FixtureServer from '../../fixtures/fixture-server'; import { getFixturesServerPort } from '../../fixtures/utils'; import { SmokeRamps } from '../../tags'; @@ -18,6 +17,7 @@ import SellGetStartedView from '../../pages/Ramps/SellGetStartedView'; import SelectRegionView from '../../pages/Ramps/SelectRegionView'; import SelectPaymentMethodView from '../../pages/Ramps/SelectPaymentMethodView'; import BuildQuoteView from '../../pages/Ramps/BuildQuoteView'; +import Utilities from '../../utils/Utilities'; const fixtureServer = new FixtureServer(); @@ -36,13 +36,13 @@ const PaymentMethods = { describe(SmokeRamps('Off-Ramp'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder() .withNetworkController(CustomNetworks.Tenderly.Mainnet) .build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ permissions: { notifications: 'YES' }, launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); diff --git a/e2e/specs/ramps/onramp.spec.js b/e2e/specs/ramps/onramp.spec.js index be78ab9d9e9..81dc0d839c5 100644 --- a/e2e/specs/ramps/onramp.spec.js +++ b/e2e/specs/ramps/onramp.spec.js @@ -8,7 +8,6 @@ import { startFixtureServer, stopFixtureServer, } from '../../fixtures/fixture-helper'; -import TestHelpers from '../../helpers'; import FixtureServer from '../../fixtures/fixture-server'; import { getFixturesServerPort } from '../../fixtures/utils'; import { SmokeRamps } from '../../tags'; @@ -17,16 +16,17 @@ import SelectRegionView from '../../pages/Ramps/SelectRegionView'; import SelectPaymentMethodView from '../../pages/Ramps/SelectPaymentMethodView'; import BuildQuoteView from '../../pages/Ramps/BuildQuoteView'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; const fixtureServer = new FixtureServer(); describe(SmokeRamps('Buy Crypto'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ permissions: { notifications: 'YES' }, launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); diff --git a/e2e/specs/settings/addressbook-tests.spec.js b/e2e/specs/settings/addressbook-tests.spec.js index d8f2df925f7..78ff96e0c06 100644 --- a/e2e/specs/settings/addressbook-tests.spec.js +++ b/e2e/specs/settings/addressbook-tests.spec.js @@ -14,13 +14,13 @@ import { startFixtureServer, stopFixtureServer, } from '../../fixtures/fixture-helper'; -import TestHelpers from '../../helpers'; import FixtureServer from '../../fixtures/fixture-server'; import { getFixturesServerPort } from '../../fixtures/utils'; import CommonView from '../../pages/CommonView'; import enContent from '../../../locales/languages/en.json'; import DeleteContactBottomSheet from '../../pages/Settings/Contacts/DeleteContactBottomSheet'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; const INVALID_ADDRESS = '0xB8B4EE5B1b693971eB60bDa15211570df2dB221L'; const TETHER_ADDRESS = '0xdac17f958d2ee523a2206206994597c13d831ec7'; @@ -30,11 +30,11 @@ const fixtureServer = new FixtureServer(); describe(SmokeCore('Addressbook Tests'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); diff --git a/e2e/specs/settings/clear-privacy-data.spec.js b/e2e/specs/settings/clear-privacy-data.spec.js index ec2e2f0b771..637dde678f2 100644 --- a/e2e/specs/settings/clear-privacy-data.spec.js +++ b/e2e/specs/settings/clear-privacy-data.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { Regression } from '../../tags'; import SettingsView from '../../pages/Settings/SettingsView'; @@ -13,11 +12,12 @@ import Assertions from '../../utils/Assertions'; import ClearPrivacyModal from '../../pages/Settings/SecurityAndPrivacy/ClearPrivacyModal'; import BrowserView from '../../pages/Browser/BrowserView'; import ConnectedAccountsModal from '../../pages/Browser/ConnectedAccountsModal'; +import Utilities from '../../utils/Utilities'; describe(Regression('Clear Privacy data'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should clear all dapp connections', async () => { diff --git a/e2e/specs/settings/contact-us.spec.js b/e2e/specs/settings/contact-us.spec.js index b86f82feb60..4156950ebb7 100644 --- a/e2e/specs/settings/contact-us.spec.js +++ b/e2e/specs/settings/contact-us.spec.js @@ -1,6 +1,5 @@ 'use strict'; import { Regression } from '../../tags'; -import TestHelpers from '../../helpers'; import SettingsView from '../../pages/Settings/SettingsView'; import FixtureBuilder from '../../fixtures/fixture-builder'; import { @@ -13,16 +12,16 @@ import FixtureServer from '../../fixtures/fixture-server'; import { loginToApp } from '../../viewHelper'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; const fixtureServer = new FixtureServer(); - describe(Regression('Settings'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); await loginToApp(); diff --git a/e2e/specs/settings/delete-wallet.spec.js b/e2e/specs/settings/delete-wallet.spec.js index c17988a0a82..58e677923e8 100644 --- a/e2e/specs/settings/delete-wallet.spec.js +++ b/e2e/specs/settings/delete-wallet.spec.js @@ -1,5 +1,4 @@ 'use strict'; -import TestHelpers from '../../helpers'; import { SmokeCore } from '../../tags'; import OnboardingView from '../../pages/Onboarding/OnboardingView'; import LoginView from '../../pages/wallet/LoginView'; @@ -13,6 +12,7 @@ import FixtureBuilder from '../../fixtures/fixture-builder'; import { withFixtures } from '../../fixtures/fixture-helper'; import CommonView from '../../pages/CommonView'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; describe( SmokeCore('Log in into the app, change password then delete wallet flow'), @@ -21,7 +21,7 @@ describe( beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should log in into the app, change password then delete wallet flow', async () => { diff --git a/e2e/specs/settings/fiat-on-testnets.spec.js b/e2e/specs/settings/fiat-on-testnets.spec.js index 5ab22fa855b..a6112dc012a 100644 --- a/e2e/specs/settings/fiat-on-testnets.spec.js +++ b/e2e/specs/settings/fiat-on-testnets.spec.js @@ -12,14 +12,14 @@ import NetworkEducationModal from '../../pages/Network/NetworkEducationModal'; import AdvancedSettingsView from '../../pages/Settings/AdvancedView'; import FiatOnTestnetsBottomSheet from '../../pages/Settings/Advanced/FiatOnTestnetsBottomSheet.js'; import Assertions from '../../utils/Assertions.js'; -import TestHelpers from '../../helpers.js'; +import Utilities from '../../utils/Utilities.js'; const SEPOLIA = CustomNetworks.Sepolia.providerConfig.nickname; describe(SmokeAssets('Fiat On Testnets Setting'), () => { beforeEach(async () => { jest.setTimeout(150000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); it('should show fiat values on testnets when enabled', async () => { @@ -44,7 +44,7 @@ describe(SmokeAssets('Fiat On Testnets Setting'), () => { ); // Wait for network switch toast to disapear - await TestHelpers.delay(2500); + await Utilities.delay(2500); // Enable fiat on testnets setting await TabBarComponent.tapSettings(); diff --git a/e2e/specs/swaps/swap-action-regression.spec.js b/e2e/specs/swaps/swap-action-regression.spec.js index 86b0dd32e64..b39c4ef70a0 100644 --- a/e2e/specs/swaps/swap-action-regression.spec.js +++ b/e2e/specs/swaps/swap-action-regression.spec.js @@ -16,7 +16,6 @@ import { import { CustomNetworks } from '../../resources/networks.e2e'; import NetworkListModal from '../../pages/Network/NetworkListModal'; import NetworkEducationModal from '../../pages/Network/NetworkEducationModal'; -import TestHelpers from '../../helpers'; import FixtureServer from '../../fixtures/fixture-server'; import { getFixturesServerPort } from '../../fixtures/utils'; import { Regression } from '../../tags'; @@ -27,6 +26,7 @@ import Assertions from '../../utils/Assertions'; import AddAccountBottomSheet from '../../pages/wallet/AddAccountBottomSheet'; import Tenderly from '../../tenderly'; +import Utilities from '../../utils/Utilities.js'; const fixtureServer = new FixtureServer(); const firstElement = 0; @@ -42,14 +42,13 @@ describe(Regression('Multiple Swaps from Actions'), () => { CustomNetworks.Tenderly.Mainnet.providerConfig.rpcUrl, wallet.address, ); - - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder() .withNetworkController(CustomNetworks.Tenderly.Mainnet) .build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ permissions: { notifications: 'YES' }, launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); @@ -91,7 +90,7 @@ describe(Regression('Multiple Swaps from Actions'), () => { false, ); await NetworkEducationModal.tapGotItButton(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); currentNetwork = network.providerConfig.nickname; } @@ -116,7 +115,7 @@ describe(Regression('Multiple Swaps from Actions'), () => { if (destTokenSymbol !== 'ETH') { await QuoteView.tapSearchToken(); await QuoteView.typeSearchToken(destTokenSymbol); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await QuoteView.selectToken(destTokenSymbol); } else await QuoteView.selectToken(destTokenSymbol, firstElement); @@ -146,8 +145,7 @@ describe(Regression('Multiple Swaps from Actions'), () => { console.log(`Swap complete didn't pop up: ${e}`); } await device.enableSynchronization(); - await TestHelpers.delay(10000); - + await Utilities.delay(10000); // Check the swap activity completed await TabBarComponent.tapActivity(); await Assertions.checkIfVisible(ActivitiesView.title); diff --git a/e2e/specs/swaps/swap-action-smoke.spec.js b/e2e/specs/swaps/swap-action-smoke.spec.js index db50f431aa7..1a31b3a8a84 100644 --- a/e2e/specs/swaps/swap-action-smoke.spec.js +++ b/e2e/specs/swaps/swap-action-smoke.spec.js @@ -17,7 +17,6 @@ import { import { CustomNetworks } from '../../resources/networks.e2e'; import NetworkListModal from '../../pages/Network/NetworkListModal'; import NetworkEducationModal from '../../pages/Network/NetworkEducationModal'; -import TestHelpers from '../../helpers'; import FixtureServer from '../../fixtures/fixture-server'; import { getFixturesServerPort } from '../../fixtures/utils'; import { SmokeSwaps } from '../../tags'; @@ -26,6 +25,7 @@ import SuccessImportAccountView from '../../pages/importAccount/SuccessImportAcc import Assertions from '../../utils/Assertions'; import AddAccountBottomSheet from '../../pages/wallet/AddAccountBottomSheet'; import ActivitiesView from '../../pages/Transactions/ActivitiesView'; +import Utilities from '../../utils/Utilities.js'; const fixtureServer = new FixtureServer(); const firstElement = 0; @@ -40,14 +40,13 @@ describe(SmokeSwaps('Swap from Actions'), () => { CustomNetworks.Tenderly.Mainnet.providerConfig.rpcUrl, wallet.address, ); - - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder() .withNetworkController(CustomNetworks.Tenderly.Mainnet) .build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ permissions: { notifications: 'YES' }, launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); @@ -92,7 +91,7 @@ describe(SmokeSwaps('Swap from Actions'), () => { false, ); await NetworkEducationModal.tapGotItButton(); - await TestHelpers.delay(3000); + await Utilities.delay(3000); currentNetwork = network.providerConfig.nickname; } @@ -116,7 +115,7 @@ describe(SmokeSwaps('Swap from Actions'), () => { if (destTokenSymbol !== 'ETH') { await QuoteView.tapSearchToken(); await QuoteView.typeSearchToken(destTokenSymbol); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await QuoteView.selectToken(destTokenSymbol); } else await QuoteView.selectToken(destTokenSymbol, firstElement); @@ -133,7 +132,7 @@ describe(SmokeSwaps('Swap from Actions'), () => { await Assertions.checkIfVisible(SwapView.gasFee); await SwapView.tapIUnderstandPriceWarning(); await Assertions.checkIfVisible(SwapView.swapButton); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await SwapView.tapSwapButton(); //Wait for Swap to complete try { @@ -149,7 +148,7 @@ describe(SmokeSwaps('Swap from Actions'), () => { console.log(`Swap complete didn't pop up: ${e}`); } await device.enableSynchronization(); - await TestHelpers.delay(10000); + await Utilities.delay(10000); // Check the swap activity completed await TabBarComponent.tapActivity(); diff --git a/e2e/specs/swaps/swap-token-chart.spec.js b/e2e/specs/swaps/swap-token-chart.spec.js index c3ed9183b9e..5f1bcef996e 100644 --- a/e2e/specs/swaps/swap-token-chart.spec.js +++ b/e2e/specs/swaps/swap-token-chart.spec.js @@ -14,7 +14,6 @@ import { stopFixtureServer, } from '../../fixtures/fixture-helper'; import { CustomNetworks } from '../../resources/networks.e2e'; -import TestHelpers from '../../helpers'; import FixtureServer from '../../fixtures/fixture-server'; import { getFixturesServerPort } from '../../fixtures/utils'; import { Regression } from '../../tags'; @@ -26,6 +25,7 @@ import AddAccountBottomSheet from '../../pages/wallet/AddAccountBottomSheet'; import ActivitiesView from '../../pages/Transactions/ActivitiesView'; import { ActivitiesViewSelectorsText } from '../../selectors/Transactions/ActivitiesView.selectors'; import Tenderly from '../../tenderly'; +import Utilities from '../../utils/Utilities.js'; const fixtureServer = new FixtureServer(); @@ -38,13 +38,13 @@ describe(Regression('Swap from Token view'), () => { CustomNetworks.Tenderly.Mainnet.providerConfig.rpcUrl, wallet.address, ); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder() .withNetworkController(CustomNetworks.Tenderly.Mainnet) .build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ permissions: { notifications: 'YES' }, launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); @@ -87,7 +87,7 @@ describe(Regression('Swap from Token view'), () => { await QuoteView.tapOnSelectDestToken(); await QuoteView.tapSearchToken(); await QuoteView.typeSearchToken(destTokenSymbol); - await TestHelpers.delay(1000); + await Utilities.delay(1000); await QuoteView.selectToken(destTokenSymbol); await QuoteView.tapOnGetQuotes(); await Assertions.checkIfVisible(SwapView.fetchingQuotes); @@ -95,14 +95,11 @@ describe(Regression('Swap from Token view'), () => { await Assertions.checkIfVisible(SwapView.gasFee); await SwapView.tapIUnderstandPriceWarning(); await SwapView.tapSwapButton(); - await TestHelpers.delay(2000); + await Utilities.delay(2000); //Wait for Swap to complete try { await Assertions.checkIfTextIsDisplayed( - SwapView.generateSwapCompleteLabel( - sourceTokenSymbol, - destTokenSymbol, - ), + SwapView.generateSwapCompleteLabel(sourceTokenSymbol, destTokenSymbol), 30000, ); } catch (e) { @@ -110,7 +107,7 @@ describe(Regression('Swap from Token view'), () => { console.log(`Swap complete didn't pop up: ${e}`); } await device.enableSynchronization(); - await TestHelpers.delay(10000); + await Utilities.delay(10000); // Check the swap activity completed await TabBarComponent.tapActivity(); diff --git a/e2e/specs/swaps/token-details.spec.js b/e2e/specs/swaps/token-details.spec.js index 4c7407e6a5f..0241c7127e0 100644 --- a/e2e/specs/swaps/token-details.spec.js +++ b/e2e/specs/swaps/token-details.spec.js @@ -8,12 +8,12 @@ import { } from '../../viewHelper'; import Assertions from '../../utils/Assertions'; import CommonView from '../../pages/CommonView'; -import TestHelpers from '../../helpers'; +import Utilities from '../../utils/Utilities'; describe(SmokeSwaps('Token Chart Tests'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.launchApp(); + await Utilities.launchApp(); }); it('should import wallet and go to the wallet view', async () => { diff --git a/e2e/specs/wallet/incoming-transactions.spec.js b/e2e/specs/wallet/incoming-transactions.spec.js index 5074d3f24ac..33b753e0770 100644 --- a/e2e/specs/wallet/incoming-transactions.spec.js +++ b/e2e/specs/wallet/incoming-transactions.spec.js @@ -1,9 +1,7 @@ 'use strict'; import { SmokeCore } from '../../tags'; -import TestHelpers from '../../helpers'; import { loginToApp } from '../../viewHelper'; import Assertions from '../../utils/Assertions'; -import { startMockServer, stopMockServer } from '../../api-mocking/mock-server'; import { withFixtures } from '../../fixtures/fixture-helper'; import FixtureBuilder, { DEFAULT_FIXTURE_ACCOUNT, @@ -11,6 +9,7 @@ import FixtureBuilder, { import ActivitiesView from '../../pages/Transactions/ActivitiesView'; import TabBarComponent from '../../pages/wallet/TabBarComponent'; import ToastModal from '../../pages/wallet/ToastModal'; +import Utilities from '../../utils/Utilities'; const TOKEN_SYMBOL_MOCK = 'ABC'; const TOKEN_ADDRESS_MOCK = '0x123'; @@ -80,7 +79,7 @@ function mockAccountsApi(transactions) { describe(SmokeCore('Incoming Transactions'), () => { beforeAll(async () => { jest.setTimeout(2500000); - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); }); xit('displays standard incoming transaction', async () => { @@ -164,7 +163,7 @@ describe(SmokeCore('Incoming Transactions'), () => { await loginToApp(); await TabBarComponent.tapActivity(); await ActivitiesView.swipeDown(); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await Assertions.checkIfTextIsNotDisplayed('Received ETH'); }, ); @@ -190,12 +189,11 @@ describe(SmokeCore('Incoming Transactions'), () => { await loginToApp(); await TabBarComponent.tapActivity(); await ActivitiesView.swipeDown(); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await Assertions.checkIfTextIsNotDisplayed('Received ETH'); }, ); }); - xit('displays notification', async () => { await withFixtures( { diff --git a/e2e/specs/wallet/portfolio-connect-account.spec.js b/e2e/specs/wallet/portfolio-connect-account.spec.js index 50fef47e2e4..d64f6f01abf 100644 --- a/e2e/specs/wallet/portfolio-connect-account.spec.js +++ b/e2e/specs/wallet/portfolio-connect-account.spec.js @@ -8,7 +8,6 @@ import { stopFixtureServer, } from '../../fixtures/fixture-helper'; import FixtureBuilder from '../../fixtures/fixture-builder'; -import TestHelpers from '../../helpers'; import WalletView from '../../pages/wallet/WalletView'; import { getFixturesServerPort } from '../../fixtures/utils'; import FixtureServer from '../../fixtures/fixture-server'; @@ -16,16 +15,17 @@ import BrowserView from '../../pages/Browser/BrowserView'; import PortfolioHomePage from '../../pages/Browser/PortfolioHomePage'; import Assertions from '../../utils/Assertions'; import ConnectBottomSheet from '../../pages/Browser/ConnectBottomSheet'; +import Utilities from '../../utils/Utilities'; const fixtureServer = new FixtureServer(); describe(SmokeCore('Connect account to Portfolio'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().withKeyringController().build(); fixture.state.user.seedphraseBackedUp = false; await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ permissions: { notifications: 'YES' }, launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); @@ -53,7 +53,7 @@ describe(SmokeCore('Connect account to Portfolio'), () => { } await device.disableSynchronization(); await PortfolioHomePage.tapConnectMetaMask(); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await ConnectBottomSheet.tapConnectButton(); await device.enableSynchronization(); }); diff --git a/e2e/specs/wallet/request-token-flow.spec.js b/e2e/specs/wallet/request-token-flow.spec.js index 9651f766b25..6184b3f4e85 100644 --- a/e2e/specs/wallet/request-token-flow.spec.js +++ b/e2e/specs/wallet/request-token-flow.spec.js @@ -14,23 +14,23 @@ import { stopFixtureServer, } from '../../fixtures/fixture-helper'; import FixtureBuilder from '../../fixtures/fixture-builder'; -import TestHelpers from '../../helpers'; import WalletView from '../../pages/wallet/WalletView'; import { getFixturesServerPort } from '../../fixtures/utils'; import FixtureServer from '../../fixtures/fixture-server'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; const SAI_CONTRACT_ADDRESS = '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359'; const fixtureServer = new FixtureServer(); describe(SmokeCore('Request Token Flow with Unprotected Wallet'), () => { beforeAll(async () => { - await TestHelpers.reverseServerPort(); + await Utilities.reverseServerPort(); const fixture = new FixtureBuilder().withKeyringController().build(); fixture.state.user.seedphraseBackedUp = false; await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); - await TestHelpers.launchApp({ + await Utilities.launchApp({ launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, }); }); diff --git a/e2e/specs/wallet/send-ERC-token.spec.js b/e2e/specs/wallet/send-ERC-token.spec.js index 6e0420f4532..dd60c5a8c84 100644 --- a/e2e/specs/wallet/send-ERC-token.spec.js +++ b/e2e/specs/wallet/send-ERC-token.spec.js @@ -1,6 +1,5 @@ 'use strict'; import { SmokeCore } from '../../tags'; -import TestHelpers from '../../helpers'; import WalletView from '../../pages/wallet/WalletView'; import NetworkEducationModal from '../../pages/Network/NetworkEducationModal'; import AmountView from '../../pages/Send/AmountView'; @@ -13,6 +12,7 @@ import ConfirmAddAssetView from '../../pages/wallet/ImportTokenFlow/ConfirmAddAs import ImportTokensView from '../../pages/wallet/ImportTokenFlow/ImportTokensView'; import Assertions from '../../utils/Assertions'; import { CustomNetworks } from '../../resources/networks.e2e'; +import Utilities from '../../utils/Utilities'; const TOKEN_ADDRESS = '0x779877A7B0D9E8603169DdbD7836e478b4624789'; const SEND_ADDRESS = '0xebe6CcB6B55e1d094d9c58980Bc10Fed69932cAb'; @@ -20,7 +20,7 @@ const SEND_ADDRESS = '0xebe6CcB6B55e1d094d9c58980Bc10Fed69932cAb'; describe(SmokeCore('Send ERC Token'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.launchApp(); + await Utilities.launchApp(); }); it('should import wallet and go to the wallet view', async () => { @@ -29,7 +29,7 @@ describe(SmokeCore('Send ERC Token'), () => { it('should add Sepolia testnet to my networks list', async () => { await WalletView.tapNetworksButtonOnNavBar(); - await TestHelpers.delay(2000); + await Utilities.delay(2000); await NetworkListModal.scrollToBottomOfNetworkList(); await NetworkListModal.tapTestNetworkSwitch(); await NetworkListModal.scrollToBottomOfNetworkList(); @@ -60,15 +60,15 @@ describe(SmokeCore('Send ERC Token'), () => { it('should send token to address via asset overview screen', async () => { await WalletView.tapOnToken('ChainLink Token'); - await TestHelpers.delay(3500); + await Utilities.delay(3500); await TokenOverview.scrollOnScreen(); - await TestHelpers.delay(3500); + await Utilities.delay(3500); await TokenOverview.tapSendButton(); await SendView.inputAddress(SEND_ADDRESS); - await TestHelpers.delay(1000); + await Utilities.delay(1000); await SendView.tapNextButton(); await AmountView.typeInTransactionAmount('0.000001'); - await TestHelpers.delay(5000); + await Utilities.delay(5000); await AmountView.tapNextButton(); await Assertions.checkIfTextIsDisplayed('< 0.00001 LINK'); await TransactionConfirmationView.tapConfirmButton(); diff --git a/e2e/specs/wallet/start-exploring.spec.js b/e2e/specs/wallet/start-exploring.spec.js index baf411132f8..725d45d24af 100644 --- a/e2e/specs/wallet/start-exploring.spec.js +++ b/e2e/specs/wallet/start-exploring.spec.js @@ -1,6 +1,5 @@ 'use strict'; import { SmokeCore } from '../../tags'; -import TestHelpers from '../../helpers'; import OnboardingView from '../../pages/Onboarding/OnboardingView'; import OnboardingCarouselView from '../../pages/Onboarding/OnboardingCarouselView'; import ProtectYourWalletView from '../../pages/Onboarding/ProtectYourWalletView'; @@ -13,13 +12,14 @@ import SkipAccountSecurityModal from '../../pages/Onboarding/SkipAccountSecurity import OnboardingWizardModal from '../../pages/Onboarding/OnboardingWizardModal'; import { acceptTermOfUse } from '../../viewHelper'; import Assertions from '../../utils/Assertions'; +import Utilities from '../../utils/Utilities'; const PASSWORD = '12345678'; describe(SmokeCore('Start Exploring'), () => { beforeAll(async () => { jest.setTimeout(150000); - await TestHelpers.launchApp(); + await Utilities.launchApp(); }); it('should show the onboarding screen', async () => { @@ -65,14 +65,16 @@ describe(SmokeCore('Start Exploring'), () => { }); it('Should dismiss Automatic Security checks screen', async () => { - await TestHelpers.delay(3500); - await Assertions.checkIfVisible(EnableAutomaticSecurityChecksView.container); + await Utilities.delay(3500); + await Assertions.checkIfVisible( + EnableAutomaticSecurityChecksView.container, + ); await EnableAutomaticSecurityChecksView.tapNoThanks(); }); it('should go through the onboarding wizard flow', async () => { // Check that Take the tour CTA is visible and tap it - await TestHelpers.delay(3000); + await Utilities.delay(3000); await Assertions.checkIfVisible(OnboardingWizardModal.stepOneContainer); await OnboardingWizardModal.tapTakeTourButton(); await Assertions.checkIfVisible(OnboardingWizardModal.stepTwoContainer); @@ -113,7 +115,7 @@ describe(SmokeCore('Start Exploring'), () => { await OnboardingWizardModal.tapGotItButton(); // Check that we are on the Browser page // dealing with flakiness on bitrise. - await TestHelpers.delay(2500); + await Utilities.delay(2500); await Assertions.checkIfVisible(Browser.browserScreenID); }); }); diff --git a/e2e/utils/Utilities.js b/e2e/utils/Utilities.js index f084f52fdb9..d3460da7495 100644 --- a/e2e/utils/Utilities.js +++ b/e2e/utils/Utilities.js @@ -1,6 +1,136 @@ import { blacklistURLs } from '../resources/blacklistURLs.json'; +import { + getFixturesServerPort, + getGanachePort, + getLocalTestDappPort, + getMockServerPort, +} from '../fixtures/utils'; +import { resolveConfig } from 'detox/internals'; export default class Utilities { + static async openDeepLink(inputURL) { + await device.launchApp({ + newInstance: true, + url: inputURL, + sourceApp: 'io.metamask', + launchArgs: { + fixtureServerPort: `${getFixturesServerPort()}`, + detoxURLBlacklistRegex: this.BlacklistURLs, + }, + }); + } + + /** + * Reverses the TCP ports for necessary servers to ensure proper communication between the device and local services. + * Only applicable for Android devices. + * + * @async + * @returns {Promise} Resolves once all required ports are reversed. + */ + static async reverseServerPort() { + if (device.getPlatform() === 'android') { + await device.reverseTcpPort(getGanachePort()); + await device.reverseTcpPort(getFixturesServerPort()); + await device.reverseTcpPort(getLocalTestDappPort()); + await device.reverseTcpPort(getMockServerPort()); + } + } + + /** + * Launches the app with the specified options. + * Automatically handles debug builds by using the `launchAppForDebugBuild` method. + * + * @async + * @param {Object} launchOptions - The options to customize app launch behavior. + * @returns {Promise} Resolves once the app is launched. + */ + static async launchApp(launchOptions) { + const config = await resolveConfig(); + const platform = device.getPlatform(); + if (config.configurationName.endsWith('debug')) { + return this.launchAppForDebugBuild(platform, launchOptions); + } + + return device.launchApp(launchOptions); + } + + /** + * Launches the app in debug mode using a specific deep link URL. + * Handles platform-specific logic for iOS and Android. + * + * @async + * @param {string} platform - The platform on which the app is being launched (`ios` or `android`). + * @param {Object} launchOptions - The options to customize app launch behavior. + * @returns {Promise} Resolves once the app is launched. + */ + static async launchAppForDebugBuild(platform, launchOptions) { + const deepLinkUrl = this.getDeepLinkUrl( + this.getDevLauncherPackagerUrl(platform), + ); + + if (platform === 'ios') { + await device.launchApp(launchOptions); + return device.openURL({ + url: deepLinkUrl, + }); + } + + return device.launchApp({ + url: deepLinkUrl, + ...launchOptions, + }); + } + + /** + * Constructs a deep link URL for the app to facilitate specific launch scenarios. + * + * @param {string} url - The base URL to be encoded into the deep link. + * @returns {string} The formatted deep link URL. + */ + static getDeepLinkUrl(url) { + return `expo-metamask://expo-development-client/?url=${encodeURIComponent( + url, + )}`; + } + + /** + * Generates the development packager URL for the Expo dev client. + * + * @param {string} platform - The platform for which the URL is being generated (`ios` or `android`). + * @returns {string} The URL pointing to the development server bundle. + */ + static getDevLauncherPackagerUrl(platform) { + return `http://localhost:8081/index.bundle?platform=${platform}&dev=true&minify=false&disableOnboarding=1`; + } + + /** + * Relaunches the app by creating a new instance and applying specific launch arguments. + * + * @returns {Promise} Resolves once the app is relaunched. + */ + static relaunchApp() { + return this.launchApp({ + newInstance: true, + launchArgs: { + detoxURLBlacklistRegex: Utilities.BlacklistURLs, + }, + }); + } + + /** + * Delays execution for a specified duration. + * + * @param {number} ms - The number of milliseconds to delay execution. + * @returns {Promise} Resolves after the specified delay. + */ + static delay(ms) { + return new Promise((resolve) => { + setTimeout(() => { + resolve(); + }, ms); + }); + } + /** * Formats an array of strings into a regex pattern string for exact matching. * This method takes an array of strings and returns a string formatted diff --git a/e2e/viewHelper.js b/e2e/viewHelper.js index 401afe1b9a5..5c41d5c042f 100644 --- a/e2e/viewHelper.js +++ b/e2e/viewHelper.js @@ -19,8 +19,6 @@ import CreatePasswordView from './pages/Onboarding/CreatePasswordView'; import ProtectYourWalletView from './pages/Onboarding/ProtectYourWalletView'; import OnboardingSuccessView from './pages/Onboarding/OnboardingSuccessView'; -import TestHelpers from './helpers'; - import TermsOfUseModal from './pages/Onboarding/TermsOfUseModal'; import TabBarComponent from './pages/wallet/TabBarComponent'; import LoginView from './pages/wallet/LoginView'; @@ -28,6 +26,7 @@ import { getGanachePort } from './fixtures/utils'; import Assertions from './utils/Assertions'; import { CustomNetworks } from './resources/networks.e2e'; import ToastModal from './pages/wallet/ToastModal'; +import Utilities from './utils/Utilities'; const LOCALHOST_URL = `http://localhost:${getGanachePort()}/`; const validAccount = Accounts.getValidAccount(); @@ -45,7 +44,8 @@ export const closeOnboardingModals = async () => { These onboarding modals are becoming a bit wild. We need less of these so we don't have to have all these workarounds in the tests */ - await TestHelpers.delay(1000); + + await Utilities.delay(1000); // Handle Onboarding wizard try { @@ -70,7 +70,7 @@ have to have all these workarounds in the tests }; export const skipNotificationsDeviceSettings = async () => { - await TestHelpers.delay(1000); + await Utilities.delay(1000); try { await Assertions.checkIfVisible( @@ -94,7 +94,7 @@ export const importWalletWithRecoveryPhrase = async (seedPhrase, password) => { await OnboardingView.tapImportWalletFromSeedPhrase(); await MetaMetricsOptIn.tapAgreeButton(); - await TestHelpers.delay(3500); + await Utilities.delay(3500); await acceptTermOfUse(); // should import wallet with secret recovery phrase await ImportWalletView.clearSecretRecoveryPhraseInputBox(); @@ -105,7 +105,7 @@ export const importWalletWithRecoveryPhrase = async (seedPhrase, password) => { await ImportWalletView.reEnterPassword(password ?? validAccount.password); //'Should dismiss Enable device Notifications checks alert' - await TestHelpers.delay(3500); + await Utilities.delay(3500); await OnboardingSuccessView.tapDone(); //'Should dismiss Enable device Notifications checks alert' await this.skipNotificationsDeviceSettings(); @@ -143,7 +143,7 @@ export const CreateNewWallet = async () => { await device.enableSynchronization(); await Assertions.checkIfVisible(WalletView.container); - await TestHelpers.delay(3500); + await Utilities.delay(3500); await OnboardingSuccessView.tapDone(); //'Should dismiss Enable device Notifications checks alert' await this.skipNotificationsDeviceSettings(); @@ -167,7 +167,7 @@ export const addLocalhostNetwork = async () => { await SettingsView.tapNetworks(); await Assertions.checkIfVisible(NetworkView.networkContainer); - await TestHelpers.delay(3000); + await Utilities.delay(3000); await NetworkView.tapAddNetworkButton(); await NetworkView.switchToCustomNetworks(); @@ -180,7 +180,7 @@ export const addLocalhostNetwork = async () => { // await NetworkView.swipeToRPCTitleAndDismissKeyboard(); // Focus outside of text input field await NetworkView.tapRpcNetworkAddButton(); } - await TestHelpers.delay(3000); + await Utilities.delay(3000); await Assertions.checkIfVisible(NetworkEducationModal.container); await Assertions.checkIfElementToHaveText(