From 09d3757845d601e2052bc6bed66a55e92f8c879f Mon Sep 17 00:00:00 2001 From: seaona Date: Wed, 19 Apr 2023 11:28:39 +0200 Subject: [PATCH 1/6] Send ETH with Ganache network --- wdio.conf.js | 22 ++++++-- wdio/features/Confirmations/SendEth.feature | 56 +++++++++++++++++++++ 2 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 wdio/features/Confirmations/SendEth.feature diff --git a/wdio.conf.js b/wdio.conf.js index e86e4f7d585..c383dfa24f8 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -1,6 +1,10 @@ import generateTestReports from './wdio/utils/generateTestReports'; +import Ganache from './app/util/test/ganache'; +import Accounts from './wdio/helpers/Accounts'; const { removeSync } = require('fs-extra'); +const ganacheServer = new Ganache(); +const validAccount = Accounts.getValidAccount(); export const config = { // @@ -28,6 +32,10 @@ export const config = { // specs: ['./wdio/features/*.feature', './wdio/features/**/*.feature'], + suites: { + confirmations: ['./wdio/features/Confirmations/*.feature'] + }, + // Patterns to exclude. exclude: [ // 'path/to/excluded/files' @@ -277,8 +285,11 @@ export const config = { * @param {String} uri path to feature file * @param {GherkinDocument.IFeature} feature Cucumber feature object */ - // beforeFeature: function (uri, feature) { - // }, + beforeFeature: async function (uri, feature) { + if(uri.includes('Confirmations')) { + await ganacheServer.start({ mnemonic: validAccount.seedPhrase }); + } + }, /** * * Runs before a Cucumber Scenario. @@ -333,8 +344,11 @@ export const config = { * @param {String} uri path to feature file * @param {GherkinDocument.IFeature} feature Cucumber feature object */ - // afterFeature: function (uri, feature) { - // }, + afterFeature: async function (uri, feature) { + if(uri.includes('Confirmations')) { + await ganacheServer.quit(); + } + }, /** * Runs after a WebdriverIO command gets executed diff --git a/wdio/features/Confirmations/SendEth.feature b/wdio/features/Confirmations/SendEth.feature new file mode 100644 index 00000000000..6d7b391f58d --- /dev/null +++ b/wdio/features/Confirmations/SendEth.feature @@ -0,0 +1,56 @@ +@androidApp +@ChainScenarios +@regression + +Feature: Sending ETH to an Externally Owned Account (EOA) + A user should be able to send ETH to another EOA address. + + Scenario: Import 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: Setting up Ganache local network + Given I tap on the burger menu + And I tap on "Settings" in the menu + And In settings I tap on "Networks" + And I tap on the Add Network button + Then "POPULAR" tab is displayed on networks screen + And "CUSTOM NETWORKS" tab is displayed on networks screen + + When I tap on the "CUSTOM NETWORKS" tab + + When I type "" into Network name field + And I type "" into the RPC url field + And I type "" into the Chain ID field + And I type "" into the Network symbol field + + When I tap on the Add button + And I tap on Got it in the network education modal + Then I should see the added network name "" in the top navigation bar + + Examples: + | Network | rpcUrl | ChainID | Symbol | + | Localhost 8545 | http://localhost:8545 | 1337 | ETH | + + Scenario Outline: Sending ETH to an EOA from inside MetaMask wallet + When On the Main Wallet view I tap "ETHER" + And On the Main Wallet view I tap "Send" + And I enter address "
" 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 + 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 + + When I tap button "Send" on Confirm Amount view + Then I am taken to the token overview screen + And the transaction is submitted with Transaction Complete! toast appearing + + + Examples: + | Address | Amount | + | 0x1FDb169Ef12954F20A15852980e1F0C122BfC1D6 | 1 | \ No newline at end of file From e38ff8d48e3aae29c82054bdc013fdc84e4954c0 Mon Sep 17 00:00:00 2001 From: seaona Date: Wed, 19 Apr 2023 16:27:01 +0200 Subject: [PATCH 2/6] Move Ganache initialization to common steps --- wdio.conf.js | 18 ++++-------------- .../{SendEth.feature => SendEthEOA.feature} | 7 ++++--- wdio/step-definitions/common-steps.js | 13 +++++++++++++ 3 files changed, 21 insertions(+), 17 deletions(-) rename wdio/features/Confirmations/{SendEth.feature => SendEthEOA.feature} (94%) diff --git a/wdio.conf.js b/wdio.conf.js index c383dfa24f8..7ff4acb4e96 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -1,10 +1,6 @@ import generateTestReports from './wdio/utils/generateTestReports'; -import Ganache from './app/util/test/ganache'; -import Accounts from './wdio/helpers/Accounts'; const { removeSync } = require('fs-extra'); -const ganacheServer = new Ganache(); -const validAccount = Accounts.getValidAccount(); export const config = { // @@ -285,11 +281,8 @@ export const config = { * @param {String} uri path to feature file * @param {GherkinDocument.IFeature} feature Cucumber feature object */ - beforeFeature: async function (uri, feature) { - if(uri.includes('Confirmations')) { - await ganacheServer.start({ mnemonic: validAccount.seedPhrase }); - } - }, + // beforeFeature: async function (uri, feature) { + // }, /** * * Runs before a Cucumber Scenario. @@ -344,11 +337,8 @@ export const config = { * @param {String} uri path to feature file * @param {GherkinDocument.IFeature} feature Cucumber feature object */ - afterFeature: async function (uri, feature) { - if(uri.includes('Confirmations')) { - await ganacheServer.quit(); - } - }, + // afterFeature: async function (uri, feature) { + // }, /** * Runs after a WebdriverIO command gets executed diff --git a/wdio/features/Confirmations/SendEth.feature b/wdio/features/Confirmations/SendEthEOA.feature similarity index 94% rename from wdio/features/Confirmations/SendEth.feature rename to wdio/features/Confirmations/SendEthEOA.feature index 6d7b391f58d..af69637bd56 100644 --- a/wdio/features/Confirmations/SendEth.feature +++ b/wdio/features/Confirmations/SendEthEOA.feature @@ -2,7 +2,7 @@ @ChainScenarios @regression -Feature: Sending ETH to an Externally Owned Account (EOA) +Feature: Sending ETH to an EOA A user should be able to send ETH to another EOA address. Scenario: Import wallet @@ -12,6 +12,7 @@ Feature: Sending ETH to an Externally Owned Account (EOA) And I tap No thanks on the onboarding welcome tutorial Scenario: Setting up Ganache local network + Given Ganache server is started Given I tap on the burger menu And I tap on "Settings" in the menu And In settings I tap on "Networks" @@ -49,8 +50,8 @@ Feature: Sending ETH to an Externally Owned Account (EOA) When I tap button "Send" on Confirm Amount view Then I am taken to the token overview screen And the transaction is submitted with Transaction Complete! toast appearing - - + Then Ganache server is stopped + Examples: | Address | Amount | | 0x1FDb169Ef12954F20A15852980e1F0C122BfC1D6 | 1 | \ No newline at end of file diff --git a/wdio/step-definitions/common-steps.js b/wdio/step-definitions/common-steps.js index bf8bef30c71..d1b8d42d711 100644 --- a/wdio/step-definitions/common-steps.js +++ b/wdio/step-definitions/common-steps.js @@ -14,6 +14,11 @@ import OnboardingWizardModal from '../screen-objects/Modals/OnboardingWizardModa import LoginScreen from '../screen-objects/LoginScreen'; import TermOfUseScreen from '../screen-objects/Modals/TermOfUseScreen'; +import Ganache from '../../app/util/test/ganache'; + +const ganacheServer = new Ganache(); +const validAccount = Accounts.getValidAccount(); + Then(/^the Welcome Screen is displayed$/, async () => { await WelcomeScreen.waitForScreenToDisplay(); }); @@ -222,3 +227,11 @@ When(/^the toast is displayed$/, async () => { await CommonScreen.waitForToastToDisplay(); await CommonScreen.waitForToastToDisappear(); }); + +Given(/^Ganache server is started$/, async () => { + await ganacheServer.start({ mnemonic: validAccount.seedPhrase }); +}); + +Then(/^Ganache server is stopped$/, async () => { + await ganacheServer.quit(); +}); \ No newline at end of file From 714fd9e3f4bd78e28c563dba3099dcd6065943b9 Mon Sep 17 00:00:00 2001 From: seaona Date: Wed, 19 Apr 2023 16:28:20 +0200 Subject: [PATCH 3/6] Remove unneeded async --- wdio.conf.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wdio.conf.js b/wdio.conf.js index 7ff4acb4e96..285f8da7b28 100644 --- a/wdio.conf.js +++ b/wdio.conf.js @@ -281,7 +281,7 @@ export const config = { * @param {String} uri path to feature file * @param {GherkinDocument.IFeature} feature Cucumber feature object */ - // beforeFeature: async function (uri, feature) { + // beforeFeature: function (uri, feature) { // }, /** * @@ -337,7 +337,7 @@ export const config = { * @param {String} uri path to feature file * @param {GherkinDocument.IFeature} feature Cucumber feature object */ - // afterFeature: async function (uri, feature) { + // afterFeature: function (uri, feature) { // }, /** From b2e3735371959fab10dc1a365f7165b415378fb3 Mon Sep 17 00:00:00 2001 From: seaona <54408225+seaona@users.noreply.github.com> Date: Tue, 25 Apr 2023 10:38:16 +0200 Subject: [PATCH 4/6] Update wdio/features/Confirmations/SendEthEOA.feature Co-authored-by: Curtis David --- wdio/features/Confirmations/SendEthEOA.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wdio/features/Confirmations/SendEthEOA.feature b/wdio/features/Confirmations/SendEthEOA.feature index af69637bd56..9d97dd43d2b 100644 --- a/wdio/features/Confirmations/SendEthEOA.feature +++ b/wdio/features/Confirmations/SendEthEOA.feature @@ -13,7 +13,7 @@ Feature: Sending ETH to an EOA Scenario: Setting up Ganache local network Given Ganache server is started - Given I tap on the burger menu + When I tap on the burger menu And I tap on "Settings" in the menu And In settings I tap on "Networks" And I tap on the Add Network button From c36a54cb17ab67c24795442600b0a4a9fabde2b8 Mon Sep 17 00:00:00 2001 From: seaona Date: Tue, 25 Apr 2023 12:22:52 +0200 Subject: [PATCH 5/6] Add extra step for closing new modal --- wdio/features/Confirmations/SendEthEOA.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/wdio/features/Confirmations/SendEthEOA.feature b/wdio/features/Confirmations/SendEthEOA.feature index 9d97dd43d2b..8daab71ca20 100644 --- a/wdio/features/Confirmations/SendEthEOA.feature +++ b/wdio/features/Confirmations/SendEthEOA.feature @@ -13,6 +13,7 @@ Feature: Sending ETH to an EOA Scenario: Setting up Ganache local network Given Ganache server is started + And I close the Whats New modal When I tap on the burger menu And I tap on "Settings" in the menu And In settings I tap on "Networks" From 583d39ac3f1c893fec0a033a2afb4cb28a359e57 Mon Sep 17 00:00:00 2001 From: seaona Date: Fri, 5 May 2023 09:10:50 +0200 Subject: [PATCH 6/6] Add tag @confirmations --- wdio/features/Confirmations/SendEthEOA.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wdio/features/Confirmations/SendEthEOA.feature b/wdio/features/Confirmations/SendEthEOA.feature index 8daab71ca20..0c59cb176a5 100644 --- a/wdio/features/Confirmations/SendEthEOA.feature +++ b/wdio/features/Confirmations/SendEthEOA.feature @@ -1,5 +1,5 @@ @androidApp -@ChainScenarios +@confirmations @regression Feature: Sending ETH to an EOA