diff --git a/e2e/backup.e2e.js b/e2e/backup.e2e.js index b6929fb60..abc465047 100644 --- a/e2e/backup.e2e.js +++ b/e2e/backup.e2e.js @@ -9,6 +9,8 @@ import { bitcoinURL, electrumHost, electrumPort, + getSeed, + restoreWallet, } from './helpers'; import initWaitForElectrumToSync from '../__tests__/utils/wait-for-electrum'; @@ -103,54 +105,9 @@ d('Backup', () => { await element(by.id('WidgetsEdit')).tap(); await expect(element(by.id('PriceWidget'))).toBeVisible(); - // get seed - await element(by.id('Settings')).tap(); - await element(by.id('BackupSettings')).tap(); - await element(by.id('BackupWallet')).tap(); - await sleep(200); // animation - await element(by.id('TapToReveal')).tap(); - - // get the seed from SeedContaider - const { label: seed } = await element( - by.id('SeedContaider'), - ).getAttributes(); - - await element(by.id('SeedContaider')).swipe('down'); - await sleep(200); // animation - await element(by.id('NavigationClose')).atIndex(0).tap(); - - await sleep(5000); // make sure everything is saved to cloud storage TODO: improve this - - console.info('seed: ', seed); - // restore wallet - await device.launchApp({ delete: true }); - - await waitFor(element(by.id('Check1'))).toBeVisible(); - await element(by.id('Check1')).tap(); - await element(by.id('Check2')).tap(); - await element(by.id('Continue')).tap(); - await waitFor(element(by.id('SkipIntro'))).toBeVisible(); - await element(by.id('SkipIntro')).tap(); - await element(by.id('RestoreWallet')).tap(); - await element(by.id('MultipleDevices-button')).tap(); - await element(by.id('Word-0')).replaceText(seed); - await element(by.id('WordIndex-4')).swipe('up'); - await element(by.id('RestoreButton')).tap(); - - await waitFor(element(by.id('GetStartedButton'))) - .toBeVisible() - .withTimeout(300000); // 5 min - await element(by.id('GetStartedButton')).tap(); - - // wait for SuggestionsLabel to appear and be accessible - for (let i = 0; i < 60; i++) { - await sleep(200); - try { - await element(by.id('SuggestionsLabel')).tap(); - break; - } catch (e) {} - } + const seed = await getSeed(); + await restoreWallet(seed); // check settings await expect( diff --git a/e2e/boost.e2e.js b/e2e/boost.e2e.js index 3fe5a424e..18c85fdfd 100644 --- a/e2e/boost.e2e.js +++ b/e2e/boost.e2e.js @@ -11,6 +11,8 @@ import { bitcoinURL, electrumHost, electrumPort, + getSeed, + restoreWallet, } from './helpers'; import initWaitForElectrumToSync from '../__tests__/utils/wait-for-electrum'; @@ -267,10 +269,23 @@ d('Boost', () => { assert(Number(oldFee.replace(' ', '')) < Number(newFee.replace(' ', ''))); assert(oldTxid !== newTxid); await expect(element(by.id('RBFBoosted'))).toBeVisible(); + await element(by.id('NavigationClose')).atIndex(0).tap(); + + // wipe & restore + const seed = await getSeed(); + await restoreWallet(seed); + + // check activity after restore + await element(by.id('WalletsScrollView')).scrollTo('bottom', NaN, 0.85); + await expect(element(by.id('BoostingIcon'))).toBeVisible(); + await element(by.id('ActivityShort-1')).tap(); + await expect(element(by.id('BoostedButton'))).toBeVisible(); + await expect(element(by.id('StatusBoosting'))).toBeVisible(); // mine new block - await element(by.id('NavigationBack')).atIndex(0).tap(); await rpc.generateToAddress(1, await rpc.getNewAddress()); + + // check activity item after mine await waitFor(element(by.id('StatusConfirmed'))) .toBeVisible() .withTimeout(30000); diff --git a/e2e/channels.e2e.js b/e2e/channels.e2e.js index 4ea00578d..454c98be8 100644 --- a/e2e/channels.e2e.js +++ b/e2e/channels.e2e.js @@ -16,6 +16,8 @@ import { sleep, waitForActiveChannel, waitForPeerConnection, + getSeed, + restoreWallet, } from './helpers'; d = checkComplete(['transfer-1', 'transfer-2']) ? describe.skip : describe; @@ -186,6 +188,18 @@ d('Transfer', () => { await expect( element(by.id('MoneyText').withAncestor(by.id('TotalSize'))), ).toHaveText('250 000'); + await element(by.id('NavigationClose')).tap(); + + const seed = await getSeed(); + await restoreWallet(seed); + + // check transfer card + await expect(element(by.id('Suggestion-lightningSettingUp'))).toBeVisible(); + + // check activity after restore + await element(by.id('WalletsScrollView')).scrollTo('bottom', NaN, 0.85); + await element(by.id('ActivityShort-1')).tap(); + await expect(element(by.id('StatusTransfer'))).toBeVisible(); markComplete('transfer-1'); }); diff --git a/e2e/helpers.js b/e2e/helpers.js index 444767cf7..1e2f7a37e 100644 --- a/e2e/helpers.js +++ b/e2e/helpers.js @@ -187,3 +187,65 @@ export const waitForActiveChannel = async (lnd, nodeId, maxRetries = 20) => { throw new Error('Channel not active'); } }; + +export const getSeed = async () => { + await element(by.id('Settings')).tap(); + await element(by.id('BackupSettings')).tap(); + await element(by.id('BackupWallet')).tap(); + // animation + await sleep(200); + await element(by.id('TapToReveal')).tap(); + + // get the seed from SeedContaider + const { label: seed } = await element(by.id('SeedContaider')).getAttributes(); + + await element(by.id('SeedContaider')).swipe('down'); + // animation + await sleep(200); + await element(by.id('NavigationClose')).atIndex(0).tap(); + + console.info({ seed }); + + return seed; +}; + +export const restoreWallet = async (seed, passphrase) => { + // make sure everything is saved to cloud storage + // TODO: improve this + await sleep(5000); + + await device.launchApp({ delete: true }); + + await waitFor(element(by.id('Check1'))).toBeVisible(); + await element(by.id('Check1')).tap(); + await element(by.id('Check2')).tap(); + await element(by.id('Continue')).tap(); + await waitFor(element(by.id('SkipIntro'))).toBeVisible(); + await element(by.id('SkipIntro')).tap(); + await element(by.id('RestoreWallet')).tap(); + await element(by.id('MultipleDevices-button')).tap(); + await element(by.id('Word-0')).replaceText(seed); + await element(by.id('WordIndex-4')).swipe('up'); + + if (passphrase) { + await element(by.id('AdvancedButton')).tap(); + await element(by.id('PassphraseInput')).typeText(passphrase); + await element(by.id('PassphraseInput')).tapReturnKey(); + } + + await element(by.id('RestoreButton')).tap(); + + await waitFor(element(by.id('GetStartedButton'))) + .toBeVisible() + .withTimeout(300000); // 5 min + await element(by.id('GetStartedButton')).tap(); + + // wait for SuggestionsLabel to appear and be accessible + for (let i = 0; i < 60; i++) { + await sleep(200); + try { + await element(by.id('SuggestionsLabel')).tap(); + break; + } catch (e) {} + } +}; diff --git a/e2e/lightning.e2e.js b/e2e/lightning.e2e.js index b613036e3..62dfc1496 100644 --- a/e2e/lightning.e2e.js +++ b/e2e/lightning.e2e.js @@ -15,6 +15,8 @@ import { sleep, waitForActiveChannel, waitForPeerConnection, + restoreWallet, + getSeed, } from './helpers'; d = checkComplete('lighting-1') ? describe.skip : describe; @@ -311,52 +313,9 @@ d('Lightning', () => { await element(by.id('Tag-stag-delete')).tap(); await element(by.id('NavigationClose')).tap(); - // get seed - await element(by.id('Settings')).tap(); - await element(by.id('BackupSettings')).tap(); - await element(by.id('BackupWallet')).tap(); - await sleep(1000); // animation - await element(by.id('TapToReveal')).tap(); - - // get the seed from SeedContaider - const { label: seed } = await element( - by.id('SeedContaider'), - ).getAttributes(); - await element(by.id('SeedContaider')).swipe('down'); - await sleep(1000); // animation - await element(by.id('NavigationClose')).atIndex(0).tap(); - - await sleep(5000); // make sure everything is saved to cloud storage TODO: improve this - console.info('seed: ', seed); - - // restore wallet - await device.launchApp({ delete: true }); - - await waitFor(element(by.id('Check1'))).toBeVisible(); - await element(by.id('Check1')).tap(); - await element(by.id('Check2')).tap(); - await element(by.id('Continue')).tap(); - await waitFor(element(by.id('SkipIntro'))).toBeVisible(); - await element(by.id('SkipIntro')).tap(); - await element(by.id('RestoreWallet')).tap(); - await element(by.id('MultipleDevices-button')).tap(); - await element(by.id('Word-0')).replaceText(seed); - await element(by.id('WordIndex-4')).swipe('up'); - await element(by.id('RestoreButton')).tap(); - - await waitFor(element(by.id('GetStartedButton'))) - .toBeVisible() - .withTimeout(300000); // 5 min - await element(by.id('GetStartedButton')).tap(); - - // wait for SuggestionsLabel to appear and be accessible - for (let i = 0; i < 60; i++) { - await sleep(1000); - try { - await element(by.id('SuggestionsLabel')).tap(); - break; - } catch (e) {} - } + // wipe and restore wallet + const seed = await getSeed(); + await restoreWallet(seed); // check balance await waitFor( diff --git a/e2e/onboarding.e2e.js b/e2e/onboarding.e2e.js index f4abf294d..d246fe383 100644 --- a/e2e/onboarding.e2e.js +++ b/e2e/onboarding.e2e.js @@ -1,6 +1,12 @@ import jestExpect from 'expect'; -import { sleep, checkComplete, markComplete } from './helpers'; +import { + sleep, + checkComplete, + markComplete, + getSeed, + restoreWallet, +} from './helpers'; d = checkComplete('onboarding-1') ? describe.skip : describe; @@ -31,8 +37,9 @@ d('Onboarding', () => { await element(by.id('SkipButton')).tap(); // create new wallet with passphrase + const passphrase = 'supersecret'; await element(by.id('Passphrase')).tap(); - await element(by.id('PassphraseInput')).typeText('supersecret'); + await element(by.id('PassphraseInput')).typeText(passphrase); await element(by.id('PassphraseInput')).tapReturnKey(); await element(by.id('CreateNewWallet')).tap(); @@ -54,20 +61,9 @@ d('Onboarding', () => { } } - // get seed - await element(by.id('Settings')).tap(); - await element(by.id('BackupSettings')).tap(); - await element(by.id('BackupWallet')).tap(); - await element(by.id('TapToReveal')).tap(); - // get the seed from SeedContaider - const { label: seed } = await element( - by.id('SeedContaider'), - ).getAttributes(); - await element(by.id('SeedContaider')).swipe('down'); - await element(by.id('NavigationClose')).atIndex(0).tap(); - console.info('seed: ', seed); - - // get receing address + const seed = await getSeed(); + + // get receiving address await element(by.id('Receive')).tap(); await waitFor(element(by.id('QRCode'))) .toBeVisible() @@ -76,38 +72,9 @@ d('Onboarding', () => { console.info('address', address1); // wipe and restore wallet - await device.launchApp({ delete: true }); - - await waitFor(element(by.id('Check1'))).toBeVisible(); - await element(by.id('Check1')).tap(); - await element(by.id('Check2')).tap(); - await element(by.id('Continue')).tap(); - await waitFor(element(by.id('SkipIntro'))).toBeVisible(); - await element(by.id('SkipIntro')).tap(); - await element(by.id('RestoreWallet')).tap(); - await element(by.id('MultipleDevices-button')).tap(); - await element(by.id('Word-0')).replaceText(seed); - await element(by.id('WordIndex-4')).swipe('up'); - await element(by.id('AdvancedButton')).tap(); - await element(by.id('PassphraseInput')).typeText('supersecret'); - await element(by.id('PassphraseInput')).tapReturnKey(); - await element(by.id('RestoreButton')).tap(); - - await waitFor(element(by.id('GetStartedButton'))) - .toBeVisible() - .withTimeout(300000); // 5 min - await element(by.id('GetStartedButton')).tap(); - - // wait for SuggestionsLabel to appear and be accessible - for (let i = 0; i < 60; i++) { - await sleep(1000); - try { - await element(by.id('SuggestionsLabel')).tap(); - break; - } catch (e) {} - } + await restoreWallet(seed, passphrase); - // get receing address + // get receiving address await element(by.id('Receive')).tap(); await waitFor(element(by.id('QRCode'))) .toBeVisible() diff --git a/e2e/slashtags.e2e.js b/e2e/slashtags.e2e.js index 0ef8ad07b..68e5226c5 100644 --- a/e2e/slashtags.e2e.js +++ b/e2e/slashtags.e2e.js @@ -9,6 +9,8 @@ import { sleep, electrumHost, electrumPort, + getSeed, + restoreWallet, } from './helpers'; import initWaitForElectrumToSync from '../__tests__/utils/wait-for-electrum'; @@ -34,16 +36,6 @@ d('Profile and Contacts', () => { let waitForElectrum; const rpc = new BitcoinJsonRpc(bitcoinURL); - const waitForSuggestionsLabel = async () => { - for (let i = 0; i < 60; i++) { - await sleep(1000); - try { - await element(by.id('SuggestionsLabel')).tap(); - break; - } catch (e) {} - } - }; - beforeAll(async () => { await completeOnboarding(); @@ -185,8 +177,7 @@ d('Profile and Contacts', () => { await expect(element(by.text(hal.name2))).toBeVisible(); // RESTART APP - await device.launchApp({ newInstance: true, delete: false }); - await waitForSuggestionsLabel(); + await launchAndWait(); await waitFor(element(by.text('NewTestName'))) .toBeVisible() @@ -233,37 +224,9 @@ d('Profile and Contacts', () => { // give it time to perform the metadata backup await sleep(5000); - // GET SEED - await element(by.id('Settings')).tap(); - await element(by.id('BackupSettings')).tap(); - await element(by.id('BackupWallet')).tap(); - await element(by.id('TapToReveal')).tap(); - const { label: seed } = await element( - by.id('SeedContaider'), - ).getAttributes(); - await element(by.id('SeedContaider')).swipe('down'); - console.info('seed: ', seed); - // WIPE APP AND RESTORE FROM THE SEED - await device.launchApp({ delete: true }); - - await waitFor(element(by.id('Check1'))).toBeVisible(); - await element(by.id('Check1')).tap(); - await element(by.id('Check2')).tap(); - await element(by.id('Continue')).tap(); - await waitFor(element(by.id('SkipIntro'))).toBeVisible(); - await element(by.id('SkipIntro')).tap(); - await element(by.id('RestoreWallet')).tap(); - await element(by.id('MultipleDevices-button')).tap(); - await element(by.id('Word-0')).replaceText(seed); - await element(by.id('WordIndex-4')).swipe('up'); - await element(by.id('RestoreButton')).tap(); - - await waitFor(element(by.id('GetStartedButton'))) - .toBeVisible() - .withTimeout(300000); // 5 min - await element(by.id('GetStartedButton')).tap(); - await waitForSuggestionsLabel(); + const seed = await getSeed(); + await restoreWallet(seed); // CHECK PROFILE, CONTACTS, TRANSACTION await waitFor(element(by.text('NewTestName'))) diff --git a/src/screens/Activity/ActivityDetail.tsx b/src/screens/Activity/ActivityDetail.tsx index 6f14def7a..742affba7 100644 --- a/src/screens/Activity/ActivityDetail.tsx +++ b/src/screens/Activity/ActivityDetail.tsx @@ -335,7 +335,7 @@ const OnchainActivityDetail = ({ if (transfer.status !== ETransferStatus.done) { const duration = getDurationForBlocks(transfer.confirmsIn); status = ( - + {t('activity_transfer_pending', { duration })}