From 5c4ea7a43aef2ff125b3e47e4cfbf6d979ab177a Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Fri, 6 Sep 2024 08:56:43 -0700 Subject: [PATCH 01/13] test: initial ramps tests --- e2e/pages/Ramps/BuyGetStartedView.js | 15 ++++++ e2e/pages/Ramps/SellGetStartedView.js | 15 ++++++ e2e/pages/modals/WalletActionsModal.js | 16 +++++++ e2e/selectors/Ramps/GetStarted.selectors.js | 5 ++ e2e/specs/ramps/offramp.spec.js | 51 +++++++++++++++++++++ e2e/specs/ramps/onramp.spec.js | 51 +++++++++++++++++++++ e2e/tags.js | 3 ++ ios/Podfile.lock | 2 +- 8 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 e2e/pages/Ramps/BuyGetStartedView.js create mode 100644 e2e/pages/Ramps/SellGetStartedView.js create mode 100644 e2e/selectors/Ramps/GetStarted.selectors.js create mode 100644 e2e/specs/ramps/offramp.spec.js create mode 100644 e2e/specs/ramps/onramp.spec.js diff --git a/e2e/pages/Ramps/BuyGetStartedView.js b/e2e/pages/Ramps/BuyGetStartedView.js new file mode 100644 index 00000000000..9a3b7c202b6 --- /dev/null +++ b/e2e/pages/Ramps/BuyGetStartedView.js @@ -0,0 +1,15 @@ +import Matchers from '../../utils/Matchers'; +import Gestures from '../../utils/Gestures'; +import { GetStartedSelectors } from '../../selectors/Ramps/GetStarted.selectors'; + +class BuyGetStartedView { + get getStartedButton() { + return Matchers.getElementByText(GetStartedSelectors.GET_STARTED); + } + + async tapGetStartedButton() { + await Gestures.waitAndTap(this.getStartedButton); + } +} + +export default new BuyGetStartedView(); 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 1c174a01ce3..d6d3aadb49b 100644 --- a/e2e/pages/modals/WalletActionsModal.js +++ b/e2e/pages/modals/WalletActionsModal.js @@ -17,6 +17,14 @@ class WalletActionsModal { return Matchers.getElementByID(WalletActionsModalSelectorsIDs.SWAP_BUTTON); } + get buyButton() { + return Matchers.getElementByID(WalletActionsModalSelectorsIDs.BUY_BUTTON); + } + + get sellButton() { + return Matchers.getElementByID(WalletActionsModalSelectorsIDs.SELL_BUTTON); + } + async tapSendButton() { await Gestures.waitAndTap(this.sendButton); } @@ -28,6 +36,14 @@ class WalletActionsModal { async tapSwapButton() { await Gestures.waitAndTap(this.swapButton); } + + async tapBuyButton() { + await Gestures.waitAndTap(this.buyButton); + } + + async tapSellButton() { + await Gestures.waitAndTap(this.sellButton); + } } export default new WalletActionsModal(); diff --git a/e2e/selectors/Ramps/GetStarted.selectors.js b/e2e/selectors/Ramps/GetStarted.selectors.js new file mode 100644 index 00000000000..6249b672af5 --- /dev/null +++ b/e2e/selectors/Ramps/GetStarted.selectors.js @@ -0,0 +1,5 @@ +import enContent from '../../../locales/languages/en.json'; + +export const GetStartedSelectors = { + GET_STARTED: enContent.fiat_on_ramp_aggregator.onboarding.get_started, +}; diff --git a/e2e/specs/ramps/offramp.spec.js b/e2e/specs/ramps/offramp.spec.js new file mode 100644 index 00000000000..4b09b6e2446 --- /dev/null +++ b/e2e/specs/ramps/offramp.spec.js @@ -0,0 +1,51 @@ +'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 { SmokeRamps } from '../../tags'; +import Assertions from '../../utils/Assertions'; +import SellGetStartedView from '../../pages/Ramps/SellGetStartedView'; + +const fixtureServer = new FixtureServer(); + +describe(SmokeRamps('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 tap the Sell button', async () => { + await TabBarComponent.tapWallet(); + await TabBarComponent.tapActions(); + await WalletActionsModal.tapSellButton(); + await SellGetStartedView.tapGetStartedButton(); + }); + +}); diff --git a/e2e/specs/ramps/onramp.spec.js b/e2e/specs/ramps/onramp.spec.js new file mode 100644 index 00000000000..ae0715e1a0a --- /dev/null +++ b/e2e/specs/ramps/onramp.spec.js @@ -0,0 +1,51 @@ +'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 { SmokeRamps } from '../../tags'; +import Assertions from '../../utils/Assertions'; +import BuyGetStartedView from '../../pages/Ramps/BuyGetStartedView'; + +const fixtureServer = new FixtureServer(); + +describe(SmokeRamps('OnRamp'), () => { + 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 tap the Buy button', async () => { + await TabBarComponent.tapWallet(); + await TabBarComponent.tapActions(); + await WalletActionsModal.tapBuyButton(); + await BuyGetStartedView.tapGetStartedButton(); + }); + +}); diff --git a/e2e/tags.js b/e2e/tags.js index 8e78b934e57..90259b42575 100644 --- a/e2e/tags.js +++ b/e2e/tags.js @@ -6,6 +6,7 @@ const tags = { SmokeSwaps: 'SmokeSwaps', SmokeRest: 'SmokeRest', smokeAssets: 'smokeAssets', + SmokeRamps: 'SmokeRamps', }; const Regression = (testName) => `${tags.regression} ${testName}`; @@ -15,6 +16,7 @@ const SmokeConfirmations = (testName) => `${tags.smokeConfirmations} ${testName}`; const SmokeSwaps = (testName) => `${tags.SmokeSwaps} ${testName}`; const SmokeAssets = (testName) => `${tags.smokeAssets} ${testName}`; +const SmokeRamps = (testName) => `${tags.SmokeRamps} ${testName}`; export { Regression, @@ -23,4 +25,5 @@ export { SmokeConfirmations, SmokeSwaps, SmokeAssets, + SmokeRamps, }; diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a2be080944f..60d4bc2c60c 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1302,6 +1302,6 @@ SPEC CHECKSUMS: Yoga: 6f5ab94cd8b1ecd04b6e973d0bc583ede2a598cc YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: e4050300fc9c8d091b9c00e1486ad6e205c250c7 +PODFILE CHECKSUM: 3514934ac1830af4ca844ba018f38720a48d006b COCOAPODS: 1.15.2 From a983288eb7bc7743b601fb888e3b27b2fab9076d Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Thu, 12 Sep 2024 22:21:29 -0400 Subject: [PATCH 02/13] test: select elements until the build quote screen --- e2e/pages/Ramps/BuildQuoteView.js | 35 +++++++++++++++++++ e2e/pages/Ramps/SelectPaymentMethodView.js | 21 +++++++++++ e2e/pages/Ramps/SelectRegionView.js | 28 +++++++++++++++ e2e/selectors/Ramps/BuildQuote.selectors.js | 5 +++ .../Ramps/SelectPaymentMethod.selectors.js | 5 +++ e2e/selectors/Ramps/SelectRegion.selectors.js | 6 ++++ e2e/specs/ramps/onramp.spec.js | 16 +++++++++ 7 files changed, 116 insertions(+) create mode 100644 e2e/pages/Ramps/BuildQuoteView.js create mode 100644 e2e/pages/Ramps/SelectPaymentMethodView.js create mode 100644 e2e/pages/Ramps/SelectRegionView.js create mode 100644 e2e/selectors/Ramps/BuildQuote.selectors.js create mode 100644 e2e/selectors/Ramps/SelectPaymentMethod.selectors.js create mode 100644 e2e/selectors/Ramps/SelectRegion.selectors.js diff --git a/e2e/pages/Ramps/BuildQuoteView.js b/e2e/pages/Ramps/BuildQuoteView.js new file mode 100644 index 00000000000..7151bf73134 --- /dev/null +++ b/e2e/pages/Ramps/BuildQuoteView.js @@ -0,0 +1,35 @@ +import Matchers from '../../utils/Matchers'; +import Gestures from '../../utils/Gestures'; +import { BuildQuoteSelectors } from '../../selectors/Ramps/BuildQuote.selectors'; + +class BuildQuoteView { + get doneButton() { + return Matchers.getElementByText(BuildQuoteSelectors.DONE_BUTTON); + } + + get amountTextField() { + return Matchers.getElementByText('$0'); + } + + async tapAmountTextField() { + await Gestures.waitAndTap(this.amountTextField); + } + + async tapFiatAmount(amount) { + const acceptedValues = ['$50', '$100', '$200', '$400']; + + if (!acceptedValues.includes(amount)) { + throw new Error(`Invalid amount: ${amount}. Accepted values are: ${acceptedValues.join(', ')}`); + } + + const amountElement = element(by.text(amount)); + await amountElement.tap(); + } + + async tapDoneButton() { + await Gestures.waitAndTap(this.doneButton); + } + +} + +export default new BuildQuoteView(); diff --git a/e2e/pages/Ramps/SelectPaymentMethodView.js b/e2e/pages/Ramps/SelectPaymentMethodView.js new file mode 100644 index 00000000000..4483c4da706 --- /dev/null +++ b/e2e/pages/Ramps/SelectPaymentMethodView.js @@ -0,0 +1,21 @@ +import Matchers from '../../utils/Matchers'; +import Gestures from '../../utils/Gestures'; +import { SelectPaymentMethodSelectors } from '../../selectors/Ramps/SelectPaymentMethod.selectors'; + +class SelectPaymentMethodView { + get continueButton() { + return Matchers.getElementByText(SelectPaymentMethodSelectors.CONTINUE_BUTTON); + } + + async tapPaymentMethodOption(paymentMethod) { + const paymentMethodOption = Matchers.getElementByText(paymentMethod); + await Gestures.waitAndTap(paymentMethodOption); + } + + async tapContinueButton() { + await Gestures.waitAndTap(this.continueButton); + } + +} + +export default new SelectPaymentMethodView(); diff --git a/e2e/pages/Ramps/SelectRegionView.js b/e2e/pages/Ramps/SelectRegionView.js new file mode 100644 index 00000000000..0f697581802 --- /dev/null +++ b/e2e/pages/Ramps/SelectRegionView.js @@ -0,0 +1,28 @@ +import Matchers from '../../utils/Matchers'; +import Gestures from '../../utils/Gestures'; +import { SelectRegionSelectors } from '../../selectors/Ramps/SelectRegion.selectors'; + +class SelectRegionView { + get selectRegionDropdown() { + return Matchers.getElementByText(SelectRegionSelectors.SELECT_REGION); + } + + get continueButton() { + return Matchers.getElementByText(SelectRegionSelectors.CONTINUE_BUTTON); + } + + async tapSelectRegionDropdown() { + await Gestures.waitAndTap(this.selectRegionDropdown); + } + + async tapRegionOption(region) { + const regionOption = Matchers.getElementByText(region); + await Gestures.waitAndTap(regionOption); + } + + async tapContinueButton() { + await Gestures.waitAndTap(this.continueButton); + } +} + +export default new SelectRegionView(); diff --git a/e2e/selectors/Ramps/BuildQuote.selectors.js b/e2e/selectors/Ramps/BuildQuote.selectors.js new file mode 100644 index 00000000000..7532eafbaa6 --- /dev/null +++ b/e2e/selectors/Ramps/BuildQuote.selectors.js @@ -0,0 +1,5 @@ +import enContent from '../../../locales/languages/en.json'; + +export const BuildQuoteSelectors = { + DONE_BUTTON: enContent.fiat_on_ramp_aggregator.done, +}; diff --git a/e2e/selectors/Ramps/SelectPaymentMethod.selectors.js b/e2e/selectors/Ramps/SelectPaymentMethod.selectors.js new file mode 100644 index 00000000000..d7d028696e7 --- /dev/null +++ b/e2e/selectors/Ramps/SelectPaymentMethod.selectors.js @@ -0,0 +1,5 @@ +import enContent from '../../../locales/languages/en.json'; + +export const SelectPaymentMethodSelectors = { + CONTINUE_BUTTON: enContent.fiat_on_ramp_aggregator.payment_method.continue_to_amount, +}; diff --git a/e2e/selectors/Ramps/SelectRegion.selectors.js b/e2e/selectors/Ramps/SelectRegion.selectors.js new file mode 100644 index 00000000000..c402d742608 --- /dev/null +++ b/e2e/selectors/Ramps/SelectRegion.selectors.js @@ -0,0 +1,6 @@ +import enContent from '../../../locales/languages/en.json'; + +export const SelectRegionSelectors = { + SELECT_REGION: enContent.fiat_on_ramp_aggregator.region.select_region, + CONTINUE_BUTTON: enContent.fiat_on_ramp_aggregator.continue, +}; diff --git a/e2e/specs/ramps/onramp.spec.js b/e2e/specs/ramps/onramp.spec.js index ae0715e1a0a..3fec14cf1a0 100644 --- a/e2e/specs/ramps/onramp.spec.js +++ b/e2e/specs/ramps/onramp.spec.js @@ -15,6 +15,12 @@ import { getFixturesServerPort } from '../../fixtures/utils'; import { SmokeRamps } from '../../tags'; import Assertions from '../../utils/Assertions'; import BuyGetStartedView from '../../pages/Ramps/BuyGetStartedView'; +import SelectRegionView from '../../pages/Ramps/SelectRegionView'; +import SelectPaymentMethodView from '../../pages/Ramps/SelectPaymentMethodView'; +import BuildQuoteView from '../../pages/Ramps/BuildQuoteView'; +import { setEmitFlags } from 'typescript'; +import { SelectPaymentMethodSelectors } from '../../selectors/Ramps/SelectPaymentMethod.selectors'; +import { BuildQuoteSelectors } from '../../selectors/Ramps/BuildQuote.selectors'; const fixtureServer = new FixtureServer(); @@ -46,6 +52,16 @@ describe(SmokeRamps('OnRamp'), () => { await TabBarComponent.tapActions(); await WalletActionsModal.tapBuyButton(); await BuyGetStartedView.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 BuildQuoteView.tapAmountTextField(); + await BuildQuoteView.tapFiatAmount('$50'); + await BuildQuoteView.tapDoneButton(); }); }); From 2a71fdba5b4450d5a9bb055a56d16142b403fa44 Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Fri, 13 Sep 2024 10:16:23 -0400 Subject: [PATCH 03/13] test: verify build quote screen appears --- e2e/pages/Ramps/BuildQuoteView.js | 32 ++++++--------------- e2e/selectors/Ramps/BuildQuote.selectors.js | 3 +- e2e/specs/ramps/onramp.spec.js | 5 +--- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/e2e/pages/Ramps/BuildQuoteView.js b/e2e/pages/Ramps/BuildQuoteView.js index 7151bf73134..b2b6eec5811 100644 --- a/e2e/pages/Ramps/BuildQuoteView.js +++ b/e2e/pages/Ramps/BuildQuoteView.js @@ -1,35 +1,19 @@ import Matchers from '../../utils/Matchers'; -import Gestures from '../../utils/Gestures'; import { BuildQuoteSelectors } from '../../selectors/Ramps/BuildQuote.selectors'; +import Assertions from '../../utils/Assertions'; class BuildQuoteView { - get doneButton() { - return Matchers.getElementByText(BuildQuoteSelectors.DONE_BUTTON); + get amountToBuyLabel() { + return Matchers.getElementByText(BuildQuoteSelectors.AMOUNT_TO_BUY_LABEL); } - - get amountTextField() { - return Matchers.getElementByText('$0'); - } - - async tapAmountTextField() { - await Gestures.waitAndTap(this.amountTextField); + get getQuotesButton() { + return Matchers.getElementByText(BuildQuoteSelectors.GET_QUOTES_BUTTON); } - async tapFiatAmount(amount) { - const acceptedValues = ['$50', '$100', '$200', '$400']; - - if (!acceptedValues.includes(amount)) { - throw new Error(`Invalid amount: ${amount}. Accepted values are: ${acceptedValues.join(', ')}`); - } - - const amountElement = element(by.text(amount)); - await amountElement.tap(); + async verifyBuildQuoteViewVisible() { + await Assertions.checkIfVisible(this.amountToBuyLabel); + await Assertions.checkIfVisible(this.getQuotesButton); } - - async tapDoneButton() { - await Gestures.waitAndTap(this.doneButton); - } - } export default new BuildQuoteView(); diff --git a/e2e/selectors/Ramps/BuildQuote.selectors.js b/e2e/selectors/Ramps/BuildQuote.selectors.js index 7532eafbaa6..6f31cad907d 100644 --- a/e2e/selectors/Ramps/BuildQuote.selectors.js +++ b/e2e/selectors/Ramps/BuildQuote.selectors.js @@ -1,5 +1,6 @@ import enContent from '../../../locales/languages/en.json'; export const BuildQuoteSelectors = { - DONE_BUTTON: enContent.fiat_on_ramp_aggregator.done, + AMOUNT_TO_BUY_LABEL: enContent.fiat_on_ramp_aggregator.amount_to_buy, + GET_QUOTES_BUTTON: enContent.fiat_on_ramp_aggregator.get_quotes, }; diff --git a/e2e/specs/ramps/onramp.spec.js b/e2e/specs/ramps/onramp.spec.js index 3fec14cf1a0..badad18fd5d 100644 --- a/e2e/specs/ramps/onramp.spec.js +++ b/e2e/specs/ramps/onramp.spec.js @@ -58,10 +58,7 @@ describe(SmokeRamps('OnRamp'), () => { await SelectRegionView.tapContinueButton(); await SelectPaymentMethodView.tapPaymentMethodOption('Debit or Credit'); await SelectPaymentMethodView.tapContinueButton(); - - await BuildQuoteView.tapAmountTextField(); - await BuildQuoteView.tapFiatAmount('$50'); - await BuildQuoteView.tapDoneButton(); + await BuildQuoteView.verifyBuildQuoteViewVisible(); }); }); From d31c85b703892171ad6887439e2cf89428d47d5a Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Fri, 13 Sep 2024 10:18:29 -0400 Subject: [PATCH 04/13] test: remove offramp test --- e2e/pages/Ramps/SellGetStartedView.js | 15 -------- e2e/specs/ramps/offramp.spec.js | 51 --------------------------- 2 files changed, 66 deletions(-) delete mode 100644 e2e/pages/Ramps/SellGetStartedView.js delete mode 100644 e2e/specs/ramps/offramp.spec.js diff --git a/e2e/pages/Ramps/SellGetStartedView.js b/e2e/pages/Ramps/SellGetStartedView.js deleted file mode 100644 index 5644df74339..00000000000 --- a/e2e/pages/Ramps/SellGetStartedView.js +++ /dev/null @@ -1,15 +0,0 @@ -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/specs/ramps/offramp.spec.js b/e2e/specs/ramps/offramp.spec.js deleted file mode 100644 index 4b09b6e2446..00000000000 --- a/e2e/specs/ramps/offramp.spec.js +++ /dev/null @@ -1,51 +0,0 @@ -'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 { SmokeRamps } from '../../tags'; -import Assertions from '../../utils/Assertions'; -import SellGetStartedView from '../../pages/Ramps/SellGetStartedView'; - -const fixtureServer = new FixtureServer(); - -describe(SmokeRamps('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 tap the Sell button', async () => { - await TabBarComponent.tapWallet(); - await TabBarComponent.tapActions(); - await WalletActionsModal.tapSellButton(); - await SellGetStartedView.tapGetStartedButton(); - }); - -}); From 271c11fb4378ed3f5ed6e67313b62fcdf6d455ef Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Fri, 13 Sep 2024 10:29:40 -0400 Subject: [PATCH 05/13] chore: cleanup --- e2e/specs/ramps/onramp.spec.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/e2e/specs/ramps/onramp.spec.js b/e2e/specs/ramps/onramp.spec.js index badad18fd5d..57d918c2202 100644 --- a/e2e/specs/ramps/onramp.spec.js +++ b/e2e/specs/ramps/onramp.spec.js @@ -8,28 +8,21 @@ import { 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 { SmokeRamps } from '../../tags'; -import Assertions from '../../utils/Assertions'; import BuyGetStartedView from '../../pages/Ramps/BuyGetStartedView'; import SelectRegionView from '../../pages/Ramps/SelectRegionView'; import SelectPaymentMethodView from '../../pages/Ramps/SelectPaymentMethodView'; import BuildQuoteView from '../../pages/Ramps/BuildQuoteView'; -import { setEmitFlags } from 'typescript'; -import { SelectPaymentMethodSelectors } from '../../selectors/Ramps/SelectPaymentMethod.selectors'; -import { BuildQuoteSelectors } from '../../selectors/Ramps/BuildQuote.selectors'; const fixtureServer = new FixtureServer(); describe(SmokeRamps('OnRamp'), () => { beforeAll(async () => { await TestHelpers.reverseServerPort(); - const fixture = new FixtureBuilder() - .withNetworkController(CustomNetworks.Tenderly) - .build(); + const fixture = new FixtureBuilder().build(); await startFixtureServer(fixtureServer); await loadFixture(fixtureServer, { fixture }); await device.launchApp({ From fbb7963462608ff3e09e014480be37f119ba67c7 Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Fri, 13 Sep 2024 10:38:26 -0400 Subject: [PATCH 06/13] test: rename test --- e2e/specs/ramps/onramp.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/specs/ramps/onramp.spec.js b/e2e/specs/ramps/onramp.spec.js index 57d918c2202..2c24981d9dd 100644 --- a/e2e/specs/ramps/onramp.spec.js +++ b/e2e/specs/ramps/onramp.spec.js @@ -19,7 +19,7 @@ import BuildQuoteView from '../../pages/Ramps/BuildQuoteView'; const fixtureServer = new FixtureServer(); -describe(SmokeRamps('OnRamp'), () => { +describe(SmokeRamps('Buy Crypto'), () => { beforeAll(async () => { await TestHelpers.reverseServerPort(); const fixture = new FixtureBuilder().build(); @@ -40,7 +40,7 @@ describe(SmokeRamps('OnRamp'), () => { jest.setTimeout(150000); }); - it('should tap the Buy button', async () => { + it('should select Region and Payment Method to see the Build Quote screen', async () => { await TabBarComponent.tapWallet(); await TabBarComponent.tapActions(); await WalletActionsModal.tapBuyButton(); From 7dc6c19b0286abcd4a615d6d84858b3cae055503 Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Fri, 13 Sep 2024 10:47:47 -0400 Subject: [PATCH 07/13] chore: cleanup --- e2e/pages/modals/WalletActionsModal.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/e2e/pages/modals/WalletActionsModal.js b/e2e/pages/modals/WalletActionsModal.js index d6d3aadb49b..1b8ac8b3fc6 100644 --- a/e2e/pages/modals/WalletActionsModal.js +++ b/e2e/pages/modals/WalletActionsModal.js @@ -21,10 +21,6 @@ class WalletActionsModal { return Matchers.getElementByID(WalletActionsModalSelectorsIDs.BUY_BUTTON); } - get sellButton() { - return Matchers.getElementByID(WalletActionsModalSelectorsIDs.SELL_BUTTON); - } - async tapSendButton() { await Gestures.waitAndTap(this.sendButton); } @@ -40,10 +36,6 @@ class WalletActionsModal { async tapBuyButton() { await Gestures.waitAndTap(this.buyButton); } - - async tapSellButton() { - await Gestures.waitAndTap(this.sellButton); - } } export default new WalletActionsModal(); From fbad38b7e3814bbe91d3845765942ff9806943fc Mon Sep 17 00:00:00 2001 From: Brendan Kirby <124314512+bkirb@users.noreply.github.com> Date: Fri, 13 Sep 2024 08:00:41 -0700 Subject: [PATCH 08/13] chore: cleanup --- ios/Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 60d4bc2c60c..a2be080944f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1302,6 +1302,6 @@ SPEC CHECKSUMS: Yoga: 6f5ab94cd8b1ecd04b6e973d0bc583ede2a598cc YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: 3514934ac1830af4ca844ba018f38720a48d006b +PODFILE CHECKSUM: e4050300fc9c8d091b9c00e1486ad6e205c250c7 COCOAPODS: 1.15.2 From 7094253d2323c2e915fd1bb9ce843489f66c8e05 Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Mon, 30 Sep 2024 19:15:43 -0700 Subject: [PATCH 09/13] chore: use SmokeAssets tag --- e2e/specs/ramps/onramp.spec.js | 4 ++-- e2e/tags.js | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/e2e/specs/ramps/onramp.spec.js b/e2e/specs/ramps/onramp.spec.js index 2c24981d9dd..8b54d3e1a4a 100644 --- a/e2e/specs/ramps/onramp.spec.js +++ b/e2e/specs/ramps/onramp.spec.js @@ -11,7 +11,7 @@ import { import TestHelpers from '../../helpers'; import FixtureServer from '../../fixtures/fixture-server'; import { getFixturesServerPort } from '../../fixtures/utils'; -import { SmokeRamps } from '../../tags'; +import { SmokeAssets } from '../../tags'; import BuyGetStartedView from '../../pages/Ramps/BuyGetStartedView'; import SelectRegionView from '../../pages/Ramps/SelectRegionView'; import SelectPaymentMethodView from '../../pages/Ramps/SelectPaymentMethodView'; @@ -19,7 +19,7 @@ import BuildQuoteView from '../../pages/Ramps/BuildQuoteView'; const fixtureServer = new FixtureServer(); -describe(SmokeRamps('Buy Crypto'), () => { +describe(SmokeAssets('Buy Crypto'), () => { beforeAll(async () => { await TestHelpers.reverseServerPort(); const fixture = new FixtureBuilder().build(); diff --git a/e2e/tags.js b/e2e/tags.js index 90259b42575..8e78b934e57 100644 --- a/e2e/tags.js +++ b/e2e/tags.js @@ -6,7 +6,6 @@ const tags = { SmokeSwaps: 'SmokeSwaps', SmokeRest: 'SmokeRest', smokeAssets: 'smokeAssets', - SmokeRamps: 'SmokeRamps', }; const Regression = (testName) => `${tags.regression} ${testName}`; @@ -16,7 +15,6 @@ const SmokeConfirmations = (testName) => `${tags.smokeConfirmations} ${testName}`; const SmokeSwaps = (testName) => `${tags.SmokeSwaps} ${testName}`; const SmokeAssets = (testName) => `${tags.smokeAssets} ${testName}`; -const SmokeRamps = (testName) => `${tags.SmokeRamps} ${testName}`; export { Regression, @@ -25,5 +23,4 @@ export { SmokeConfirmations, SmokeSwaps, SmokeAssets, - SmokeRamps, }; From b4e456619d738b509c8d2a522d6d11bd19c546ce Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Wed, 2 Oct 2024 07:28:26 -0700 Subject: [PATCH 10/13] test: initial ramps sell test --- e2e/pages/Ramps/SellGetStartedView.js | 15 +++++++++++++++ e2e/specs/ramps/offramp.spec.js | 0 2 files changed, 15 insertions(+) create mode 100644 e2e/pages/Ramps/SellGetStartedView.js create mode 100644 e2e/specs/ramps/offramp.spec.js 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/specs/ramps/offramp.spec.js b/e2e/specs/ramps/offramp.spec.js new file mode 100644 index 00000000000..e69de29bb2d From 7f075654b66da55373bab8f4c268d6c411ec67db Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Wed, 2 Oct 2024 07:30:32 -0700 Subject: [PATCH 11/13] test: initial ramps sell test --- e2e/specs/ramps/offramp.spec.js | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/e2e/specs/ramps/offramp.spec.js b/e2e/specs/ramps/offramp.spec.js index e69de29bb2d..4b09b6e2446 100644 --- a/e2e/specs/ramps/offramp.spec.js +++ b/e2e/specs/ramps/offramp.spec.js @@ -0,0 +1,51 @@ +'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 { SmokeRamps } from '../../tags'; +import Assertions from '../../utils/Assertions'; +import SellGetStartedView from '../../pages/Ramps/SellGetStartedView'; + +const fixtureServer = new FixtureServer(); + +describe(SmokeRamps('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 tap the Sell button', async () => { + await TabBarComponent.tapWallet(); + await TabBarComponent.tapActions(); + await WalletActionsModal.tapSellButton(); + await SellGetStartedView.tapGetStartedButton(); + }); + +}); From e23ea0ab7abe9f67e9f4389c6913a9180b510f6b Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Wed, 2 Oct 2024 19:08:47 -0700 Subject: [PATCH 12/13] test: move assertions to test file --- e2e/pages/Ramps/BuildQuoteView.js | 6 ------ e2e/specs/ramps/onramp.spec.js | 6 ++++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/e2e/pages/Ramps/BuildQuoteView.js b/e2e/pages/Ramps/BuildQuoteView.js index b2b6eec5811..dbdc2e524ed 100644 --- a/e2e/pages/Ramps/BuildQuoteView.js +++ b/e2e/pages/Ramps/BuildQuoteView.js @@ -1,6 +1,5 @@ import Matchers from '../../utils/Matchers'; import { BuildQuoteSelectors } from '../../selectors/Ramps/BuildQuote.selectors'; -import Assertions from '../../utils/Assertions'; class BuildQuoteView { get amountToBuyLabel() { @@ -9,11 +8,6 @@ class BuildQuoteView { get getQuotesButton() { return Matchers.getElementByText(BuildQuoteSelectors.GET_QUOTES_BUTTON); } - - async verifyBuildQuoteViewVisible() { - await Assertions.checkIfVisible(this.amountToBuyLabel); - await Assertions.checkIfVisible(this.getQuotesButton); - } } export default new BuildQuoteView(); diff --git a/e2e/specs/ramps/onramp.spec.js b/e2e/specs/ramps/onramp.spec.js index 8b54d3e1a4a..90f170d2ef6 100644 --- a/e2e/specs/ramps/onramp.spec.js +++ b/e2e/specs/ramps/onramp.spec.js @@ -16,6 +16,7 @@ import BuyGetStartedView from '../../pages/Ramps/BuyGetStartedView'; import SelectRegionView from '../../pages/Ramps/SelectRegionView'; import SelectPaymentMethodView from '../../pages/Ramps/SelectPaymentMethodView'; import BuildQuoteView from '../../pages/Ramps/BuildQuoteView'; +import Assertions from '../../utils/Assertions'; const fixtureServer = new FixtureServer(); @@ -50,8 +51,9 @@ describe(SmokeAssets('Buy Crypto'), () => { await SelectRegionView.tapRegionOption('California'); await SelectRegionView.tapContinueButton(); await SelectPaymentMethodView.tapPaymentMethodOption('Debit or Credit'); - await SelectPaymentMethodView.tapContinueButton(); - await BuildQuoteView.verifyBuildQuoteViewVisible(); + await SelectPaymentMethodView.tapContinueButton(); + await Assertions.checkIfVisible(BuildQuoteView.amountToBuyLabel); + await Assertions.checkIfVisible(BuildQuoteView.getQuotesButton); }); }); From 291ad35cc2edfaef8a64d7e979714af351c05f26 Mon Sep 17 00:00:00 2001 From: Brendan Kirby Date: Wed, 2 Oct 2024 19:52:59 -0700 Subject: [PATCH 13/13] test: finish test for building sell quote --- e2e/pages/Ramps/BuildQuoteView.js | 5 +++++ e2e/pages/modals/WalletActionsModal.js | 8 ++++++++ e2e/selectors/Ramps/BuildQuote.selectors.js | 1 + e2e/specs/ramps/offramp.spec.js | 17 ++++++++++++++--- e2e/specs/ramps/onramp.spec.js | 2 +- 5 files changed, 29 insertions(+), 4 deletions(-) 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/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 index 4b09b6e2446..8c3644a4ac4 100644 --- a/e2e/specs/ramps/offramp.spec.js +++ b/e2e/specs/ramps/offramp.spec.js @@ -12,13 +12,16 @@ 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'; +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(SmokeRamps('OffRamp'), () => { +describe(SmokeAssets('OffRamp'), () => { beforeAll(async () => { await TestHelpers.reverseServerPort(); const fixture = new FixtureBuilder() @@ -41,11 +44,19 @@ describe(SmokeRamps('OffRamp'), () => { jest.setTimeout(150000); }); - it('should tap the Sell button', async () => { + 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();