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

View File

@ -5,8 +5,10 @@ import Col from '~/components/layout/Col'
import Row from '~/components/layout/Row' import Row from '~/components/layout/Row'
import Paragraph from '~/components/layout/Paragraph/index' import Paragraph from '~/components/layout/Paragraph/index'
export const NO_TRANSACTION_ROW_TEST_ID = 'no-transaction-row'
const NoTransactions = () => ( const NoTransactions = () => (
<Row> <Row data-testid={NO_TRANSACTION_ROW_TEST_ID}>
<Col xs={12} center="xs" sm={10} smOffset={2} start="sm" margin="md"> <Col xs={12} center="xs" sm={10} smOffset={2} start="sm" margin="md">
<Paragraph size="lg"> <Paragraph size="lg">
<Bold>No transactions found for this safe</Bold> <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 { type Transaction } from '~/routes/safe/store/models/transaction'
import { styles } from './style' 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 = { type Props = {
onClose: () => void, onClose: () => void,
@ -115,7 +115,7 @@ const ApproveTxModal = ({
minHeight={42} minHeight={42}
color="primary" color="primary"
onClick={approveTx} onClick={approveTx}
testId={APPROVE_TX_MODAL_SUBMIT_BTN_TESTID} testId={APPROVE_TX_MODAL_SUBMIT_BTN_TEST_ID}
> >
{title} {title}
</Button> </Button>

View File

@ -7,8 +7,8 @@ import Row from '~/components/layout/Row'
import Button from '~/components/layout/Button' import Button from '~/components/layout/Button'
import { sm, lg } from '~/theme/variables' import { sm, lg } from '~/theme/variables'
export const CONFIRM_TX_BTN_TESTID = 'confirm-btn' export const CONFIRM_TX_BTN_TEST_ID = 'confirm-btn'
export const EXECUTE_TX_BTN_TESTID = 'execute-btn' export const EXECUTE_TX_BTN_TEST_ID = 'execute-btn'
type Props = { type Props = {
onTxConfirm: Function, onTxConfirm: Function,
@ -63,7 +63,7 @@ const ButtonRow = ({
minWidth={140} minWidth={140}
color="primary" color="primary"
onClick={onTxConfirm} onClick={onTxConfirm}
testId={CONFIRM_TX_BTN_TESTID} testId={CONFIRM_TX_BTN_TEST_ID}
> >
<EditIcon className={classes.icon} /> <EditIcon className={classes.icon} />
{' '} {' '}
@ -77,7 +77,7 @@ const ButtonRow = ({
minWidth={140} minWidth={140}
color="primary" color="primary"
onClick={onTxExecute} onClick={onTxExecute}
testId={EXECUTE_TX_BTN_TESTID} testId={EXECUTE_TX_BTN_TEST_ID}
> >
<EditIcon className={classes.icon} /> <EditIcon className={classes.icon} />
{' '} {' '}

View File

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

View File

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