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 off-ramp test to show build quote screen #11573

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions e2e/pages/Ramps/BuildQuoteView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
15 changes: 15 additions & 0 deletions e2e/pages/Ramps/SellGetStartedView.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 SellGetStartedView {
get getStartedButton() {
return Matchers.getElementByText(GetStartedSelectors.GET_STARTED);
}

async tapGetStartedButton() {
await Gestures.waitAndTap(this.getStartedButton);
}
}

export default new SellGetStartedView();
8 changes: 8 additions & 0 deletions e2e/pages/modals/WalletActionsModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -36,6 +40,10 @@ class WalletActionsModal {
async tapBuyButton() {
await Gestures.waitAndTap(this.buyButton);
}

async tapSellButton() {
await Gestures.waitAndTap(this.sellButton);
}
}

export default new WalletActionsModal();
1 change: 1 addition & 0 deletions e2e/selectors/Ramps/BuildQuote.selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
62 changes: 62 additions & 0 deletions e2e/specs/ramps/offramp.spec.js
Original file line number Diff line number Diff line change
@@ -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);
});

});
2 changes: 1 addition & 1 deletion e2e/specs/ramps/onramp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading