TST: e2e: create bip84 -> receive (& receive with amount)

This commit is contained in:
marcosrdz 2021-01-22 23:50:52 -05:00
parent e9a5539af3
commit 35fd560702
4 changed files with 30 additions and 7 deletions

View file

@ -574,7 +574,7 @@ export class BlueCopyTextToClipboard extends Component {
render() { render() {
return ( return (
<View style={{ justifyContent: 'center', alignItems: 'center', paddingHorizontal: 16 }}> <View style={{ justifyContent: 'center', alignItems: 'center', paddingHorizontal: 16 }}>
<TouchableOpacity onPress={this.copyToClipboard} disabled={this.state.hasTappedText}> <TouchableOpacity onPress={this.copyToClipboard} disabled={this.state.hasTappedText} testID="BlueCopyTextToClipboard">
<Animated.Text style={styleCopyTextToClipboard.address} numberOfLines={0}> <Animated.Text style={styleCopyTextToClipboard.address} numberOfLines={0}>
{this.state.address} {this.state.address}
</Animated.Text> </Animated.Text>

View file

@ -138,15 +138,15 @@ const ReceiveDetails = () => {
<View style={styles.scrollBody}> <View style={styles.scrollBody}>
{isCustom && ( {isCustom && (
<> <>
<BlueText style={styles.amount} numberOfLines={1}> <BlueText testID="CustomAmountText" style={styles.amount} numberOfLines={1}>
{getDisplayAmount()} {getDisplayAmount()}
</BlueText> </BlueText>
<BlueText style={styles.label} numberOfLines={1}> <BlueText testID="CustomAmountDescriptionText" style={styles.label} numberOfLines={1}>
{customLabel} {customLabel}
</BlueText> </BlueText>
</> </>
)} )}
<View style={styles.qrCodeContainer}> <View style={styles.qrCodeContainer} testID="BitcoinAddressQRCodeContainer">
<QRCode <QRCode
value={bip21encoded} value={bip21encoded}
logo={require('../../img/qr-code.png')} logo={require('../../img/qr-code.png')}
@ -161,7 +161,7 @@ const ReceiveDetails = () => {
<BlueCopyTextToClipboard text={isCustom ? bip21encoded : address} /> <BlueCopyTextToClipboard text={isCustom ? bip21encoded : address} />
</View> </View>
<View style={styles.share}> <View style={styles.share}>
<BlueButtonLink title={loc.receive.details_setAmount} onPress={showCustomAmountModal} /> <BlueButtonLink testID="SetCustomAmountButton" title={loc.receive.details_setAmount} onPress={showCustomAmountModal} />
<View> <View>
<SecondButton onPress={handleShareButtonPressed} title={loc.receive.details_share} /> <SecondButton onPress={handleShareButtonPressed} title={loc.receive.details_share} />
</View> </View>
@ -302,11 +302,17 @@ const ReceiveDetails = () => {
value={customLabel || ''} value={customLabel || ''}
numberOfLines={1} numberOfLines={1}
style={styles.customAmountText} style={styles.customAmountText}
testID="CustomAmountDescription"
/> />
</View> </View>
<BlueSpacing20 /> <BlueSpacing20 />
<View> <View>
<BlueButton style={styles.modalButton} title={loc.receive.details_create} onPress={createCustomAmountAddress} /> <BlueButton
testID="CustomAmountSaveButton"
style={styles.modalButton}
title={loc.receive.details_create}
onPress={createCustomAmountAddress}
/>
<BlueSpacing20 /> <BlueSpacing20 />
</View> </View>
<BlueSpacing20 /> <BlueSpacing20 />

View file

@ -678,6 +678,7 @@ const WalletTransactions = () => {
<FContainer> <FContainer>
{wallet.current.allowReceive() && ( {wallet.current.allowReceive() && (
<FButton <FButton
testID="ReceiveButton"
text={loc.receive.header} text={loc.receive.header}
onPress={() => { onPress={() => {
if (wallet.current.chain === Chain.OFFCHAIN) { if (wallet.current.chain === Chain.OFFCHAIN) {

View file

@ -31,7 +31,7 @@ describe('BlueWallet UI Tests', () => {
process.env.TRAVIS && require('fs').writeFileSync(lockFile, '1'); process.env.TRAVIS && require('fs').writeFileSync(lockFile, '1');
}); });
it('can create wallet, reload app and it persists', async () => { it('can create wallet, reload app and it persists. then go to receive screen, set custom amount and label.', async () => {
const lockFile = '/tmp/travislock.' + hashIt(jasmine.currentTest.fullName); const lockFile = '/tmp/travislock.' + hashIt(jasmine.currentTest.fullName);
if (process.env.TRAVIS) { if (process.env.TRAVIS) {
if (require('fs').existsSync(lockFile)) if (require('fs').existsSync(lockFile))
@ -44,6 +44,22 @@ describe('BlueWallet UI Tests', () => {
await device.launchApp({ newInstance: true }); await device.launchApp({ newInstance: true });
await yo('WalletsList'); await yo('WalletsList');
await expect(element(by.id('cr34t3d'))).toBeVisible(); await expect(element(by.id('cr34t3d'))).toBeVisible();
await element(by.id('cr34t3d')).tap();
await element(by.id('ReceiveButton')).tap();
await element(by.text('Yes, I have')).tap();
await element(by.text(`No, and don't ask me again`)).tap();
await yo('BitcoinAddressQRCodeContainer');
await yo('BlueCopyTextToClipboard');
await element(by.id('SetCustomAmountButton')).tap();
await element(by.id('BitcoinAmountInput')).typeText('1');
await element(by.id('CustomAmountDescription')).typeText('test');
await element(by.id('CustomAmountSaveButton')).tap();
await sup('1 BTC');
await sup('test');
await yo('BitcoinAddressQRCodeContainer');
await yo('BlueCopyTextToClipboard');
await device.pressBack();
await device.pressBack();
process.env.TRAVIS && require('fs').writeFileSync(lockFile, '1'); process.env.TRAVIS && require('fs').writeFileSync(lockFile, '1');
}); });