From abae5ab25a056c2d7f9efe48daa2e0900e01a21c Mon Sep 17 00:00:00 2001 From: mmv Date: Wed, 17 Jul 2019 18:44:23 +0400 Subject: [PATCH] add test for sending funds with threshold = 2 --- src/logic/wallets/getWeb3.js | 4 ++ src/routes/safe/components/Layout.jsx | 3 +- .../ExpandedTx/ApproveTxModal/index.jsx | 3 ++ .../ExpandedTx/OwnersColumn/ButtonRow.jsx | 21 +++++++- .../TransactionsNew/TxsTable/index.jsx | 3 ++ .../safe/store/actions/fetchTransactions.js | 2 +- .../safe/store/actions/processTransaction.js | 4 +- src/test/safe.dom.funds.threshold>1.test.js | 51 ++++++++++--------- src/test/utils/accounts.js | 13 +++++ 9 files changed, 74 insertions(+), 30 deletions(-) create mode 100644 src/test/utils/accounts.js diff --git a/src/logic/wallets/getWeb3.js b/src/logic/wallets/getWeb3.js index 0d7c2865..dd56dd13 100644 --- a/src/logic/wallets/getWeb3.js +++ b/src/logic/wallets/getWeb3.js @@ -57,6 +57,10 @@ const getProviderName: Function = (web3Provider): boolean => { const getAccountFrom: Function = async (web3Provider): Promise => { const accounts = await web3Provider.eth.getAccounts() + if (process.env.NODE_ENV === 'test' && window.testAccountIndex) { + return accounts[window.testAccountIndex] + } + return accounts && accounts.length > 0 ? accounts[0] : null } diff --git a/src/routes/safe/components/Layout.jsx b/src/routes/safe/components/Layout.jsx index 49f8414f..8db502ab 100644 --- a/src/routes/safe/components/Layout.jsx +++ b/src/routes/safe/components/Layout.jsx @@ -23,6 +23,7 @@ import Transactions from './TransactionsNew' import Settings from './Settings' export const SETTINGS_TAB_BTN_TESTID = 'settings-tab-btn' +export const TRANSACTIONS_TAB_BTN_TESTID = 'transactions-tab-btn' export const SAFE_VIEW_NAME_HEADING_TESTID = 'safe-name-heading' type State = { @@ -144,7 +145,7 @@ class Layout extends React.Component { - + diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal/index.jsx b/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal/index.jsx index 35acb344..68174ef9 100644 --- a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal/index.jsx +++ b/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal/index.jsx @@ -16,6 +16,8 @@ import Paragraph from '~/components/layout/Paragraph' import { type Transaction } from '~/routes/safe/store/models/transaction' import { styles } from './style' +export const APPROVE_TX_MODAL_SUBMIT_BTN_TESTID = 'approve-tx-modal-submit-btn' + type Props = { onClose: () => void, classes: Object, @@ -113,6 +115,7 @@ const ApproveTxModal = ({ minHeight={42} color="primary" onClick={approveTx} + testId={APPROVE_TX_MODAL_SUBMIT_BTN_TESTID} > {title} diff --git a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/ButtonRow.jsx b/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/ButtonRow.jsx index 09e87fa5..1ecd5280 100644 --- a/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/ButtonRow.jsx +++ b/src/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/ButtonRow.jsx @@ -7,6 +7,9 @@ import Row from '~/components/layout/Row' import Button from '~/components/layout/Button' import { sm, lg } from '~/theme/variables' +export const CONFIRM_TX_BTN_TESTID = 'confirm-btn' +export const EXECUTE_TX_BTN_TESTID = 'execute-btn' + type Props = { onTxConfirm: Function, onTxCancel: Function, @@ -54,14 +57,28 @@ const ButtonRow = ({ )} {showConfirmBtn && ( - )} {showExecuteBtn && ( -