Adjust names for test variables

This commit is contained in:
Germán Martínez 2019-07-18 12:54:52 +02:00
parent a3f2f56dd7
commit 23fe8dca42
6 changed files with 27 additions and 25 deletions

View File

@ -22,9 +22,10 @@ import Balances from './Balances'
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'
export const BALANCES_TAB_BTN_TEST_ID = 'balances-tab-btn'
export const SETTINGS_TAB_BTN_TEST_ID = 'settings-tab-btn'
export const TRANSACTIONS_TAB_BTN_TEST_ID = 'transactions-tab-btn'
export const SAFE_VIEW_NAME_HEADING_TEST_ID = 'safe-name-heading'
type State = {
tabIndex: number,
@ -127,7 +128,7 @@ class Layout extends React.Component<Props, State> {
<Identicon address={address} diameter={50} />
<Block className={classes.name}>
<Row>
<Heading tag="h2" color="secondary" testId={SAFE_VIEW_NAME_HEADING_TESTID}>
<Heading tag="h2" color="secondary" testId={SAFE_VIEW_NAME_HEADING_TEST_ID}>
{name}
</Heading>
{!granted && <Block className={classes.readonly}>Read Only</Block>}
@ -144,9 +145,9 @@ class Layout extends React.Component<Props, State> {
</Block>
<Row>
<Tabs value={tabIndex} onChange={this.handleChange} indicatorColor="secondary" textColor="secondary">
<Tab label="Balances" />
<Tab label="Transactions" data-testid={TRANSACTIONS_TAB_BTN_TESTID} />
<Tab label="Settings" data-testid={SETTINGS_TAB_BTN_TESTID} />
<Tab label="Balances" data-testid={BALANCES_TAB_BTN_TEST_ID} />
<Tab label="Transactions" data-testid={TRANSACTIONS_TAB_BTN_TEST_ID} />
<Tab label="Settings" data-testid={SETTINGS_TAB_BTN_TEST_ID} />
</Tabs>
</Row>
<Hairline color="#c8ced4" />

View File

@ -5,8 +5,10 @@ import Col from '~/components/layout/Col'
import Row from '~/components/layout/Row'
import Paragraph from '~/components/layout/Paragraph/index'
export const NO_TRANSACTION_ROW_TEST_ID = 'no-transaction-row'
const NoTransactions = () => (
<Row>
<Row data-testid={NO_TRANSACTION_ROW_TEST_ID}>
<Col xs={12} center="xs" sm={10} smOffset={2} start="sm" margin="md">
<Paragraph size="lg">
<Bold>No transactions found for this safe</Bold>

View File

@ -16,7 +16,7 @@ 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'
export const APPROVE_TX_MODAL_SUBMIT_BTN_TEST_ID = 'approve-tx-modal-submit-btn'
type Props = {
onClose: () => void,
@ -115,7 +115,7 @@ const ApproveTxModal = ({
minHeight={42}
color="primary"
onClick={approveTx}
testId={APPROVE_TX_MODAL_SUBMIT_BTN_TESTID}
testId={APPROVE_TX_MODAL_SUBMIT_BTN_TEST_ID}
>
{title}
</Button>

View File

@ -7,8 +7,8 @@ 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'
export const CONFIRM_TX_BTN_TEST_ID = 'confirm-btn'
export const EXECUTE_TX_BTN_TEST_ID = 'execute-btn'
type Props = {
onTxConfirm: Function,
@ -63,7 +63,7 @@ const ButtonRow = ({
minWidth={140}
color="primary"
onClick={onTxConfirm}
testId={CONFIRM_TX_BTN_TESTID}
testId={CONFIRM_TX_BTN_TEST_ID}
>
<EditIcon className={classes.icon} />
{' '}
@ -77,7 +77,7 @@ const ButtonRow = ({
minWidth={140}
color="primary"
onClick={onTxExecute}
testId={EXECUTE_TX_BTN_TESTID}
testId={EXECUTE_TX_BTN_TEST_ID}
>
<EditIcon className={classes.icon} />
{' '}

View File

@ -22,7 +22,7 @@ import {
import { styles } from './style'
import Status from './Status'
export const TRANSACTION_ROW_TEST_ID = 'tx-row'
export const TRANSACTION_ROW_TEST_ID = 'transaction-row'
const expandCellStyle = {
paddingLeft: 0,

View File

@ -2,19 +2,18 @@
import { fireEvent, cleanup } from '@testing-library/react'
import { aNewStore } from '~/store'
import { aMinedSafe } from '~/test/builder/safe.redux.builder'
import { sendTokenTo, sendEtherTo } from '~/test/utils/tokenMovements'
import { sendEtherTo } from '~/test/utils/tokenMovements'
import { renderSafeView } from '~/test/builder/safe.dom.utils'
import { getWeb3, getBalanceInEtherOf } from '~/logic/wallets/getWeb3'
import { dispatchAddTokenToList } from '~/test/utils/transactions/moveTokens.helper'
import { sleep } from '~/utils/timer'
import '@testing-library/jest-dom/extend-expect'
import { BALANCE_ROW_TEST_ID } from '~/routes/safe/components/Balances'
import { fillAndSubmitSendFundsForm } from './utils/transactions'
import { TRANSACTIONS_TAB_BTN_TESTID } from '~/routes/safe/components/Layout'
import { TRANSACTIONS_TAB_BTN_TEST_ID } from '~/routes/safe/components/Layout'
import { TRANSACTION_ROW_TEST_ID } from '~/routes/safe/components/TransactionsNew/TxsTable'
import { useTestAccountAt, resetTestAccount } from './utils/accounts'
import { CONFIRM_TX_BTN_TESTID, EXECUTE_TX_BTN_TESTID } from '~/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/ButtonRow'
import { APPROVE_TX_MODAL_SUBMIT_BTN_TESTID } from '~/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal'
import { CONFIRM_TX_BTN_TEST_ID, EXECUTE_TX_BTN_TEST_ID } from '~/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/OwnersColumn/ButtonRow'
import { APPROVE_TX_MODAL_SUBMIT_BTN_TEST_ID } from '~/routes/safe/components/TransactionsNew/TxsTable/ExpandedTx/ApproveTxModal'
afterEach(cleanup)
afterEach(resetTestAccount)
@ -49,7 +48,7 @@ describe('DOM > Feature > Sending Funds', () => {
await fillAndSubmitSendFundsForm(SafeDom, sendButton, ethAmount, accounts[0])
// CONFIRM TX
fireEvent.click(SafeDom.getByTestId(TRANSACTIONS_TAB_BTN_TESTID))
fireEvent.click(SafeDom.getByTestId(TRANSACTIONS_TAB_BTN_TEST_ID))
await sleep(200)
useTestAccountAt(1)
@ -59,17 +58,17 @@ describe('DOM > Feature > Sending Funds', () => {
fireEvent.click(txRows[0])
await sleep(100)
fireEvent.click(SafeDom.getByTestId(CONFIRM_TX_BTN_TESTID))
fireEvent.click(SafeDom.getByTestId(CONFIRM_TX_BTN_TEST_ID))
await sleep(100)
// Travel confirm modal
fireEvent.click(SafeDom.getByTestId(APPROVE_TX_MODAL_SUBMIT_BTN_TESTID))
fireEvent.click(SafeDom.getByTestId(APPROVE_TX_MODAL_SUBMIT_BTN_TEST_ID))
await sleep(500)
// EXECUTE TX
fireEvent.click(SafeDom.getByTestId(EXECUTE_TX_BTN_TESTID))
fireEvent.click(SafeDom.getByTestId(EXECUTE_TX_BTN_TEST_ID))
await sleep(100)
fireEvent.click(SafeDom.getByTestId(APPROVE_TX_MODAL_SUBMIT_BTN_TESTID))
fireEvent.click(SafeDom.getByTestId(APPROVE_TX_MODAL_SUBMIT_BTN_TEST_ID))
await sleep(500)
// THEN