mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-01-19 05:45:15 +01:00
FIX: minor fix on send screen; TST: e2e test for scan BIP21
This commit is contained in:
parent
6ce1f36d66
commit
b4528c3099
@ -2258,6 +2258,7 @@ export class BlueAddressInput extends Component {
|
||||
{...this.props}
|
||||
/>
|
||||
<TouchableOpacity
|
||||
testID="BlueAddressInputScanQrButton"
|
||||
disabled={this.props.isLoading}
|
||||
onPress={() => {
|
||||
Keyboard.dismiss();
|
||||
|
@ -198,7 +198,11 @@ export default class Confirm extends Component {
|
||||
{!!this.state.payjoinUrl && (
|
||||
<View style={styles.payjoinWrapper}>
|
||||
<Text style={styles.payjoinText}>Payjoin</Text>
|
||||
<Switch value={this.state.isPayjoinEnabled} onValueChange={isPayjoinEnabled => this.setState({ isPayjoinEnabled })} />
|
||||
<Switch
|
||||
testID="PayjoinSwitch"
|
||||
value={this.state.isPayjoinEnabled}
|
||||
onValueChange={isPayjoinEnabled => this.setState({ isPayjoinEnabled })}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
{this.state.isLoading ? <ActivityIndicator /> : <BlueButton onPress={() => this.send()} title={loc.send.confirm_sendNow} />}
|
||||
|
@ -309,12 +309,14 @@ export default class SendDetails extends Component {
|
||||
units[this.state.recipientsScrollIndex] = BitcoinUnit.BTC; // also resetting current unit to BTC
|
||||
recipients[[this.state.recipientsScrollIndex]].address = address;
|
||||
recipients[[this.state.recipientsScrollIndex]].amount = options.amount;
|
||||
recipients[[this.state.recipientsScrollIndex]].amountSats = new BigNumber(options.amount).multipliedBy(100000000).toNumber();
|
||||
this.setState({
|
||||
addresses: recipients,
|
||||
memo: options.label || options.message,
|
||||
isLoading: false,
|
||||
amountUnit: BitcoinUnit.BTC,
|
||||
units,
|
||||
payjoinUrl: options.pj || '',
|
||||
});
|
||||
} else {
|
||||
this.setState({ isLoading: false });
|
||||
|
@ -396,15 +396,45 @@ describe('BlueWallet UI Tests', () => {
|
||||
return;
|
||||
}
|
||||
|
||||
// now, testing scanQR with bip21:
|
||||
|
||||
await device.pressBack();
|
||||
await device.pressBack();
|
||||
await element(by.id('BlueAddressInputScanQrButton')).tap();
|
||||
|
||||
// tapping 10 times invisible button is a backdoor:
|
||||
for (let c = 0; c <= 10; c++) {
|
||||
await element(by.id('ScanQrBackdoorButton')).tap();
|
||||
await sleep(1000);
|
||||
}
|
||||
|
||||
const bip21 = 'bitcoin:bc1qnapskphjnwzw2w3dk4anpxntunc77v6qrua0f7?amount=0.00015&pj=https://btc.donate.kukks.org/BTC/pj';
|
||||
await element(by.type('android.widget.EditText')).replaceText(bip21);
|
||||
await element(by.text('OK')).tap();
|
||||
|
||||
if (process.env.TRAVIS) await sleep(5000);
|
||||
try {
|
||||
await element(by.id('CreateTransactionButton')).tap();
|
||||
} catch (_) {}
|
||||
// created. verifying:
|
||||
await yo('TransactionValue');
|
||||
await yo('PayjoinSwitch');
|
||||
await element(by.id('TransactionDetailsButton')).tap();
|
||||
txhex = await extractTextFromElementById('TxhexInput');
|
||||
console.log({ txhex });
|
||||
transaction = bitcoin.Transaction.fromHex(txhex);
|
||||
assert.strictEqual(bitcoin.address.fromOutputScript(transaction.outs[0].script), 'bc1qnapskphjnwzw2w3dk4anpxntunc77v6qrua0f7');
|
||||
assert.strictEqual(transaction.outs[0].value, 15000);
|
||||
|
||||
// now, testing units switching, and then creating tx with SATS:
|
||||
|
||||
await device.pressBack();
|
||||
await device.pressBack();
|
||||
await element(by.id('changeAmountUnitButton')).tap(); // switched to sats
|
||||
assert.strictEqual(await extractTextFromElementById('BitcoinAmountInput'), '10000');
|
||||
assert.strictEqual(await extractTextFromElementById('BitcoinAmountInput'), '15000');
|
||||
await element(by.id('changeAmountUnitButton')).tap(); // switched to FIAT
|
||||
await element(by.id('changeAmountUnitButton')).tap(); // switched to BTC
|
||||
assert.strictEqual(await extractTextFromElementById('BitcoinAmountInput'), '0.0001');
|
||||
assert.strictEqual(await extractTextFromElementById('BitcoinAmountInput'), '0.00015');
|
||||
await element(by.id('changeAmountUnitButton')).tap(); // switched to sats
|
||||
await element(by.id('BitcoinAmountInput')).replaceText('50000');
|
||||
|
||||
|
@ -202,6 +202,11 @@ describe('unit - DeepLinkSchemaMatch', function () {
|
||||
},
|
||||
});
|
||||
|
||||
decoded = DeeplinkSchemaMatch.bip21decode(
|
||||
'bitcoin:bc1qnapskphjnwzw2w3dk4anpxntunc77v6qrua0f7?amount=0.0001&pj=https://btc.donate.kukks.org/BTC/pj',
|
||||
);
|
||||
assert.strictEqual(decoded.options.pj, 'https://btc.donate.kukks.org/BTC/pj');
|
||||
|
||||
decoded = DeeplinkSchemaMatch.bip21decode('BITCOIN:1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH?amount=20.3&label=Foobar');
|
||||
assert.deepStrictEqual(decoded, {
|
||||
address: '1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH',
|
||||
|
Loading…
Reference in New Issue
Block a user