Skip to content

Commit 9811f62

Browse files
authored
test: remove defaultGanacheOptions (#30728)
<!-- 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** In this PR we remove the `defaultGanacheOptions` variable from all specs. 2 reasons: - the default options, are already handled in the node class level, so no need to pass default options in any spec, only custom options - we are going to use anvil, or other nodes, so this custom variable makes no sense anymore Note: skip-e2e-quality-gate is added because we modify several spec files, which can take long to run, reaching timeout as they'll all be rerun + 5 times extra, but there should be no functional change, so e2e should continue to work as before [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/30728?quickstart=1) ## **Related issues** Fixes: MetaMask/MetaMask-planning#4348 ## **Manual testing steps** 1. All specs should continue to work normally ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/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-extension/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.
1 parent bb391c2 commit 9811f62

File tree

11 files changed

+8
-62
lines changed

11 files changed

+8
-62
lines changed

test/e2e/helpers.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -531,17 +531,7 @@ const PRIVATE_KEY_TWO =
531531
const ACCOUNT_1 = '0x5cfe73b6021e818b776b421b1c4db2474086a7e1';
532532
const ACCOUNT_2 = '0x09781764c08de8ca82e156bbf156a3ca217c7950';
533533

534-
const defaultGanacheOptions = {
535-
accounts: [
536-
{
537-
secretKey: PRIVATE_KEY,
538-
balance: convertETHToHexGwei(DEFAULT_GANACHE_ETH_BALANCE_DEC),
539-
},
540-
],
541-
};
542-
543534
const defaultGanacheOptionsForType2Transactions = {
544-
...defaultGanacheOptions,
545535
// EVM version that supports type 2 transactions (EIP1559)
546536
hardfork: 'london',
547537
};
@@ -956,7 +946,6 @@ module.exports = {
956946
switchToOrOpenDapp,
957947
connectToDapp,
958948
multipleGanacheOptions,
959-
defaultGanacheOptions,
960949
defaultGanacheOptionsForType2Transactions,
961950
multipleGanacheOptionsForType2Transactions,
962951
sendTransaction,

test/e2e/json-rpc/eth_newBlockFilter.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { strict as assert } from 'assert';
2-
import { defaultGanacheOptions, withFixtures } from '../helpers';
2+
import { withFixtures } from '../helpers';
33
import { loginWithBalanceValidation } from '../page-objects/flows/login.flow';
44
import FixtureBuilder from '../fixture-builder';
55
import { Driver } from '../webdriver/driver';
66

77
describe('eth_newBlockFilter', function () {
8-
const ganacheOptions: typeof defaultGanacheOptions & { blockTime: number } = {
8+
const ganacheOptions: { blockTime: number } = {
99
blockTime: 0.1,
10-
...defaultGanacheOptions,
1110
};
1211
it('executes a new block filter call', async function () {
1312
await withFixtures(

test/e2e/json-rpc/wallet_addEthereumChain.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import FixtureBuilder from '../fixture-builder';
77
import { Driver } from '../webdriver/driver';
88
import {
99
withFixtures,
10-
defaultGanacheOptions,
1110
openDapp,
1211
unlockWallet,
1312
WINDOW_TITLES,
@@ -479,7 +478,6 @@ describe('Add Ethereum Chain', function () {
479478
fixtures: new FixtureBuilder()
480479
.withPermissionControllerConnectedToTestDappWithChains(['0x539'])
481480
.build(),
482-
localNodeOptions: defaultGanacheOptions,
483481
title: this.test?.fullTitle(),
484482
},
485483
async ({ driver }: { driver: Driver }) => {

test/e2e/tests/confirmations/helpers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { TransactionEnvelopeType } from '@metamask/transaction-controller';
22
import FixtureBuilder from '../../fixture-builder';
33
import {
4-
defaultGanacheOptions,
54
defaultGanacheOptionsForType2Transactions,
65
withFixtures,
76
} from '../../helpers';
@@ -44,7 +43,7 @@ export function withTransactionEnvelopeTypeFixtures(
4443
.build(),
4544
localNodeOptions:
4645
transactionEnvelopeType === TransactionEnvelopeType.legacy
47-
? defaultGanacheOptions
46+
? {}
4847
: defaultGanacheOptionsForType2Transactions,
4948
...(smartContract && { smartContract }),
5049
...(mocks && { testSpecificMock: mocks }),

test/e2e/tests/metrics/metametrics-persistence.spec.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@ const { strict: assert } = require('assert');
22
const FixtureBuilder = require('../../fixture-builder');
33
const {
44
withFixtures,
5-
generateGanacheOptions,
6-
defaultGanacheOptions,
75
unlockWallet,
8-
genRandInitBal,
96
getCleanAppState,
107
} = require('../../helpers');
118

129
describe('MetaMetrics ID persistence', function () {
1310
it('MetaMetrics ID should persist when the user opts-out and then opts-in again of MetaMetrics collection', async function () {
14-
const { initialBalanceInHex } = genRandInitBal();
15-
1611
const initialMetaMetricsId = 'test-metrics-id';
1712

1813
await withFixtures(
@@ -23,14 +18,6 @@ describe('MetaMetrics ID persistence', function () {
2318
participateInMetaMetrics: true,
2419
})
2520
.build(),
26-
localNodeOptions: generateGanacheOptions({
27-
accounts: [
28-
{
29-
secretKey: defaultGanacheOptions.accounts[0].secretKey,
30-
balance: initialBalanceInHex,
31-
},
32-
],
33-
}),
3421
title: this.test.fullTitle(),
3522
},
3623
async ({ driver }) => {

test/e2e/tests/multichain/asset-picker-send.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Context } from 'mocha';
33
import { CHAIN_IDS } from '../../../../shared/constants/network';
44
import FixtureBuilder from '../../fixture-builder';
55
import {
6-
defaultGanacheOptions,
76
openActionMenuAndStartSendFlow,
87
unlockWallet,
98
withFixtures,
@@ -17,7 +16,6 @@ describe('AssetPickerSendFlow', function () {
1716
const fixtures = {
1817
fixtures: new FixtureBuilder({ inputChainId: chainId }).build(),
1918
localNodeOptions: {
20-
...defaultGanacheOptions,
2119
chainId: parseInt(chainId, 16),
2220
},
2321
};

test/e2e/tests/request-queuing/sendTx-revokePermissions.spec.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import TransactionConfirmation from '../../page-objects/pages/confirmations/rede
44
import { Driver } from '../../webdriver/driver';
55
import { DEFAULT_FIXTURE_ACCOUNT } from '../../constants';
66
import FixtureBuilder from '../../fixture-builder';
7-
import {
8-
withFixtures,
9-
defaultGanacheOptions,
10-
WINDOW_TITLES,
11-
} from '../../helpers';
7+
import { withFixtures, WINDOW_TITLES } from '../../helpers';
128

139
describe('Request Queuing', function () {
1410
// TODO: add a new spec which checks that after revoking and connecting again
@@ -22,9 +18,6 @@ describe('Request Queuing', function () {
2218
.withPermissionControllerConnectedToTestDapp()
2319
.withSelectedNetworkControllerPerDomain()
2420
.build(),
25-
localNodeOptions: {
26-
...defaultGanacheOptions,
27-
},
2821
title: this.test?.fullTitle(),
2922
},
3023
async ({ driver }: { driver: Driver }) => {

test/e2e/tests/tokens/add-token-using-search.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { MockedEndpoint, Mockttp } from 'mockttp';
2-
import { defaultGanacheOptions, withFixtures } from '../../helpers';
2+
import { withFixtures } from '../../helpers';
33
import FixtureBuilder from '../../fixture-builder';
44
import { CHAIN_IDS } from '../../../../shared/constants/network';
55
import AssetListPage from '../../page-objects/pages/home/asset-list';
@@ -48,7 +48,6 @@ describe('Add existing token using search', function () {
4848
})
4949
.build(),
5050
localNodeOptions: {
51-
...defaultGanacheOptions,
5251
chainId: parseInt(CHAIN_IDS.BSC, 16),
5352
},
5453
title: this.test?.fullTitle(),

test/e2e/tests/tokens/token-details.spec.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ import { Context } from 'mocha';
33
import { CHAIN_IDS } from '../../../../shared/constants/network';
44
import { formatCurrency } from '../../../../ui/helpers/utils/confirm-tx.util';
55
import FixtureBuilder from '../../fixture-builder';
6-
import {
7-
defaultGanacheOptions,
8-
unlockWallet,
9-
withFixtures,
10-
} from '../../helpers';
6+
import { unlockWallet, withFixtures } from '../../helpers';
117
import { Driver } from '../../webdriver/driver';
128
import HomePage from '../../page-objects/pages/home/homepage';
139
import AssetListPage from '../../page-objects/pages/home/asset-list';
@@ -26,7 +22,6 @@ describe('Token Details', function () {
2622
const fixtures = {
2723
fixtures: new FixtureBuilder({ inputChainId: chainId }).build(),
2824
localNodeOptions: {
29-
...defaultGanacheOptions,
3025
chainId: parseInt(chainId, 16),
3126
},
3227
};

test/e2e/tests/tokens/token-list.spec.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import { zeroAddress } from 'ethereumjs-util';
44
import { Browser } from 'selenium-webdriver';
55
import { CHAIN_IDS } from '../../../../shared/constants/network';
66
import FixtureBuilder from '../../fixture-builder';
7-
import {
8-
defaultGanacheOptions,
9-
unlockWallet,
10-
withFixtures,
11-
} from '../../helpers';
7+
import { unlockWallet, withFixtures } from '../../helpers';
128
import { Driver } from '../../webdriver/driver';
139
import HomePage from '../../page-objects/pages/home/homepage';
1410
import AssetListPage from '../../page-objects/pages/home/asset-list';
@@ -30,7 +26,6 @@ describe('Token List', function () {
3026
const fixtures = {
3127
fixtures: new FixtureBuilder({ inputChainId: chainId }).build(),
3228
localNodeOptions: {
33-
...defaultGanacheOptions,
3429
chainId: parseInt(chainId, 16),
3530
},
3631
};

0 commit comments

Comments
 (0)