From 3f433d6f191a1bd87c04c980a85205a2a4ab13c7 Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Wed, 2 Aug 2023 15:17:11 +0300 Subject: [PATCH] e2e: group chat unread messages --- .../chat/home/chat_list_item/view.cljs | 4 +++- .../tests/critical/chats/test_group_chat.py | 4 ++-- .../critical/test_public_chat_browsing.py | 8 +++---- test/appium/tests/medium/test_profile_m.py | 2 +- test/appium/tests/upgrade/test_upgrade.py | 2 +- test/appium/views/home_view.py | 22 +++++++++---------- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/status_im2/contexts/chat/home/chat_list_item/view.cljs b/src/status_im2/contexts/chat/home/chat_list_item/view.cljs index c37ca6a081..b1c3b57976 100644 --- a/src/status_im2/contexts/chat/home/chat_list_item/view.cljs +++ b/src/status_im2/contexts/chat/home/chat_list_item/view.cljs @@ -227,7 +227,9 @@ ;; TODO: use the grey-dot component when chat-list-item is moved to quo2.components (and group-chat unread-messages?) - [rn/view {:style (style/grey-dot)}] + [rn/view + {:style (style/grey-dot) + :accessibility-label :unviewed-messages-public}] unread-messages? [quo/info-count diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index ba271af678..c1de879671 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -539,7 +539,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.chats[0].send_message(muted_message) self.homes[1].just_fyi("Member 1 checks that chat is muted and message is received") chat = self.homes[1].get_chat(self.chat_name) - if chat.new_messages_counter.is_element_displayed(30): + if chat.new_messages_grey_dot.is_element_displayed(30): self.errors.append("New messages counter near chat name is shown after mute") try: after_mute_counter = int(self.homes[1].chats_tab.counter.text) @@ -588,7 +588,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): initial_counter = 0 self.chats[2].send_message(unmuted_message) self.homes[1].just_fyi("Member 1 checks that chat is unmuted and message is received") - if not chat.new_messages_counter.is_element_displayed(30): + if not chat.new_messages_grey_dot.is_element_displayed(30): self.errors.append("New messages counter near chat name is not shown after unmute") try: after_mute_counter = int(self.homes[1].chats_tab.counter.text) diff --git a/test/appium/tests/critical/test_public_chat_browsing.py b/test/appium/tests/critical/test_public_chat_browsing.py index 3db9f0f935..0fea733537 100644 --- a/test/appium/tests/critical/test_public_chat_browsing.py +++ b/test/appium/tests/critical/test_public_chat_browsing.py @@ -850,14 +850,14 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_2.send_message(message) self.home_1.just_fyi('Check new messages badge is shown for community') community_element_1 = self.home_1.get_chat(self.community_name, community=True) - if not community_element_1.new_messages_community.is_element_displayed(sec=30): + if not community_element_1.new_messages_grey_dot.is_element_displayed(sec=30): self.errors.append('New message community badge is not shown') community_1 = community_element_1.click() channel_1_element = community_1.get_channel(self.channel_name) self.home_1.just_fyi('Check new messages badge is shown for community') - if not community_element_1.new_messages_community.is_element_displayed(): + if not community_element_1.new_messages_grey_dot.is_element_displayed(): self.errors.append('New messages channel badge is not shown on channel') channel_1_element.click() self.errors.verify_no_errors() @@ -966,12 +966,12 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.community_2.get_channel(self.channel_name).click() self.channel_2.send_message(self.text_message) community_1_element = self.community_1.get_chat(self.community_name) - if not community_1_element.new_messages_public_chat.is_element_displayed(90): + if not community_1_element.new_messages_grey_dot.is_element_displayed(90): self.errors.append('New messages counter is not shown in home > Commmunity element') mark_as_read_button = self.community_1.mark_all_messages_as_read_button community_1_element.long_press_until_element_is_shown(mark_as_read_button) mark_as_read_button.click() - if community_1_element.new_messages_public_chat.is_element_displayed(): + if community_1_element.new_messages_grey_dot.is_element_displayed(): self.errors.append( 'Unread messages badge is shown in community channel while there are no unread messages') # TODO: there should be one more check for community channel, which is still not ready diff --git a/test/appium/tests/medium/test_profile_m.py b/test/appium/tests/medium/test_profile_m.py index 6e8974754d..4e656a1054 100644 --- a/test/appium/tests/medium/test_profile_m.py +++ b/test/appium/tests/medium/test_profile_m.py @@ -334,7 +334,7 @@ class TestProfileGapsCommunityMediumMultipleDevicesMerged(MultipleSharedDeviceTe community_1.home_button.double_click() self.home_1.get_chat(community_name, community=True).click() chat_element_1 = community_1.get_chat(channel_name) - if not chat_element_1.new_messages_public_chat.is_element_displayed(): + if not chat_element_1.new_messages_grey_dot.is_element_displayed(): self.errors.append("Unread messages counter is not shown for community channel!") if not community_1.element_by_text(message_member).is_element_displayed(): self.errors.append("Message from member is not shown for community channel!") diff --git a/test/appium/tests/upgrade/test_upgrade.py b/test/appium/tests/upgrade/test_upgrade.py index f13bfeb0b1..49b2e896fc 100644 --- a/test/appium/tests/upgrade/test_upgrade.py +++ b/test/appium/tests/upgrade/test_upgrade.py @@ -51,7 +51,7 @@ class TestUpgradeApplication(SingleDeviceTestCase): unread_one_to_one, unread_public = home.get_chat(unread_one_to_one_name), home.get_chat(unread_public_name) if unread_one_to_one.new_messages_counter.text != chats[unread_one_to_one_name]['unread']: self.errors.append('New messages counter is not shown on chat element') - if not unread_public.new_messages_public_chat.is_element_displayed(): + if not unread_public.new_messages_grey_dot.is_element_displayed(): self.errors.append('Unread messages badge is not shown in public chat') home.just_fyi("Check images / add to contacts") diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index f62d2c7e40..f2cdaea8e8 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -101,20 +101,20 @@ class ChatElement(SilentButton): return NoMessageText(self.driver, self.locator) @property - def new_messages_public_chat(self): + def new_messages_grey_dot(self): class UnreadMessagesPublicChat(BaseElement): - def __init__(self, driver): - super().__init__(driver, accessibility_id="unviewed-messages-public") + def __init__(self, driver, parent_locator): + super().__init__(driver, xpath="%s/*[@content-desc='unviewed-messages-public']" % parent_locator) - return UnreadMessagesPublicChat(self.driver) + return UnreadMessagesPublicChat(self.driver, self.locator) - @property - def new_messages_community(self): - class UnreadMessagesCommunity(BaseElement): - def __init__(self, driver, parent_locator: str): - super().__init__(driver, prefix=parent_locator, xpath="%s/android.view.ViewGroup" % parent_locator) - - return UnreadMessagesCommunity(self.driver, self.locator) + # @property + # def new_messages_community(self): + # class UnreadMessagesCommunity(BaseElement): + # def __init__(self, driver, parent_locator: str): + # super().__init__(driver, prefix=parent_locator, xpath="%s/android.view.ViewGroup" % parent_locator) + # + # return UnreadMessagesCommunity(self.driver, self.locator) @property def chat_image(self):