From 0d9048ed23df3db68d7dee7723d2aa77ddad4ec5 Mon Sep 17 00:00:00 2001 From: Davide Brocchetto Date: Mon, 28 Oct 2024 22:48:58 +0100 Subject: [PATCH] added ERC-20 to ERC-20 and changes swipe to button --- app/components/UI/Swaps/QuotesView.js | 2 +- e2e/pages/swaps/SwapView.js | 19 ++++--------------- e2e/selectors/swaps/SwapsView.selectors.js | 2 +- .../swaps/swap-action-regression.spec.js | 2 +- e2e/specs/swaps/swap-action-smoke.spec.js | 4 +++- e2e/specs/swaps/swap-token-chart.spec.js | 2 +- 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/app/components/UI/Swaps/QuotesView.js b/app/components/UI/Swaps/QuotesView.js index 431857e6a4c9..6632acde84de 100644 --- a/app/components/UI/Swaps/QuotesView.js +++ b/app/components/UI/Swaps/QuotesView.js @@ -2157,7 +2157,7 @@ function SwapsQuotesView({ )} - + {strings('swaps.swap')} diff --git a/e2e/pages/swaps/SwapView.js b/e2e/pages/swaps/SwapView.js index 6e919cbd1722..6d130ccab2e9 100644 --- a/e2e/pages/swaps/SwapView.js +++ b/e2e/pages/swaps/SwapView.js @@ -20,8 +20,8 @@ class SwapView { return Matchers.getElementByText(SwapViewSelectorsTexts.FETCHING_QUOTES); } - get swipeToSwapButton() { - return Matchers.getElementByID(SwapsViewSelectors.SWIPE_TO_SWAP_BUTTON); + get swapButton() { + return Matchers.getElementByID(SwapsViewSelectors.SWAP_BUTTON); } get iUnderstandLabel() { @@ -41,19 +41,8 @@ class SwapView { return attributes.enabled === true; // Check if enabled is true } - async swipeToSwap() { - const percentage = device.getPlatform() === 'ios' ? 0.72 : 0.95; - const swapsSliderElement = await this.swipeToSwapButton; - const delay = 500; // Delay in milliseconds - - // Wait until the button is enabled before performing swipe actions - while (!(await this.isButtonEnabled(swapsSliderElement))) { - await TestHelpers.delay(delay); // Wait for the specified delay - } - - // Once enabled, perform the swipe actions - await Gestures.swipe(this.swipeToSwapButton, 'right', 'fast', percentage); - await Gestures.swipe(this.swipeToSwapButton, 'right', 'fast', percentage); + async tapSwapButton() { + await Gestures.waitAndTap(this.swapButton); } async swapCompleteLabel(sourceTokenSymbol, destTokenSymbol) { diff --git a/e2e/selectors/swaps/SwapsView.selectors.js b/e2e/selectors/swaps/SwapsView.selectors.js index 0dac1ac2447f..d379e8c4a200 100644 --- a/e2e/selectors/swaps/SwapsView.selectors.js +++ b/e2e/selectors/swaps/SwapsView.selectors.js @@ -1,7 +1,7 @@ import enContent from '../../../locales/languages/en.json'; export const SwapsViewSelectors = { - SWIPE_TO_SWAP_BUTTON: 'swipe-to-swap-button', + SWAP_BUTTON: 'swap-button', QUOTE_SUMMARY: 'swap-quote-summary', GAS_FEE: 'swap-gas-fee', }; diff --git a/e2e/specs/swaps/swap-action-regression.spec.js b/e2e/specs/swaps/swap-action-regression.spec.js index 4bab8e6978d8..931c131aca2c 100644 --- a/e2e/specs/swaps/swap-action-regression.spec.js +++ b/e2e/specs/swaps/swap-action-regression.spec.js @@ -142,7 +142,7 @@ describe(Regression('Multiple Swaps from Actions'), () => { await Assertions.checkIfVisible(SwapView.quoteSummary); await Assertions.checkIfVisible(SwapView.gasFee); await SwapView.tapIUnderstandPriceWarning(); - await SwapView.swipeToSwap(); + await SwapView.tapSwapButton(); //Wait for Swap to complete await SwapView.swapCompleteLabel(sourceTokenSymbol, destTokenSymbol); await device.enableSynchronization(); diff --git a/e2e/specs/swaps/swap-action-smoke.spec.js b/e2e/specs/swaps/swap-action-smoke.spec.js index 4c662fddd582..e4c4a6c15618 100644 --- a/e2e/specs/swaps/swap-action-smoke.spec.js +++ b/e2e/specs/swaps/swap-action-smoke.spec.js @@ -83,6 +83,8 @@ describe(SmokeSwaps('Swap from Actions'), () => { type | quantity | sourceTokenSymbol | destTokenSymbol | network ${'native'}$ |${'.4'} | ${'ETH'} | ${'WETH'} | ${CustomNetworks.Tenderly.Mainnet} ${'wrapped'}$ |${'.2'} | ${'WETH'} | ${'ETH'} | ${CustomNetworks.Tenderly.Mainnet} + ${'native'}$ |${'.5'} | ${'ETH'} | ${'DAI'} | ${CustomNetworks.Tenderly.Mainnet} + ${'unapproved'}$ |${'50'} | ${'DAI'} | ${'USDC'} | ${CustomNetworks.Tenderly.Mainnet} `( "should swap $type token '$sourceTokenSymbol' to '$destTokenSymbol' on '$network.providerConfig.nickname'", async ({ type, quantity, sourceTokenSymbol, destTokenSymbol, network }) => { @@ -140,7 +142,7 @@ describe(SmokeSwaps('Swap from Actions'), () => { await Assertions.checkIfVisible(SwapView.quoteSummary); await Assertions.checkIfVisible(SwapView.gasFee); await SwapView.tapIUnderstandPriceWarning(); - await SwapView.swipeToSwap(); + await SwapView.tapSwapButton(); //Wait for Swap to complete await SwapView.swapCompleteLabel(sourceTokenSymbol, destTokenSymbol); await device.enableSynchronization(); diff --git a/e2e/specs/swaps/swap-token-chart.spec.js b/e2e/specs/swaps/swap-token-chart.spec.js index 59e4ebb7bbe4..9187b191c43d 100644 --- a/e2e/specs/swaps/swap-token-chart.spec.js +++ b/e2e/specs/swaps/swap-token-chart.spec.js @@ -94,7 +94,7 @@ describe(Regression('Swap from Token view'), () => { await Assertions.checkIfVisible(SwapView.quoteSummary); await Assertions.checkIfVisible(SwapView.gasFee); await SwapView.tapIUnderstandPriceWarning(); - await SwapView.swipeToSwap(); + await SwapView.tapSwapButton(); //Wait for Swap to complete await SwapView.swapCompleteLabel('ETH', 'DAI'); await device.enableSynchronization();