From e2bcd67b1aee161d872d667423fc671132a0a4e7 Mon Sep 17 00:00:00 2001 From: SamuelSalas Date: Fri, 27 Sep 2024 15:52:01 -0600 Subject: [PATCH] test: Merge Import Token flow methods and ids in just one folder and files (#11458) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## **Description** We are aiming to refactor the page objects in the modal folder so that they strictly follow the page object model pattern. This would aide in providing more readable and help standardize the way we create our tests. Because of the amount of files remaining, this issue will focus on working on three files to refactor, as well as their respective testIDS. While doing some analysis we see that the ImportTokens and AddCustomTokenView classes could be merge together. So the refactoring of the test and classes should be implemented on both files. NOTE: You should move the AddCustomTokenView and ImportTokens files into a token-import subfolder within the wallet folder for better organization and clarity. ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** Regressin test runs: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/ca857ba6-cebc-4903-8918-3d7dc3a51a36 ### **Before** ### **After** ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --- .../UI/AddCustomCollectible/index.tsx | 20 +--- .../__snapshots__/index.test.tsx.snap | 3 +- app/components/UI/AddCustomToken/index.js | 30 ++--- app/components/UI/AssetList/index.js | 2 - app/components/UI/AssetSearch/index.tsx | 6 +- .../UI/ConfirmAddAsset/ConfirmAddAsset.tsx | 12 +- .../MultiAssetListItems.tsx | 4 +- app/components/UI/Navbar/index.js | 8 +- .../UI/SearchTokenAutocomplete/index.tsx | 3 +- .../__snapshots__/AddAsset.test.tsx.snap | 4 +- e2e/pages/AddCustomTokenView.js | 103 ------------------ e2e/pages/ConfirmAddAsset.js | 35 ------ e2e/pages/ImportTokensView.js | 43 -------- e2e/pages/TokenOverview.js | 4 +- .../wallet/ImportNFTFlow/ImportNFTView.js | 31 ++++++ .../wallet/ImportTokenFlow/ConfirmAddAsset.js | 42 +++++++ .../ImportTokenFlow/ImportTokensView.js | 71 ++++++++++++ e2e/selectors/AddCustomTokenView.selectors.js | 12 -- e2e/selectors/ImportTokenView.selectors.js | 13 --- .../wallet/ImportNFTView.selectors.js | 8 ++ .../wallet/ImportTokenView.selectors.js | 28 +++++ e2e/specs/assets/import-tokens.spec.js | 22 ++-- e2e/specs/assets/nft-details.spec.js | 8 +- e2e/specs/quarantine/import-nft.failing.js | 18 +-- e2e/specs/wallet/send-ERC-token.spec.js | 21 ++-- .../AddCustomImportTokensScreen.js | 22 +--- wdio/screen-objects/TokenOverviewScreen.js | 4 +- .../testIDs/Screens/AddCustomToken.testIds.js | 11 -- .../testIDs/Screens/AssetSearch.testIds.js | 3 - .../Screens/NFTImportScreen.testIds.js | 7 -- .../Screens/TokenOverviewScreen.testIds.js | 3 - 31 files changed, 251 insertions(+), 350 deletions(-) delete mode 100644 e2e/pages/AddCustomTokenView.js delete mode 100644 e2e/pages/ConfirmAddAsset.js delete mode 100644 e2e/pages/ImportTokensView.js create mode 100644 e2e/pages/wallet/ImportNFTFlow/ImportNFTView.js create mode 100644 e2e/pages/wallet/ImportTokenFlow/ConfirmAddAsset.js create mode 100644 e2e/pages/wallet/ImportTokenFlow/ImportTokensView.js delete mode 100644 e2e/selectors/AddCustomTokenView.selectors.js delete mode 100644 e2e/selectors/ImportTokenView.selectors.js create mode 100644 e2e/selectors/wallet/ImportNFTView.selectors.js create mode 100644 e2e/selectors/wallet/ImportTokenView.selectors.js delete mode 100644 wdio/screen-objects/testIDs/Screens/AddCustomToken.testIds.js delete mode 100644 wdio/screen-objects/testIDs/Screens/AssetSearch.testIds.js delete mode 100644 wdio/screen-objects/testIDs/Screens/NFTImportScreen.testIds.js diff --git a/app/components/UI/AddCustomCollectible/index.tsx b/app/components/UI/AddCustomCollectible/index.tsx index a0bf94fd374..be364abd6c8 100644 --- a/app/components/UI/AddCustomCollectible/index.tsx +++ b/app/components/UI/AddCustomCollectible/index.tsx @@ -6,7 +6,6 @@ import { TextInput, View, StyleSheet, - Platform, } from 'react-native'; import { fontStyles } from '../../../styles/common'; import Engine from '../../../core/Engine'; @@ -18,14 +17,7 @@ import Device from '../../../util/device'; import { MetaMetricsEvents } from '../../../core/Analytics'; import { useTheme } from '../../../util/theme'; -import { CUSTOM_TOKEN_CONTAINER_ID } from '../../../../wdio/screen-objects/testIDs/Screens/AddCustomToken.testIds'; -import generateTestId from '../../../../wdio/utils/generateTestId'; -import { - NFT_ADDRESS_INPUT_BOX_ID, - NFT_IDENTIFIER_WARNING_MESSAGE_ID, - NFT_ADDRESS_WARNING_MESSAGE_ID, - NFT_IDENTIFIER_INPUT_BOX_ID, -} from '../../../../wdio/screen-objects/testIDs/Screens/NFTImportScreen.testIds'; +import { NFTImportScreenSelectorsIDs } from '../../../../e2e/selectors/wallet/ImportNFTView.selectors'; import { selectChainId } from '../../../selectors/networkController'; import { selectSelectedInternalAccountChecksummedAddress } from '../../../selectors/accountsController'; import { getDecimalChainId } from '../../../util/networks'; @@ -233,7 +225,7 @@ const AddCustomCollectible = ({ return ( {warningAddress} @@ -282,7 +274,7 @@ const AddCustomCollectible = ({ keyboardType="numeric" onChangeText={onTokenIdChange} onBlur={validateCustomCollectibleTokenId} - {...generateTestId(Platform, NFT_IDENTIFIER_INPUT_BOX_ID)} + testID={NFTImportScreenSelectorsIDs.IDENTIFIER_INPUT_BOX} ref={assetTokenIdInput} onSubmitEditing={addNft} returnKeyType={'done'} @@ -292,7 +284,7 @@ const AddCustomCollectible = ({ /> {warningTokenId} diff --git a/app/components/UI/AddCustomToken/__snapshots__/index.test.tsx.snap b/app/components/UI/AddCustomToken/__snapshots__/index.test.tsx.snap index e0596fa1cff..4ad291a7d08 100644 --- a/app/components/UI/AddCustomToken/__snapshots__/index.test.tsx.snap +++ b/app/components/UI/AddCustomToken/__snapshots__/index.test.tsx.snap @@ -8,7 +8,6 @@ exports[`AddCustomToken render matches previous snapshot 1`] = ` "flex": 1, } } - testID="add-custom-token-screen" > @@ -226,7 +225,7 @@ exports[`AddCustomToken render matches previous snapshot 1`] = ` "width": "90%", } } - testID="next-button-custom-import" + testID="token-import-next-button" > + {this.renderBanner()} @@ -540,14 +529,14 @@ class AddCustomToken extends PureComponent { onBlur={() => { this.handleBlurAddress(); }} - {...generateTestId(Platform, TOKEN_ADDRESS_INPUT_BOX_ID)} + testID={ImportTokenViewSelectorsIDs.ADDRESS_INPUT} onSubmitEditing={this.jumpToAssetSymbol} returnKeyType={'next'} keyboardAppearance={themeAppearance} /> {this.state.warningAddress} @@ -565,7 +554,7 @@ class AddCustomToken extends PureComponent { value={this.state.symbol} onChangeText={this.onSymbolChange} onBlur={this.validateCustomTokenSymbol} - {...generateTestId(Platform, TOKEN_ADDRESS_SYMBOL_ID)} + testID={ImportTokenViewSelectorsIDs.SYMBOL_INPUT} ref={this.assetSymbolInput} onSubmitEditing={this.jumpToAssetPrecision} returnKeyType={'next'} @@ -590,7 +579,7 @@ class AddCustomToken extends PureComponent { placeholderTextColor={colors.text.muted} onChangeText={this.onDecimalsChange} onBlur={this.validateCustomTokenDecimals} - {...generateTestId(Platform, NFT_IDENTIFIER_INPUT_BOX_ID)} + testID={ImportTokenViewSelectorsIDs.DECIMAL_INPUT} ref={this.assetPrecisionInput} onSubmitEditing={this.addToken} returnKeyType={'done'} @@ -601,10 +590,7 @@ class AddCustomToken extends PureComponent { {this.state.warningDecimals ? ( {this.state.warningDecimals}{' '} diff --git a/app/components/UI/AssetList/index.js b/app/components/UI/AssetList/index.js index c5c89f3709d..f5f736236de 100644 --- a/app/components/UI/AssetList/index.js +++ b/app/components/UI/AssetList/index.js @@ -6,7 +6,6 @@ import StyledButton from '../StyledButton'; // eslint-disable-line import/no-un import AssetIcon from '../AssetIcon'; import { fontStyles } from '../../../styles/common'; import Text from '../../Base/Text'; -import { ImportTokenViewSelectorsIDs } from '../../../../e2e/selectors/ImportTokenView.selectors'; const styles = StyleSheet.create({ rowWrapper: { @@ -80,7 +79,6 @@ export default class AssetList extends PureComponent { containerStyle={styles.item} onPress={() => handleSelectAsset(searchResults[i])} // eslint-disable-line key={i} - testID={ImportTokenViewSelectorsIDs.CONTAINER} > diff --git a/app/components/UI/AssetSearch/index.tsx b/app/components/UI/AssetSearch/index.tsx index dfc06c6462d..b1cfd4be105 100644 --- a/app/components/UI/AssetSearch/index.tsx +++ b/app/components/UI/AssetSearch/index.tsx @@ -3,7 +3,6 @@ import { TextInput, View, StyleSheet, - Platform, TextStyle, DimensionValue, } from 'react-native'; @@ -14,8 +13,7 @@ import { toLowerCaseEquals } from '../../../util/general'; import { useSelector } from 'react-redux'; import { TokenListToken } from '@metamask/assets-controllers'; import { useTheme } from '../../../util/theme'; -import generateTestId from '../../../../wdio/utils/generateTestId'; -import { TOKEN_INPUT_BOX_ID } from '../../../../wdio/screen-objects/testIDs/Screens/AssetSearch.testIds'; +import { ImportTokenViewSelectorsIDs } from '../../../../e2e/selectors/wallet/ImportTokenView.selectors'; import { TokenViewSelectors } from '../../../../e2e/selectors/AddTokenView.selectors'; import { selectTokenListArray } from '../../../selectors/tokenListController'; import Icon, { @@ -166,7 +164,7 @@ const AssetSearch = memo(({ onSearch, onFocus, onBlur }: Props) => { placeholder={strings('token.search_tokens_placeholder')} placeholderTextColor={colors.text.muted} onChangeText={handleSearch} - {...generateTestId(Platform, TOKEN_INPUT_BOX_ID)} + testID={ImportTokenViewSelectorsIDs.SEARCH_BAR} keyboardAppearance={themeAppearance} /> diff --git a/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.tsx b/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.tsx index e6701455b55..097b76baf44 100644 --- a/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.tsx +++ b/app/components/UI/ConfirmAddAsset/ConfirmAddAsset.tsx @@ -1,5 +1,5 @@ import React, { useCallback, useEffect } from 'react'; -import { View, Platform } from 'react-native'; +import { View } from 'react-native'; import Text, { TextVariant, } from '../../../component-library/components/Texts/Text'; @@ -36,11 +36,7 @@ import Modal from 'react-native-modal'; import Box from '../Ramp/components/Box'; import SheetHeader from '../../../component-library/components/Sheet/SheetHeader'; import Routes from '../../../constants/navigation/Routes'; -import generateTestId from '../../../../wdio/utils/generateTestId'; -import { - ADD_CANCEL_ADD_CUSTOM_ASSET_MODAL, - ADD_CONFIRM_CUSTOM_ASSET, -} from '../../../../wdio/screen-objects/testIDs/Screens/AddCustomToken.testIds'; +import { ImportTokenViewSelectorsIDs } from '../../../../e2e/selectors/wallet/ImportTokenView.selectors'; import { TOKEN_TITLE } from '../../../components/Views/AddAsset/AddAsset.constants'; const RenderBalance = (asset: { @@ -129,7 +125,7 @@ const ConfirmAddAsset = () => { > @@ -175,7 +171,7 @@ const ConfirmAddAsset = () => { return ( {strings('wallet.import_token')} diff --git a/app/components/UI/MultiAssetListItems/MultiAssetListItems.tsx b/app/components/UI/MultiAssetListItems/MultiAssetListItems.tsx index 303596448e4..c8875de551f 100644 --- a/app/components/UI/MultiAssetListItems/MultiAssetListItems.tsx +++ b/app/components/UI/MultiAssetListItems/MultiAssetListItems.tsx @@ -14,7 +14,7 @@ import AssetIcon from '../AssetIcon'; import { useSelector } from 'react-redux'; import { selectNetworkImageSource } from '../../../selectors/networkInfos'; import { strings } from '../../../../locales/i18n'; -import { ImportTokenViewSelectorsIDs } from '../../../../e2e/selectors/ImportTokenView.selectors'; +import { ImportTokenViewSelectorsIDs } from '../../../../e2e/selectors/wallet/ImportTokenView.selectors'; interface Props { /** @@ -83,7 +83,7 @@ const MultiAssetListItems = ({ style={styles.base} key={i} onPress={() => handleSelectAsset(searchResults[i])} - testID={ImportTokenViewSelectorsIDs.CONTAINER} + testID={ImportTokenViewSelectorsIDs.SEARCH_TOKEN_RESULT} > { MetaMetrics.getInstance().trackEvent(event, params); @@ -1119,7 +1119,7 @@ export function getImportTokenNavbarOptions( // eslint-disable-next-line react/jsx-no-bind navigation.pop()} style={styles.backButton} - {...generateTestId(Platform, ASSET_BACK_BUTTON)} + testID={ImportTokenViewSelectorsIDs.BACK_BUTTON} > navigation.pop()} style={styles.backButton} - {...generateTestId(Platform, ASSET_BACK_BUTTON)} + testID={ImportTokenViewSelectorsIDs.BACK_BUTTON} > { label={strings('transaction.next')} onPress={goToConfirmAddToken} isDisabled={selectedAsset.length < 1} - testID="token-import-next-button" + testID={ImportTokenViewSelectorsIDs.NEXT_BUTTON} /> diff --git a/app/components/Views/AddAsset/__snapshots__/AddAsset.test.tsx.snap b/app/components/Views/AddAsset/__snapshots__/AddAsset.test.tsx.snap index 6d8585a8d64..9ba957f6497 100644 --- a/app/components/Views/AddAsset/__snapshots__/AddAsset.test.tsx.snap +++ b/app/components/Views/AddAsset/__snapshots__/AddAsset.test.tsx.snap @@ -86,7 +86,7 @@ exports[`AddAsset component renders correctly 1`] = ` "flex": 1, } } - testID="add-custom-token-screen" + testID="import-nft-screen" > { it('should add a token via token autocomplete', async () => { await WalletView.tapImportTokensButton(); - // Search for SNX - await ImportTokensView.typeInTokenName('SNX'); - await TestHelpers.delay(2000); + await ImportTokensView.searchToken('SNX'); await ImportTokensView.tapOnToken(); // taps the first token in the returned list - await TestHelpers.delay(500); await ImportTokensView.tapOnNextButton(); await TestHelpers.delay(500); - await ConfirmAddAssetView.isVisible(); + await Assertions.checkIfVisible(ConfirmAddAssetView.container); await ConfirmAddAssetView.tapOnConfirmButton(); @@ -54,25 +51,22 @@ describe(SmokeAssets('Import Tokens'), () => { it('should cancel add a token via token autocomplete', async () => { await WalletView.tapImportTokensButton(); - // Search for SNX - await ImportTokensView.typeInTokenName('SNX'); + await ImportTokensView.searchToken('SNX'); await TestHelpers.delay(2000); - await ImportTokensView.tapOnToken(); // taps the first token in the returned list + await ImportTokensView.tapOnToken(); await TestHelpers.delay(500); await ImportTokensView.tapOnNextButton(); await TestHelpers.delay(500); - await ConfirmAddAssetView.isVisible(); + await Assertions.checkIfVisible(ConfirmAddAssetView.container); await ConfirmAddAssetView.tapOnCancelButton(); - await ConfirmAddAssetView.cancelModalIsVisible(); - + await Assertions.checkIfVisible(ConfirmAddAssetView.cancelModal); await ConfirmAddAssetView.tapOnConfirmModalButton(); }); it('should hide token from Wallet view', async () => { await WalletView.removeTokenFromWallet('0 SNX'); - await TestHelpers.delay(1500); await Assertions.checkIfNotVisible(WalletView.tokenInWallet('SNX')); }); }); diff --git a/e2e/specs/assets/nft-details.spec.js b/e2e/specs/assets/nft-details.spec.js index b61fa8d7868..a352684c7f9 100644 --- a/e2e/specs/assets/nft-details.spec.js +++ b/e2e/specs/assets/nft-details.spec.js @@ -10,7 +10,7 @@ import { } from '../../fixtures/fixture-helper'; import { SMART_CONTRACTS } from '../../../app/util/test/smart-contracts'; import WalletView from '../../pages/wallet/WalletView'; -import AddCustomTokenView from '../../pages/AddCustomTokenView'; +import ImportNFTView from '../../pages/wallet/ImportNFTFlow/ImportNFTView'; import Assertions from '../../utils/Assertions'; import enContent from '../../../locales/languages/en.json'; @@ -45,9 +45,9 @@ describe(SmokeAssets('NFT Details page'), () => { await WalletView.scrollDownOnNFTsTab(); // Tap on the add collectibles button await WalletView.tapImportNFTButton(); - await AddCustomTokenView.isVisible(); - await AddCustomTokenView.typeInNFTAddress(nftsAddress); - await AddCustomTokenView.typeInNFTIdentifier('1'); + await Assertions.checkIfVisible(ImportNFTView.container); + await ImportNFTView.typeInNFTAddress(nftsAddress); + await ImportNFTView.typeInNFTIdentifier('1'); await Assertions.checkIfVisible(WalletView.container); // Wait for asset to load diff --git a/e2e/specs/quarantine/import-nft.failing.js b/e2e/specs/quarantine/import-nft.failing.js index e7e2fed937e..d609e2b95db 100644 --- a/e2e/specs/quarantine/import-nft.failing.js +++ b/e2e/specs/quarantine/import-nft.failing.js @@ -2,7 +2,7 @@ import { SmokeAssets } from '../../tags'; import Assertions from '../../utils/Assertions'; import WalletView from '../../pages/wallet/WalletView'; -import AddCustomTokenView from '../../pages/AddCustomTokenView'; +import ImportNFTView from '../../pages/wallet/ImportNFTFlow/ImportNFTView'; import { loginToApp } from '../../viewHelper'; import { withFixtures, @@ -38,16 +38,16 @@ describe(SmokeAssets('Import NFT'), () => { await WalletView.scrollDownOnNFTsTab(); // Tap on the add collectibles button await WalletView.tapImportNFTButton(); - await AddCustomTokenView.isVisible(); + await Assertions.checkIfVisible(ImportNFTView.container); // Input incorrect contract address - await AddCustomTokenView.typeInNFTAddress('1234'); - await AddCustomTokenView.typeInNFTIdentifier(''); - await AddCustomTokenView.isNFTAddressWarningVisible(); - await AddCustomTokenView.tapBackButton(); + await ImportNFTView.typeInNFTAddress('1234'); + await ImportNFTView.typeInNFTIdentifier(''); + await Assertions.checkIfVisible(ImportNFTView.addressWarningMessage); + //await ImportNFTView.tapBackButton(); await WalletView.tapImportNFTButton(); - await AddCustomTokenView.isVisible(); - await AddCustomTokenView.typeInNFTAddress(erc1155ContractAddress); - await AddCustomTokenView.typeInNFTIdentifier('1'); + await Assertions.checkIfVisible(ImportNFTView.container); + await ImportNFTView.typeInNFTAddress(erc1155ContractAddress); + await ImportNFTView.typeInNFTIdentifier('1'); await Assertions.checkIfVisible(WalletView.container); // Wait for asset to load await Assertions.checkIfVisible(WalletView.nftInWallet('TestDappNFTs')); diff --git a/e2e/specs/wallet/send-ERC-token.spec.js b/e2e/specs/wallet/send-ERC-token.spec.js index baf4aacd48e..86d3a494ab3 100644 --- a/e2e/specs/wallet/send-ERC-token.spec.js +++ b/e2e/specs/wallet/send-ERC-token.spec.js @@ -3,15 +3,15 @@ import { SmokeCore } from '../../tags'; import TestHelpers from '../../helpers'; import WalletView from '../../pages/wallet/WalletView'; import NetworkEducationModal from '../../pages/modals/NetworkEducationModal'; -import AddCustomTokenView from '../../pages/AddCustomTokenView'; import AmountView from '../../pages/Send/AmountView'; import SendView from '../../pages/Send/SendView'; import { importWalletWithRecoveryPhrase } from '../../viewHelper'; import TransactionConfirmationView from '../../pages/Send/TransactionConfirmView'; import NetworkListModal from '../../pages/modals/NetworkListModal'; import TokenOverview from '../../pages/TokenOverview'; +import ConfirmAddAssetView from '../../pages/wallet/ImportTokenFlow/ConfirmAddAsset'; +import ImportTokensView from '../../pages/wallet/ImportTokenFlow/ImportTokensView'; import Assertions from '../../utils/Assertions'; -import ConfirmAddAssetView from '../../pages/ConfirmAddAsset'; import { CustomNetworks } from '../../resources/networks.e2e'; const TOKEN_ADDRESS = '0x779877A7B0D9E8603169DdbD7836e478b4624789'; @@ -45,16 +45,13 @@ describe(SmokeCore('Send ERC Token'), () => { it('should Import custom token', async () => { await WalletView.tapImportTokensButton(); - await AddCustomTokenView.switchToCustomTab(); - await AddCustomTokenView.typeTokenAddress(TOKEN_ADDRESS); - await TestHelpers.delay(1000); - await AddCustomTokenView.tapTokenSymbolInputBox(); - await TestHelpers.delay(1000); - await AddCustomTokenView.tapTokenSymbolText(); - await AddCustomTokenView.scrollDownOnImportCustomTokens(); - await AddCustomTokenView.tapNextButton(); - await TestHelpers.delay(500); - await ConfirmAddAssetView.isVisible(); + await ImportTokensView.switchToCustomTab(); + await ImportTokensView.typeTokenAddress(TOKEN_ADDRESS); + await ImportTokensView.tapSymbolInput(); + await ImportTokensView.tapTokenSymbolText(); + await ImportTokensView.scrollDownOnImportCustomTokens(); + await ImportTokensView.tapOnNextButton(); + await Assertions.checkIfVisible(ConfirmAddAssetView.container); await ConfirmAddAssetView.tapOnConfirmButton(); await Assertions.checkIfVisible(WalletView.container); }); diff --git a/wdio/screen-objects/AddCustomImportTokensScreen.js b/wdio/screen-objects/AddCustomImportTokensScreen.js index 69a63fc40eb..bf327fd8387 100644 --- a/wdio/screen-objects/AddCustomImportTokensScreen.js +++ b/wdio/screen-objects/AddCustomImportTokensScreen.js @@ -1,33 +1,27 @@ -/* eslint-disable no-undef */ import Gestures from '../helpers/Gestures'; import Selectors from '../helpers/Selectors'; import { - TOKEN_ADDRESS_INPUT_BOX_ID, - TOKEN_ADDRESS_SYMBOL_ID, - TOKEN_IMPORT_BUTTON_ID, -} from './testIDs/Screens/AddCustomToken.testIds'; + ImportTokenViewSelectorsIDs, + ImportTokenViewSelectorsText +} from '../../e2e/selectors/wallet/ImportTokenView.selectors'; class AddCustomImportToken { get customTokenAddressField() { - return Selectors.getElementByPlatform(TOKEN_ADDRESS_INPUT_BOX_ID); + return Selectors.getElementByPlatform(ImportTokenViewSelectorsIDs.ADDRESS_INPUT); } get importButton() { - return Selectors.getElementByPlatform(TOKEN_IMPORT_BUTTON_ID); + return Selectors.getXpathElementByText(ImportTokenViewSelectorsText.IMPORT_BUTTON); } get symbolField() { - return Selectors.getElementByPlatform(TOKEN_ADDRESS_SYMBOL_ID); + return Selectors.getElementByPlatform(ImportTokenViewSelectorsIDs.SYMBOL_INPUT); } async typeCustomTokenAddress(text) { await Gestures.typeText(this.customTokenAddressField, text); } - async scrollToImportButton() { - await Gestures.swipe({ x: 300, y: 1000 }, { x: 300, y: 10 }); - } - async tapImportButton() { await Gestures.waitAndTap(this.importButton); } @@ -36,10 +30,6 @@ class AddCustomImportToken { await Gestures.waitAndTap(this.symbolField); } - async isTokenSymbolDisplayed() { - await Gestures.waitAndTap(this.symbolField); - } - async waitForImportButtonEnabled() { const importButton = await this.importButton; await importButton.waitForEnabled(); diff --git a/wdio/screen-objects/TokenOverviewScreen.js b/wdio/screen-objects/TokenOverviewScreen.js index 5eee33b3267..2fc17edb3b3 100644 --- a/wdio/screen-objects/TokenOverviewScreen.js +++ b/wdio/screen-objects/TokenOverviewScreen.js @@ -1,10 +1,10 @@ import { - ASSET_BACK_BUTTON, TOKEN_ASSET_OVERVIEW, TOKEN_OVERVIEW_SEND_BUTTON, } from './testIDs/Screens/TokenOverviewScreen.testIds.js'; import Selectors from '../helpers/Selectors'; import Gestures from '../helpers/Gestures'; +import { ImportTokenViewSelectorsIDs } from '../../e2e/selectors/wallet/ImportTokenView.selectors'; class TokenOverviewScreen { get tokenAssetOverview() { @@ -16,7 +16,7 @@ class TokenOverviewScreen { } get backButtonTokenOverview() { - return Selectors.getElementByPlatform(ASSET_BACK_BUTTON); + return Selectors.getElementByPlatform(ImportTokenViewSelectorsIDs.BACK_BUTTON); } async tapBackButton() { diff --git a/wdio/screen-objects/testIDs/Screens/AddCustomToken.testIds.js b/wdio/screen-objects/testIDs/Screens/AddCustomToken.testIds.js deleted file mode 100644 index 37282d2ab20..00000000000 --- a/wdio/screen-objects/testIDs/Screens/AddCustomToken.testIds.js +++ /dev/null @@ -1,11 +0,0 @@ -export const CUSTOM_TOKEN_CONTAINER_ID = 'add-custom-token-screen'; -export const TOKEN_CONTAINER_ID = 'add-custom-token-screen'; -export const TOKEN_ADDRESS_INPUT_BOX_ID = 'input-token-address'; -export const TOKEN_ADDRESS_SYMBOL_ID = 'input-token-symbol'; -export const TOKEN_ADDRESS_WARNING_MESSAGE_ID = 'token-address-warning'; -export const TOKEN_PRECISION_WARNING_MESSAGE_ID = 'token-decimals-warning'; -export const CUSTOM_TOKEN_BACK_BUTTON_ID = 'asset-back-button'; -export const TOKEN_IMPORT_BUTTON_ID = 'add-custom-asset-confirm-button'; -export const TOKEN_CANCEL_IMPORT_BUTTON_ID = 'add-asset-cancel-button'; -export const ADD_CONFIRM_CUSTOM_ASSET = 'add-confirm-custom-asset'; -export const ADD_CANCEL_ADD_CUSTOM_ASSET_MODAL = 'add-cancel-custom-asset-modal'; diff --git a/wdio/screen-objects/testIDs/Screens/AssetSearch.testIds.js b/wdio/screen-objects/testIDs/Screens/AssetSearch.testIds.js deleted file mode 100644 index cc40a4da924..00000000000 --- a/wdio/screen-objects/testIDs/Screens/AssetSearch.testIds.js +++ /dev/null @@ -1,3 +0,0 @@ -export const TOKEN_INPUT_BOX_ID = 'input-search-asset'; -export const ASSET_BACK_BUTTON = 'asset-back-button'; -export const TOKEN_IMPORT_NEXT_BUTTON = 'token-import-next-button' diff --git a/wdio/screen-objects/testIDs/Screens/NFTImportScreen.testIds.js b/wdio/screen-objects/testIDs/Screens/NFTImportScreen.testIds.js deleted file mode 100644 index 19772a0b2d8..00000000000 --- a/wdio/screen-objects/testIDs/Screens/NFTImportScreen.testIds.js +++ /dev/null @@ -1,7 +0,0 @@ -export const NFT_ADDRESS_INPUT_BOX_ID = 'input-collectible-address'; -export const NFT_ADDRESS_WARNING_MESSAGE_ID = 'collectible-address-warning'; -export const NFT_IDENTIFIER_WARNING_MESSAGE_ID = - 'collectible-identifier-warning'; -export const NFT_IDENTIFIER_INPUT_BOX_ID = 'input-token-decimals'; -export const NEXT_BUTTON_CUSTOM_IMPORT = 'next-button-custom-import'; - diff --git a/wdio/screen-objects/testIDs/Screens/TokenOverviewScreen.testIds.js b/wdio/screen-objects/testIDs/Screens/TokenOverviewScreen.testIds.js index c78ea7691e7..c719ab1d7f1 100644 --- a/wdio/screen-objects/testIDs/Screens/TokenOverviewScreen.testIds.js +++ b/wdio/screen-objects/testIDs/Screens/TokenOverviewScreen.testIds.js @@ -1,7 +1,4 @@ export const TOKEN_ASSET_OVERVIEW = 'token-asset-overview'; - -export const ASSET_BACK_BUTTON = 'asset-back-button'; - export const TOKEN_PRICE = 'token-price'; export const TOKEN_OVERVIEW_SEND_BUTTON = 'token-send-button'; export const TOKEN_OVERVIEW_BRIDGE_BUTTON = 'token-bridge-button';