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: address flaky smoke e2e #10219

Merged
merged 12 commits into from
Jul 3, 2024
18 changes: 17 additions & 1 deletion e2e/fixtures/fixture-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { getGanachePort } from './utils';
import { merge } from 'lodash';
import { PopularNetworksList } from '../resources/networks.e2e';
import { CustomNetworks, PopularNetworksList } from '../resources/networks.e2e';
const DAPP_URL = 'localhost';

/**
Expand Down Expand Up @@ -719,6 +719,22 @@ class FixtureBuilder {
return this;
}

withSepoliaNetwork() {
OGPoyraz marked this conversation as resolved.
Show resolved Hide resolved
const fixtures = this.fixture.state.engine.backgroundState;

fixtures.NetworkController = {
isCustomNetwork: true,
providerConfig: {
type: 'rpc',
chainId: CustomNetworks.Sepolia.providerConfig.chainId,
rpcUrl: CustomNetworks.Sepolia.providerConfig.rpcTarget,
nickname: CustomNetworks.Sepolia.providerConfig.nickname,
ticker: CustomNetworks.Sepolia.providerConfig.ticker,
},
};
return this;
}

withPopularNetworks() {
const fixtures = this.fixture.state.engine.backgroundState;
const networkIDs = {}; // Object to store network configurations
Expand Down
5 changes: 3 additions & 2 deletions e2e/pages/Send/TransactionConfirmView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Gestures from '../../utils/Gestures';
import Matchers from '../../utils/Matchers';

import {
EditGasViewSelectorsText,
EditGasViewSelectorsIDs,
Expand Down Expand Up @@ -40,7 +39,7 @@ class TransactionConfirmationView {
}

get transactionAmount() {
return Matchers.getElementByText(
return Matchers.getElementByID(
OGPoyraz marked this conversation as resolved.
Show resolved Hide resolved
TransactionConfirmViewSelectorsIDs.COMFIRM_TXN_AMOUNT,
);
}
Expand Down Expand Up @@ -81,6 +80,8 @@ class TransactionConfirmationView {
}

async tapEstimatedGasLink() {
await Gestures.swipe(this.transactionAmount, 'up', 'fast');
OGPoyraz marked this conversation as resolved.
Show resolved Hide resolved

await Gestures.waitAndTap(this.estimatedGasLink);
}

Expand Down
9 changes: 4 additions & 5 deletions e2e/resources/networks.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { toHex } from '@metamask/controller-utils';
/* eslint-disable @typescript-eslint/no-require-imports, import/no-commonjs */
const InfuraKey = process.env.MM_INFURA_PROJECT_ID;
const infuraProjectId = InfuraKey === 'null' ? '' : InfuraKey;
const TENDERLY_KEY = process.env.TENDERLY_NETWORK_ID;

const PopularNetworksList = {
Avalanche: {
Expand Down Expand Up @@ -85,9 +84,9 @@ const CustomNetworks = {
},
Sepolia: {
providerConfig: {
type: 'mainnet',
chainId: '11155111',
rpcTarget: 'https://sepolia.infura.io/v3/',
type: 'rpc',
chainId: '0xaa36a7',
rpcTarget: `https://sepolia.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161`,
OGPoyraz marked this conversation as resolved.
Show resolved Hide resolved
nickname: 'Sepolia',
ticker: 'SepoliaETH',
},
Expand All @@ -98,7 +97,7 @@ const CustomNetworks = {
providerConfig: {
type: 'rpc',
chainId: '0x1',
rpcUrl: `https://rpc.tenderly.co/fork/${TENDERLY_KEY}`,
rpcUrl: `https://rpc.tenderly.co/fork/bbfe5a2e-2426-4512-a5f8-46ce85fe9ad6`,
OGPoyraz marked this conversation as resolved.
Show resolved Hide resolved
nickname: 'Tenderly',
ticker: 'ETH',
},
Expand Down
14 changes: 1 addition & 13 deletions e2e/specs/confirmations/advanced-gas-fees.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ import WalletActionsModal from '../../pages/modals/WalletActionsModal';
import TestHelpers from '../../helpers';
import Assertions from '../../utils/Assertions';
import { AmountViewSelectorsText } from '../../selectors/SendFlow/AmountView.selectors';
import NetworkListModal from '../../pages/modals/NetworkListModal';
import NetworkEducationModal from '../../pages/modals/NetworkEducationModal';
import { CustomNetworks } from '../../resources/networks.e2e';

const VALID_ADDRESS = '0xebe6CcB6B55e1d094d9c58980Bc10Fed69932cAb';

Expand All @@ -30,7 +27,7 @@ describe(SmokeConfirmations('Advanced Gas Fees and Priority Tests'), () => {
it('should edit priority gas settings and send ETH', async () => {
await withFixtures(
{
fixture: new FixtureBuilder().withGanacheNetwork().build(),
fixture: new FixtureBuilder().withSepoliaNetwork().build(),
restartDevice: true,
ganacheOptions: defaultGanacheOptions,
},
Expand All @@ -40,15 +37,6 @@ describe(SmokeConfirmations('Advanced Gas Fees and Priority Tests'), () => {
// Check that we are on the wallet screen
await WalletView.isVisible();

await WalletView.tapNetworksButtonOnNavBar();
await TestHelpers.delay(2000);
await NetworkListModal.changeNetworkTo(
CustomNetworks.Sepolia.providerConfig.nickname,
);
await Assertions.checkIfVisible(NetworkEducationModal.container);
await NetworkEducationModal.tapGotItButton();
await Assertions.checkIfNotVisible(NetworkEducationModal.container);

//Tap send Icon
await TestHelpers.delay(2000);
await TabBarComponent.tapActions();
Expand Down
4 changes: 2 additions & 2 deletions e2e/specs/settings/fiat-on-testnets.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
import { SmokeCore } from '../../tags';
import { SmokeAssets } from '../../tags';
import SettingsView from '../../pages/Settings/SettingsView';
import TabBarComponent from '../../pages/TabBarComponent';
import { loginToApp } from '../../viewHelper';
Expand All @@ -18,7 +18,7 @@ import { WalletViewSelectorsIDs } from '../../selectors/wallet/WalletView.select

const SEPOLIA = CustomNetworks.Sepolia.providerConfig.nickname;

describe(SmokeCore('Fiat On Testnets Setting'), () => {
describe(SmokeAssets('Fiat On Testnets Setting'), () => {
OGPoyraz marked this conversation as resolved.
Show resolved Hide resolved
beforeEach(async () => {
jest.setTimeout(150000);
await TestHelpers.reverseServerPort();
Expand Down
1 change: 1 addition & 0 deletions e2e/specs/swaps/swap-action-smoke.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ describe(SmokeSwaps('Swap from Actions'), () => {
await SwapView.tapIUnderstandPriceWarning();
await SwapView.swipeToSwap();
await SwapView.waitForSwapToComplete(sourceTokenSymbol, destTokenSymbol);
await Assertions.checkIfVisible(TabBarComponent.tabBarActivityButton);
await TabBarComponent.tapActivity();
await ActivitiesView.isVisible();
await ActivitiesView.tapOnSwapActivity(
Expand Down
Loading