From 6f920afcf79289071d7c84844fc8d9636ad06132 Mon Sep 17 00:00:00 2001 From: Yevheniia Berdnyk Date: Tue, 13 Jun 2023 06:24:21 +0300 Subject: [PATCH] e2e: Fixes for jump-to --- test/appium/tests/base_test_case.py | 2 +- .../critical/chats/test_1_1_public_chats.py | 6 ++++-- .../tests/critical/test_public_chat_browsing.py | 17 +++++++++++------ test/appium/views/base_view.py | 5 ++++- test/appium/views/chat_view.py | 2 +- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/test/appium/tests/base_test_case.py b/test/appium/tests/base_test_case.py index 9108bb317a..1fdec301f1 100644 --- a/test/appium/tests/base_test_case.py +++ b/test/appium/tests/base_test_case.py @@ -370,7 +370,7 @@ class SauceSharedMultipleDeviceTestCase(AbstractTestCase): '%s_geth%s.log' % (test_suite_data.current_test.name, str(self.drivers[driver].number))) geth_contents.append(self.pull_geth(self.drivers[driver])) - except (WebDriverException, AttributeError, RemoteDisconnected): + except (WebDriverException, AttributeError, RemoteDisconnected, ProtocolError): pass finally: try: 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 c05b9b3f7b..b3f06a5b3f 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 @@ -1148,8 +1148,10 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): @marks.testrail_id(702733) def test_1_1_chat_text_message_delete_push_disappear(self): - self.chat_2.jump_to_card_by_text(self.username_1) - self.chat_1.jump_to_card_by_text(self.username_2) + if not self.chat_2.chat_message_input.is_element_displayed(): + self.chat_2.jump_to_card_by_text(self.username_1) + if not self.chat_1.chat_message_input.is_element_displayed(): + self.chat_1.jump_to_card_by_text(self.username_2) self.device_2.just_fyi("Verify Device1 can not edit and delete received message from Device2") message_after_edit_1_1 = 'smth I should edit' diff --git a/test/appium/tests/critical/test_public_chat_browsing.py b/test/appium/tests/critical/test_public_chat_browsing.py index a0084b5092..def86220d6 100644 --- a/test/appium/tests/critical/test_public_chat_browsing.py +++ b/test/appium/tests/critical/test_public_chat_browsing.py @@ -454,9 +454,9 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): (", ".join(sent_time_variants), timestamp)) self.channel_1.verify_message_is_under_today_text(message, self.errors) new_message = "new message" - self.channel_1.send_message(message) + self.channel_1.send_message(new_message) self.channel_2.verify_message_is_under_today_text(new_message, self.errors, 60) - if self.channel_2.chat_element_by_text(message).username.text != self.username_1: + if self.channel_2.chat_element_by_text(new_message).username.text != self.username_1: self.errors.append("Default username '%s' is not shown next to the received message" % self.username_1) self.errors.verify_no_errors() @@ -542,7 +542,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_2.chat_message_input.send_keys(message_text) self.channel_2.send_message_button.click() chat_element_1 = self.channel_1.chat_element_by_text(message_text) - if not chat_element_1.is_element_displayed(sec=60) or chat_element_1.replied_message_text != 'Image': + if not chat_element_1.is_element_displayed(sec=60) or chat_element_1.replied_message_text != image_description: self.errors.append('Reply message was not received by the sender') self.errors.verify_no_errors() @@ -566,7 +566,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_2.chat_message_input.send_keys(message_text) self.channel_2.send_message_button.click() chat_element_1 = self.channel_1.chat_element_by_text(message_text) - if not chat_element_1.is_element_displayed(sec=60) or chat_element_1.replied_message_text != 'Image': + if not chat_element_1.is_element_displayed(sec=60) or chat_element_1.replied_message_text != image_description: self.errors.append('Reply message was not received by the sender') self.errors.verify_no_errors() @@ -760,8 +760,13 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): @marks.testrail_id(703086) def test_community_mark_all_messages_as_read(self): - self.channel_1.jump_to_communities_home() - self.home_2.jump_to_card_by_text('# %s' % self.channel_name) + self.channel_1.click_system_back_button_until_element_is_shown() + self.home_1.communities_tab.click() + if not self.channel_2.chat_message_input.is_element_displayed(): + self.channel_2.click_system_back_button_until_element_is_shown() + self.home_2.communities_tab.click() + self.home_2.get_chat(self.community_name, community=True).click() + 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): diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 149cf115be..a712dca55d 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -369,7 +369,7 @@ class BaseView(object): def hide_keyboard_if_shown(self): if self.driver.is_keyboard_shown(): - self.driver.hide_keyboard() + self.click_system_back_button() def click_system_back_button(self, times=1): self.driver.info('Click system back button') @@ -598,14 +598,17 @@ class BaseView(object): sign_in_view.sign_in(password) def jump_to_messages_home(self): + self.hide_keyboard_if_shown() self.jump_to_button.click() self.chats_tab.click_until_presence_of_element(self.jump_to_button) def jump_to_communities_home(self): + self.hide_keyboard_if_shown() self.jump_to_button.click() self.communities_tab.click_until_presence_of_element(self.jump_to_button) def jump_to_card_by_text(self, text: str): + self.hide_keyboard_if_shown() self.jump_to_button.click() self.element_by_text(text).click() diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 8d96683a0e..9aae178be7 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -1167,7 +1167,7 @@ class ChatView(BaseView): self.allow_button.click_if_shown() [self.get_image_by_index(i).click() for i in indexes] self.images_confirm_selection_button.click() - self.chat_message_input.set_value(description) + self.chat_message_input.send_keys(description) self.send_message_button.click() @staticmethod