Skip to content

Commit

Permalink
[#8650] Tappable "backup seed" notification in wallet
Browse files Browse the repository at this point in the history
- notification is tappable
- appears only if user has nonzero balance and hasn't backed up seed yet
- Fix e2e test for this change
  • Loading branch information
rasom committed Oct 22, 2019
1 parent dbb4dfa commit 474ff00
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 14 deletions.
12 changes: 12 additions & 0 deletions src/status_im/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,18 @@
(fn [wallet]
(map :balance (vals (:accounts wallet)))))

(re-frame/reg-sub
:empty-balances?
:<- [:balances]
(fn [balances]
(every?
(fn [balance]
(every?
(fn [asset]
(or (nil? asset) (.isZero asset)))
(vals balance)))
balances)))

(re-frame/reg-sub
:price
:<- [:prices]
Expand Down
24 changes: 16 additions & 8 deletions src/status_im/ui/screens/wallet/accounts/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,24 @@
[react/text {:style {:color colors/gray}} (i18n/label :t/wallet-total-value)]]))

(views/defview accounts-options []
(views/letsubs [{:keys [seed-backed-up?]} [:multiaccount]]
(views/letsubs [{:keys [seed-backed-up?]} [:multiaccount]
empty-balances? [:empty-balances?]]
[react/view {:flex-direction :row :align-items :center}
[react/view {:flex 1 :padding-left 16}
(when-not seed-backed-up?
[react/view {:flex-direction :row :align-items :center}
[react/view {:width 14 :height 14 :background-color colors/gray :border-radius 7 :align-items :center
:justify-content :center :margin-right 9}
[react/text {:style {:color colors/white :font-size 13 :font-weight "700"}} "!"]]
[react/text {:style {:color colors/gray}
:accessibility-label :back-up-your-seed-phrase-warning} (i18n/label :t/back-up-your-seed-phrase)]])]
(when (and (not seed-backed-up?)
(not empty-balances?))
[react/touchable-highlight
{:on-press #(re-frame/dispatch [:navigate-to :backup-seed])}
[react/view {:flex-direction :row :align-items :center}
[react/view {:width 14 :height 14 :background-color colors/gray :border-radius 7 :align-items :center
:justify-content :center :margin-right 9}
[react/text {:style {:color colors/white
:font-size 13
:font-weight "700"}}
"!"]]
[react/text {:style {:color colors/gray}
:accessibility-label :back-up-your-seed-phrase-warning}
(i18n/label :t/back-up-your-seed-phrase)]]])]
[react/touchable-highlight {:on-press #(re-frame/dispatch [:bottom-sheet/show-sheet
{:content (sheets/accounts-options seed-backed-up?)
:content-height (if seed-backed-up? 190 250)}])}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,20 @@ def test_manage_assets(self):
self.verify_no_errors()

@marks.testrail_id(5358)
@marks.critical
@marks.medium
def test_backup_recovery_phrase_warning_from_wallet(self):
sign_in = SignInView(self.driver)
sign_in.create_user()
wallet = sign_in.wallet_button.click()
wallet.set_up_wallet()
if not wallet.backup_recovery_phrase_warning_text.is_element_present():
self.driver.fail("'Back up your seed phrase' warning is not shown on Wallet")
wallet.multiaccount_more_options.click_until_presence_of_element(wallet.backup_recovery_phrase)
wallet.backup_recovery_phrase.click()
if wallet.backup_recovery_phrase_warning_text.is_element_present():
self.driver.fail("'Back up your seed phrase' warning is shown on Wallet while no funds are present")
address = wallet.get_wallet_address()
self.network_api.get_donate(address[2:])
wallet.back_button.click()
if not wallet.backup_recovery_phrase_warning_text.is_element_present(30):
self.driver.fail("'Back up your seed phrase' warning is not shown on Wallet with funds")
wallet.backup_recovery_phrase_warning_text.click()
profile = wallet.get_profile_view()
profile.backup_recovery_phrase()

Expand Down
1 change: 0 additions & 1 deletion test/appium/tests/atomic/transactions/test_wallet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import random
import pytest

from support.utilities import get_merged_txs_list
from tests import marks, unique_password, common_password
Expand Down
8 changes: 8 additions & 0 deletions test/appium/views/send_transaction_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ def __init__(self, driver):
super(UpdateFeeButton, self).__init__(driver)
self.locator = self.Locator.xpath_selector("//*[@text='Update']")

def click(self):
for _ in range(3):
self.driver.info('Tap on %s' % self.name)
self.find_element().click()
self.driver.info('Wait for no %s' % self.name)
if not self.is_element_displayed(1):
return self.navigate()


class ShareButton(BaseButton):

Expand Down

0 comments on commit 474ff00

Please sign in to comment.