Merge pull request #1102 from gnosis/AddingTestId

(e2e Tests) Add necessary attributes for Send Funds workflow
This commit is contained in:
Mikhail Mikheev 2020-07-16 16:41:19 +04:00 committed by GitHub
commit 6daf174e7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 41 additions and 13 deletions

View File

@ -64,7 +64,7 @@ const AddressInfo = ({ ethBalance, safeAddress, safeName }: Props) => {
{ethBalance && ( {ethBalance && (
<StyledBlock> <StyledBlock>
<Paragraph noMargin> <Paragraph noMargin>
Balance: <Bold>{`${ethBalance} ETH`}</Bold> Balance: <Bold data-testid="current-eth-balance">{`${ethBalance} ETH`}</Bold>
</Paragraph> </Paragraph>
</StyledBlock> </StyledBlock>
)} )}

View File

@ -72,7 +72,7 @@ const ProviderInfo = ({ classes, connected, network, provider, userAddress }) =>
> >
{providerText} {providerText}
</Paragraph> </Paragraph>
<Paragraph className={classes.address} color={color} noMargin size="xs"> <Paragraph className={classes.address} color={color} noMargin size="xs" data-testid="cut-address">
{cutAddress} {cutAddress}
</Paragraph> </Paragraph>
</Col> </Col>

View File

@ -23,6 +23,7 @@ export const GenericFooter = ({ safeCreationTxHash }: { safeCreationTxHash: stri
href={getEtherScanLink('tx', safeCreationTxHash)} href={getEtherScanLink('tx', safeCreationTxHash)}
rel="noopener noreferrer" rel="noopener noreferrer"
target="_blank" target="_blank"
data-testid="safe-create-etherscan-link"
> >
Etherscan.io Etherscan.io
</EtherScanLink> </EtherScanLink>

View File

@ -72,7 +72,7 @@ const Coins = (props) => {
break break
} }
case BALANCE_TABLE_BALANCE_ID: { case BALANCE_TABLE_BALANCE_ID: {
cellItem = <div>{row[id]}</div> cellItem = <div data-testid={`balance-${row[BALANCE_TABLE_ASSET_ID].symbol}`}>{row[id]}</div>
break break
} }
case BALANCE_TABLE_VALUE_ID: { case BALANCE_TABLE_VALUE_ID: {

View File

@ -110,6 +110,7 @@ const ChooseTxType = ({ onClose, recipientAddress, setActiveScreen }) => {
minWidth={260} minWidth={260}
onClick={() => setActiveScreen('sendFunds')} onClick={() => setActiveScreen('sendFunds')}
variant="contained" variant="contained"
testId="modal-send-funds-btn"
> >
<Img alt="Send funds" className={classNames(classes.leftIcon, classes.iconSmall)} src={Token} /> <Img alt="Send funds" className={classNames(classes.leftIcon, classes.iconSmall)} src={Token} />
Send funds Send funds
@ -122,6 +123,7 @@ const ChooseTxType = ({ onClose, recipientAddress, setActiveScreen }) => {
minWidth={260} minWidth={260}
onClick={() => setActiveScreen('sendCollectible')} onClick={() => setActiveScreen('sendCollectible')}
variant="contained" variant="contained"
testId="modal-send-collectible-btn"
> >
<Img <Img
alt="Send collectible" alt="Send collectible"
@ -138,6 +140,7 @@ const ChooseTxType = ({ onClose, recipientAddress, setActiveScreen }) => {
minWidth={260} minWidth={260}
onClick={() => setActiveScreen('contractInteraction')} onClick={() => setActiveScreen('contractInteraction')}
variant="outlined" variant="outlined"
testId="modal-contract-interaction-btn"
> >
<Img <Img
alt="Contract Interaction" alt="Contract Interaction"

View File

@ -105,7 +105,7 @@ const ReviewTx = ({ closeSnackbar, enqueueSnackbar, onClose, onPrev, tx }) => {
return ( return (
<> <>
<Row align="center" className={classes.heading} grow> <Row align="center" className={classes.heading} grow data-testid="send-funds-review-step">
<Paragraph className={classes.headingText} noMargin weight="bolder"> <Paragraph className={classes.headingText} noMargin weight="bolder">
Send Funds Send Funds
</Paragraph> </Paragraph>
@ -136,7 +136,12 @@ const ReviewTx = ({ closeSnackbar, enqueueSnackbar, onClose, onPrev, tx }) => {
</Col> </Col>
<Col layout="column" xs={11}> <Col layout="column" xs={11}>
<Block justify="left"> <Block justify="left">
<Paragraph className={classes.address} noMargin weight="bolder"> <Paragraph
className={classes.address}
noMargin
weight="bolder"
data-testid="recipient-address-review-step"
>
{tx.recipientAddress} {tx.recipientAddress}
</Paragraph> </Paragraph>
<CopyBtn content={tx.recipientAddress} /> <CopyBtn content={tx.recipientAddress} />
@ -151,12 +156,12 @@ const ReviewTx = ({ closeSnackbar, enqueueSnackbar, onClose, onPrev, tx }) => {
</Row> </Row>
<Row align="center" margin="md"> <Row align="center" margin="md">
<Img alt={txToken.name} height={28} onError={setImageToPlaceholder} src={txToken.logoUri} /> <Img alt={txToken.name} height={28} onError={setImageToPlaceholder} src={txToken.logoUri} />
<Paragraph className={classes.amount} noMargin size="md"> <Paragraph className={classes.amount} noMargin size="md" data-testid={`amount-${txToken.symbol}-review-step`}>
{tx.amount} {txToken.symbol} {tx.amount} {txToken.symbol}
</Paragraph> </Paragraph>
</Row> </Row>
<Row> <Row>
<Paragraph> <Paragraph data-testid="fee-meg-review-step">
{`You're about to create a transaction and will have to confirm it with your currently connected wallet. Make sure you have ${gasCosts} (fee price) ETH in this wallet to fund this confirmation.`} {`You're about to create a transaction and will have to confirm it with your currently connected wallet. Make sure you have ${gasCosts} (fee price) ETH in this wallet to fund this confirmation.`}
</Paragraph> </Paragraph>
</Row> </Row>

View File

@ -57,7 +57,11 @@ const TokenSelectField = ({ classes, initialValue, isValid, tokens }) => (
<ListItemIcon> <ListItemIcon>
<Img alt={token.name} height={28} onError={setImageToPlaceholder} src={token.logoUri} /> <Img alt={token.name} height={28} onError={setImageToPlaceholder} src={token.logoUri} />
</ListItemIcon> </ListItemIcon>
<ListItemText primary={token.name} secondary={`${formatAmount(token.balance)} ${token.symbol}`} /> <ListItemText
primary={token.name}
secondary={`${formatAmount(token.balance)} ${token.symbol}`}
data-testid={`select-token-${token.name}`}
/>
</MenuItem> </MenuItem>
))} ))}
</Field> </Field>

View File

@ -84,7 +84,7 @@ const SendFunds = ({ initialValues, onClose, onNext, recipientAddress, selectedT
return ( return (
<> <>
<Row align="center" className={classes.heading} grow> <Row align="center" className={classes.heading} grow data-testid="modal-title-send-funds">
<Paragraph className={classes.manage} noMargin weight="bolder"> <Paragraph className={classes.manage} noMargin weight="bolder">
Send Funds Send Funds
</Paragraph> </Paragraph>
@ -221,7 +221,11 @@ const SendFunds = ({ initialValues, onClose, onNext, recipientAddress, selectedT
<Paragraph color="disabled" noMargin size="md" style={{ letterSpacing: '-0.5px' }}> <Paragraph color="disabled" noMargin size="md" style={{ letterSpacing: '-0.5px' }}>
Amount Amount
</Paragraph> </Paragraph>
<ButtonLink onClick={() => mutators.setMax(selectedTokenRecord.balance)} weight="bold"> <ButtonLink
onClick={() => mutators.setMax(selectedTokenRecord.balance)}
weight="bold"
testId="send-max-btn"
>
Send max Send max
</ButtonLink> </ButtonLink>
</Col> </Col>
@ -239,6 +243,7 @@ const SendFunds = ({ initialValues, onClose, onNext, recipientAddress, selectedT
placeholder="Amount*" placeholder="Amount*"
text="Amount*" text="Amount*"
type="text" type="text"
testId="amount-input"
validate={composeValidators( validate={composeValidators(
required, required,
mustBeFloat, mustBeFloat,

View File

@ -40,6 +40,7 @@ export const getBalanceData = (activeTokens, currencySelected, currencyValues, c
name: token.name, name: token.name,
logoUri: token.logoUri, logoUri: token.logoUri,
address: token.address, address: token.address,
symbol: token.symbol,
}, },
[buildOrderFieldFrom(BALANCE_TABLE_ASSET_ID)]: token.name, [buildOrderFieldFrom(BALANCE_TABLE_ASSET_ID)]: token.name,
[BALANCE_TABLE_BALANCE_ID]: `${formatAmount(token.balance)} ${token.symbol}`, [BALANCE_TABLE_BALANCE_ID]: `${formatAmount(token.balance)} ${token.symbol}`,

View File

@ -147,6 +147,7 @@ const ApproveTxModal = ({
<FormControlLabel <FormControlLabel
control={<Checkbox checked={approveAndExecute} color="primary" onChange={handleExecuteCheckbox} />} control={<Checkbox checked={approveAndExecute} color="primary" onChange={handleExecuteCheckbox} />}
label="Execute transaction" label="Execute transaction"
data-testid="execute-checkbox"
/> />
)} )}
</> </>

View File

@ -144,9 +144,16 @@ const OwnersColumn = ({
return ( return (
<Col className={classes.rightCol} layout="block" xs={6}> <Col className={classes.rightCol} layout="block" xs={6}>
<Block className={cn(classes.ownerListTitle, (thresholdReached || tx.isExecuted) && classes.ownerListTitleDone)}> <Block
className={cn(classes.ownerListTitle, (thresholdReached || tx.isExecuted) && classes.ownerListTitleDone)}
data-testid={`confirmed-${tx.confirmations.size}-out-of-${txThreshold}`}
>
<div className={classes.circleState}> <div className={classes.circleState}>
<Img alt="" src={thresholdReached || tx.isExecuted ? CheckLargeFilledGreenCircle : ConfirmLargeGreenCircle} /> <Img
alt=""
src={thresholdReached || tx.isExecuted ? CheckLargeFilledGreenCircle : ConfirmLargeGreenCircle}
data-testid={thresholdReached || tx.isExecuted ? 'confirmed-tx-check' : 'not-confirmed-tx-check'}
/>
</div> </div>
{tx.isExecuted {tx.isExecuted
? `Confirmed [${tx.confirmations.size}/${tx.confirmations.size}]` ? `Confirmed [${tx.confirmations.size}/${tx.confirmations.size}]`
@ -169,6 +176,7 @@ const OwnersColumn = ({
classes.ownerListTitle, classes.ownerListTitle,
(cancelThresholdReached || cancelTx.isExecuted) && classes.ownerListTitleCancelDone, (cancelThresholdReached || cancelTx.isExecuted) && classes.ownerListTitleCancelDone,
)} )}
data-testid={`rejected-${cancelTx.confirmations.size}-out-of-${cancelThreshold}`}
> >
<div <div
className={cn(classes.verticalLine, tx.isExecuted ? classes.verticalLineDone : classes.verticalLinePending)} className={cn(classes.verticalLine, tx.isExecuted ? classes.verticalLineDone : classes.verticalLinePending)}

View File

@ -42,7 +42,7 @@ const Status = ({ classes, status }) => {
return ( return (
<Block className={`${classes.container} ${classes[status]}`}> <Block className={`${classes.container} ${classes[status]}`}>
{typeof Icon === 'object' ? Icon : <Img alt={statusToLabel[status]} src={Icon} style={statusIconStyle} />} {typeof Icon === 'object' ? Icon : <Img alt={statusToLabel[status]} src={Icon} style={statusIconStyle} />}
<Paragraph className={classes.statusText} noMargin> <Paragraph className={classes.statusText} noMargin data-testid={`tx-status-${statusToLabel[status]}`}>
{statusToLabel[status]} {statusToLabel[status]}
</Paragraph> </Paragraph>
</Block> </Block>