TST: batch send test

This commit is contained in:
Ivan Vershigora 2021-02-25 17:32:11 +03:00
parent 723b8a3f2e
commit 660fe14380
2 changed files with 40 additions and 1 deletions

View File

@ -1224,6 +1224,7 @@ export default class SendDetails extends Component {
{this.state.fromWallet.allowBatchSend() && (
<>
<BlueListItem
testID="AddRecipient"
disabled={isSendMaxUsed}
title={loc.send.details_add_rec_add}
hideChevron
@ -1231,6 +1232,7 @@ export default class SendDetails extends Component {
onPress={this.handleAddRecipient}
/>
<BlueListItem
testID="RemoveRecipient"
title={loc.send.details_add_rec_rem}
hideChevron
disabled={this.state.addresses.length < 2}
@ -1334,7 +1336,7 @@ export default class SendDetails extends Component {
renderBitcoinTransactionInfoFields = ({ item, index }) => {
return (
<View style={{ width: this.state.width }}>
<View style={{ width: this.state.width }} testID={'Transaction' + index}>
<BlueBitcoinAmount
isLoading={this.state.isLoading}
amount={item.amount ? item.amount.toString() : null}

View File

@ -418,6 +418,7 @@ describe('BlueWallet UI Tests', () => {
await device.pressBack();
await device.pressBack();
await element(by.id('changeAmountUnitButton')).tap(); // switched to FIAT
await element(by.id('BlueAddressInputScanQrButton')).tap();
// tapping 10 times invisible button is a backdoor:
@ -467,6 +468,42 @@ describe('BlueWallet UI Tests', () => {
assert.strictEqual(transaction.outs.length, 2);
assert.strictEqual(transaction.outs[0].value, 50000);
// now, testing send many feature
await device.pressBack();
await device.pressBack();
// we already have one output, lest add another two
await element(by.id('advancedOptionsMenuButton')).tap();
await element(by.id('AddRecipient')).tap();
await element(by.id('Transaction0')).swipe('left');
await element(by.id('AddressInput').withAncestor(by.id('Transaction1'))).replaceText('bc1q063ctu6jhe5k4v8ka99qac8rcm2tzjjnuktyrl');
await element(by.id('BitcoinAmountInput').withAncestor(by.id('Transaction1'))).typeText('0.0002\n');
await element(by.id('advancedOptionsMenuButton')).tap();
await element(by.id('AddRecipient')).tap();
await element(by.id('Transaction1')).swipe('left');
await element(by.id('AddressInput').withAncestor(by.id('Transaction2'))).replaceText('bc1q063ctu6jhe5k4v8ka99qac8rcm2tzjjnuktyrl');
await element(by.id('BitcoinAmountInput').withAncestor(by.id('Transaction2'))).typeText('0.0003\n');
// remove second output
await element(by.id('Transaction2')).swipe('right', 'fast', NaN, 0.2);
await element(by.id('advancedOptionsMenuButton')).tap();
await element(by.id('RemoveRecipient')).tap();
// creating and verifying. tx should have 3 outputs
try {
await element(by.id('CreateTransactionButton')).tap();
} catch (_) {}
await element(by.id('TransactionDetailsButton')).tap();
txhex = await extractTextFromElementById('TxhexInput');
transaction = bitcoin.Transaction.fromHex(txhex);
assert.strictEqual(transaction.outs.length, 3);
assert.strictEqual(bitcoin.address.fromOutputScript(transaction.outs[0].script), 'bc1qnapskphjnwzw2w3dk4anpxntunc77v6qrua0f7');
assert.strictEqual(transaction.outs[0].value, 50000);
assert.strictEqual(bitcoin.address.fromOutputScript(transaction.outs[1].script), 'bc1q063ctu6jhe5k4v8ka99qac8rcm2tzjjnuktyrl');
assert.strictEqual(transaction.outs[1].value, 20000);
// now, testing sendMAX feature:
await device.pressBack();