From eea55b22d73dcb0a5b876c63f24fa9635c42185f Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Thu, 18 May 2023 00:20:38 +0530 Subject: [PATCH] Dont check `app-state` for `Android` when evaluating universal links routing (#15896) * Dont check app-state for android before routing PN On Android devices, right after account creation and before a log out, the :app-state value in reframe db is set to background. The value becomes active after a log out and then log in which causes tapping on push notifications to do nothing. This behaviour breaks E2E and hence in this PR, I remove the checking of this case only for Android platforms. More work should be done to figure out why the app state event handler is behaving this way on Android but for now I would like to unblock E2E. * e2e: remove xfailed tests --------- Co-authored-by: Churikova Tetiana --- src/status_im/utils/universal_links/core.cljs | 12 +++++++++--- .../tests/critical/chats/test_1_1_public_chats.py | 1 - test/appium/tests/critical/chats/test_group_chat.py | 1 - .../tests/critical/test_public_chat_browsing.py | 1 - 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/status_im/utils/universal_links/core.cljs b/src/status_im/utils/universal_links/core.cljs index 73a7397e24..90c2c8ec68 100644 --- a/src/status_im/utils/universal_links/core.cljs +++ b/src/status_im/utils/universal_links/core.cljs @@ -13,7 +13,8 @@ [status-im.wallet.choose-recipient.core :as choose-recipient] [status-im2.navigation.events :as navigation] [taoensso.timbre :as log] - [native-module.core :as native-module])) + [native-module.core :as native-module] + [react-native.platform :as platform])) ;; TODO(yenda) investigate why `handle-universal-link` event is ;; dispatched 7 times for the same link @@ -175,10 +176,15 @@ (rf/defn handle-url "Store url in the database if the user is not logged in, to be processed - on login, otherwise just handle it" + on login, otherwise just handle it. On Android platform the app-state value + in db is `background` immediately after account creation, hence we avoid the + app-state check for android platforms to fix this e2e blocker : + https://github.com/status-im/status-mobile/issues/15859 + " {:events [:universal-links/handle-url]} [{:keys [db] :as cofx} url] - (if (and (multiaccounts.model/logged-in? db) (= (:app-state db) "active")) + (if (and (multiaccounts.model/logged-in? db) + (or platform/android? (= (:app-state db) "active"))) (route-url cofx url) (store-url-for-later cofx url))) 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 f1af5d78dd..2815e3b0a0 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 @@ -1065,7 +1065,6 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.errors.verify_no_errors() @marks.testrail_id(702813) - @marks.xfail(reason="blocked by 15859") def test_1_1_chat_push_emoji(self): message_no_pn, message = 'No PN', 'Text push notification' diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index af24222154..2241e66826 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -203,7 +203,6 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.chats[0].send_message(self.message_before_adding) @marks.testrail_id(702807) - @marks.xfail(reason="blocked by 15859") def test_group_chat_join_send_text_messages_push(self): message_to_admin = self.message_to_admin [self.homes[i].click_system_back_button_until_element_is_shown() for i in range(3)] diff --git a/test/appium/tests/critical/test_public_chat_browsing.py b/test/appium/tests/critical/test_public_chat_browsing.py index 10c8b9182d..97e15654eb 100644 --- a/test/appium/tests/critical/test_public_chat_browsing.py +++ b/test/appium/tests/critical/test_public_chat_browsing.py @@ -743,7 +743,6 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.errors.verify_no_errors() @marks.testrail_id(702786) - @marks.xfail(reason="blocked by 15859") def test_community_mentions_push_notification(self): self.home_1.click_system_back_button_until_element_is_shown() if not self.channel_2.chat_message_input.is_element_displayed():