[Feature] Show "Testnet mode enabled" banner if testnet enabled (#19348)

This commit 
- adds the "Testnet mode enabled" banner if the User has enabled the testnet
- fixes a E2E bug

---------

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
Co-authored-by: Yevheniia Berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
Mohamed Javid 2024-04-03 16:15:07 +05:30 committed by GitHub
parent a6a7ec8bc0
commit 41763689e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 21 additions and 5 deletions

View File

@ -57,6 +57,7 @@
[quo/button [quo/button
{:on-press (fn [] {:on-press (fn []
(rf/dispatch [:init-root :shell-stack]) (rf/dispatch [:init-root :shell-stack])
(rf/dispatch [:profile/show-testnet-mode-banner-if-enabled])
(rf/dispatch [:universal-links/process-stored-event])) (rf/dispatch [:universal-links/process-stored-event]))
:type :primary :type :primary
:accessibility-label :welcome-button :accessibility-label :welcome-button

View File

@ -10,6 +10,7 @@
[status-im.contexts.profile.rpc :as profile.rpc] [status-im.contexts.profile.rpc :as profile.rpc]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[utils.ethereum.chain :as chain] [utils.ethereum.chain :as chain]
[utils.i18n :as i18n]
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.security.core :as security])) [utils.security.core :as security]))
@ -82,7 +83,8 @@
constants/theme-type-dark) constants/theme-type-dark)
:shell-stack :shell-stack
false]] false]]
[:set-root :shell-stack]]))}))) [:set-root :shell-stack]
[:dispatch [:profile/show-testnet-mode-banner-if-enabled]]]))})))
;; login phase 2: we want to load and show chats faster, so we split login into 2 phases ;; login phase 2: we want to load and show chats faster, so we split login into 2 phases
(rf/reg-event-fx :profile.login/get-chats-callback (rf/reg-event-fx :profile.login/get-chats-callback
@ -234,3 +236,12 @@
:profile/on-password-input-changed :profile/on-password-input-changed
(fn [{:keys [db]} [{:keys [password error]}]] (fn [{:keys [db]} [{:keys [password error]}]]
{:db (update db :profile/login assoc :password password :error error)})) {:db (update db :profile/login assoc :password password :error error)}))
(rf/reg-event-fx
:profile/show-testnet-mode-banner-if-enabled
(fn [{:keys [db]}]
(when (get-in db [:profile/profile :test-networks-enabled?])
{:fx [[:dispatch
[:alert-banners/add
{:type :alert
:text (i18n/label :t/testnet-mode-enabled)}]]]})))

View File

@ -314,6 +314,7 @@ class BaseView(object):
# share contact screen # share contact screen
self.show_qr_button = Button(self.driver, accessibility_id="show-qr-button") self.show_qr_button = Button(self.driver, accessibility_id="show-qr-button")
self.link_to_profile_button = Button(self.driver, accessibility_id="share-qr-code-info-text") self.link_to_profile_button = Button(self.driver, accessibility_id="share-qr-code-info-text")
self.sharing_text_native = Text(self.driver, xpath="//*[@resource-id='android:id/content_preview_text']")
# checkboxes and toggles # checkboxes and toggles
self.checkbox_button = CheckBox(self.driver, accessibility_id="checkbox-off") self.checkbox_button = CheckBox(self.driver, accessibility_id="checkbox-off")

View File

@ -331,6 +331,7 @@ class HomeView(BaseView):
self.mark_all_read_activity_button = Button(self.driver, translation_id="mark-all-notifications-as-read") self.mark_all_read_activity_button = Button(self.driver, translation_id="mark-all-notifications-as-read")
# Share tab # Share tab
self.link_to_profile_button = Button(self.driver, accessibility_id="link-to-profile")
self.link_to_profile_text = Text(self.driver, accessibility_id="share-qr-code-info-text") self.link_to_profile_text = Text(self.driver, accessibility_id="share-qr-code-info-text")
self.close_share_tab_button = Button(self.driver, accessibility_id="close-shell-share-tab") self.close_share_tab_button = Button(self.driver, accessibility_id="close-shell-share-tab")
@ -562,9 +563,10 @@ class HomeView(BaseView):
def get_link_to_profile(self): def get_link_to_profile(self):
self.show_qr_code_button.click() self.show_qr_code_button.click()
self.link_to_profile_text.wait_for_visibility_of_element() self.link_to_profile_button.click()
self.link_to_profile_text.click() link_to_profile = self.sharing_text_native.text
return self.driver.get_clipboard_text() self.click_system_back_button()
return link_to_profile
def get_public_key(self): def get_public_key(self):
self.driver.info("Getting public key via Share tab") self.driver.info("Getting public key via Share tab")

View File

@ -2566,5 +2566,6 @@
"key-name-error-length": "Key name too long", "key-name-error-length": "Key name too long",
"key-name-error-emoji": "Emojis are not allowed", "key-name-error-emoji": "Emojis are not allowed",
"key-name-error-special-char": "Special characters are not allowed", "key-name-error-special-char": "Special characters are not allowed",
"display": "Display" "display": "Display",
"testnet-mode-enabled": "Testnet mode enabled"
} }