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: Enhance ramps deeplink e2e #12821

Merged
merged 9 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 8 additions & 0 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ stages:
- run_tag_smoke_assets_android: {}
- run_tag_smoke_confirmations_ios: {}
- run_tag_smoke_confirmations_android: {}
- run_tag_smoke_ramps_ios: {}
# - run_tag_smoke_swaps_ios: {}
# - run_tag_smoke_swaps_android: {}
- run_tag_smoke_core_ios: {}
Expand All @@ -182,6 +183,7 @@ stages:
- run_tag_smoke_confirmations_android: {}
- run_tag_smoke_accounts_ios: {}
- run_tag_smoke_accounts_android: {}
- run_tag_smoke_ramps_ios: {}
# - run_tag_smoke_identity_ios: {}
# - run_tag_smoke_identity_android: {}
# - run_tag_smoke_assets_ios: {}
Expand Down Expand Up @@ -699,6 +701,12 @@ workflows:
- TEST_SUITE_TAG: '.*SmokeMultiChainPermissions.*'
after_run:
- android_e2e_test
run_tag_smoke_ramps_ios:
envs:
- TEST_SUITE_FOLDER: './e2e/specs/ramps/*'
- TEST_SUITE_TAG: '.*SmokeRamps.*'
after_run:
- ios_e2e_test
android_e2e_build:
before_run:
- code_setup
Expand Down
20 changes: 6 additions & 14 deletions e2e/pages/Network/NetworkAddedBottomSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,15 @@ class NetworkAddedBottomSheet {
}

get switchNetworkButton() {
return device.getPlatform() === 'android'
? Matchers.getElementByLabel(
NetworkAddedBottomSheetSelectorsIDs.SWITCH_NETWORK_BUTTON,
)
: Matchers.getElementByID(
NetworkAddedBottomSheetSelectorsIDs.SWITCH_NETWORK_BUTTON,
);
return Matchers.getElementByID(
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
NetworkAddedBottomSheetSelectorsIDs.SWITCH_NETWORK_BUTTON,
);
}

get closeNetworkButton() {
return device.getPlatform() === 'android'
? Matchers.getElementByLabel(
NetworkAddedBottomSheetSelectorsIDs.CLOSE_NETWORK_BUTTON,
)
: Matchers.getElementByID(
NetworkAddedBottomSheetSelectorsIDs.CLOSE_NETWORK_BUTTON,
);
return Matchers.getElementByID(
NetworkAddedBottomSheetSelectorsIDs.CLOSE_NETWORK_BUTTON,
);
}

async tapSwitchToNetwork() {
Expand Down
2 changes: 1 addition & 1 deletion e2e/resources/networks.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const PopularNetworksList = {
type: 'rpc',
chainId: toHex('10'),
rpcUrl: `https://optimism-mainnet.infura.io/v3/${infuraProjectId}`,
nickname: 'Optimism',
nickname: 'OP Mainnet',
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
ticker: 'ETH',
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import TestHelpers from '../../helpers';

import { loginToApp } from '../../viewHelper';
import { withFixtures } from '../../fixtures/fixture-helper';
import { SmokeCore } from '../../tags';
import { SmokeRamps } from '../../tags';
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
import FixtureBuilder from '../../fixtures/fixture-builder';

import SellGetStartedView from '../../pages/Ramps/SellGetStartedView';
Expand All @@ -13,8 +13,10 @@ import Assertions from '../../utils/Assertions';
import NetworkAddedBottomSheet from '../../pages/Network/NetworkAddedBottomSheet';
import NetworkApprovalBottomSheet from '../../pages/Network/NetworkApprovalBottomSheet';
import NetworkEducationModal from '../../pages/Network/NetworkEducationModal';
import NetworkListModal from '../../pages/Network/NetworkListModal';
import { PopularNetworksList } from '../../resources/networks.e2e';

describe(SmokeCore('Buy Crypto Deeplinks'), () => {
describe(SmokeRamps('Buy Crypto Deeplinks'), () => {
beforeAll(async () => {
await TestHelpers.reverseServerPort();
});
Expand All @@ -23,9 +25,8 @@ describe(SmokeCore('Buy Crypto Deeplinks'), () => {
jest.setTimeout(150000);
});

it('should deep link to onramp on Base network', async () => {
const BuyDeepLink =
'metamask://buy?chainId=8453&address=0x833589fcd6edb6e08f4c7c32d4f71b54bda02913&amount=12';
it('should deep link to onramp to unsupported network', async () => {
const BuyDeepLink = 'metamask://buy?chainId=2';

await withFixtures(
{
Expand All @@ -45,12 +46,16 @@ describe(SmokeCore('Buy Crypto Deeplinks'), () => {

await BuyGetStartedView.tapGetStartedButton();

await Assertions.checkIfVisible(NetworkApprovalBottomSheet.container);
await Assertions.checkIfTextIsDisplayed('Unsupported buy Network');
await NetworkListModal.changeNetworkTo(
PopularNetworksList.Polygon.providerConfig.nickname,
);
await NetworkApprovalBottomSheet.tapApproveButton();
await NetworkAddedBottomSheet.tapSwitchToNetwork();
await NetworkAddedBottomSheet.tapCloseButton();
await Assertions.checkIfVisible(NetworkEducationModal.container);
await NetworkEducationModal.tapGotItButton();
await Assertions.checkIfTextIsDisplayed('USD Coin');
await Assertions.checkIfTextIsNotDisplayed('Unsupported buy Network');
await Assertions.checkIfTextIsDisplayed('Polygon Ecosystem Token');
},
);
});
Expand Down
40 changes: 38 additions & 2 deletions e2e/specs/ramps/deeplink-to-buy-flow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import TestHelpers from '../../helpers';

import { loginToApp } from '../../viewHelper';
import { withFixtures } from '../../fixtures/fixture-helper';
import { SmokeCore } from '../../tags';
import { SmokeRamps } from '../../tags';
import FixtureBuilder from '../../fixtures/fixture-builder';

import SellGetStartedView from '../../pages/Ramps/SellGetStartedView';
Expand All @@ -13,7 +13,9 @@ import BuildQuoteView from '../../pages/Ramps/BuildQuoteView';
import TokenSelectBottomSheet from '../../pages/Ramps/TokenSelectBottomSheet';
import Assertions from '../../utils/Assertions';

describe(SmokeCore('Buy Crypto Deeplinks'), () => {
import { PopularNetworksList } from '../../resources/networks.e2e';
import NetworkEducationModal from '../../pages/Network/NetworkEducationModal';
describe(SmokeRamps('Buy Crypto Deeplinks'), () => {
beforeAll(async () => {
await TestHelpers.reverseServerPort();
});
Expand Down Expand Up @@ -52,4 +54,38 @@ describe(SmokeCore('Buy Crypto Deeplinks'), () => {
},
);
});
it('should deep link to onramp on Base network', async () => {
const BuyDeepLink =
'metamask://buy?chainId=8453&address=0x833589fcd6edb6e08f4c7c32d4f71b54bda02913&amount=12';

await withFixtures(
{
fixture: new FixtureBuilder()
.withPopularNetworks()
.withRampsSelectedRegion()
.build(),
restartDevice: true,
},
async () => {
await loginToApp();
await device.sendToHome();
await device.launchApp({
url: BuyDeepLink,
});

await Assertions.checkIfVisible(
await SellGetStartedView.getStartedButton,
);

await BuyGetStartedView.tapGetStartedButton();

await Assertions.checkIfVisible(NetworkEducationModal.container);
await NetworkEducationModal.tapGotItButton();
await Assertions.checkIfTextIsDisplayed('USD Coin');
await Assertions.checkIfTextIsDisplayed(
PopularNetworksList.Base.providerConfig.nickname,
);
},
);
});
});
29 changes: 19 additions & 10 deletions e2e/specs/ramps/deeplink-to-sell-flow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ import { withFixtures } from '../../fixtures/fixture-helper';

import TestHelpers from '../../helpers';
import SellGetStartedView from '../../pages/Ramps/SellGetStartedView';
import { SmokeCore } from '../../tags';
import { SmokeRamps } from '../../tags';

import BuildQuoteView from '../../pages/Ramps/BuildQuoteView';
import Assertions from '../../utils/Assertions';
import NetworkApprovalBottomSheet from '../../pages/Network/NetworkApprovalBottomSheet';
import NetworkAddedBottomSheet from '../../pages/Network/NetworkAddedBottomSheet';
import NetworkEducationModal from '../../pages/Network/NetworkEducationModal';
import NetworkListModal from '../../pages/Network/NetworkListModal';
import { PopularNetworksList } from '../../resources/networks.e2e';

describe(SmokeCore('Sell Crypto Deeplinks'), () => {
describe(SmokeRamps('Sell Crypto Deeplinks'), () => {
beforeAll(async () => {
await TestHelpers.reverseServerPort();
});
Expand Down Expand Up @@ -59,8 +61,8 @@ describe(SmokeCore('Sell Crypto Deeplinks'), () => {
},
);
});
it('Should deep link to an unsupported network in the off-ramp flow', async () => {
const unsupportedNetworkSellDeepLink = 'metamask://sell?chainId=56';
it('should deep link to offramp with Base but switch network to OP Mainnet', async () => {
const SellDeepLink = 'metamask://sell?chainId=8453';

await withFixtures(
{
Expand All @@ -69,20 +71,27 @@ describe(SmokeCore('Sell Crypto Deeplinks'), () => {
},
async () => {
await loginToApp();

await device.openURL({
url: unsupportedNetworkSellDeepLink,
await device.sendToHome();
await device.launchApp({
url: SellDeepLink,
});
await Assertions.checkIfVisible(
await SellGetStartedView.getStartedButton,
);

await SellGetStartedView.tapGetStartedButton();

await Assertions.checkIfVisible(NetworkApprovalBottomSheet.container);
await NetworkApprovalBottomSheet.tapCancelButton();
await NetworkListModal.changeNetworkTo(
PopularNetworksList.Optimism.providerConfig.nickname,
);
await NetworkApprovalBottomSheet.tapApproveButton();
await NetworkAddedBottomSheet.tapSwitchToNetwork();
await NetworkAddedBottomSheet.tapCloseButton();
await Assertions.checkIfVisible(NetworkEducationModal.container);
await NetworkEducationModal.tapGotItButton();
await Assertions.checkIfTextIsDisplayed('Ethereum');
await Assertions.checkIfTextIsDisplayed(
PopularNetworksList.Optimism.providerConfig.nickname,
);
},
);
});
Expand Down
4 changes: 2 additions & 2 deletions e2e/specs/ramps/offramp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { CustomNetworks } from '../../resources/networks.e2e';
import TestHelpers from '../../helpers';
import FixtureServer from '../../fixtures/fixture-server';
import { getFixturesServerPort } from '../../fixtures/utils';
import { SmokeCore } from '../../tags';
import { SmokeRamps } from '../../tags';
import Assertions from '../../utils/Assertions';
import SellGetStartedView from '../../pages/Ramps/SellGetStartedView';
import SelectRegionView from '../../pages/Ramps/SelectRegionView';
Expand All @@ -34,7 +34,7 @@ const PaymentMethods = {
ACH_BANK_TRANSFER: 'ACH Bank Transfer',
};

describe(SmokeCore('Off-Ramp'), () => {
describe(SmokeRamps('Off-Ramp'), () => {
beforeAll(async () => {
await TestHelpers.reverseServerPort();
const fixture = new FixtureBuilder()
Expand Down
4 changes: 2 additions & 2 deletions e2e/specs/ramps/onramp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import TestHelpers from '../../helpers';
import FixtureServer from '../../fixtures/fixture-server';
import { getFixturesServerPort } from '../../fixtures/utils';
import { SmokeCore } from '../../tags';
import { SmokeRamps } from '../../tags';
import BuyGetStartedView from '../../pages/Ramps/BuyGetStartedView';
import SelectRegionView from '../../pages/Ramps/SelectRegionView';
import SelectPaymentMethodView from '../../pages/Ramps/SelectPaymentMethodView';
Expand All @@ -20,7 +20,7 @@ import Assertions from '../../utils/Assertions';

const fixtureServer = new FixtureServer();

describe(SmokeCore('Buy Crypto'), () => {
describe(SmokeRamps('Buy Crypto'), () => {
beforeAll(async () => {
await TestHelpers.reverseServerPort();
const fixture = new FixtureBuilder().build();
Expand Down
3 changes: 3 additions & 0 deletions e2e/tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const tags = {
smokeAssets: 'smokeAssets:',
smokeIdentity: 'smokeIdentity:',
smokeMultiChainPermissions: 'SmokeMultiChainPermissions:',
smokeRamps: 'SmokeRamps:',
cortisiko marked this conversation as resolved.
Show resolved Hide resolved
};

const Regression = (testName) => `${tags.regression} ${testName}`;
Expand All @@ -18,6 +19,7 @@ const SmokeConfirmations = (testName) =>
const SmokeSwaps = (testName) => `${tags.SmokeSwaps} ${testName}`;
const SmokeAssets = (testName) => `${tags.smokeAssets} ${testName}`;
const SmokeIdentity = (testName) => `${tags.smokeIdentity} ${testName}`;
const SmokeRamps = (testName) => `${tags.smokeRamps} ${testName}`;

const SmokeMultiChainPermissions = (testName) =>
`${tags.smokeMultiChainPermissions} ${testName}`;
Expand All @@ -30,4 +32,5 @@ export {
SmokeAssets,
SmokeIdentity,
SmokeMultiChainPermissions,
SmokeRamps,
};
Loading