diff --git a/screen/transactions/TransactionDetails.tsx b/screen/transactions/TransactionDetails.tsx index 9026b9ea8..afc4b73f7 100644 --- a/screen/transactions/TransactionDetails.tsx +++ b/screen/transactions/TransactionDetails.tsx @@ -275,8 +275,10 @@ const TransactionDetails = () => { placeholder={loc.send.details_note_placeholder} value={memo} placeholderTextColor="#81868e" + clearButtonMode="while-editing" style={[styles.memoTextInput, stylesHooks.memoTextInput]} onChangeText={setMemo} + testID="TransactionDetailsMemoInput" /> {isCounterpartyLabelVisible ? ( diff --git a/screen/wallets/WalletsList.tsx b/screen/wallets/WalletsList.tsx index f96ceba7d..b703cf48e 100644 --- a/screen/wallets/WalletsList.tsx +++ b/screen/wallets/WalletsList.tsx @@ -421,6 +421,7 @@ const WalletsList: React.FC = () => { contentInset={styles.scrollContent} renderSectionFooter={renderSectionFooter} sections={sections} + testID="SectionList" windowSize={21} maxToRenderPerBatch={10} updateCellsBatchingPeriod={50} diff --git a/tests/e2e/bluewallet2.spec.js b/tests/e2e/bluewallet2.spec.js index 5fd8d6c5d..95b26221e 100644 --- a/tests/e2e/bluewallet2.spec.js +++ b/tests/e2e/bluewallet2.spec.js @@ -173,6 +173,63 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => { process.env.TRAVIS && require('fs').writeFileSync(lockFile, '1'); }); + it('can save, clear, and persist note', async () => { + const lockFile = '/tmp/travislock.' + hashIt('t_save_note'); + if (process.env.TRAVIS) { + if (require('fs').existsSync(lockFile)) + return console.warn('skipping', JSON.stringify('t_save_note'), 'as it previously passed on Travis'); + } + if (!process.env.HD_MNEMONIC_BIP84) { + console.error('process.env.HD_MNEMONIC_BIP84 not set, skipped'); + return; + } + await device.launchApp({ newInstance: true }); + + // go inside the wallet + await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap(); + + // navigate to the transaction details + await element(by.text('0.0001')).atIndex(0).tap(); + await element(by.text('Details')).tap(); + + // save note + await element(by.id('TransactionDetailsMemoInput')).replaceText('Test note'); + await element(by.text('Save')).tap(); + await element(by.text('OK')).tap(); + + // close and reopen app + await device.terminateApp(); + await device.launchApp({ newInstance: true }); + + // go back inside the wallet and transaction details + await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap(); + await element(by.text('0.0001')).atIndex(0).tap(); + await element(by.text('Details')).tap(); + + // verify note is saved + let noteText = await extractTextFromElementById('TransactionDetailsMemoInput'); + assert.strictEqual(noteText, 'Test note', 'The note text does not match'); + + // clear the note + await element(by.id('TransactionDetailsMemoInput')).replaceText(''); + await element(by.text('Save')).tap(); + await element(by.text('OK')).tap(); + + // close and reopen app + await device.terminateApp(); + await device.launchApp({ newInstance: true }); + + // go back inside the wallet and transaction details + await element(by.text('Imported HD SegWit (BIP84 Bech32 Native)')).tap(); + await element(by.text('0.0001')).atIndex(0).tap(); + await element(by.text('Details')).tap(); + + // verify note is cleared + noteText = await extractTextFromElementById('TransactionDetailsMemoInput'); + assert.strictEqual(noteText, '', 'The note text is not cleared'); + + process.env.TRAVIS && require('fs').writeFileSync(lockFile, '1'); + }, 1200_000); it('can batch send', async () => { const lockFile = '/tmp/travislock.' + hashIt('t_batch_send'); @@ -421,7 +478,7 @@ describe('BlueWallet UI Tests - import BIP84 wallet', () => { await device.launchApp({ newInstance: true, - url: 'bitcoin:BC1QH6TF004TY7Z7UN2V5NTU4MKF630545GVHS45U7?amount=0.0001&label=Yo', + url: ' ', }); // setting fee rate: