Skip to content

Commit

Permalink
added ERC-20 to ERC-20 and changes swipe to button
Browse files Browse the repository at this point in the history
  • Loading branch information
davibroc committed Oct 28, 2024
1 parent 7531db0 commit 0d9048e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/components/UI/Swaps/QuotesView.js
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,7 @@ function SwapsQuotesView({
</QuotesSummary.Body>
</QuotesSummary>
)}
<StyledButton type="confirm" onPress={handleCompleteSwap} disabled={unableToSwap || isHandlingSwap || isAnimating}>
<StyledButton testID={SwapsViewSelectors.SWAP_BUTTON} type="confirm" onPress={handleCompleteSwap} disabled={unableToSwap || isHandlingSwap || isAnimating}>
{strings('swaps.swap')}
</StyledButton>
<TouchableOpacity onPress={handleTermsPress} style={styles.termsButton}>
Expand Down
19 changes: 4 additions & 15 deletions e2e/pages/swaps/SwapView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion e2e/selectors/swaps/SwapsView.selectors.js
Original file line number Diff line number Diff line change
@@ -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',
};
Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/swaps/swap-action-regression.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 3 additions & 1 deletion e2e/specs/swaps/swap-action-smoke.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion e2e/specs/swaps/swap-token-chart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 0d9048e

Please sign in to comment.