From 6d5ff4aa92b0a52f322321e81f79472f949e92f1 Mon Sep 17 00:00:00 2001 From: Jamie Caprani Date: Mon, 28 Nov 2022 11:17:12 +0000 Subject: [PATCH] chore: fix issues with e2e tests after refactors (#14440) --- src/quo2/components/counter/counter.cljs | 6 +- src/status_im2/common/home/view.cljs | 7 +- .../test_deeplink_chat_share_profile.py | 132 +++++++++--------- test/appium/views/home_view.py | 10 +- 4 files changed, 82 insertions(+), 73 deletions(-) diff --git a/src/quo2/components/counter/counter.cljs b/src/quo2/components/counter/counter.cljs index 27048d7662..7bad174661 100644 --- a/src/quo2/components/counter/counter.cljs +++ b/src/quo2/components/counter/counter.cljs @@ -20,7 +20,7 @@ (defn counter "type: default, secondary, grey, outline value: integer" - [{:keys [type override-text-color override-bg-color style]} value] + [{:keys [type override-text-color override-bg-color style accessibility-label]} value] (let [type (or type :default) text-color (or override-text-color (if (or @@ -38,7 +38,9 @@ 1 16 2 20 28)] - [rn/view {:style (cond-> (merge + [rn/view {:accessible true + :accessibility-label accessibility-label + :style (cond-> (merge {:align-items :center :justify-content :center :border-radius 6 diff --git a/src/status_im2/common/home/view.cljs b/src/status_im2/common/home/view.cljs index a203c3e9a1..9dcb34ec27 100644 --- a/src/status_im2/common/home/view.cljs +++ b/src/status_im2/common/home/view.cljs @@ -94,14 +94,17 @@ :open-activity-center-button button-common-props]] (when new-notifications? (if (= notification-indicator :counter) - [quo/counter {:outline false + [quo/counter {:accessibility-label :notifications-unread-badge + :outline false :override-text-color colors/white :override-bg-color colors/primary-50 :style {:position :absolute :left 34 :top -6}} counter-label] - [rn/view {:style {:width 8 + [rn/view {:accessible true + :accessibility-label :notifications-unread-badge + :style {:width 8 :height 8 :border-radius 4 :top -2 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 06b59ce7f8..b8740c5624 100644 --- a/test/appium/tests/medium/test_deeplink_chat_share_profile.py +++ b/test/appium/tests/medium/test_deeplink_chat_share_profile.py @@ -396,72 +396,72 @@ class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase): self.driver.fail("User profile screen is not opened") self.errors.verify_no_errors() - @marks.testrail_id(702777) - @marks.skip(reason="Skipping until chat names are implemented in new UI") - def test_scan_qr_with_scan_contact_code_via_start_chat(self): + # @marks.testrail_id(702777) + # @marks.skip(reason="Skipping until chat names are implemented in new UI") + # def test_scan_qr_with_scan_contact_code_via_start_chat(self): - url_data = { - 'ens_with_stateofus_domain_deep_link': { - 'url': 'https://join.status.im/u/%s.stateofus.eth' % ens_user_message_sender['ens'], - 'username': '@%s' % ens_user_message_sender['ens'] - }, - 'ens_without_stateofus_domain_deep_link': { - 'url': 'https://join.status.im/u/%s' % ens_user_message_sender['ens'], - 'username': '@%s' % ens_user_message_sender['ens'] - }, - 'ens_another_domain_deep_link': { - 'url': 'status-im://u/%s' % ens_user['ens'], - 'username': '@%s' % ens_user['ens'] - }, - 'own_profile_key_deep_link': { - 'url': 'https://join.status.im/u/%s' % self.public_key, - 'error': "That's you" - }, - 'other_user_profile_key_deep_link': { - 'url': 'https://join.status.im/u/%s' % transaction_senders['M']['public_key'], - 'username': transaction_senders['M']['username'] - }, - 'other_user_profile_key_deep_link_invalid': { - 'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'], - 'error': 'Please enter or scan a valid chat key' - }, - 'own_profile_key': { - 'url': self.public_key, - 'error': "That's you" - }, - # 'ens_without_stateofus_domain': { - # 'url': ens_user['ens'], - # 'username': ens_user['username'] - # }, - 'other_user_profile_key': { - 'url': transaction_senders['M']['public_key'], - 'username': transaction_senders['M']['username'] - }, - 'other_user_profile_key_invalid': { - 'url': '%s123' % ens_user['public_key'], - 'error': 'Please enter or scan a valid chat key' - }, - } + # url_data = { + # 'ens_with_stateofus_domain_deep_link': { + # 'url': 'https://join.status.im/u/%s.stateofus.eth' % ens_user_message_sender['ens'], + # 'username': '@%s' % ens_user_message_sender['ens'] + # }, + # 'ens_without_stateofus_domain_deep_link': { + # 'url': 'https://join.status.im/u/%s' % ens_user_message_sender['ens'], + # 'username': '@%s' % ens_user_message_sender['ens'] + # }, + # 'ens_another_domain_deep_link': { + # 'url': 'status-im://u/%s' % ens_user['ens'], + # 'username': '@%s' % ens_user['ens'] + # }, + # 'own_profile_key_deep_link': { + # 'url': 'https://join.status.im/u/%s' % self.public_key, + # 'error': "That's you" + # }, + # 'other_user_profile_key_deep_link': { + # 'url': 'https://join.status.im/u/%s' % transaction_senders['M']['public_key'], + # 'username': transaction_senders['M']['username'] + # }, + # 'other_user_profile_key_deep_link_invalid': { + # 'url': 'https://join.status.im/u/%sinvalid' % ens_user['public_key'], + # 'error': 'Please enter or scan a valid chat key' + # }, + # 'own_profile_key': { + # 'url': self.public_key, + # 'error': "That's you" + # }, + # # 'ens_without_stateofus_domain': { + # # 'url': ens_user['ens'], + # # 'username': ens_user['username'] + # # }, + # 'other_user_profile_key': { + # 'url': transaction_senders['M']['public_key'], + # 'username': transaction_senders['M']['username'] + # }, + # 'other_user_profile_key_invalid': { + # 'url': '%s123' % ens_user['public_key'], + # 'error': 'Please enter or scan a valid chat key' + # }, + # } - for key in url_data: - self.home.chats_tab.click_until_presence_of_element(self.home.plus_button) - self.home.plus_button.click_until_presence_of_element(self.home.start_new_chat_button) - contacts = self.home.start_new_chat_button.click() - self.home.just_fyi('Checking scanning qr for "%s" case' % key) - contacts.scan_contact_code_button.click() - contacts.allow_button.click_if_shown(3) - contacts.enter_qr_edit_box.scan_qr(url_data[key]['url']) - chat = ChatView(self.drivers[0]) - if url_data[key].get('error'): - if not chat.element_by_text_part(url_data[key]['error']).is_element_displayed(): - self.errors.append('Expected error %s is not shown' % url_data[key]['error']) - chat.ok_button.click() - if url_data[key].get('username'): - if not chat.chat_message_input.is_element_displayed(): - self.errors.append( - 'In "%s" case chat input is not found after scanning, so no redirect to 1-1' % key) - if not chat.element_by_text(url_data[key]['username']).is_element_displayed(): - self.errors.append('In "%s" case "%s" not found after scanning' % (key, url_data[key]['username'])) - chat.get_back_to_home_view() - self.errors.verify_no_errors() + # for key in url_data: + # self.home.chats_tab.click_until_presence_of_element(self.home.plus_button) + # self.home.plus_button.click_until_presence_of_element(self.home.start_new_chat_button) + # contacts = self.home.start_new_chat_button.click() + # self.home.just_fyi('Checking scanning qr for "%s" case' % key) + # contacts.scan_contact_code_button.click() + # contacts.allow_button.click_if_shown(3) + # contacts.enter_qr_edit_box.scan_qr(url_data[key]['url']) + # chat = ChatView(self.drivers[0]) + # if url_data[key].get('error'): + # if not chat.element_by_text_part(url_data[key]['error']).is_element_displayed(): + # self.errors.append('Expected error %s is not shown' % url_data[key]['error']) + # chat.ok_button.click() + # if url_data[key].get('username'): + # if not chat.chat_message_input.is_element_displayed(): + # self.errors.append( + # 'In "%s" case chat input is not found after scanning, so no redirect to 1-1' % key) + # if not chat.element_by_text(url_data[key]['username']).is_element_displayed(): + # self.errors.append('In "%s" case "%s" not found after scanning' % (key, url_data[key]['username'])) + # chat.get_back_to_home_view() + # self.errors.verify_no_errors() diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index f2e2166380..eead34cb75 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -207,7 +207,9 @@ class HomeView(BaseView): # Notification centre self.notifications_button = Button(self.driver, accessibility_id="notifications-button") - self.notifications_unread_badge = Button(self.driver, accessibility_id="notifications-unread-badge") + self.notifications_unread_badge = BaseElement(self.driver, accessibility_id="notifications-unread-badge") + self.open_activity_center_button = Button(self.driver, accessibility_id="open-activity-center-button") + self.notifications_select_button = Button(self.driver, translation_id="select") self.notifications_reject_and_delete_button = Button(self.driver, accessibility_id="reject-and-delete" "-activity-center") @@ -257,7 +259,8 @@ class HomeView(BaseView): self.driver.info("Looking for chat: '%s'" % username) chat_element = ChatElement(self.driver, username[:25], community=community) if not chat_element.is_element_displayed(10): - self.notifications_unread_badge.wait_and_click(wait_time) + if self.notifications_unread_badge.is_element_displayed(30): + self.open_activity_center_button.click() chat_in_ac = ActivityCenterChatElement(self.driver, username[:25]) chat_in_ac.wait_for_element(20) chat_in_ac.click() @@ -274,7 +277,8 @@ class HomeView(BaseView): return chat_element def handle_contact_request(self, username: str, accept=True): - self.notifications_unread_badge.wait_and_click() + if self.notifications_unread_badge.is_element_displayed(30): + self.open_activity_center_button.click() chat_element = ActivityCenterChatElement(self.driver, username[:25]) if accept: self.driver.info("Accepting contact request for %s" % username)