Skip to content

Commit

Permalink
[#19182] fix: shell share design feedback (#19617)
Browse files Browse the repository at this point in the history
Co-authored-by: Yevheniia Berdnyk <ie.berdnyk@gmail.com>
  • Loading branch information
mohsen-ghafouri and yevh-berdnyk authored Apr 18, 2024
1 parent ea4578b commit 8f67f38
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 21 deletions.
20 changes: 10 additions & 10 deletions src/quo/components/share/share_qr_code/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@
[{:keys [on-legacy-press on-multichain-press address]}]
[rn/view {:style style/header-container}
[tab/view
{:accessibility-label :share-qr-code-legacy-tab
:id :wallet-legacy-tab
{:accessibility-label :share-qr-code-multichain-tab
:id :wallet-multichain-tab
:active-item-container-style style/header-tab-active
:item-container-style style/header-tab-inactive
:size 24
:active (= :legacy address)
:on-press on-legacy-press}
(i18n/label :t/legacy)]
:active (= :multichain address)
:on-press on-multichain-press}
(i18n/label :t/multichain)]
[rn/view {:style style/space-between-tabs}]
[tab/view
{:accessibility-label :share-qr-code-multichain-tab
:id :wallet-multichain-tab
{:accessibility-label :share-qr-code-legacy-tab
:id :wallet-legacy-tab
:active-item-container-style style/header-tab-active
:item-container-style style/header-tab-inactive
:size 24
:active (= :multichain address)
:on-press on-multichain-press}
(i18n/label :t/multichain)]])
:active (= :legacy address)
:on-press on-legacy-press}
(i18n/label :t/legacy)]])

(defn- info-label
[share-qr-code-type]
Expand Down
3 changes: 2 additions & 1 deletion src/status_im/contexts/shell/share/style.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@

(def tabs-container
{:padding-horizontal screen-padding
:margin-vertical 8})
:margin-top 8
:margin-bottom 16})

(def wip-style
{:color colors/white
Expand Down
7 changes: 4 additions & 3 deletions src/status_im/contexts/shell/share/wallet/component_spec.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
share-qr-code (h/get-by-label-text :share-qr-code)]
;; Fires on-layout since it's needed to render the content
(h/fire-event :layout share-qr-code #js {:nativeEvent #js {:layout #js {:width 500}}})
(rerender-fn [wallet-view/wallet-tab])))
(rerender-fn [wallet-view/wallet-tab])
(h/fire-event :press (h/get-by-label-text :share-qr-code-legacy-tab))))

(h/describe "share wallet addresses"
(h/setup-restorable-re-frame)
Expand All @@ -26,8 +27,8 @@

(h/test "should display the wallet tab"
(render-wallet-view)
(-> (h/wait-for #(h/get-by-text "Wallet One"))
(.then (fn [] (h/is-truthy (h/get-by-text "Wallet One"))))))
(-> (h/expect (h/query-by-text "Wallet One"))
(h/is-truthy)))

(h/test "should display the legacy account"
(render-wallet-view)
Expand Down
2 changes: 1 addition & 1 deletion src/status_im/contexts/shell/share/wallet/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
[{:keys [account index]}]
(let [{window-width :width} (rn/get-window)
selected-networks (reagent/atom constants/default-network-names)
wallet-type (reagent/atom :legacy)
wallet-type (reagent/atom :multichain)
on-settings-press #(open-preferences selected-networks account)
on-legacy-press #(reset! wallet-type :legacy)
on-multichain-press #(reset! wallet-type :multichain)]
Expand Down
20 changes: 14 additions & 6 deletions test/appium/tests/critical/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,22 @@ def test_wallet_add_remove_regular_account(self):
self.wallet_view.click_system_back_button()
self.wallet_view.close_account_button.click_until_presence_of_element(self.home_view.show_qr_code_button)

self.wallet_view.just_fyi("Checking that the new wallet is added to the Sare QR Code menu")
self.wallet_view.just_fyi("Checking that the new wallet is added to the Share QR Code menu")
self.home_view.show_qr_code_button.click()
self.home_view.share_wallet_tab_button.click()
if self.home_view.account_name_text.text != 'Account 1':
self.errors.append("Incorrect first account is shown on Share QR Code menu")
self.home_view.qr_code_image_element.swipe_left_on_element()
try:
self.home_view.account_name_text.wait_for_element_text(text=new_account_name, wait_time=3)
if self.home_view.copy_wallet_address() != new_wallet_address.split(':')[-1]:
self.home_view.driver.fail("Incorrect address")
except Failed:
self.errors.append("Can't swipe between accounts, newly added account is not shown")
else:
shown_address = self.home_view.copy_wallet_address()
if set(shown_address.split(':')) != set(new_wallet_address.split(':')):
self.errors.append(
"Incorrect address '%s' is shown when swiping between accounts, expected one is '%s'" % (
shown_address, new_wallet_address))
self.home_view.click_system_back_button()

self.wallet_view.just_fyi("Removing newly added account")
Expand All @@ -189,18 +193,22 @@ def test_wallet_add_remove_watch_only_account(self):
pytest.fail("Account to watch was not added")
self.wallet_view.close_account_button.click_until_presence_of_element(self.home_view.show_qr_code_button)

self.wallet_view.just_fyi("Checking that the new wallet is added to the Sare QR Code menu")
self.wallet_view.just_fyi("Checking that the new wallet is added to the Share QR Code menu")
self.home_view.show_qr_code_button.click()
self.home_view.share_wallet_tab_button.click()
if self.home_view.account_name_text.text != 'Account 1':
self.errors.append("Incorrect first account is shown on Share QR Code menu")
self.home_view.qr_code_image_element.swipe_left_on_element()
try:
self.home_view.account_name_text.wait_for_element_text(text=new_account_name, wait_time=3)
if self.home_view.copy_wallet_address() != address_to_watch:
self.home_view.driver.fail("Incorrect address")
except Failed:
self.errors.append("Can't swipe between accounts, account to watch is not shown")
else:
shown_address = self.home_view.copy_wallet_address()
if set(shown_address.split(':')) != {'eth', 'arb1', 'opt', address_to_watch}:
self.home_view.driver.fail(
"Incorrect address '%s' is shown when swiping between accounts, expected one is '%s'" % (
shown_address, ':'.join(address_to_watch)))
self.home_view.click_system_back_button()

self.wallet_view.just_fyi("Removing account to watch")
Expand Down

0 comments on commit 8f67f38

Please sign in to comment.