diff --git a/e2e/pages/Ramps/BuildQuoteView.js b/e2e/pages/Ramps/BuildQuoteView.js index dbdc2e524ed..63c916c0833 100644 --- a/e2e/pages/Ramps/BuildQuoteView.js +++ b/e2e/pages/Ramps/BuildQuoteView.js @@ -5,6 +5,11 @@ class BuildQuoteView { get amountToBuyLabel() { return Matchers.getElementByText(BuildQuoteSelectors.AMOUNT_TO_BUY_LABEL); } + + get amountToSellLabel() { + return Matchers.getElementByText(BuildQuoteSelectors.AMOUNT_TO_SELL_LABEL); + } + get getQuotesButton() { return Matchers.getElementByText(BuildQuoteSelectors.GET_QUOTES_BUTTON); } diff --git a/e2e/pages/Ramps/SellGetStartedView.js b/e2e/pages/Ramps/SellGetStartedView.js new file mode 100644 index 00000000000..5644df74339 --- /dev/null +++ b/e2e/pages/Ramps/SellGetStartedView.js @@ -0,0 +1,15 @@ +import Matchers from '../../utils/Matchers'; +import Gestures from '../../utils/Gestures'; +import { GetStartedSelectors } from '../../selectors/Ramps/GetStarted.selectors'; + +class SellGetStartedView { + get getStartedButton() { + return Matchers.getElementByText(GetStartedSelectors.GET_STARTED); + } + + async tapGetStartedButton() { + await Gestures.waitAndTap(this.getStartedButton); + } +} + +export default new SellGetStartedView(); diff --git a/e2e/pages/modals/WalletActionsModal.js b/e2e/pages/modals/WalletActionsModal.js index 1b8ac8b3fc6..d6d3aadb49b 100644 --- a/e2e/pages/modals/WalletActionsModal.js +++ b/e2e/pages/modals/WalletActionsModal.js @@ -21,6 +21,10 @@ class WalletActionsModal { return Matchers.getElementByID(WalletActionsModalSelectorsIDs.BUY_BUTTON); } + get sellButton() { + return Matchers.getElementByID(WalletActionsModalSelectorsIDs.SELL_BUTTON); + } + async tapSendButton() { await Gestures.waitAndTap(this.sendButton); } @@ -36,6 +40,10 @@ class WalletActionsModal { async tapBuyButton() { await Gestures.waitAndTap(this.buyButton); } + + async tapSellButton() { + await Gestures.waitAndTap(this.sellButton); + } } export default new WalletActionsModal(); diff --git a/e2e/selectors/Ramps/BuildQuote.selectors.js b/e2e/selectors/Ramps/BuildQuote.selectors.js index 6f31cad907d..1c3a116b9f8 100644 --- a/e2e/selectors/Ramps/BuildQuote.selectors.js +++ b/e2e/selectors/Ramps/BuildQuote.selectors.js @@ -2,5 +2,6 @@ import enContent from '../../../locales/languages/en.json'; export const BuildQuoteSelectors = { AMOUNT_TO_BUY_LABEL: enContent.fiat_on_ramp_aggregator.amount_to_buy, + AMOUNT_TO_SELL_LABEL: enContent.fiat_on_ramp_aggregator.amount_to_sell, GET_QUOTES_BUTTON: enContent.fiat_on_ramp_aggregator.get_quotes, }; diff --git a/e2e/specs/ramps/offramp.spec.js b/e2e/specs/ramps/offramp.spec.js new file mode 100644 index 00000000000..8c3644a4ac4 --- /dev/null +++ b/e2e/specs/ramps/offramp.spec.js @@ -0,0 +1,62 @@ +'use strict'; +import { loginToApp } from '../../viewHelper'; +import TabBarComponent from '../../pages/TabBarComponent'; +import WalletActionsModal from '../../pages/modals/WalletActionsModal'; +import FixtureBuilder from '../../fixtures/fixture-builder'; +import { + loadFixture, + startFixtureServer, + 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 { SmokeAssets } from '../../tags'; +import Assertions from '../../utils/Assertions'; +import SellGetStartedView from '../../pages/Ramps/SellGetStartedView'; +import SelectRegionView from '../../pages/Ramps/SelectRegionView'; +import SelectPaymentMethodView from '../../pages/Ramps/SelectPaymentMethodView'; +import BuildQuoteView from '../../pages/Ramps/BuildQuoteView'; + +const fixtureServer = new FixtureServer(); + +describe(SmokeAssets('OffRamp'), () => { + beforeAll(async () => { + await TestHelpers.reverseServerPort(); + const fixture = new FixtureBuilder() + .withNetworkController(CustomNetworks.Tenderly) + .build(); + await startFixtureServer(fixtureServer); + await loadFixture(fixtureServer, { fixture }); + await device.launchApp({ + permissions: { notifications: 'YES' }, + launchArgs: { fixtureServerPort: `${getFixturesServerPort()}` }, + }); + await loginToApp(); + }); + + afterAll(async () => { + await stopFixtureServer(fixtureServer); + }); + + beforeEach(async () => { + jest.setTimeout(150000); + }); + + it('should select Region and Payment Method to see the Build Sell Quote screen', async () => { + await TabBarComponent.tapWallet(); + await TabBarComponent.tapActions(); + await WalletActionsModal.tapSellButton(); + await SellGetStartedView.tapGetStartedButton(); + await SelectRegionView.tapSelectRegionDropdown(); + await SelectRegionView.tapRegionOption('United States of America'); + await SelectRegionView.tapRegionOption('California'); + await SelectRegionView.tapContinueButton(); + await SelectPaymentMethodView.tapPaymentMethodOption('Debit or Credit'); + await SelectPaymentMethodView.tapContinueButton(); + await Assertions.checkIfVisible(BuildQuoteView.amountToSellLabel); + await Assertions.checkIfVisible(BuildQuoteView.getQuotesButton); + }); + +}); diff --git a/e2e/specs/ramps/onramp.spec.js b/e2e/specs/ramps/onramp.spec.js index 90f170d2ef6..d4e0a5ac9b8 100644 --- a/e2e/specs/ramps/onramp.spec.js +++ b/e2e/specs/ramps/onramp.spec.js @@ -41,7 +41,7 @@ describe(SmokeAssets('Buy Crypto'), () => { jest.setTimeout(150000); }); - it('should select Region and Payment Method to see the Build Quote screen', async () => { + it('should select Region and Payment Method to see the Build Buy Quote screen', async () => { await TabBarComponent.tapWallet(); await TabBarComponent.tapActions(); await WalletActionsModal.tapBuyButton();