diff --git a/wdio.conf.js b/wdio.conf.js
index a1f0b1bb336a..22ba7730b7a8 100644
--- a/wdio.conf.js
+++ b/wdio.conf.js
@@ -4,6 +4,12 @@ dotenv.config({ path: '.e2e.env' });
import generateTestReports from './wdio/utils/generateTestReports';
import ADB from 'appium-adb';
import { gasApiDown, cleanAllMocks } from './wdio/utils/mocks';
+import {
+ startGanache,
+ stopGanache,
+ deployMultisig,
+ deployErc20,
+ } from './wdio/utils/ganache';
const { removeSync } = require('fs-extra');
export const config = {
@@ -272,7 +278,6 @@ export const config = {
return capabilities.platformName;
};
const adb = await ADB.createADB();
- await adb.reversePort(8000, 8000);
await adb.reversePort(8545, 8545);
},
/**
@@ -296,9 +301,26 @@ export const config = {
* @param {ITestCaseHookParameter} world world object containing information on pickle and test step
* @param {Object} context Cucumber World object
*/
- beforeScenario: ({tags: '@gasApiDown'}, async function (world, context) {
- context.mock = gasApiDown();
- }),
+ beforeScenario: async function (world, context) {
+ const tags = world.pickle.tags;
+
+ if(tags.filter(e => e.name === '@ganache').length > 0){
+ await startGanache();
+ }
+
+ if(tags.filter(e => e.name === '@multisig').length > 0){
+ const multisig = await deployMultisig();
+ context.multisig = multisig;
+ }
+
+ if(tags.filter(e => e.name === '@erc20').length > 0){
+ context.erc20 = await deployErc20();
+ }
+
+ if(tags.filter(e => e.name === '@gasApiDown').length > 0){
+ context.mock = gasApiDown();
+ }
+ },
/**
*
* Runs before a Cucumber Step.
@@ -331,9 +353,17 @@ export const config = {
* @param {number} result.duration duration of scenario in milliseconds
* @param {Object} context Cucumber World object
*/
- afterScenario: ({tags: '@mock'}, async function (world, result, context) {
- cleanAllMocks();
- }),
+ afterScenario: async function (world, context) {
+ const tags = world.pickle.tags;
+
+ if(tags.filter(e => e.name === '@ganache').length > 0){
+ await stopGanache();
+ }
+
+ if(tags.filter(e => e.name === '@mock').length > 0){
+ cleanAllMocks();
+ }
+ },
/**
*
* Runs after a Cucumber Feature.
diff --git a/wdio/features/Confirmations/ApproveERC20.feature b/wdio/features/Confirmations/ApproveERC20.feature
index 52c78c2296eb..d2a6fee4258d 100644
--- a/wdio/features/Confirmations/ApproveERC20.feature
+++ b/wdio/features/Confirmations/ApproveERC20.feature
@@ -2,25 +2,21 @@
@confirmations
@regression
-Feature: Approving an ERC20 token from a dapp
+Feature: Approve an ERC20 token from a dapp
A user should be able to approve an ERC20 token from a dapp.
-
- Scenario: Import wallet
+ @ganache
+ @erc20
+ Scenario: should approve successfully the default token amount suggested by the dapp
Given the app displayed the splash animation
And I have imported my wallet
And I tap No Thanks on the Enable security check screen
And I tap No thanks on the onboarding welcome tutorial
-
- Scenario: Approve an ERC20 token from a dapp with default amount
- Given Ganache server is started
And I close the Whats New modal
And Ganache network is selected
- And ERC20 token contract is deployed
When I navigate to the browser
And I am on Home MetaMask website
And I navigate to "test-dapp-erc20"
And I connect my active wallet to the test dapp
And I scroll to the ERC20 section
And I approve ERC20 tokens
- Then the transaction is submitted with Transaction Complete! toast appearing
- Then Ganache server is stopped
\ No newline at end of file
+ Then the transaction is submitted with Transaction Complete! toast appearing
\ No newline at end of file
diff --git a/wdio/features/Confirmations/DappSendERC20.feature b/wdio/features/Confirmations/SendERC20.feature
similarity index 63%
rename from wdio/features/Confirmations/DappSendERC20.feature
rename to wdio/features/Confirmations/SendERC20.feature
index 35d62ff74649..a67a55562c9d 100644
--- a/wdio/features/Confirmations/DappSendERC20.feature
+++ b/wdio/features/Confirmations/SendERC20.feature
@@ -2,25 +2,21 @@
@confirmations
@regression
-Feature: Sending an ERC20 token from a dapp
- A user should be able to send an ERC20 token from a dapp.
-
- Scenario: Import wallet
+Feature: Send an ERC20 token
+ A user should be able to send an ERC20.
+ @ganache
+ @erc20
+ Scenario: should successfully send an ERC20 token from a dapp
Given the app displayed the splash animation
And I have imported my wallet
And I tap No Thanks on the Enable security check screen
And I tap No thanks on the onboarding welcome tutorial
-
- Scenario: Send ERC20 token from a dapp
- Given Ganache server is started
- And I close the Whats New modal
+ Given I close the Whats New modal
And Ganache network is selected
- And ERC20 token contract is deployed
When I navigate to the browser
And I am on Home MetaMask website
When I navigate to "test-dapp-erc20"
And I connect my active wallet to the test dapp
And I scroll to the ERC20 section
And I transfer ERC20 tokens
- Then the transaction is submitted with Transaction Complete! toast appearing
- Then Ganache server is stopped
\ No newline at end of file
+ Then the transaction is submitted with Transaction Complete! toast appearing
\ No newline at end of file
diff --git a/wdio/features/Confirmations/SendEthEOA.feature b/wdio/features/Confirmations/SendEthEOA.feature
index deaddd669c1c..8923b35546d2 100644
--- a/wdio/features/Confirmations/SendEthEOA.feature
+++ b/wdio/features/Confirmations/SendEthEOA.feature
@@ -2,31 +2,24 @@
@confirmations
@regression
-Feature: Sending ETH to an EOA
+Feature: Send ETH to an EOA
A user should be able to send ETH to another EOA address.
-
- Scenario: Import wallet
+ @ganache
+ Scenario: should successfully send ETH to an EOA from inside MetaMask wallet
Given the app displayed the splash animation
And I have imported my wallet
And I tap No Thanks on the Enable security check screen
And I tap No thanks on the onboarding welcome tutorial
-
- Scenario Outline: Sending ETH to an EOA from inside MetaMask wallet
- Given Ganache server is started
And I close the Whats New modal
And Ganache network is selected
When On the Main Wallet view I tap on the Send Action
- And I enter address "
" in the sender's input box
+ And I enter address "0x1FDb169Ef12954F20A15852980e1F0C122BfC1D6" in the sender's input box
And I tap button "Next" on Send To view
Then I proceed to the amount view
- When I type amount "" into amount input field
+ When I type amount "1" into amount input field
And I tap button "Next" on the Amount view
Then I should be taken to the transaction confirmation view
- And the token amount to be sent is visible
+ And the token amount 1 to be sent is visible
When I tap button "Send" on Confirm Amount view
Then I am on the main wallet view
- And the transaction is submitted with Transaction Complete! toast appearing
- Then Ganache server is stopped
- Examples:
- | Address | Amount |
- | 0x1FDb169Ef12954F20A15852980e1F0C122BfC1D6 | 1 |
+ And the transaction is submitted with Transaction Complete! toast appearing
\ No newline at end of file
diff --git a/wdio/features/Confirmations/SendEthGasApiDown.feature b/wdio/features/Confirmations/SendEthGasApiDown.feature
index c950a1a35e78..de9d1ada3955 100644
--- a/wdio/features/Confirmations/SendEthGasApiDown.feature
+++ b/wdio/features/Confirmations/SendEthGasApiDown.feature
@@ -2,19 +2,16 @@
@confirmations
@regression
-Feature: Sending ETH when Gas API is down
+Feature: Send ETH with Gas API down
A user should be able to send ETH when the Gas API is down.
-
- Scenario: Import wallet
+ @ganache
+ @mock
+ @gasApiDown
+ Scenario: should display fallback gas properties on the Gas Edit screen
Given the app displayed the splash animation
And I have imported my wallet
And I tap No Thanks on the Enable security check screen
And I tap No thanks on the onboarding welcome tutorial
-
- @mock
- @gasApiDown
- Scenario: Display fallback on the Gas Edit screen
- Given Ganache server is started
And I close the Whats New modal
And Ganache network is selected
When On the Main Wallet view I tap on the Send Action
@@ -30,5 +27,4 @@ Feature: Sending ETH when Gas API is down
When I tap Save Gas Values
When I tap button "Send" on Confirm Amount view
Then I am on the main wallet view
- And the transaction is submitted with Transaction Complete! toast appearing
- And Ganache server is stopped
\ No newline at end of file
+ And the transaction is submitted with Transaction Complete! toast appearing
\ No newline at end of file
diff --git a/wdio/features/Confirmations/SendEthMultisig.feature b/wdio/features/Confirmations/SendEthMultisig.feature
index d2886efcf6a4..dd706aa086f4 100644
--- a/wdio/features/Confirmations/SendEthMultisig.feature
+++ b/wdio/features/Confirmations/SendEthMultisig.feature
@@ -2,32 +2,25 @@
@confirmations
@regression
-Feature: Sending ETH to a Multisig
+Feature: Send ETH to a Multisig
A user should be able to send ETH to a Multisig address.
-
- Scenario: Import wallet
+ @ganache
+ @multisig
+ Scenario: should successfully send ETH to a Multisig address from inside MetaMask wallet
Given the app displayed the splash animation
And I have imported my wallet
And I tap No Thanks on the Enable security check screen
And I tap No thanks on the onboarding welcome tutorial
-
- Scenario Outline: Sending ETH to a Multisig address from inside MetaMask wallet
- Given Ganache server is started
And I close the Whats New modal
And Ganache network is selected
- And Multisig contract is deployed
When On the Main Wallet view I tap on the Send Action
And I enter address "MultisigAddress" in the sender's input box
When I tap button "Next" on Send To view
Then I proceed to the amount view
- When I type amount "" into amount input field
+ When I type amount "1" into amount input field
And I tap button "Next" on the Amount view
Then I should be taken to the transaction confirmation view
- And the token amount to be sent is visible
+ And the token amount 1 to be sent is visible
When I tap button "Send" on Confirm Amount view
Then I am on the main wallet view
- And the transaction is submitted with Transaction Complete! toast appearing
- Then Ganache server is stopped
- Examples:
- | Amount |
- | 1 |
\ No newline at end of file
+ And the transaction is submitted with Transaction Complete! toast appearing
\ No newline at end of file
diff --git a/wdio/screen-objects/TransactionConfirmScreen.js b/wdio/screen-objects/TransactionConfirmScreen.js
index d172fad81a01..fbc35ca6cb08 100644
--- a/wdio/screen-objects/TransactionConfirmScreen.js
+++ b/wdio/screen-objects/TransactionConfirmScreen.js
@@ -6,7 +6,6 @@ import {
import { ESTIMATED_FEE_TEST_ID } from './testIDs/Screens/TransactionSummaryScreen.testIds';
import { MAX_PRIORITY_FEE_INPUT_TEST_ID, SAVE_GAS_FEE_TEST_ID } from './testIDs/Screens/EditGasFeeScreen.testids';
import Gestures from '../helpers/Gestures';
-import { ESTIMATED_FEE_TEST_ID } from './testIDs/Screens/TransactionSummaryScreen.testIds';
class TransactionConfirmScreen {
get confirmAmount() {
diff --git a/wdio/step-definitions/send-flow.steps.js b/wdio/step-definitions/send-flow.steps.js
index a5e927fbcdfe..ad6ea56af41f 100644
--- a/wdio/step-definitions/send-flow.steps.js
+++ b/wdio/step-definitions/send-flow.steps.js
@@ -27,7 +27,7 @@ Then(/^I tap the Save button/, async () => {
Given(
/^I enter address "([^"]*)?" in the sender's input box/,
- async (address) => {
+ async function (address) {
await CommonScreen.checkNoNotification(); // Notification appears a little late and inteferes with clicking function
switch (address) {
case 'MultisigAddress':
diff --git a/wdio/step-definitions/ganache-steps.js b/wdio/utils/ganache.js
similarity index 64%
rename from wdio/step-definitions/ganache-steps.js
rename to wdio/utils/ganache.js
index 67cb324f1d11..e48124a40315 100644
--- a/wdio/step-definitions/ganache-steps.js
+++ b/wdio/utils/ganache.js
@@ -1,4 +1,3 @@
-import { Given, Then } from '@wdio/cucumber-framework';
import Accounts from '../helpers/Accounts';
import Ganache from '../../app/util/test/ganache';
import { SMART_CONTRACTS } from '../../app/util/test/smart-contracts';
@@ -7,24 +6,26 @@ import GanacheSeeder from '../../app/util/test/ganache-seeder';
const ganacheServer = new Ganache();
const validAccount = Accounts.getValidAccount();
-Given(/^Ganache server is started$/, async () => {
+export const startGanache = async () => {
await ganacheServer.start({ mnemonic: validAccount.seedPhrase });
-});
+}
-Then(/^Ganache server is stopped$/, async () => {
+export const stopGanache = async () => {
await ganacheServer.quit();
-});
+}
-Given(/^Multisig contract is deployed$/, async function() {
+export const deployMultisig = async () => {
const ganacheSeeder = await new GanacheSeeder(ganacheServer.getProvider());
await ganacheSeeder.deploySmartContract(SMART_CONTRACTS.MULTISIG);
const contractRegistry = ganacheSeeder.getContractRegistry();
- this.multisig = await contractRegistry.getContractAddress(SMART_CONTRACTS.MULTISIG);
-});
+ const multisigAddress = await contractRegistry.getContractAddress(SMART_CONTRACTS.MULTISIG);
+ return multisigAddress;
+}
-Given(/^ERC20 token contract is deployed$/, async function() {
+export const deployErc20 = async () => {
const ganacheSeeder = await new GanacheSeeder(ganacheServer.getProvider());
await ganacheSeeder.deploySmartContract(SMART_CONTRACTS.HST);
const contractRegistry = ganacheSeeder.getContractRegistry();
- this.erc20 = await contractRegistry.getContractAddress(SMART_CONTRACTS.HST);
-});
\ No newline at end of file
+ const erc20Address = await contractRegistry.getContractAddress(SMART_CONTRACTS.HST);
+ return erc20Address;
+}