Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: initial ramps E2E test to build quote #11086

Merged
merged 19 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions e2e/pages/Ramps/BuildQuoteView.js
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();
15 changes: 15 additions & 0 deletions e2e/pages/Ramps/BuyGetStartedView.js
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();
21 changes: 21 additions & 0 deletions e2e/pages/Ramps/SelectPaymentMethodView.js
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();
28 changes: 28 additions & 0 deletions e2e/pages/Ramps/SelectRegionView.js
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();
8 changes: 8 additions & 0 deletions e2e/pages/modals/WalletActionsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ class WalletActionsModal {
return Matchers.getElementByID(WalletActionsModalSelectorsIDs.SWAP_BUTTON);
}

get buyButton() {
return Matchers.getElementByID(WalletActionsModalSelectorsIDs.BUY_BUTTON);
}

async tapSendButton() {
await Gestures.waitAndTap(this.sendButton);
}
Expand All @@ -28,6 +32,10 @@ class WalletActionsModal {
async tapSwapButton() {
await Gestures.waitAndTap(this.swapButton);
}

async tapBuyButton() {
await Gestures.waitAndTap(this.buyButton);
}
}

export default new WalletActionsModal();
6 changes: 6 additions & 0 deletions e2e/selectors/Ramps/BuildQuote.selectors.js
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,
};
5 changes: 5 additions & 0 deletions e2e/selectors/Ramps/GetStarted.selectors.js
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,
};
5 changes: 5 additions & 0 deletions e2e/selectors/Ramps/SelectPaymentMethod.selectors.js
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,
};
6 changes: 6 additions & 0 deletions e2e/selectors/Ramps/SelectRegion.selectors.js
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,
};
59 changes: 59 additions & 0 deletions e2e/specs/ramps/onramp.spec.js
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 () => {
bkirb marked this conversation as resolved.
Show resolved Hide resolved
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);
});

});
Loading