From 36056d23639934d6664844e8ee20b6edea9724ee Mon Sep 17 00:00:00 2001 From: sleepytanya Date: Sun, 30 Jul 2023 22:09:18 -0400 Subject: [PATCH 1/5] Migrate SendEthMultisig test to Detox --- .../confirmations/send-eth-multisig.spec.js | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 e2e/specs/confirmations/send-eth-multisig.spec.js diff --git a/e2e/specs/confirmations/send-eth-multisig.spec.js b/e2e/specs/confirmations/send-eth-multisig.spec.js new file mode 100644 index 00000000000..402f68b085d --- /dev/null +++ b/e2e/specs/confirmations/send-eth-multisig.spec.js @@ -0,0 +1,57 @@ +'use strict'; + +import { Regression } from '../../tags'; +import TestHelpers from '../../helpers'; + +import AmountView from '../../pages/AmountView'; +import SendView from '../../pages/SendView'; +import TransactionConfirmationView from '../../pages/TransactionConfirmView'; +import { + importWalletWithRecoveryPhrase, + addLocalhostNetwork, +} from '../../viewHelper'; +import TabBarComponent from '../../pages/TabBarComponent'; +import WalletActionsModal from '../../pages/modals/WalletActionsModal'; +import Accounts from '../../../wdio/helpers/Accounts'; +import Ganache from '../../../app/util/test/ganache'; + + +const validAccount = Accounts.getValidAccount(); +const MULTISIG_ADDRESS = '0x0C1DD822d1Ddf78b0b702df7BF9fD0991D6255A1'; +const AMOUNT_TO_SEND ='0.12345' + +describe(Regression('Send tests'), () => { + let ganacheServer; + beforeAll(async () => { + jest.setTimeout(2500000); + if (device.getPlatform() === 'android') { + await device.reverseTcpPort('8081'); // because on android we need to expose the localhost ports to run ganache + await device.reverseTcpPort('8545'); + } + ganacheServer = new Ganache(); + await ganacheServer.start({ mnemonic: validAccount.seedPhrase }); + }); + + afterAll(async () => { + await ganacheServer.quit(); + }); + + it('Send ETH to a Multisig address from inside MetaMask wallet', async () => { + await importWalletWithRecoveryPhrase(); + await addLocalhostNetwork(); + + await TabBarComponent.tapActions() + await WalletActionsModal.tapSendButton() + + await SendView.inputAddress(MULTISIG_ADDRESS) + await SendView.tapNextButton() + + await AmountView.typeInTransactionAmount(AMOUNT_TO_SEND) + await AmountView.tapNextButton() + + await TransactionConfirmationView.tapConfirmButton(); + await TabBarComponent.tapActivity() + + await TestHelpers.checkIfElementByTextIsVisible(AMOUNT_TO_SEND + ' ETH'); + }); +}); \ No newline at end of file From 5e4ac13ff2ec08c6cb4e26072a3b9d356d11aed1 Mon Sep 17 00:00:00 2001 From: sleepytanya Date: Sun, 30 Jul 2023 23:41:38 -0400 Subject: [PATCH 2/5] Add TabBarComponent.tapActivity method --- e2e/pages/TabBarComponent.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/e2e/pages/TabBarComponent.js b/e2e/pages/TabBarComponent.js index 13e5ad6ffff..51b330d1707 100644 --- a/e2e/pages/TabBarComponent.js +++ b/e2e/pages/TabBarComponent.js @@ -4,6 +4,7 @@ import { TAB_BAR_BROWSER_BUTTON, TAB_BAR_SETTING_BUTTON, TAB_BAR_WALLET_BUTTON, + TAB_BAR_ACTIVITY_BUTTON } from '../../wdio/screen-objects/testIDs/Components/TabBar.testIds'; export default class TabBarComponent { @@ -25,4 +26,8 @@ export default class TabBarComponent { static async tapSettings() { await TestHelpers.waitAndTap(TAB_BAR_SETTING_BUTTON); } -} + + static async tapActivity() { + await TestHelpers.waitAndTap(TAB_BAR_ACTIVITY_BUTTON); + } +} \ No newline at end of file From 267b586d0a03cc9fb4c0968580831c251b87ae00 Mon Sep 17 00:00:00 2001 From: sleepytanya Date: Mon, 31 Jul 2023 00:27:12 -0400 Subject: [PATCH 3/5] Fix linter issues --- e2e/pages/TabBarComponent.js | 4 +- .../confirmations/send-eth-multisig.spec.js | 75 +++++++++---------- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/e2e/pages/TabBarComponent.js b/e2e/pages/TabBarComponent.js index 51b330d1707..96f83e425f1 100644 --- a/e2e/pages/TabBarComponent.js +++ b/e2e/pages/TabBarComponent.js @@ -4,7 +4,7 @@ import { TAB_BAR_BROWSER_BUTTON, TAB_BAR_SETTING_BUTTON, TAB_BAR_WALLET_BUTTON, - TAB_BAR_ACTIVITY_BUTTON + TAB_BAR_ACTIVITY_BUTTON, } from '../../wdio/screen-objects/testIDs/Components/TabBar.testIds'; export default class TabBarComponent { @@ -30,4 +30,4 @@ export default class TabBarComponent { static async tapActivity() { await TestHelpers.waitAndTap(TAB_BAR_ACTIVITY_BUTTON); } -} \ No newline at end of file +} diff --git a/e2e/specs/confirmations/send-eth-multisig.spec.js b/e2e/specs/confirmations/send-eth-multisig.spec.js index 402f68b085d..e606c0e78c7 100644 --- a/e2e/specs/confirmations/send-eth-multisig.spec.js +++ b/e2e/specs/confirmations/send-eth-multisig.spec.js @@ -7,51 +7,50 @@ import AmountView from '../../pages/AmountView'; import SendView from '../../pages/SendView'; import TransactionConfirmationView from '../../pages/TransactionConfirmView'; import { - importWalletWithRecoveryPhrase, - addLocalhostNetwork, + importWalletWithRecoveryPhrase, + addLocalhostNetwork, } from '../../viewHelper'; import TabBarComponent from '../../pages/TabBarComponent'; import WalletActionsModal from '../../pages/modals/WalletActionsModal'; import Accounts from '../../../wdio/helpers/Accounts'; import Ganache from '../../../app/util/test/ganache'; - const validAccount = Accounts.getValidAccount(); const MULTISIG_ADDRESS = '0x0C1DD822d1Ddf78b0b702df7BF9fD0991D6255A1'; -const AMOUNT_TO_SEND ='0.12345' +const AMOUNT_TO_SEND = '0.12345'; describe(Regression('Send tests'), () => { - let ganacheServer; - beforeAll(async () => { - jest.setTimeout(2500000); - if (device.getPlatform() === 'android') { - await device.reverseTcpPort('8081'); // because on android we need to expose the localhost ports to run ganache - await device.reverseTcpPort('8545'); - } - ganacheServer = new Ganache(); - await ganacheServer.start({ mnemonic: validAccount.seedPhrase }); - }); - - afterAll(async () => { - await ganacheServer.quit(); - }); - - it('Send ETH to a Multisig address from inside MetaMask wallet', async () => { - await importWalletWithRecoveryPhrase(); - await addLocalhostNetwork(); - - await TabBarComponent.tapActions() - await WalletActionsModal.tapSendButton() - - await SendView.inputAddress(MULTISIG_ADDRESS) - await SendView.tapNextButton() - - await AmountView.typeInTransactionAmount(AMOUNT_TO_SEND) - await AmountView.tapNextButton() - - await TransactionConfirmationView.tapConfirmButton(); - await TabBarComponent.tapActivity() - - await TestHelpers.checkIfElementByTextIsVisible(AMOUNT_TO_SEND + ' ETH'); - }); -}); \ No newline at end of file + let ganacheServer; + beforeAll(async () => { + jest.setTimeout(2500000); + if (device.getPlatform() === 'android') { + await device.reverseTcpPort('8081'); // because on android we need to expose the localhost ports to run ganache + await device.reverseTcpPort('8545'); + } + ganacheServer = new Ganache(); + await ganacheServer.start({ mnemonic: validAccount.seedPhrase }); + }); + + afterAll(async () => { + await ganacheServer.quit(); + }); + + it('Send ETH to a Multisig address from inside MetaMask wallet', async () => { + await importWalletWithRecoveryPhrase(); + await addLocalhostNetwork(); + + await TabBarComponent.tapActions(); + await WalletActionsModal.tapSendButton(); + + await SendView.inputAddress(MULTISIG_ADDRESS); + await SendView.tapNextButton(); + + await AmountView.typeInTransactionAmount(AMOUNT_TO_SEND); + await AmountView.tapNextButton(); + + await TransactionConfirmationView.tapConfirmButton(); + await TabBarComponent.tapActivity(); + + await TestHelpers.checkIfElementByTextIsVisible(AMOUNT_TO_SEND + ' ETH'); + }); +}); From 4a4c61befca0b68b32bcf35bf96866dfd2383821 Mon Sep 17 00:00:00 2001 From: sleepytanya Date: Mon, 31 Jul 2023 16:05:09 -0400 Subject: [PATCH 4/5] Replace hardcoded token name with one from en.json --- .../confirmations/send-eth-multisig.spec.js | 7 +++++- .../Confirmations/SendEthMultisig.feature | 25 ------------------- 2 files changed, 6 insertions(+), 26 deletions(-) delete mode 100644 wdio/features/Confirmations/SendEthMultisig.feature diff --git a/e2e/specs/confirmations/send-eth-multisig.spec.js b/e2e/specs/confirmations/send-eth-multisig.spec.js index e606c0e78c7..9fa97c77518 100644 --- a/e2e/specs/confirmations/send-eth-multisig.spec.js +++ b/e2e/specs/confirmations/send-eth-multisig.spec.js @@ -14,10 +14,13 @@ import TabBarComponent from '../../pages/TabBarComponent'; import WalletActionsModal from '../../pages/modals/WalletActionsModal'; import Accounts from '../../../wdio/helpers/Accounts'; import Ganache from '../../../app/util/test/ganache'; +import root from '../../../locales/languages/en.json'; const validAccount = Accounts.getValidAccount(); const MULTISIG_ADDRESS = '0x0C1DD822d1Ddf78b0b702df7BF9fD0991D6255A1'; const AMOUNT_TO_SEND = '0.12345'; +const TOKEN_NAME = root.unit.eth + describe(Regression('Send tests'), () => { let ganacheServer; @@ -51,6 +54,8 @@ describe(Regression('Send tests'), () => { await TransactionConfirmationView.tapConfirmButton(); await TabBarComponent.tapActivity(); - await TestHelpers.checkIfElementByTextIsVisible(AMOUNT_TO_SEND + ' ETH'); + await TestHelpers.checkIfElementByTextIsVisible( + AMOUNT_TO_SEND + ' ' + TOKEN_NAME, + ); }); }); diff --git a/wdio/features/Confirmations/SendEthMultisig.feature b/wdio/features/Confirmations/SendEthMultisig.feature deleted file mode 100644 index f9cc6b8a17c..00000000000 --- a/wdio/features/Confirmations/SendEthMultisig.feature +++ /dev/null @@ -1,25 +0,0 @@ -@androidApp -@confirmations -@regression - -Feature: Send ETH to a Multisig - A user should be able to send ETH to a Multisig address. - @ganache - @multisig - Scenario: should successfully send ETH to a Multisig address from inside MetaMask wallet - Given 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 - And Ganache network is selected - 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 "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 1 to be sent is visible - When I tap button "Send" on Confirm Amount view - Then I am on the main wallet view - When I tap on the Activity tab option - Then "Smart contract interaction" transaction is displayed \ No newline at end of file From 6c879e05341f043fa7a245e168f6021a7aa9d872 Mon Sep 17 00:00:00 2001 From: sleepytanya Date: Mon, 31 Jul 2023 18:06:28 -0400 Subject: [PATCH 5/5] Fix linter finds --- e2e/specs/confirmations/send-eth-multisig.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/e2e/specs/confirmations/send-eth-multisig.spec.js b/e2e/specs/confirmations/send-eth-multisig.spec.js index 9fa97c77518..1b4610288cd 100644 --- a/e2e/specs/confirmations/send-eth-multisig.spec.js +++ b/e2e/specs/confirmations/send-eth-multisig.spec.js @@ -19,8 +19,7 @@ import root from '../../../locales/languages/en.json'; const validAccount = Accounts.getValidAccount(); const MULTISIG_ADDRESS = '0x0C1DD822d1Ddf78b0b702df7BF9fD0991D6255A1'; const AMOUNT_TO_SEND = '0.12345'; -const TOKEN_NAME = root.unit.eth - +const TOKEN_NAME = root.unit.eth; describe(Regression('Send tests'), () => { let ganacheServer;