From 460aaedbcad9b515e9dbf4e3c55c7a30f7e42bdc Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Thu, 4 Jul 2024 17:07:34 +0300 Subject: [PATCH] e2e: false failures fixes --- .../critical/chats/test_1_1_public_chats.py | 9 +++++---- .../tests/critical/chats/test_group_chat.py | 18 +++++++----------- test/appium/views/chat_view.py | 4 +++- 3 files changed, 15 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 880bc17502..c35f5719ba 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 @@ -261,11 +261,12 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): # self.errors.append("Message_4 is not unpinned!") for chat_number, chat in enumerate([self.chat_1, self.chat_2]): - count = chat.pinned_messages_count.text - if count != '2': + try: + chat.pinned_messages_count.wait_for_element_text(text='2', wait_time=20) + except Failed: self.errors.append( - "Pinned messages count is %s but should be 2 after unpinning the last pinned message for user %s" % - (count, chat_number + 1) + "Pinned messages count is not 2 after unpinning the last pinned message for user %s" % ( + chat_number + 1) ) self.errors.verify_no_errors() diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index 288579e607..5388e31b2b 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -435,16 +435,14 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.errors.verify_no_errors() @marks.testrail_id(703495) - @marks.xfail( - reason="Chat is not unmuted after expected time: https://github.com/status-im/status-mobile/issues/19627") def test_group_chat_mute_chat(self): [self.homes[i].navigate_back_to_home_view() for i in range(3)] - self.homes[1].just_fyi("Member 1 mutes the chat for 1 hour") - self.homes[1].mute_chat_long_press(self.chat_name, "mute-for-1-hour") + self.homes[1].just_fyi("Member 1 mutes the chat for 8 hours") + self.homes[1].mute_chat_long_press(self.chat_name, "mute-for-8-hours") device_time = self.homes[1].driver.device_time current_time = datetime.datetime.strptime(device_time, "%Y-%m-%dT%H:%M:%S%z") - expected_times = [current_time + datetime.timedelta(minutes=i) for i in range(59, 62)] + expected_times = [current_time + datetime.timedelta(minutes=i) for i in range(479, 482)] expected_texts = [ "Muted until %s %s" % (exp_time.strftime('%H:%M'), "today" if current_time.hour < 23 else "tomorrow") for exp_time in expected_times] @@ -484,14 +482,12 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): "Message '%s' is not shown in chat for %s after mute" % (muted_message, self.usernames[1])) self.chats[1].navigate_back_to_home_view() - self.chats[1].just_fyi("Change device time so chat will be unmuted by timer") - unmute_time = current_time + datetime.timedelta(minutes=61) - self.homes[1].driver.execute_script("mobile: shell", - {"command": "su root date %s" % unmute_time.strftime("%m%d%H%M%Y.%S")} - ) + self.chats[1].just_fyi("Member 1 unmutes the chat") + chat.long_press_element() + self.homes[1].mute_chat_button.click() chat.long_press_element() if self.homes[1].element_starts_with_text("Muted until").is_element_displayed(): - self.errors.append("Chat is still muted after timeout") + self.errors.append("Chat is still muted after being unmuted") self.errors.verify_no_errors() if self.homes[1].mute_chat_button.is_element_displayed(): self.homes[1].click_system_back_button() diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 5676fbd71f..572f72159c 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -1037,7 +1037,9 @@ class ChatView(BaseView): def quote_message(self, message: str): self.driver.info("Quoting '%s' message" % message) - self.chat_element_by_text(message).long_press_until_element_is_shown(self.reply_message_button) + element = self.chat_element_by_text(message) + element.wait_for_sent_state() + element.long_press_until_element_is_shown(self.reply_message_button) self.reply_message_button.click() def set_reaction(self, message: str, emoji: str = 'thumbs-up', emoji_message=False):