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 e98a5524f2..6c537e40b4 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 @@ -227,6 +227,7 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase): self.chat_2 = self.home_2.get_chat(self.default_username_1).click() @marks.testrail_id(6315) + # moved def test_1_1_chat_message_reaction(self): message_from_sender = "Message sender" self.device_1.just_fyi("Sender start 1-1 chat, set emoji and check counter") @@ -378,6 +379,7 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase): self.errors.verify_no_errors() @marks.testrail_id(5315) + # moved def test_1_1_chat_non_latin_message_to_newly_added_contact_with_profile_picture_on_different_networks(self): self.home_1.get_app_from_background() self.home_2.get_app_from_background() @@ -1223,11 +1225,10 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase): self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) self.home_1 = self.device_1.create_user(enable_notifications=True) self.home_2 = self.device_2.create_user(enable_notifications=True) - self.home_1.browser_tab.click() #temp, until profile is on browser tab self.profile_1 = self.home_1.get_profile_view() - self.default_username_1 = self.profile_1.default_username_text.text - self.profile_1.chats_tab.click() + self.public_key_1, self.default_username_1 = self.home_1.get_public_key_and_username(return_username=True) self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True) + self.profile_1.chats_tab.click() self.chat_1 = self.home_1.add_contact(self.public_key_2) self.chat_1.send_message('hey') self.home_2.click_system_back_button_until_element_is_shown() @@ -1260,3 +1261,56 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase): if counter != 1: self.errors.append('Counter is not decreased after re-tapping emoji from receiver!') self.errors.verify_no_errors() + + @marks.testrail_id(702745) + def test_1_1_chat_non_latin_messages_stack_update_profile_photo(self): + self.home_1.click_system_back_button_until_element_is_shown() + self.home_1.browser_tab.click() #temp, until profile is on browser tab + self.profile_1.edit_profile_picture('sauce_logo.png') + self.profile_1.chats_tab.click() + + self.chat_2.just_fyi("Send messages with non-latin symbols") + messages = ['hello', '¿Cómo estás tu año?', 'ё, доброго вечерочка', '® æ ç ♥'] + + for message in messages: + self.chat_2.send_message(message) + if not self.chat_1.chat_message_input.is_element_displayed(): + self.chat_1.click_system_back_button_until_element_is_shown() + self.home_1.get_chat(self.default_username_2).click() + + for message in messages: + if not self.chat_1.chat_element_by_text(message).is_element_displayed(): + self.errors.append("Message with test '%s' was not received" % message) + + self.chat_2.just_fyi("Checking updated member photo, timestamp and username on message") + timestamp = self.chat_2.chat_element_by_text(messages[0]).timestamp + sent_time_variants = self.chat_2.convert_device_time_to_chat_timestamp() + if timestamp not in sent_time_variants: + self.errors.append('Timestamp on message %s does not correspond expected [%s]' % (timestamp, *sent_time_variants)) + + for message in [messages[1], messages[2]]: + if self.chat_2.chat_element_by_text(message).member_photo.is_element_displayed(): + self.errors.append('%s is not stack to 1st(they are sent in less than 5 minutes)!' % message) + + self.chat_1.just_fyi("Sending message while user is still not in contacts") + message = 'profile_photo' + self.chat_1.send_message(message) + self.chat_2.chat_element_by_text(message).wait_for_visibility_of_element(30) + if not self.chat_2.chat_element_by_text(message).member_photo.is_element_differs_from_template("member.png", + diff=5): + self.errors.append("Image of user in 1-1 chat is updated even when user is not added to contacts!") + + self.chat_1.just_fyi("Users add to contacts each other") + [home.click_system_back_button_until_element_is_shown() for home in (self.home_1, self.home_2)] + [home.browser_tab.click() for home in (self.home_1, self.home_2)] + self.profile_1.add_contact_via_contacts_list(self.public_key_2) + self.profile_2 = self.home_2.get_profile_view() + self.profile_2.add_contact_via_contacts_list(self.public_key_1) + + self.chat_1.just_fyi("Go back to chat view and checking that profile photo is updated") + [home.chats_tab.click() for home in (self.home_1, self.home_2)] + if not self.chat_2.chat_message_input.is_element_displayed(): + self.home_2.get_chat(self.default_username_1).click() + if self.chat_2.chat_element_by_text(message).member_photo.is_element_differs_from_template("member.png", diff=5): + self.errors.append("Image of user in 1-1 chat is too different from template!") + self.errors.verify_no_errors() diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 7be0a69c47..a5b5a9a6fc 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -151,14 +151,11 @@ class ChatElementByText(Text): return TimeStampText(self.driver, self.locator) @property - def timestamp_on_tap(self): - timestamp_element = Text(self.driver, xpath="//*[@content-desc='message-timestamp']") - try: - self.sent_status_checkmark.wait_for_element(30) - self.sent_status_checkmark.click_until_presence_of_element(timestamp_element) - return timestamp_element.text - except (NoSuchElementException, TimeoutException): - return None + def timestamp(self): + class TimeStampText(Button): + def __init__(self, driver, parent_locator: str): + super().__init__(driver, xpath="%s//*[@content-desc='message-timestamp']" % parent_locator) + return TimeStampText(self.driver, self.locator).text @property def member_photo(self): @@ -265,6 +262,7 @@ class ChatElementByText(Text): return 0 return int(EmojisNumber(self.driver, self.locator).text) + @property def pinned_by_label(self): class PinnedByLabelText(Text): diff --git a/test/appium/views/elements_templates/member.png b/test/appium/views/elements_templates/member.png new file mode 100644 index 0000000000..f8c00be55d Binary files /dev/null and b/test/appium/views/elements_templates/member.png differ diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index c159a1f319..0aa9417262 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -362,6 +362,17 @@ class ProfileView(BaseView): from views.chat_view import ChatView return ChatView(self.driver) + def add_contact_via_contacts_list(self, public_key): + self.driver.info("Adding user to Contacts via Profile > Contacts") + self.contacts_button.wait_and_click(30) + self.add_new_contact_button.wait_and_click() + chat = self.get_chat_view() + chat.public_key_edit_box.click() + chat.public_key_edit_box.send_keys(public_key) + chat.confirm_until_presence_of_element(self.add_new_contact_button) + self.click_system_back_button_until_element_is_shown() + + def add_custom_network(self, rpc_url: str, name: str, symbol: str, netwrok_id:str): self.driver.info("## Add custom network", device=False) self.advanced_button.click()