From e1bcc8fec4a67aa900ed0cd64c94737b99afb1e7 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Mon, 27 Feb 2023 16:38:50 +0100 Subject: [PATCH] e2e: fix pinned messages --- .../critical/chats/test_1_1_public_chats.py | 7 ++++++- .../tests/critical/chats/test_group_chat.py | 19 ++++++++----------- .../critical/test_public_chat_browsing.py | 4 +--- test/appium/views/chat_view.py | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) 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 760b3d8755..bdb7644f03 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 @@ -1138,7 +1138,12 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.home_1.just_fyi("Unpin one message and check it's unpinned for another user") self.chat_2.tap_by_coordinates(500, 100) - self.chat_1.pin_message(self.message_4, action="unpin-from-chat") + self.chat_1.view_pinned_messages_button.click_until_presence_of_element(self.chat_1.pinned_messages_list) + pinned_message = self.chat_1.pinned_messages_list.message_element_by_text(self.message_4) + + element = self.chat_1.element_by_translation_id("unpin-from-chat") + pinned_message.long_press_until_element_is_shown(element) + element.click_until_absense_of_element(element) try: self.chat_2.chat_element_by_text(self.message_4).pinned_by_label.wait_for_invisibility_of_element() except TimeoutException: diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index 25eecd7a2e..5c83e23cba 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -321,17 +321,14 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.chats[0].just_fyi("Check that a user can not pin more than 3 messages") self.chats[0].send_message(self.message_4) self.chats[0].pin_message(self.message_4, 'pin-to-chat') - if self.chats[0].pin_limit_popover.is_element_displayed(30): - self.chats[0].view_pinned_messages_button.click_until_presence_of_element(self.chats[0].pinned_messages_list) - self.chats[0].pinned_messages_list.message_element_by_text(self.message_2).click_inside_element_by_coordinate() - self.chats[0].element_by_translation_id('unpin-from-chat').double_click() - self.chats[0].chat_element_by_text(self.message_4).click() - self.chats[0].pin_message(self.message_4, 'pin-to-chat') - if not (self.chats[0].chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30) and - self.chats[1].chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30)): - self.errors.append("Message 4 is not pinned in group chat after unpinning previous one") - else: - self.errors.append("Can pin more than 3 messages in group chat") + self.chats[0].view_pinned_messages_button.click_until_presence_of_element(self.chats[0].pinned_messages_list) + self.chats[0].pinned_messages_list.message_element_by_text(self.message_2).click_inside_element_by_coordinate() + self.chats[0].element_by_translation_id('unpin-from-chat').double_click() + self.chats[0].chat_element_by_text(self.message_4).click() + self.chats[0].pin_message(self.message_4, 'pin-to-chat') + if not (self.chats[0].chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30) and + self.chats[1].chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30)): + self.errors.append("Message 4 is not pinned in group chat after unpinning previous one") self.chats[0].just_fyi("Check pinned messages count and content") for chat_number, group_chat in enumerate([self.chats[0], self.chats[1]]): diff --git a/test/appium/tests/critical/test_public_chat_browsing.py b/test/appium/tests/critical/test_public_chat_browsing.py index ded08ae604..3ba721ff8b 100644 --- a/test/appium/tests/critical/test_public_chat_browsing.py +++ b/test/appium/tests/critical/test_public_chat_browsing.py @@ -555,7 +555,6 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): channel_1_element.click() self.errors.verify_no_errors() - # @marks.testrail_id(702842) # Skipped until implemented in NEW UI # def test_community_mark_all_messages_as_read(self): @@ -578,10 +577,9 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): # self.errors.verify_no_errors() @marks.testrail_id(702845) - @marks.xfail(reason="blocked by 15187") def test_community_leave(self): self.home_2.jump_to_communities_home() - community = self.home_2.element_by_text(self.community_name) + community = self.home_2.get_chat(self.community_name, community=True) community_to_leave = CommunityView(self.drivers[1]) community.long_press_until_element_is_shown(community_to_leave.leave_community_button) community_to_leave.leave_community_button.click() diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 69c49f9c22..4c71160850 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -617,7 +617,7 @@ class PinnedMessagesList(BaseElement): return len(element.find_elements()) def message_element_by_text(self, text): - message_element = Text(self.driver, prefix=self.locator, xpath="//*[starts-with(@text,'%s')]" % text) + message_element = Button(self.driver, prefix=self.locator, xpath="//*[starts-with(@text,'%s')]" % text) self.driver.info("Looking for a pinned message by text: %s" % message_element.exclude_emoji(text)) return message_element