From f731f75fcaf6da7add27acc421d08ba8b7bc7263 Mon Sep 17 00:00:00 2001 From: flexsurfer Date: Thu, 2 Mar 2023 10:55:45 +0100 Subject: [PATCH] move profile tab (#15224) * move profile tab * e2e: new profile tab * e2e: fix leftovers * e2e: last --------- Co-authored-by: Churikova Tetiana --- src/status_im/browser/core.cljs | 21 +++++++++++++----- src/status_im/ui/screens/browser/stack.cljs | 14 ++++++++++++ src/status_im/ui/screens/browser/styles.cljs | 5 +++-- .../ui/screens/browser/tabs/views.cljs | 2 +- src/status_im/ui/screens/browser/views.cljs | 2 +- .../ui/screens/profile/user/views.cljs | 3 +++ src/status_im/ui/screens/screens.cljs | 22 ------------------- src/status_im2/common/home/view.cljs | 11 +++++----- src/status_im2/contexts/shell/home_stack.cljs | 6 ++--- src/status_im2/subs/root.cljs | 1 + .../critical/chats/test_1_1_public_chats.py | 13 ++++++----- .../tests/critical/chats/test_group_chat.py | 9 ++++---- .../critical/test_public_chat_browsing.py | 1 + .../tests/medium/test_activity_center.py | 3 ++- .../test_deeplink_chat_share_profile.py | 4 +++- test/appium/views/base_view.py | 10 +++++---- 16 files changed, 70 insertions(+), 57 deletions(-) create mode 100644 src/status_im/ui/screens/browser/stack.cljs diff --git a/src/status_im/browser/core.cljs b/src/status_im/browser/core.cljs index c17ca33ef2..db9e023bc5 100644 --- a/src/status_im/browser/core.cljs +++ b/src/status_im/browser/core.cljs @@ -305,9 +305,10 @@ (rf/merge cofx {:db (assoc db :browser/options - {:browser-id (:browser-id browser)})} - (navigation/change-tab :browser-stack) + {:browser-id (:browser-id browser)} + :browser/screen-id :browser)} (navigation/pop-to-root :shell-stack) + (navigation/change-tab :browser-stack) (update-browser browser) (resolve-url nil))))) @@ -319,11 +320,19 @@ (rf/merge cofx {:db (assoc db :browser/options - {:browser-id browser-id})} + {:browser-id browser-id} + :browser/screen-id :browser)} (update-browser browser) - (navigation/set-stack-root :browser-stack :browser) + (navigation/change-tab :browser-stack) (resolve-url nil)))) +(rf/defn open-browser-tabs + {:events [:browser.ui/open-browser-tabs]} + [{:keys [db] :as cofx}] + (rf/merge cofx + {:db (assoc db :browser/screen-id :browser-tabs)} + (navigation/change-tab :browser-stack))) + (rf/defn web3-error-callback {:events [:browser.dapp/transaction-on-error]} [_ message-id message] @@ -573,9 +582,9 @@ (rf/defn open-empty-tab {:events [:browser.ui/open-empty-tab]} - [cofx] + [{:keys [db]}] (debounce/clear :browser/navigation-state-changed) - (navigation/set-stack-root cofx :browser-stack :empty-tab)) + {:db (assoc db :browser/screen-id :empty-tab)}) (rf/defn url-input-pressed {:events [:browser.ui/url-input-pressed]} diff --git a/src/status_im/ui/screens/browser/stack.cljs b/src/status_im/ui/screens/browser/stack.cljs new file mode 100644 index 0000000000..207d3c5c18 --- /dev/null +++ b/src/status_im/ui/screens/browser/stack.cljs @@ -0,0 +1,14 @@ +(ns status-im.ui.screens.browser.stack + (:require [utils.re-frame :as rf] + [status-im.ui.screens.browser.empty-tab.views :as empty-tab] + [status-im.ui.screens.browser.views :as browser] + [status-im.ui.screens.browser.tabs.views :as tabs])) + +(defn browser-stack + [] + (let [screen-id (rf/sub [:browser/screen-id])] + (case screen-id + :empty-tab [empty-tab/empty-tab] + :browser [browser/browser] + :browser-tabs [tabs/tabs] + [empty-tab/empty-tab]))) diff --git a/src/status_im/ui/screens/browser/styles.cljs b/src/status_im/ui/screens/browser/styles.cljs index a2ca5cabbb..c8a6a8c09c 100644 --- a/src/status_im/ui/screens/browser/styles.cljs +++ b/src/status_im/ui/screens/browser/styles.cljs @@ -6,13 +6,14 @@ (defn navbar [] {:background-color colors/white - :height 51 + :height 100 :flex-direction :row :align-items :center :justify-content :space-between :border-top-color colors/gray-lighter :border-top-width 1 - :padding-horizontal 24}) + :padding-horizontal 24 + :padding-bottom 50}) (def disabled-button {:opacity 0.4}) diff --git a/src/status_im/ui/screens/browser/tabs/views.cljs b/src/status_im/ui/screens/browser/tabs/views.cljs index 3cd4cc392b..939621e72f 100644 --- a/src/status_im/ui/screens/browser/tabs/views.cljs +++ b/src/status_im/ui/screens/browser/tabs/views.cljs @@ -55,7 +55,7 @@ (views/defview tabs [] (views/letsubs [browsers [:browser/browsers-vals]] - [react/view {:flex 1} + [react/view {:flex 1 :margin-bottom 50} [topbar/topbar {:modal? true :border-bottom false diff --git a/src/status_im/ui/screens/browser/views.cljs b/src/status_im/ui/screens/browser/views.cljs index a68558bddb..6418cfed82 100644 --- a/src/status_im/ui/screens/browser/views.cljs +++ b/src/status_im/ui/screens/browser/views.cljs @@ -99,7 +99,7 @@ [chat-icon/custom-icon-view-list (:name dapps-account) (:color dapps-account) 32]] [react/touchable-highlight - {:on-press #(re-frame/dispatch [:set-stack-root :browser-stack :browser-tabs]) + {:on-press #(re-frame/dispatch [:browser.ui/open-browser-tabs]) :accessibility-label :browser-open-tabs} [icons/icon :main-icons/tabs {:color colors/black}]] diff --git a/src/status_im/ui/screens/profile/user/views.cljs b/src/status_im/ui/screens/profile/user/views.cljs index 7cd1f80c82..06e724bcea 100644 --- a/src/status_im/ui/screens/profile/user/views.cljs +++ b/src/status_im/ui/screens/profile/user/views.cljs @@ -204,6 +204,9 @@ {:right-accessories [{:accessibility-label :share-header-button :icon :main-icons/share :on-press on-share}] + :left-accessories [{:accessibility-label :close-header-button + :icon :main-icons/close + :on-press #(re-frame/dispatch [:navigate-back])}] :use-insets true :extended-header (profile-header/extended-header {:on-press on-share diff --git a/src/status_im/ui/screens/screens.cljs b/src/status_im/ui/screens/screens.cljs index fb47281a15..1a2ac273ae 100644 --- a/src/status_im/ui/screens/screens.cljs +++ b/src/status_im/ui/screens/screens.cljs @@ -12,9 +12,6 @@ [status-im.ui.screens.bootnodes-settings.edit-bootnode.views :as edit-bootnode] [status-im.ui.screens.bootnodes-settings.views :as bootnodes-settings] [status-im.ui.screens.browser.bookmarks.views :as bookmarks] - [status-im.ui.screens.browser.empty-tab.views :as empty-tab] - [status-im.ui.screens.browser.tabs.views :as browser.tabs] - [status-im.ui.screens.browser.views :as browser] [status-im.ui.screens.bug-report :as bug-report] [status-im.ui.screens.communities.channel-details :as communities.channel-details] [status-im.ui.screens.communities.community :as community] @@ -286,25 +283,6 @@ :options {:topBar {:title {:text (i18n/label :t/membership-title)}}} :component membership/membership} - ;;BROWSER - - {:name :empty-tab - :insets {:top true} - :options {:topBar {:visible false} - :hardwareBackButton {:popStackOnPress false}} - :component empty-tab/empty-tab} - {:name :browser - :options {:topBar {:visible false} - :popGesture false - :hardwareBackButton {:dismissModalOnPress false - :popStackOnPress false}} - :component browser/browser} - {:name :browser-tabs - :insets {:top true} - :options {:topBar {:visible false} - :hardwareBackButton {:popStackOnPress false}} - :component browser.tabs/tabs} - ;;WALLET {:name :wallet diff --git a/src/status_im2/common/home/view.cljs b/src/status_im2/common/home/view.cljs index 618c8f558b..91ddbef424 100644 --- a/src/status_im2/common/home/view.cljs +++ b/src/status_im2/common/home/view.cljs @@ -46,7 +46,7 @@ :style override-style :avatar user-avatar} " - [{:keys [type open-profile style avatar hide-search]}] + [{:keys [type style avatar hide-search]}] (let [button-common-props (get-button-common-props type) notif-count (rf/sub [:activity-center/unread-count]) new-notifications? (pos? notif-count) @@ -54,11 +54,12 @@ counter-label "0"] [rn/view {:style (assoc style :height 56)} ;; Left Section - [rn/touchable-without-feedback {:on-press open-profile} + [rn/touchable-without-feedback {:on-press #(rf/dispatch [:navigate-to :my-profile])} [rn/view - {:style {:position :absolute - :left 20 - :top 12}} + {:accessibility-label :open-profile + :style {:position :absolute + :left 20 + :top 12}} [quo/user-avatar (merge {:status-indicator? true diff --git a/src/status_im2/contexts/shell/home_stack.cljs b/src/status_im2/contexts/shell/home_stack.cljs index ad32fa0be3..4426a2c0e2 100644 --- a/src/status_im2/contexts/shell/home_stack.cljs +++ b/src/status_im2/contexts/shell/home_stack.cljs @@ -2,13 +2,13 @@ (:require [react-native.core :as rn] [react-native.reanimated :as reanimated] [react-native.safe-area :as safe-area] - [status-im.ui.screens.profile.user.views :as profile.user] [status-im.ui.screens.wallet.accounts.views :as wallet.accounts] [status-im2.contexts.chat.home.view :as chat] ;; TODO move to status-im2 [status-im2.contexts.communities.home.view :as communities] [status-im2.contexts.shell.animation :as animation] [status-im2.contexts.shell.constants :as shell.constants] - [status-im2.contexts.shell.style :as styles])) + [status-im2.contexts.shell.style :as styles] + [status-im.ui.screens.browser.stack :as browser.stack])) (defn load-stack? [stack-id] @@ -39,7 +39,7 @@ :communities-stack [communities/home] :chats-stack [chat/home] :wallet-stack [wallet.accounts/accounts-overview] - :browser-stack [profile.user/my-profile])])])) + :browser-stack [browser.stack/browser-stack])])])) (defn home-stack [] diff --git a/src/status_im2/subs/root.cljs b/src/status_im2/subs/root.cljs index c0f89a00b2..f323b99070 100644 --- a/src/status_im2/subs/root.cljs +++ b/src/status_im2/subs/root.cljs @@ -132,6 +132,7 @@ (reg-root-key-sub :browser/options :browser/options) (reg-root-key-sub :dapps/permissions :dapps/permissions) (reg-root-key-sub :bookmarks :bookmarks/bookmarks) +(reg-root-key-sub :browser/screen-id :browser/screen-id) ;;stickers (reg-root-key-sub :stickers/selected-pack :stickers/selected-pack) diff --git a/test/appium/tests/critical/chats/test_1_1_public_chats.py b/test/appium/tests/critical/chats/test_1_1_public_chats.py index bdb7644f03..9c6a19ea01 100644 --- a/test/appium/tests/critical/chats/test_1_1_public_chats.py +++ b/test/appium/tests/critical/chats/test_1_1_public_chats.py @@ -982,12 +982,12 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.profile_2.switch_push_notifications() self.profile_1.just_fyi("Sending contact request via Profile > Contacts") - self.profile_1.click_system_back_button_until_element_is_shown(self.profile_1.chats_tab) - self.home_1.chats_tab.click() + for home in (self.home_1, self.home_2): + home.click_system_back_button_until_element_is_shown() + home.chats_tab.click() self.home_1.send_contact_request_via_bottom_sheet(self.public_key_2) self.home_2.just_fyi("Accepting contact request from activity centre") - self.home_2.chats_tab.click() self.home_2.handle_contact_request(self.default_username_1) self.profile_1.just_fyi("Sending message to contact via Messages > Recent") @@ -1161,8 +1161,9 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): @marks.testrail_id(702745) def test_1_1_chat_non_latin_messages_stack_update_profile_photo(self): self.home_1.click_system_back_button_until_element_is_shown() - self.home_1.browser_tab.click() # temp, until profile is on browser tab + self.home_1.profile_button.click() self.profile_1.edit_profile_picture('sauce_logo.png') + self.profile_1.click_system_back_button_until_element_is_shown() self.profile_1.chats_tab.click() self.chat_2.just_fyi("Send messages with non-latin symbols") @@ -1204,7 +1205,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): [device.click_system_back_button_until_element_is_shown() for device in (self.device_1, self.device_2)] - self.home_2.browser_tab.click() # temp, until profile is on browser tab + self.home_2.profile_button.click() self.home_1.chats_tab.click() self.device_2.just_fyi("Device 2 puts app on background being on Profile view to receive PN with text") @@ -1214,7 +1215,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.device_1.just_fyi("Device 1 puts app on background to receive emoji push notification") self.device_1.click_system_back_button_until_element_is_shown() - self.device_1.browser_tab.click() # temp, until profile is on browser tab + self.device_1.profile_button.click() self.device_1.click_system_home_button() self.device_2.just_fyi("Check text push notification and tap it") diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index c46897cf30..fb645ab7a5 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -184,14 +184,13 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): for i in range(3): self.public_keys[i], self.usernames[i] = users[i] - self.homes[0].chats_tab.click() - for i in range(1, 3): - - self.homes[0].add_contact(self.public_keys[i]) - for i in range(3): + self.homes[i].click_system_back_button_until_element_is_shown() self.homes[i].chats_tab.click() + for i in range(1, 3): + self.homes[0].add_contact(self.public_keys[i]) + self.homes[0].just_fyi('Members add admin to contacts to see PNs and put app in background') self.loop.run_until_complete( run_in_parallel( diff --git a/test/appium/tests/critical/test_public_chat_browsing.py b/test/appium/tests/critical/test_public_chat_browsing.py index 72121daed1..a8680c1161 100644 --- a/test/appium/tests/critical/test_public_chat_browsing.py +++ b/test/appium/tests/critical/test_public_chat_browsing.py @@ -361,6 +361,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.public_key_1, self.default_username_1 = self.home_1.get_public_key_and_username(return_username=True) self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True) self.profile_1 = self.home_1.get_profile_view() + [home.click_system_back_button_until_element_is_shown() for home in (self.home_1, self.home_2)] [home.chats_tab.click() for home in (self.home_1, self.home_2)] self.home_1.add_contact(self.public_key_2) self.home_2.handle_contact_request(self.default_username_1) diff --git a/test/appium/tests/medium/test_activity_center.py b/test/appium/tests/medium/test_activity_center.py index 7825976a0d..bf29cac9b7 100644 --- a/test/appium/tests/medium/test_activity_center.py +++ b/test/appium/tests/medium/test_activity_center.py @@ -92,6 +92,8 @@ class TestActivityCenterMultipleDevicePR(MultipleSharedDeviceTestCase): self.profile_1.just_fyi("Enabling PNs") self.profile_1.switch_push_notifications() + [home.click_system_back_button_until_element_is_shown() for home in [self.home_1, self.home_2]] + @marks.testrail_id(702871) def test_activity_center_cancel_outgoing_contact_request_no_pn(self): @@ -133,7 +135,6 @@ class TestActivityCenterMultipleDevicePR(MultipleSharedDeviceTestCase): [home.chats_tab.click() for home in [self.home_1, self.home_2]] self.home_2.just_fyi("Device2 sends pending contact request after cancelling") - # self.home_2.browser_tab.click() # temp self.home_2.add_contact(self.public_key_1) self.device_1.just_fyi('Device1 verifies pending contact request') diff --git a/test/appium/tests/medium/test_deeplink_chat_share_profile.py b/test/appium/tests/medium/test_deeplink_chat_share_profile.py index b1a3a9310c..f388897767 100644 --- a/test/appium/tests/medium/test_deeplink_chat_share_profile.py +++ b/test/appium/tests/medium/test_deeplink_chat_share_profile.py @@ -344,6 +344,7 @@ class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase): self.sign_in = SignInView(self.drivers[0]) self.home = self.sign_in.create_user() self.public_key, self.default_username = self.home.get_public_key_and_username(return_username=True) + self.home.click_system_back_button_until_element_is_shown() self.home.chats_tab.click_until_presence_of_element(self.home.plus_button) @marks.testrail_id(702774) @@ -364,7 +365,8 @@ class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase): deep_link = 'status-im://u/%s' % self.public_key self.sign_in.open_weblink_and_login(deep_link) profile = self.home.get_profile_view() - self.home.browser_tab.click() + self.home.chats_tab.click() + self.home.profile_button.click() if profile.default_username_text.text != self.default_username: self.errors.append("Can't navigate to profile from deep link with own public key") self.errors.verify_no_errors() diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 94467c8828..0ea800f8ff 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -139,13 +139,15 @@ class WalletButton(TabButton): class ProfileButton(TabButton): def __init__(self, driver): - super().__init__(driver, xpath="//*[contains(@content-desc,'5 out of 5')]") + super().__init__(driver, accessibility_id="open-profile") def navigate(self): from views.profile_view import ProfileView return ProfileView(self.driver) def click(self, desired_element_text='privacy'): + if not self.is_element_displayed(): + ChatsTab(self.driver).click() from views.profile_view import ProfileView if desired_element_text == 'privacy': self.click_until_presence_of_element(ProfileView(self.driver).privacy_and_security_button) @@ -621,9 +623,9 @@ class BaseView(object): def get_public_key_and_username(self, return_username=False): self.driver.info("Get public key and username") - # profile_view = self.profile_button.click() - self.browser_tab.click() # temp, until profile is on browser tab - profile_view = self.get_profile_view() + profile_view = self.profile_button.click() + # self.browser_tab.click() # temp, until profile is on browser tab + #profile_view = self.get_profile_view() default_username = profile_view.default_username_text.text profile_view.share_my_profile_button.click() profile_view.public_key_text.wait_for_visibility_of_element(20)