-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: initial ramps E2E test to build quote (#11086)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This is the initial foundation for Ramps Mobile E2E tests. This adds the first basic user flow, which is to login, go through onboarding, select region and payment method, and verify the Build Quote view appears. ## **Related issues** https://consensyssoftware.atlassian.net/browse/RAMPS-1858 ## **Manual testing steps** ``` PASS e2e/specs/ramps/onramp.spec.js (43.097 s) SmokeRamps Buy Crypto ✓ should select Region and Payment Method to see the Build Quote screen (15625 ms) Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: 43.154 s ``` ## **Screenshots/Recordings** https://github.com/user-attachments/assets/30eed114-5f32-4989-9b07-65ec818c0381 ## **Pre-merge author checklist** - [x] 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). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] 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. --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Curtis David <Curtis.David7@gmail.com>
- Loading branch information
1 parent
aef9a93
commit ddffe09
Showing
10 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Matchers from '../../utils/Matchers'; | ||
import { BuildQuoteSelectors } from '../../selectors/Ramps/BuildQuote.selectors'; | ||
|
||
class BuildQuoteView { | ||
get amountToBuyLabel() { | ||
return Matchers.getElementByText(BuildQuoteSelectors.AMOUNT_TO_BUY_LABEL); | ||
} | ||
get getQuotesButton() { | ||
return Matchers.getElementByText(BuildQuoteSelectors.GET_QUOTES_BUTTON); | ||
} | ||
} | ||
|
||
export default new BuildQuoteView(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import enContent from '../../../locales/languages/en.json'; | ||
|
||
export const BuildQuoteSelectors = { | ||
AMOUNT_TO_BUY_LABEL: enContent.fiat_on_ramp_aggregator.amount_to_buy, | ||
GET_QUOTES_BUTTON: enContent.fiat_on_ramp_aggregator.get_quotes, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import enContent from '../../../locales/languages/en.json'; | ||
|
||
export const GetStartedSelectors = { | ||
GET_STARTED: enContent.fiat_on_ramp_aggregator.onboarding.get_started, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'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 TestHelpers from '../../helpers'; | ||
import FixtureServer from '../../fixtures/fixture-server'; | ||
import { getFixturesServerPort } from '../../fixtures/utils'; | ||
import { SmokeAssets } from '../../tags'; | ||
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(); | ||
|
||
describe(SmokeAssets('Buy Crypto'), () => { | ||
beforeAll(async () => { | ||
await TestHelpers.reverseServerPort(); | ||
const fixture = new FixtureBuilder().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 Quote screen', async () => { | ||
await TabBarComponent.tapWallet(); | ||
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 Assertions.checkIfVisible(BuildQuoteView.amountToBuyLabel); | ||
await Assertions.checkIfVisible(BuildQuoteView.getQuotesButton); | ||
}); | ||
|
||
}); |