diff --git a/test/appium/tests/activity_center/test_activity_center.py b/test/appium/tests/activity_center/test_activity_center.py index 9383c4f0cf..defef85f3d 100644 --- a/test/appium/tests/activity_center/test_activity_center.py +++ b/test/appium/tests/activity_center/test_activity_center.py @@ -40,9 +40,10 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC if text_name != self.username_1 and text_name != "%s...%s" % ( self.public_key_1[:3], self.public_key_1[-6:]): self.errors.append( + self.home_2, "Neither username nor public key is shown on 'Add contact' page after entering valid public key") else: - self.errors.append("User is not found on 'Add contact' page after entering valid public key") + self.errors.append(self.home_2, "User is not found on 'Add contact' page after entering valid public key") chat = self.home_2.get_chat_view() chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_send_contact_request_button) @@ -55,7 +56,8 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC self.device_1.just_fyi("Device 1: check there is no PN when receiving new message to activity centre") self.device_1.open_notification_bar() if self.home_1.element_by_text_part("Please add me to your contacts").is_element_displayed(): - self.errors.append("Push notification with text was received for new message in activity centre") + self.errors.append(self.home_1, + "Push notification with text was received for new message in activity centre") self.device_1.click_system_back_button() self.device_1.driver.activate_app(app_package) self.device_1.wait_for_application_to_be_running(app_package) @@ -65,9 +67,9 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC for indicator in (self.home_1.notifications_unread_badge, self.home_1.contact_new_badge): if not indicator.is_element_displayed(): self.errors.append( - "Unread indicator on contacts tab or on activity center is not shown for incoming CR!") + self.home_1, "Unread indicator on contacts tab or on activity center is not shown for incoming CR!") if self.home_1.pending_contact_request_text.text != '1': - self.errors.append("The amount of contact requests is not shown for incoming CR!") + self.errors.append(self.home_1, "The amount of contact requests is not shown for incoming CR!") self.device_1.just_fyi('Device1 declines pending contact request') self.home_1.handle_contact_request(username=self.username_2, action='decline') @@ -75,6 +77,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC self.home_1.pending_contact_request_text): if indicator.is_element_displayed(): self.errors.append( + self.home_1, "Unread indicator on contacts tab or on activity center is shown after declining contact request!") self.device_1.just_fyi("Check that it is still pending contact after declining on sender device") @@ -85,7 +88,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC if element.title.text != 'Contact request' or element.context_tag_text != self.username_1 \ or not element.pending_status_tag.is_element_displayed(): self.errors.append( - "Pending contact request is not shown on unread notification element on Activity center!") + self.home_2, "Pending contact request is not shown on unread notification element on Activity center!") self.home_2.close_activity_centre.click() self.errors.verify_no_errors() @@ -123,7 +126,8 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC self.home_1.more_options_activity_button.click() self.home_1.mark_all_read_activity_button.click() if cr_element.is_element_displayed(): - self.errors.append("Contact request is still shown in activity centre after marking all messages as read!") + self.errors.append( + self.home_1, "Contact request is still shown in activity centre after marking all messages as read!") self.home_1.just_fyi("Check that can accept contact request from read notifications") self.home_1.activity_unread_filter_button.click() @@ -132,14 +136,16 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC self.home_1.close_activity_centre.click() self.home_1.contacts_tab.click() if not self.home_1.contact_details_row(username=new_username).is_element_displayed(20): - self.errors.append("Contact was not added to contact list after accepting contact request (as receiver)") + self.errors.append(self.home_1, + "Contact was not added to contact list after accepting contact request (as receiver)") self.device_2.just_fyi('Device1 check that contact appeared in contact list mutually') self.home_2.navigate_back_to_home_view() self.home_2.chats_tab.click() self.home_2.contacts_tab.click() if not self.home_2.contact_details_row(username=self.username_1).is_element_displayed(20): - self.errors.append("Contact was not added to contact list after accepting contact request (as sender)") + self.errors.append(self.home_2, + "Contact was not added to contact list after accepting contact request (as sender)") self.errors.verify_no_errors() @@ -172,9 +178,10 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC text_name = self.home_1.user_name_text.text if text_name != self.username_2 and text_name != "%s...%s" % (public_key_2[:3], public_key_2[-6:]): self.errors.append( + self.home_1, "Neither username nor public key is shown on 'Add contact' page after entering valid profile link") else: - self.errors.append("User is not found on 'Add contact' page after entering valid public key") + self.errors.append(self.home_1, "User is not found on 'Add contact' page after entering valid public key") chat_1 = self.home_1.get_chat_view() chat_1.view_profile_new_contact_button.click_until_presence_of_element( chat_1.profile_send_contact_request_button) @@ -197,9 +204,10 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC text_name = self.home_1.user_name_text.text if text_name != self.username_2 and text_name != "%s...%s" % (public_key_2[:3], public_key_2[-6:]): self.errors.append( + self.home_1, "Neither username nor public key is shown on 'Add contact' page after entering valid public key") else: - self.errors.append("User is not found on 'Add contact' page after entering valid public key") + self.errors.append(self.home_1, "User is not found on 'Add contact' page after entering valid public key") self.home_2.just_fyi("Device 2 gets sync code") self.home_2.navigate_back_to_home_view() @@ -217,7 +225,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC try: self.home_1.element_by_translation_id("invalid-ens-or-key").wait_for_visibility_of_element() except TimeoutException: - self.errors.append("Error message is not shown for value \"%s\"" % value) + self.errors.append(self.home_1, "Error message is not shown for value \"%s\"" % value) self.errors.verify_no_errors() @@ -266,15 +274,16 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase): self.community_1.click_on_floating_jump_to() for card in (self.community_name, self.username_2): if not self.community_1.element_by_text_part(card).is_element_displayed(20): - self.errors.append("Card %s is not shown on Jump to screen!" % card) + self.errors.append(self.community_1, "Card %s is not shown on Jump to screen!" % card) self.community_1.element_by_translation_id("community-channel").click() if not self.channel_1.chat_element_by_text(self.text_message).is_element_displayed(20): - self.errors.append("User was not redirected to community channel after tapping on community channel card!") + self.errors.append(self.channel_1, + "User was not redirected to community channel after tapping on community channel card!") self.channel_1.click_system_back_button() self.community_1.click_on_floating_jump_to() self.community_1.element_by_text_part(self.username_2).click() if not self.chat_1.chat_element_by_text(self.one_to_one_message).is_element_displayed(20): - self.errors.append("User was not redirected to 1-1 chat after tapping card!") + self.errors.append(self.chat_1, "User was not redirected to 1-1 chat after tapping card!") self.errors.verify_no_errors() @@ -298,29 +307,29 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase): community_element_1 = self.home_1.get_chat(self.community_name, community=True) for unread_counter in community_element_1.new_messages_counter, self.home_1.communities_tab.counter: if not unread_counter.is_element_displayed(60): - self.errors.append('New message counter badge is not shown!') + self.errors.append(self.home_1, 'New message counter badge is not shown!') if int(unread_counter.text) != 1: - self.errors.append('New message counter badge is not 1, it is %s!' % unread_counter.text) + self.errors.append(self.home_1, 'New message counter badge is not 1, it is %s!' % unread_counter.text) self.home_1.just_fyi("Checking reply attributes in activity center") self.home_1.open_activity_center_button.click() reply_element = self.home_1.get_element_from_activity_center_view(reply_to_message_from_sender) if reply_element.title.text != 'Reply': - self.errors.append("Expected title is not shown, '%s' is instead!" % reply_element.title) + self.errors.append(self.home_1, "Expected title is not shown, '%s' is instead!" % reply_element.title) if not reply_element.unread_indicator.is_element_displayed(): - self.errors.append("No unread dot is shown on activity center element!") + self.errors.append(self.home_1, "No unread dot is shown on activity center element!") self.home_2.chats_tab.is_element_displayed() # just saving device 2 session from expiration self.home_1.just_fyi("Swiping to 'Replies' on activity center and check unread there") self.home_1.mention_activity_tab_button.click() if reply_element.is_element_displayed(2): - self.errors.append("Filter on mentions is not working in Activity centre!") + self.errors.append(self.home_1, "Filter on mentions is not working in Activity centre!") self.home_1.reply_activity_tab_button.click() if not self.home_1.reply_activity_tab_button.counter.is_element_displayed(2): - self.errors.append("No unread dot is shown on activity center tab element!") + self.errors.append(self.home_1, "No unread dot is shown on activity center tab element!") if not reply_element.is_element_displayed(): - self.errors.append("Filter on replies tab is not working in Activity centre!") + self.errors.append(self.home_1, "Filter on replies tab is not working in Activity centre!") self.home_2.chats_tab.is_element_displayed() # just saving device 2 session from expiration @@ -328,10 +337,10 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase): reply_element.title.swipe_right_on_element(width_percentage=6) self.home_1.activity_notification_swipe_button.click() if reply_element.is_element_displayed(2): - self.errors.append("Message is not marked as read!") + self.errors.append(self.home_1, "Message is not marked as read!") self.home_1.activity_unread_filter_button.click() if not reply_element.is_element_displayed(2): - self.errors.append("Read filter is not displayed read message!") + self.errors.append(self.home_1, "Read filter is not displayed read message!") self.home_2.chats_tab.is_element_displayed() # just saving device 2 session from expiration @@ -339,16 +348,18 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase): reply_element.title.swipe_right_on_element(width_percentage=6) self.home_1.activity_notification_swipe_button.click() if not reply_element.unread_indicator.is_element_displayed(): - self.errors.append("No unread dot is shown on activity center element after marking it as unread!") + self.errors.append(self.home_1, + "No unread dot is shown on activity center element after marking it as unread!") self.home_1.just_fyi("Tap on it and check it marked as read") reply_element.click() if not self.channel_1.chat_element_by_text(reply_to_message_from_sender).is_element_displayed(): - self.errors.append("Was not redirected to chat after tapping on reply!") + self.errors.append(self.home_1, "Was not redirected to chat after tapping on reply!") self.home_1.navigate_back_to_home_view() self.home_1.communities_tab.click() if self.home_1.notifications_unread_badge.is_element_displayed(): - self.errors.append("Notification was not marked as read after opening it in community channel!") + self.errors.append(self.home_1, + "Notification was not marked as read after opening it in community channel!") self.home_2.chats_tab.is_element_displayed() # just saving device 2 session from expiration @@ -357,7 +368,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase): reply_element.swipe_left_on_element() self.home_1.activity_notification_swipe_button.click() if reply_element.is_element_displayed(): - self.errors.append("Reply is still shown after removing from activity centre!") + self.errors.append(self.home_1, "Reply is still shown after removing from activity centre!") self.errors.verify_no_errors() @@ -414,25 +425,26 @@ class TestActivityMultipleDevicePRTwo(MultipleSharedDeviceTestCase): community_element_1 = self.home_1.get_chat(self.community_name, community=True) for unread_counter in community_element_1.new_messages_counter, self.home_1.communities_tab.counter: if not unread_counter.is_element_displayed(60): - self.errors.append('New message counter badge is not shown while mentioned!') + self.errors.append(self.home_1, 'New message counter badge is not shown while mentioned!') if int(unread_counter.text) != 1: - self.errors.append('New message counter badge is not 1, it is %s!' % unread_counter.text) + self.errors.append(self.home_1, 'New message counter badge is not 1, it is %s!' % unread_counter.text) self.home_1.just_fyi("Checking mention attributes in activity center") self.home_1.open_activity_center_button.click() mention_element = self.home_1.get_element_from_activity_center_view('@%s' % self.username_1) if mention_element.title.text != 'Mention': - self.errors.append("Expected title is not shown, '%s' is instead!" % mention_element.title) + self.errors.append(self.home_1, "Expected title is not shown, '%s' is instead!" % mention_element.title) if not mention_element.unread_indicator.is_element_displayed(): - self.errors.append("No unread dot is shown on activity center element (mention)!") + self.errors.append(self.home_1, "No unread dot is shown on activity center element (mention)!") if mention_element.message_body.text != '@%s' % self.username_1: self.errors.append( - "Mention body in activity center does not match expected, it is %s!" % mention_element.message_body.text) + self.home_1, "Mention body in activity center does not match expected, it is %s!" + % mention_element.message_body.text) self.home_1.just_fyi("Tap on it and check redirect to channel") mention_element.click() if not self.channel_1.chat_element_by_text(self.username_1).is_element_displayed(): - self.errors.append("Was not redirected to chat after tapping on mention!") + self.errors.append(self.home_1, "Was not redirected to chat after tapping on mention!") self.errors.verify_no_errors() @marks.testrail_id(702958) @@ -465,13 +477,13 @@ class TestActivityMultipleDevicePRTwo(MultipleSharedDeviceTestCase): try: self.home_1.notifications_unread_badge.wait_for_visibility_of_element(120) except TimeoutException: - self.errors.append("Unread indicator is not shown in notifications") + self.errors.append(self.home_1, "Unread indicator is not shown in notifications") self.home_1.open_activity_center_button.click() reply_element = self.home_1.get_element_from_activity_center_view(self.username_2) if reply_element.title.text != 'Join request': - self.errors.append("Expected title is not shown, '%s' is instead!" % reply_element.title) + self.errors.append(self.home_1, "Expected title is not shown, '%s' is instead!" % reply_element.title) if not reply_element.unread_indicator.is_element_displayed(): - self.errors.append("No unread dot is shown on activity center element!") + self.errors.append(self.home_1, "No unread dot is shown on activity center element!") reply_element.title.swipe_right_on_element(width_percentage=2.5) self.home_1.activity_notification_swipe_button.click() self.home_1.close_activity_centre.click() @@ -479,5 +491,5 @@ class TestActivityMultipleDevicePRTwo(MultipleSharedDeviceTestCase): self.home_2.just_fyi("Checking that community appeared on the list") if not self.home_2.element_by_text_part(community_name).is_element_displayed(30): self.errors.append( - "Community is not appeared in the list after accepting admin request from activity centre") + self.home_2, "Community is not appeared in the list after accepting admin request from activity centre") self.errors.verify_no_errors() diff --git a/test/appium/tests/base_test_case.py b/test/appium/tests/base_test_case.py index 8d2964becb..0b4e47f74e 100644 --- a/test/appium/tests/base_test_case.py +++ b/test/appium/tests/base_test_case.py @@ -18,6 +18,7 @@ from urllib3.exceptions import MaxRetryError, ProtocolError from support.api.network_api import NetworkApi from tests import test_suite_data, start_threads, pytest_config_global, transl from tests.conftest import github_report, run_name, lambda_test_username, lambda_test_access_key +from views.base_view import BaseView executor_lambda_test = 'https://%s:%s@mobile-hub.lambdatest.com/wd/hub' % (lambda_test_username, lambda_test_access_key) @@ -164,12 +165,14 @@ class Driver(webdriver.Remote): self.execute_script("lambda-hook: %s" % str(data).replace("'", "\"")) -class Errors(object): +class Errors: def __init__(self): self.errors = list() - def append(self, text=str()): - self.errors.append(text) + def append(self, view: BaseView, text: str): + error_text = "Device %s: %s" % (view.driver.number, text) + self.errors.append(error_text) + view.driver.log_event("appium", error_text) def verify_no_errors(self): if self.errors: 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 833b0ee845..2a4ff6bcf3 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 @@ -89,13 +89,13 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): if not self.chat_1.user_list_element_by_name( self.username_1).is_element_displayed() or not self.chat_1.user_list_element_by_name( self.username_2).is_element_displayed(): - self.errors.append("Incorrect users are shown for 'love' reaction.") + self.errors.append(self.chat_1, "Incorrect users are shown for 'love' reaction.") self.chat_1.authors_for_reaction(emoji="thumbs-up").double_click() if not self.chat_1.user_list_element_by_name( self.username_1).is_element_displayed() or self.chat_1.user_list_element_by_name( self.username_2).is_element_displayed(): - self.errors.append("Incorrect users are shown for 'thumbs-up' reaction.") + self.errors.append(self.chat_1, "Incorrect users are shown for 'thumbs-up' reaction.") self.chat_1.driver.press_keycode(4) self.errors.verify_no_errors() @@ -111,17 +111,18 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.chat_1.send_message(emoji.emojize(emoji_name)) for chat in self.chat_1, self.chat_2: if not chat.chat_element_by_text(emoji_unicode).is_element_displayed(): - self.errors.append('Message with emoji was not sent or received in 1-1 chat') + self.errors.append(chat, 'Message with emoji was not sent or received in 1-1 chat') self.chat_1.quote_message(emoji_unicode) actual_text = self.chat_1.quote_username_in_message_input.text if actual_text != "You": self.errors.append( + self.chat_1, "'You' is not displayed in reply quote snippet replying to own message, '%s' instead" % actual_text) self.chat_1.just_fyi("Clear quote and check there is not snippet anymore") self.chat_1.cancel_reply_button.click() if self.chat_1.cancel_reply_button.is_element_displayed(): - self.errors.append("Message quote kept in public chat input after it was cancelled") + self.errors.append(self.chat_1, "Message quote kept in public chat input after it was cancelled") self.chat_1.just_fyi("Send reply") self.chat_1.quote_message(emoji_unicode) @@ -130,7 +131,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.chat_1.just_fyi("Receiver verifies received reply...") if self.chat_2.chat_element_by_text(reply_to_message_from_sender).replied_message_text != emoji_unicode: - self.errors.append("No reply received in 1-1 chat") + self.errors.append(self.chat_2, "No reply received in 1-1 chat") else: self.chat_2.just_fyi("Device 2 sets a reaction on the message reply. Device 1 checks the reaction") self.chat_1.set_reaction(reply_to_message_from_sender) @@ -138,7 +139,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.chat_1.chat_element_by_text( reply_to_message_from_sender).emojis_below_message().wait_for_element_text(1) except Failed: - self.errors.append("Reply message reaction is not shown for the sender") + self.errors.append(self.chat_1, "Reply message reaction is not shown for the sender") self.home_1.just_fyi("Check that link can be opened and replied from 1-1 chat") reply = 'reply to link' @@ -149,14 +150,15 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.chat_2.send_message(reply) replied_message = self.chat_1.chat_element_by_text(reply) if replied_message.replied_message_text != url_message: - self.errors.append("Reply for '%s' not present in message received in public chat" % url_message) + self.errors.append(self.chat_1, + "Reply for '%s' not present in message received in public chat" % url_message) self.chat_2.just_fyi("Device 2 sets a reaction on the message with a link. Device 1 checks the reaction") self.chat_2.set_reaction(url_message) try: self.chat_1.chat_element_by_text(url_message).emojis_below_message().wait_for_element_text(1) except (Failed, NoSuchElementException): - self.errors.append("Link message reaction is not shown for the sender") + self.errors.append(self.chat_1, "Link message reaction is not shown for the sender") self.home_2.just_fyi("Check 'Open in Status' option") # url_to_open = 'http://status.app' @@ -169,15 +171,15 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): try: self.chat_2.wait_for_current_package_to_be('com.android.chrome') except TimeoutException: - self.errors.append('URL was not opened from 1-1 chat') + self.errors.append(self.chat_2, 'URL was not opened from 1-1 chat') else: self.chat_2.element_by_text("No thanks").click_if_shown() text_element = self.chat_2.element_by_text("a free (libre) open source, mobile OS for Ethereum") sign_in_button = Button(self.chat_2.driver, xpath="//android.view.View[@content-desc='Sign in']") if not text_element.is_element_displayed() or not sign_in_button.is_element_displayed(): - self.errors.append('URL was not opened from 1-1 chat') + self.errors.append(self.chat_2, 'URL was not opened from 1-1 chat') else: - self.errors.append("Message with URL was not received") + self.errors.append(self.chat_2, "Message with URL was not received") self.errors.verify_no_errors() @@ -212,14 +214,15 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): else: expected_text = "You" if message == self.message_2 else self.username_1 if text != expected_text: - self.errors.append( - "Pinned by '%s' doesn't match expected '%s' for user %s" % ( - text, expected_text, chat_number + 1) - ) + self.errors.append(chat, + "Pinned by '%s' doesn't match expected '%s' for user %s" % ( + text, expected_text, chat_number + 1) + ) else: - self.errors.append( - "Message '%s' is missed on Pinned messages list for user %s" % (message, chat_number + 1) - ) + self.errors.append(chat, + "Message '%s' is missed on Pinned messages list for user %s" % ( + message, chat_number + 1) + ) chat.click_system_back_button() self.home_1.just_fyi("Check that Device1 can not pin more than 3 messages and 'Unpin' dialog appears") @@ -232,22 +235,23 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.chat_1.view_pinned_messages_button.click_until_presence_of_element(self.chat_1.pinned_messages_list) if self.chat_1.pinned_messages_list.get_pinned_messages_number() > 3 \ or self.chat_1.pinned_messages_list.message_element_by_text(self.message_4).is_element_displayed(): - self.errors.append("Can pin more than 3 messages in chat") + self.errors.append(self.chat_1, "Can pin more than 3 messages in chat") else: unpin_element = self.chat_1.element_by_translation_id('unpin-from-chat') self.chat_1.pinned_messages_list.message_element_by_text(self.message_2).long_press_without_release() self.home_1.just_fyi("Unpin one message so that another could be pinned") unpin_element.click_until_absense_of_element(desired_element=unpin_element) self.chat_1.pin_message(self.message_4, 'pin-to-chat') - if not (self.chat_1.chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30) and - self.chat_2.chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30)): - self.errors.append("Message 4 is not pinned in chat after unpinning previous one") + for chat in self.chat_1, self.chat_2: + if chat.chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30): + self.errors.append(chat, "Message 4 is not pinned in chat after unpinning previous one") self.home_1.just_fyi("Check pinned messages are visible in Pinned panel for both users") for chat_number, chat in enumerate([self.chat_1, self.chat_2]): count = chat.pinned_messages_count.text if count != '3': - self.errors.append("Pinned messages count is %s but should be 3 for user %s" % (count, chat_number + 1)) + self.errors.append(chat, + "Pinned messages count is %s but should be 3 for user %s" % (count, chat_number + 1)) self.home_1.just_fyi("Unpin one message and check it's unpinned for another user") self.chat_2.tap_by_coordinates(500, 100) @@ -268,7 +272,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): chat.pinned_messages_count.wait_for_element_text(text='2', wait_time=20) except Failed: self.errors.append( - "Pinned messages count is not 2 after unpinning the last pinned message for user %s" % ( + chat, "Pinned messages count is not 2 after unpinning the last pinned message for user %s" % ( chat_number + 1) ) self.errors.verify_no_errors() @@ -293,7 +297,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): for message in messages: self.chat_2.send_message(message) if not self.chat_1.chat_element_by_text(message).is_element_displayed(30): - self.errors.append("Message with text '%s' was not received" % message) + self.errors.append(self.chat_1, "Message with text '%s' was not received" % message) self.chat_2.just_fyi("Checking updated member photo, timestamp and username on message") self.chat_2.hide_keyboard_if_shown() @@ -301,13 +305,15 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): 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)) + self.errors.append(self.chat_2, + 'Timestamp on message %s does not correspond expected %s' % ( + timestamp, sent_time_variants)) except NoSuchElementException: - self.errors.append("No timestamp on message %s" % messages[0]) + self.errors.append(self.chat_2, "No timestamp on message %s" % messages[0]) 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.errors.append(self.chat_2, + '%s is not stack to 1st(they are sent in less than 5 minutes)!' % message) self.chat_1.just_fyi("Sending message") message = 'profile_photo' @@ -319,7 +325,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.home_2.get_chat(self.username_1).click() if self.chat_2.chat_element_by_text(message).member_photo.is_element_differs_from_template( "profile_image_in_1_1_chat.png", diff=7): - self.errors.append("Image of user in 1-1 chat is too different from template!") + self.errors.append(self.chat_2, "Image of user in 1-1 chat is too different from template!") self.errors.verify_no_errors() @marks.testrail_id(702813) @@ -371,9 +377,10 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.device_1.just_fyi("Checks there are no PN after message was seen") [home.open_notification_bar() for home in self.homes] - if (self.device_2.element_by_text_part(message).is_element_displayed() - or self.device_1.element_by_text_part(emoji_unicode).is_element_displayed()): - self.errors.append("PN are keep staying after message was seen by user") + if self.device_2.element_by_text_part(message).is_element_displayed(): + self.errors.append(self.chat_2, "PN are keep staying after message '%s' was seen by user" % message) + if self.device_1.element_by_text_part(emoji_unicode).is_element_displayed(): + self.errors.append(self.chat_1, "PN are keep staying after message '%s' was seen by user" % emoji_unicode) self.errors.verify_no_errors() @marks.testrail_id(702855) @@ -393,7 +400,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): message_text_after_edit = message_after_edit_1_1 + ' (Edited)' chat_element = self.chat_1.chat_element_by_text(message_text_after_edit) if not chat_element.is_element_displayed(30): - self.errors.append('No edited message in 1-1 chat displayed') + self.errors.append(self.chat_1, 'No edited message in 1-1 chat displayed') else: self.device_1.just_fyi("Device 1 sets a reaction on the edited message. Device 2 checks the reaction") self.chat_1.set_reaction(message_text_after_edit) @@ -401,7 +408,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.chat_1.chat_element_by_text( message_text_after_edit).emojis_below_message().wait_for_element_text(1) except Failed: - self.errors.append("Message reaction is not shown for the sender") + self.errors.append(self.chat_1, "Message reaction is not shown for the sender") self.errors.verify_no_errors() @marks.testrail_id(703391) @@ -425,7 +432,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.chat_2.chat_element_by_text(image_description).wait_for_visibility_of_element(30) if not self.chat_2.chat_element_by_text( image_description).image_in_message.is_element_image_similar_to_template('image_1_chat_view.png'): - self.errors.append("Not expected image is shown to the receiver.") + self.errors.append(self.chat_2, "Not expected image is shown to the receiver.") for chat in self.chat_1, self.chat_2: chat.just_fyi("Open the image and share it") @@ -437,8 +444,9 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): try: chat.wait_for_current_package_to_be('com.google.android.apps.docs') except TimeoutException: - self.errors.append( - "%s can't share an image via Gmail." % ("Sender" if chat is self.chat_1 else "Receiver")) + self.errors.append(chat, + "%s can't share an image via Gmail." % ( + "Sender" if chat is self.chat_1 else "Receiver")) chat.navigate_back_to_chat_view() for chat in self.chat_1, self.chat_2: @@ -452,10 +460,10 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): toast_element_text = toast_element.text if toast_element_text != chat.get_translation_by_key("photo-saved"): self.errors.append( - "Shown message '%s' doesn't match expected '%s' after saving an image for %s." % ( + chat, "Shown message '%s' doesn't match expected '%s' after saving an image for %s." % ( toast_element_text, chat.get_translation_by_key("photo-saved"), device_name)) else: - self.errors.append("Message about saving a photo is not shown for %s." % device_name) + self.errors.append(chat, "Message about saving a photo is not shown for %s." % device_name) chat.navigate_back_to_chat_view() for chat in self.chat_1, self.chat_2: @@ -463,8 +471,9 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): chat.show_images_button.click() chat.allow_all_button.click_if_shown() if not chat.get_image_by_index(0).is_element_image_similar_to_template("image_1_gallery_view.png"): - self.errors.append( - "Image is not saved to gallery for %s." % ("sender" if chat is self.chat_1 else "receiver")) + self.errors.append(chat, + "Image is not saved to gallery for %s." % ( + "sender" if chat is self.chat_1 else "receiver")) chat.click_system_back_button() self.errors.verify_no_errors() @@ -490,7 +499,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): chat_1_element.long_press_without_release() for action in ("edit", "delete-for-everyone"): if self.chat_1.element_by_translation_id(action).is_element_displayed(): - self.errors.append('Option to %s someone else message available!' % action) + self.errors.append(self.chat_1, 'Option to %s someone else message available!' % action) self.home_1.tap_by_coordinates(500, 100) self.device_2.just_fyi("Delete message for me and check it is only deleted for the author") @@ -500,23 +509,23 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): self.chat_2.chat_element_by_text(message_to_delete_for_me).wait_for_status_to_be("Delivered", timeout) self.chat_2.delete_message_in_chat(message_to_delete_for_me, everyone=False) except TimeoutException: - self.errors.append("Message status was not changed to 'Delivered' after %s s" % timeout) + self.errors.append(self.chat_2, "Message status was not changed to 'Delivered' after %s s" % timeout) else: if not self.chat_2.chat_element_by_text(message_to_delete_for_me).is_element_disappeared(20): - self.errors.append("Deleted for me message is shown in chat for the author of message") + self.errors.append(self.chat_2, "Deleted for me message is shown in chat for the author of message") if not self.chat_2.element_by_translation_id('message-deleted-for-you').is_element_displayed(20): - self.errors.append("System message about deletion for you is not displayed") + self.errors.append(self.chat_2, "System message about deletion for you is not displayed") if not self.chat_1.chat_element_by_text(message_to_delete_for_me).is_element_displayed(20): - self.errors.append("Deleted for me message is deleted for both users") + self.errors.append(self.chat_1, "Deleted for me message is deleted for both users") self.device_2.just_fyi("Delete message for everyone and check it is not shown in chat preview on home") self.chat_2.delete_message_in_chat(message_after_edit_1_1) for chat in (self.chat_2, self.chat_1): if chat.chat_element_by_text(message_after_edit_1_1).is_element_displayed(30): - self.errors.append("Deleted message is shown in chat view for 1-1 chat") + self.errors.append(chat, "Deleted message is shown in chat view for 1-1 chat") self.chat_1.navigate_back_to_home_view() if self.home_1.element_by_text(message_after_edit_1_1).is_element_displayed(30): - self.errors.append("Deleted message is shown on chat element on home screen") + self.errors.append(self.home_1, "Deleted message is shown on chat element on home screen") self.device_2.just_fyi("Send one more message and check that PN will be deleted with message deletion") message_to_delete = 'DELETE ME' @@ -527,12 +536,12 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase): if not self.home_1.get_pn(message_to_delete): self.home_1.click_system_back_button() self.device_2.driver.activate_app(app_package) - self.errors.append("Push notification doesn't appear") + self.errors.append(self.home_1, "Push notification doesn't appear") self.chat_2.delete_message_in_chat(message_to_delete) pn_to_disappear = self.home_1.get_pn(message_to_delete) if pn_to_disappear: if not pn_to_disappear.is_element_disappeared(90): - self.errors.append("Push notification was not removed after initial message deletion") + self.errors.append(self.home_1, "Push notification was not removed after initial message deletion") self.errors.verify_no_errors() @@ -580,9 +589,9 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase chat_element = chat.chat_element_by_text(image_description) if chat_element.is_element_displayed(30): if not chat_element.image_in_message.is_element_image_similar_to_template('saucelabs_camera_image.png'): - self.errors.append("Not expected image is shown to the %s." % chat_name) + self.errors.append(chat, "Not expected image is shown to the %s." % chat_name) else: - self.errors.append("Message with camera image is not shown in chat for %s" % chat_name) + self.errors.append(chat, "Message with camera image is not shown in chat for %s" % chat_name) self.errors.verify_no_errors() @marks.testrail_id(702783) @@ -608,7 +617,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase self.chat_2.send_message(message_1) status = self.chat_2.chat_element_by_text(message_1).status if not (status == 'Sending' or status == 'Sent'): - self.errors.append('Message status is not "Sending", it is "%s"!' % status) + self.errors.append(self.chat_2, 'Message status is not "Sending", it is "%s"!' % status) self.home_2.just_fyi('Device2 goes back online and checks that status of the message is changed to "delivered"') for home in self.homes: @@ -616,13 +625,13 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase self.home_1.just_fyi('Device1 goes back online and checks that 1-1 chat will be fetched') if not self.chat_1.chat_element_by_text(message_1).is_element_displayed(120): - self.errors.append("Message was not delivered after resending from offline") + self.errors.append(self.chat_1, "Message was not delivered after resending from offline") self.home_2.just_fyi('Device1 goes back online and checks that 1-1 chat will be fetched') try: self.chat_2.chat_element_by_text(message_1).wait_for_status_to_be(expected_status='Delivered', timeout=120) except TimeoutException as e: - self.errors.append('%s after back up online!' % e.msg) + self.errors.append(self.chat_2, '%s after back up online!' % e.msg) self.errors.verify_no_errors() @marks.testrail_id(703496) @@ -636,33 +645,35 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase self.chat_2.send_message(muted_message) chat = self.home_1.get_chat(self.username_2) if chat.new_messages_counter.is_element_displayed(30) or self.home_1.chats_tab.counter.is_element_displayed(10): - self.errors.append("New messages counter is shown after mute") + self.errors.append(self.home_1, "New messages counter is shown after mute") if not chat.chat_preview.text.startswith(muted_message): - self.errors.append("Message text '%s' is not shown in chat preview after mute" % muted_message) + self.errors.append(self.home_1, "Message text '%s' is not shown in chat preview after mute" % muted_message) chat.click() if not self.chat_1.chat_element_by_text(muted_message).is_element_displayed(30): - self.errors.append("Message '%s' is not shown in chat for receiver after mute" % muted_message) + self.errors.append(self.chat_1, "Message '%s' is not shown in chat for receiver after mute" % muted_message) self.chat_1.just_fyi("Unmute chat") self.chat_1.navigate_back_to_home_view() chat.long_press_without_release() if self.home_1.mute_chat_button.text != transl["unmute-chat"]: - self.errors.append("Chat is not muted") + self.errors.append(self.home_1, "Chat is not muted") expected_text = "Muted until you turn it back on" if not self.home_1.element_by_text(expected_text).is_element_displayed(): - self.errors.append("Text '%s' is not shown for muted chat" % expected_text) + self.errors.append(self.home_1, "Text '%s' is not shown for muted chat" % expected_text) self.home_1.mute_chat_button.double_click() unmuted_message = "after unmute" self.chat_2.send_message(unmuted_message) if not chat.new_messages_counter.is_element_displayed( 30) or not self.home_1.chats_tab.counter.is_element_displayed(10): - self.errors.append("New messages counter is not shown after unmute") + self.errors.append(self.home_1, "New messages counter is not shown after unmute") if not chat.chat_preview.text.startswith(unmuted_message): - self.errors.append("Message text '%s' is not shown in chat preview after unmute" % unmuted_message) + self.errors.append(self.home_1, + "Message text '%s' is not shown in chat preview after unmute" % unmuted_message) chat.click() if not self.chat_1.chat_element_by_text(unmuted_message).is_element_displayed(30): - self.errors.append("Message '%s' is not shown in chat for receiver after unmute" % unmuted_message) + self.errors.append(self.chat_1, + "Message '%s' is not shown in chat for receiver after unmute" % unmuted_message) self.errors.verify_no_errors() @@ -677,7 +688,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase for element in self.chat_2.chat_element_by_text(text='').message_text_content.find_elements(): chat_history.append(element.text) if not chat_history: - self.errors.append("No chat history was loaded") + self.errors.append(self.chat_2, "No chat history was loaded") self.home_2.just_fyi("Deleting chat via delete button and check it will not reappear after relaunching app") self.home_2.navigate_back_to_home_view() @@ -685,10 +696,12 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase self.home_2.delete_chat_long_press(username=self.username_1) chat = self.home_2.get_chat_from_home_view(self.username_1) if chat.is_element_displayed(): - self.errors.append("Deleted '%s' chat is shown, but the chat has been deleted" % self.username_1) + self.errors.append(self.chat_2, + "Deleted '%s' chat is shown, but the chat has been deleted" % self.username_1) self.home_2.reopen_app(user_name=self.username_2) if chat.is_element_displayed(15): self.errors.append( + self.chat_2, "Deleted chat '%s' is shown after re-login, but the chat has been deleted" % self.username_1) chat.click() else: @@ -701,5 +714,6 @@ class TestOneToOneChatMultipleSharedDevicesNewUiTwo(MultipleSharedDeviceTestCase if not self.chat_2.chat_element_by_text(message_text).is_element_displayed(): lost_messages.append(message_text) if lost_messages: - self.errors.append("Message(s) missed in 1-1 chat after deleting the chat and relogin: %s" % lost_messages) + self.errors.append(self.chat_2, + "Message(s) missed in 1-1 chat after deleting the chat and relogin: %s" % lost_messages) 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 6dd2d9edcd..ed33eda165 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -95,14 +95,14 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): if pn: pn.click() else: - self.errors.append("No PN was received on new message for message in group chat") + self.errors.append(self.homes[0], "No PN was received on new message for message in group chat") self.homes[0].click_system_back_button() self.homes[0].get_chat(self.chat_name).click() self.chats[1].just_fyi('Check message status and message delivery') self.chats[1].chat_element_by_text(message_to_admin).wait_for_status_to_be('Delivered', timeout=120) if not self.chats[0].chat_element_by_text(message_to_admin).is_element_displayed(30): - self.errors.append('Message %s was not received by admin' % message_to_admin) + self.errors.append(self.chats[0], 'Message %s was not received by admin' % message_to_admin) self.errors.verify_no_errors() @marks.testrail_id(703202) @@ -139,19 +139,19 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): if not self.chats[0].user_list_element_by_name( self.usernames[1]).is_element_displayed() or not self.chats[0].user_list_element_by_name( self.usernames[2]).is_element_displayed(): - self.errors.append("Incorrect users are shown for 'thumbs-up' reaction.") + self.errors.append(self.chats[0], "Incorrect users are shown for 'thumbs-up' reaction.") self.chats[0].authors_for_reaction(emoji="love").double_click() if not self.chats[0].user_list_element_by_name( self.usernames[1]).is_element_displayed() or self.chats[0].user_list_element_by_name( self.usernames[2]).is_element_displayed(): - self.errors.append("Incorrect users are shown for 'love' reaction.") + self.errors.append(self.chats[0], "Incorrect users are shown for 'love' reaction.") self.chats[0].authors_for_reaction(emoji="laugh").click() if self.chats[0].user_list_element_by_name( self.usernames[1]).is_element_displayed() or not self.chats[0].user_list_element_by_name( self.usernames[2]).is_element_displayed(): - self.errors.append("Incorrect users are shown for 'laugh' reaction.") + self.errors.append(self.chats[0], "Incorrect users are shown for 'laugh' reaction.") self.chats[0].just_fyi("Admin opens member_2 profile") self.chats[0].user_list_element_by_name(self.usernames[2]).click() @@ -159,11 +159,12 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): username_shown = self.chats[0].get_profile_view().contact_name_text.text if username_shown != self.usernames[2]: self.errors.append( + self.chats[0], "Incorrect profile is opened from the list of reactions, username is %s but expected to be %s" % ( username_shown, self.usernames[2]) ) except NoSuchElementException: - self.errors.append("User profile was not opened from the list of reactions") + self.errors.append(self.chats[0], "User profile was not opened from the list of reactions") self.chats[0].navigate_back_to_chat_view() self.chats[1].just_fyi("Member_1 removes 'thumbs-up' reaction and adds 'sad' one") @@ -183,8 +184,9 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): chat_element.emojis_below_message(emoji="love").wait_for_element_text(1) chat_element.emojis_below_message(emoji="sad").wait_for_element_text(2) except (Failed, NoSuchElementException): - self.errors.append( - "Incorrect reactions count for %s after changing the reactions" % self.usernames[chat_view_index]) + self.errors.append(self.chats[chat_view_index], + "Incorrect reactions count for %s after changing the reactions" % self.usernames[ + chat_view_index]) self.loop.run_until_complete(run_in_parallel(( (_check_reactions_count_after_change, {'chat_view_index': 0}), @@ -204,7 +206,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): message_element.emojis_below_message(emoji="love").wait_for_element_text(1) message_element.emojis_below_message(emoji="sad").wait_for_element_text(2) except (Failed, NoSuchElementException): - self.errors.append("Incorrect reactions count after relogin") + self.errors.append(self.chats[0], "Incorrect reactions count after relogin") for chat in self.chats[1], self.chats[2]: chat.just_fyi("Just making the session not to quit") @@ -215,19 +217,19 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): if self.chats[0].user_list_element_by_name( self.usernames[1]).is_element_displayed() or not self.chats[0].user_list_element_by_name( self.usernames[2]).is_element_displayed(): - self.errors.append("Incorrect users are shown for 'thumbs-up' reaction after relogin.") + self.errors.append(self.chats[0], "Incorrect users are shown for 'thumbs-up' reaction after relogin.") self.chats[0].authors_for_reaction(emoji="love").double_click() if not self.chats[0].user_list_element_by_name( self.usernames[1]).is_element_displayed() or self.chats[0].user_list_element_by_name( self.usernames[2]).is_element_displayed(): - self.errors.append("Incorrect users are shown for 'love' reaction after relogin.") + self.errors.append(self.chats[0], "Incorrect users are shown for 'love' reaction after relogin.") self.chats[0].authors_for_reaction(emoji="sad").click() if not self.chats[0].user_list_element_by_name( self.usernames[1]).is_element_displayed() or not self.chats[0].user_list_element_by_name( self.usernames[2]).is_element_displayed(): - self.errors.append("Incorrect users are shown for 'laugh' reaction after relogin.") + self.errors.append(self.chats[0], "Incorrect users are shown for 'laugh' reaction after relogin.") self.errors.verify_no_errors() @@ -245,13 +247,13 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): chat_element = self.chats[0].chat_element_by_text(image_description) chat_element.wait_for_visibility_of_element(60) if not chat_element.image_in_message.is_element_image_similar_to_template('image_2_chat_view.png'): - self.errors.append("Not expected image is shown to the admin.") + self.errors.append(self.chats[0], "Not expected image is shown to the admin.") self.chats[2].just_fyi("Member_2 checks image message") chat_element = self.chats[2].chat_element_by_text(image_description) chat_element.wait_for_visibility_of_element(60) if not chat_element.image_in_message.is_element_image_similar_to_template('image_2_chat_view.png'): - self.errors.append("Not expected image is shown to the member_2.") + self.errors.append(self.chats[2], "Not expected image is shown to the member_2.") self.chats[0].just_fyi("Admin opens the image and shares it") self.chats[0].chat_element_by_text(image_description).image_in_message.click() @@ -260,7 +262,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): try: self.chats[0].wait_for_current_package_to_be('com.google.android.apps.docs') except TimeoutException: - self.errors.append("Admin can't share an image via Gmail.") + self.errors.append(self.chats[0], "Admin can't share an image via Gmail.") self.chats[0].navigate_back_to_chat_view() self.chats[1].navigate_back_to_home_view() @@ -275,10 +277,11 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): toast_element_text = toast_element.wait_for_visibility_of_element().text if toast_element_text != self.chats[2].get_translation_by_key("photo-saved"): self.errors.append( + self.chats[2], "Shown message '%s' doesn't match expected '%s' after saving an image for member_2." % ( toast_element_text, self.chats[2].get_translation_by_key("photo-saved"))) except TimeoutException: - self.errors.append("Message about saving a photo is not shown for member_2.") + self.errors.append(self.chats[2], "Message about saving a photo is not shown for member_2.") self.chats[2].navigate_back_to_chat_view() # workaround for app closed after navigating back from gallery @@ -292,7 +295,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.chats[2].show_images_button.click() self.chats[2].allow_all_button.click_if_shown() if not self.chats[2].get_image_by_index(0).is_element_image_similar_to_template("image_2_gallery_view.png"): - self.errors.append("Image is not saved to gallery for member_2.") + self.errors.append(self.chats[2], "Image is not saved to gallery for member_2.") self.chats[2].navigate_back_to_home_view() # workaround for app closed after navigating back from gallery @@ -333,7 +336,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): if self.homes[0].element_by_text(message).is_element_displayed(30): break else: - self.errors.append('Messages PN was not fetched from offline') + self.errors.append(self.homes[0], 'Messages PN was not fetched from offline') self.homes[0].click_system_back_button() # workaround for app closed after opening notifications if not self.homes[0].chats_tab.is_element_displayed(): @@ -346,7 +349,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.chats[index].just_fyi("Check that messages are shown for user %s" % self.usernames[index]) for message_text in (message_1, message_2): if not self.chats[index].chat_element_by_text(message_text).is_element_displayed(30): - self.errors.append('%s if not shown for device %s' % (message_text, index)) + self.errors.append(self.chats[index], '%s if not shown for device %s' % (message_text, index)) self.loop.run_until_complete(run_in_parallel(( (_check_messages, {'index': 0}), @@ -367,14 +370,14 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.chats[0].send_message(self.message_1) self.chats[0].pin_message(self.message_1, "pin-to-chat") - if not (self.chats[0].chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed(30) and - self.chats[1].chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed(30)): - self.errors.append("Message 1 is not pinned in group chat!") + for chat in self.chats[0], self.chats[1]: + if not chat.chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed(30): + self.errors.append(chat, "Message 1 is not pinned in group chat!") self.chats[0].just_fyi("Check that non admin user can not unpin messages") self.chats[1].chat_element_by_text(self.message_1).long_press_without_release() if self.chats[1].element_by_translation_id("unpin-from-chat").is_element_displayed(): - self.errors.append("Unpin option is available for non-admin user") + self.errors.append(self.chats[1], "Unpin option is available for non-admin user") self.chats[1].tap_by_coordinates(500, 100) self.chats[1].tap_by_coordinates(500, 100) @@ -396,9 +399,9 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): # here group_chat_1 should be changed to group_chat_2 after enabling the previous block self.chats[0].send_message(message) self.chats[0].pin_message(message, 'pin-to-chat') - if not (self.chats[0].chat_element_by_text(message).pinned_by_label.is_element_displayed(30) and - self.chats[1].chat_element_by_text(message).pinned_by_label.is_element_displayed(30)): - self.errors.append("%s is not pinned in group chat!" % message) + for chat in self.chats[0], self.chats[1]: + if not chat.chat_element_by_text(message).pinned_by_label.is_element_displayed(30): + self.errors.append(chat, "%s is not pinned in group chat!" % message) self.chats[0].just_fyi("Check that a user can not pin more than 3 messages") self.chats[0].send_message(self.message_4) @@ -409,16 +412,17 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): unpin_element.click_until_absense_of_element(desired_element=unpin_element) 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") + for chat in self.chats[0], self.chats[1]: + if not chat.chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30): + self.errors.append(chat, "Message 4 is not pinned in group chat after unpinning previous one") def _check_pinned_messages(index): self.chats[index].just_fyi("Check pinned messages count and content for user %s" % self.usernames[index]) count = self.chats[index].pinned_messages_count.text if count != '3': - self.errors.append( - "Pinned messages count %s doesn't match expected 3 for user %s" % (count, self.usernames[index])) + self.errors.append(self.chats[index], + "Pinned messages count %s doesn't match expected 3 for user %s" % ( + count, self.usernames[index])) self.chats[index].pinned_messages_count.click() for message_text in self.message_1, self.message_3, self.message_4: pinned_by = self.chats[index].pinned_messages_list.get_message_pinned_by_text(message_text) @@ -426,14 +430,15 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): text = pinned_by.text.strip() expected_text = "You" if index == 0 else self.usernames[0] if text != expected_text: - self.errors.append( - "Pinned by '%s' doesn't match expected '%s' for user %s" % ( - text, expected_text, self.usernames[index]) - ) + self.errors.append(self.chats[index], + "Pinned by '%s' doesn't match expected '%s' for user %s" % ( + text, expected_text, self.usernames[index]) + ) else: - self.errors.append( - "Message '%s' is missed on Pinned messages list for user %s" % (message, self.usernames[index]) - ) + self.errors.append(self.chats[index], + "Message '%s' is missed on Pinned messages list for user %s" % ( + message, self.usernames[index]) + ) self.loop.run_until_complete(run_in_parallel(( (_check_pinned_messages, {'index': 0}), @@ -460,7 +465,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): pytest.fail("Chat is not muted") current_text = self.homes[1].mute_chat_button.unmute_caption_text if current_text not in expected_texts: - self.errors.append("Text '%s' is not shown for muted chat" % expected_texts[1]) + self.errors.append(self.homes[1], "Text '%s' is not shown for muted chat" % expected_texts[1]) self.homes[1].click_system_back_button() try: initial_counter = int(self.homes[1].chats_tab.counter.text) @@ -474,20 +479,23 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.homes[1].just_fyi("Member 1 checks that chat is muted and message is received") if chat.new_messages_grey_dot.is_element_displayed(30): - self.errors.append("New messages grey dot near chat name is shown after mute") + self.errors.append(self.homes[1], "New messages grey dot near chat name is shown after mute") try: after_mute_counter = int(self.homes[1].chats_tab.counter.text) except NoSuchElementException: after_mute_counter = 0 if after_mute_counter > initial_counter: - self.errors.append("New messages counter near chats tab button is %s after mute, but should be %s" % ( - after_mute_counter, initial_counter)) + self.errors.append(self.homes[1], + "New messages counter near chats tab button is %s after mute, but should be %s" % ( + after_mute_counter, initial_counter)) if not chat.chat_preview.text.startswith("%s: %s" % (self.usernames[0], muted_message[:25])): - self.errors.append("Message text '%s' is not shown in chat preview after mute" % muted_message) + self.errors.append(self.homes[1], + "Message text '%s' is not shown in chat preview after mute" % muted_message) chat.click() if not self.chats[1].chat_element_by_text(muted_message).is_element_displayed(30): - self.errors.append( - "Message '%s' is not shown in chat for %s (Member 1) after mute" % (muted_message, self.usernames[1])) + self.errors.append(self.chats[1], + "Message '%s' is not shown in chat for %s (Member 1) after mute" % ( + muted_message, self.usernames[1])) self.chats[1].navigate_back_to_home_view() self.chats[1].just_fyi("Member 1 unmutes the chat") @@ -495,7 +503,7 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): self.homes[1].mute_chat_button.double_click() chat.long_press_without_release() if self.homes[1].element_starts_with_text("Muted until").is_element_displayed(): - self.errors.append("Chat is still muted after being unmuted") + self.errors.append(self.homes[1], "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() @@ -510,20 +518,22 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase): 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_grey_dot.is_element_displayed(30): - self.errors.append("New messages counter near chat name is not shown after unmute") + self.errors.append(self.homes[1], "New messages counter near chat name is not shown after unmute") try: after_mute_counter = int(self.homes[1].chats_tab.counter.text) except NoSuchElementException: after_mute_counter = 0 if after_mute_counter != initial_counter: - self.errors.append("New messages counter near chats tab button is %s after unmute, but should be %s" % ( - after_mute_counter, initial_counter + 1)) + self.errors.append(self.homes[1], + "New messages counter near chats tab button is %s after unmute, but should be %s" % ( + after_mute_counter, initial_counter + 1)) if not chat.chat_preview.text.startswith("%s: %s" % (self.usernames[2], unmuted_message)): - self.errors.append("Message text '%s' is not shown in chat preview after unmute" % unmuted_message) + self.errors.append(self.homes[1], + "Message text '%s' is not shown in chat preview after unmute" % unmuted_message) chat.click() if not self.chats[1].chat_element_by_text(unmuted_message).is_element_displayed(30): - self.errors.append( - "Message '%s' is not shown in chat for %s (Member 1) after unmute" % ( - unmuted_message, self.usernames[1])) + self.errors.append(self.chats[1], + "Message '%s' is not shown in chat for %s (Member 1) after unmute" % ( + unmuted_message, self.usernames[1])) self.errors.verify_no_errors() diff --git a/test/appium/tests/critical/chats/test_public_chat_browsing.py b/test/appium/tests/critical/chats/test_public_chat_browsing.py index 51af20b417..e6a133a303 100644 --- a/test/appium/tests/critical/chats/test_public_chat_browsing.py +++ b/test/appium/tests/critical/chats/test_public_chat_browsing.py @@ -10,7 +10,7 @@ from selenium.common.exceptions import NoSuchElementException, TimeoutException, from tests import marks, run_in_parallel, pytest_config_global, transl from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase -from views.chat_view import CommunityView, ChatView +from views.chat_view import CommunityView from views.dbs.waku_backup import user as waku_user from views.sign_in_view import SignInView @@ -61,6 +61,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): actual_copied_text = self.channel.driver.get_clipboard_text() if actual_copied_text != message: self.errors.append( + self.channel, 'Message %s text was not copied in community channel, text in clipboard %s' % actual_copied_text) self.errors.verify_no_errors() @@ -103,9 +104,9 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): try: current_text = self.home.unmute_community_button.unmute_caption_text if current_text not in expected_texts: - self.errors.append("Text '%s' is not shown for muted community" % expected_texts[1]) + self.errors.append(self.home, "Text '%s' is not shown for muted community" % expected_texts[1]) except NoSuchElementException: - self.errors.append("Caption with text 'Muted until...' is not shown for muted community") + self.errors.append(self.home, "Caption with text 'Muted until...' is not shown for muted community") self.home.click_system_back_button() self.home.get_chat(self.community_name, community=True).click() @@ -114,9 +115,11 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): try: current_text = self.home.mute_channel_button.unmute_caption_text if current_text not in expected_texts: - self.errors.append("Text '%s' is not shown for a channel in muted community" % expected_texts[1]) + self.errors.append(self.home, + "Text '%s' is not shown for a channel in muted community" % expected_texts[1]) except NoSuchElementException: - self.errors.append("Caption with text 'Muted until...' is not shown for a channel in muted community") + self.errors.append(self.home, + "Caption with text 'Muted until...' is not shown for a channel in muted community") self.home.just_fyi("Unmute channel and check that the community is also unmuted") self.home.mute_channel_button.click() @@ -124,7 +127,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): self.home.communities_tab.click() self.home.get_chat(self.community_name, community=True).long_press_element() if not self.home.element_by_text("Mute community").is_element_displayed(): - self.errors.append("Community is not unmuted when channel is unmuted") + self.errors.append(self.home, "Community is not unmuted when channel is unmuted") self.home.click_system_back_button() self.home.just_fyi("Mute channel and check that community is not muted") @@ -140,16 +143,18 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): try: current_text = self.home.mute_channel_button.unmute_caption_text if current_text not in expected_texts: - self.errors.append("Text '%s' is not shown for a muted community channel" % expected_texts[1]) + self.errors.append(self.home, + "Text '%s' is not shown for a muted community channel" % expected_texts[1]) except NoSuchElementException: - self.errors.append("Caption with text '%s' is not shown for a muted community channel" % expected_texts[1]) + self.errors.append(self.home, + "Caption with text '%s' is not shown for a muted community channel" % expected_texts[1]) self.home.click_system_back_button() self.home.navigate_back_to_home_view() self.home.communities_tab.click() self.home.get_chat(self.community_name, community=True).long_press_element() if self.home.element_by_text_part("Muted until").is_element_displayed() or \ self.home.mute_community_button.text != transl["mute-community"]: - self.errors.append("Community is muted when channel is muted") + self.errors.append(self.home, "Community is muted when channel is muted") self.home.click_system_back_button() self.errors.verify_no_errors() @@ -172,7 +177,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): # "Incorrect contacts number restored: %s instead of %s" % (contacts_number, len(waku_user.contacts))) for contact in waku_user.contacts: if not self.home.element_by_text(contact).is_element_displayed(30): - self.errors.append('%s was not restored as a contact from waku backup!' % contact) + self.errors.append(self.home, '%s was not restored as a contact from waku backup!' % contact) # Disabled for simple check as sometimes from waku-backup users restored with 3-random names # self.home.click_system_back_button_until_element_is_shown() # contact_row = self.home.contact_details_row(index=i + 1) @@ -201,7 +206,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): self.home.communities_tab.click() for key in ['admin_open', 'member_open', 'admin_closed', 'member_closed']: if not self.home.element_by_text(waku_user.communities[key]).is_element_displayed(30): - self.errors.append("%s was not restored from waku-backup!!" % key) + self.errors.append(self.home, "%s was not restored from waku-backup!!" % key) # TODO: there is a bug when pending community sometimes restored as joined; needs investigation # self.home.opened_communities_tab.click() # if not self.home.element_by_text(waku_user.communities['member_pending']).is_element_displayed(30): @@ -222,7 +227,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): self.home.navigate_back_to_home_view() self.home.communities_tab.click() if self.home.element_by_text(waku_user.communities['admin_open']).is_element_displayed(30): - self.errors.append("Community of previous user is shown!") + self.errors.append(self.home, "Community of previous user is shown!") self.home.just_fyi("Check that can remove user from logged out state") self.home.reopen_app(sign_in=False) @@ -230,13 +235,13 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): user_card.open_user_options() self.sign_in.remove_profile_button.click() if not self.sign_in.element_by_translation_id("remove-profile-confirm-message").is_element_displayed(30): - self.errors.append("Warning is not shown on removing profile!") + self.errors.append(self.home, "Warning is not shown on removing profile!") self.sign_in.element_by_translation_id("remove").click() self.home.just_fyi("Check that removed user is not shown in the list anymore") self.home.reopen_app(sign_in=False) if self.sign_in.element_by_text(recover_user_name).is_element_displayed(): - self.errors.append("Removed user is re-appeared after relogin!") + self.errors.append(self.home, "Removed user is re-appeared after relogin!") self.errors.verify_no_errors() @@ -279,21 +284,23 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase): except TimeoutException: missing_tags.append(text) if missing_tags: - self.errors.append("Community '%s' is missing tag(s) %s." % (community_name, ','.join(tags))) + self.errors.append(self.home, + "Community '%s' is missing tag(s) %s." % (community_name, ','.join(tags))) # if community_name == 'Status': self.home.just_fyi("Check Status community screen") card.click() if self.community_view.join_button.is_element_differs_from_template( 'status_community_join_button.png'): - self.errors.append("Status community Join button is different from expected template.") + self.errors.append(self.home, "Status community Join button is different from expected template.") if self.community_view.community_logo.is_element_differs_from_template('status_community_logo.png'): - self.errors.append("Status community logo is different from expected template.") + self.errors.append(self.home, "Status community logo is different from expected template.") # self.community_view.close_community_view_button.click() # self.home.swipe_up() except TimeoutException: - self.errors.append("Community '%s' is not in the Discover Communities list." % community_name) + self.errors.append(self.home, + "Community '%s' is not in the Discover Communities list." % community_name) self.errors.verify_no_errors() # Note: this test should always be the LAST ONE in the group because it turns on mainnet in the app! @@ -350,7 +357,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): timestamp = self.channel_1.chat_element_by_text(message).timestamp if sent_time_variants and timestamp: if timestamp not in sent_time_variants: - self.errors.append("Timestamp is not shown, expected: '%s', in fact: '%s'" % + self.errors.append(self.channel_1, "Timestamp is not shown, expected: '%s', in fact: '%s'" % (", ".join(sent_time_variants), timestamp)) self.channel_1.verify_message_is_under_today_text(message, self.errors) self.channel_2.send_message("one more message") @@ -358,7 +365,8 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): 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(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.append(self.channel_2, + "Default username '%s' is not shown next to the received message" % self.username_1) self.errors.verify_no_errors() @marks.smoke @@ -370,13 +378,13 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_1.edit_message_in_chat(message_before_edit, message_after_edit) for channel in (self.channel_1, self.channel_2): if not channel.element_by_text_part(message_after_edit).is_element_displayed(60): - self.errors.append('Message is not edited') + self.errors.append(channel, 'Message is not edited') message_text_after_edit = message_after_edit + ' (Edited)' self.channel_2.set_reaction(message_text_after_edit) try: self.channel_1.chat_element_by_text(message_text_after_edit).emojis_below_message().wait_for_element_text(1) except (Failed, NoSuchElementException): - self.errors.append("Message reaction is not shown for the sender") + self.errors.append(self.channel_1, "Message reaction is not shown for the sender") self.errors.verify_no_errors() @marks.testrail_id(702839) @@ -389,9 +397,9 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_2.delete_message_in_chat(message_to_delete_everyone) for channel in (self.channel_1, self.channel_2): if not channel.chat_element_by_text(message_to_delete_everyone).is_element_disappeared(30): - self.errors.append("Deleted message is shown in channel") + self.errors.append(channel, "Deleted message is shown in channel") if not self.channel_2.element_by_translation_id('message-deleted-for-everyone').is_element_displayed(30): - self.errors.append("System message about deletion for everyone is not displayed") + self.errors.append(self.channel_2, "System message about deletion for everyone is not displayed") self.home_2.just_fyi( 'Deleting message for me. Checking that message is deleted only for the author of the message') @@ -399,11 +407,11 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_1.chat_element_by_text(message_to_delete_for_me).wait_for_element(120) self.channel_2.delete_message_in_chat(message_to_delete_for_me, everyone=False) if not self.channel_2.chat_element_by_text(message_to_delete_for_me).is_element_disappeared(30): - self.errors.append("Deleted for me message is shown in channel for the author of message") + self.errors.append(self.channel_2, "Deleted for me message is shown in channel for the author of message") if not self.channel_2.element_by_translation_id('message-deleted-for-you').is_element_displayed(30): - self.errors.append("System message about deletion for you is not displayed") + self.errors.append(self.channel_2, "System message about deletion for you is not displayed") if not self.channel_1.chat_element_by_text(message_to_delete_for_me).is_element_displayed(30): - self.errors.append("Deleted for me message is deleted all channel members") + self.errors.append(self.channel_1, "Deleted for me message is deleted all channel members") self.errors.verify_no_errors() @marks.testrail_id(703194) @@ -423,22 +431,22 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): image = chat_element.image_container_in_message if (image.is_element_differs_from_template("images_gallery.png", 5) and image.is_element_differs_from_template("images_gallery_inverted.png", 5)): - self.errors.append("Gallery message does not match the template!") + self.errors.append(self.channel_2, "Gallery message does not match the template!") except TimeoutException: - self.errors.append("Gallery message was not received") + self.errors.append(self.channel_2, "Gallery message was not received") received = False if received: self.channel_2.just_fyi("Checking an ability to save and share an image from gallery") chat_element.image_container_in_message.image_by_index(1).click() if not self.channel_2.share_image_icon_button.is_element_displayed(): - self.errors.append("Can't share an image from gallery.") + self.errors.append(self.channel_2, "Can't share an image from gallery.") if self.channel_2.view_image_options_button.is_element_displayed(): self.channel_2.view_image_options_button.click() if not self.channel_2.save_image_icon_button.is_element_displayed(): - self.errors.append("Can't save an image from gallery.") + self.errors.append(self.channel_2, "Can't save an image from gallery.") else: - self.errors.append("Image options button is not shown for an image from gallery.") + self.errors.append(self.channel_2, "Image options button is not shown for an image from gallery.") self.channel_2.navigate_back_to_chat_view() @@ -450,7 +458,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): 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_description: - self.errors.append('Reply message was not received by the sender') + self.errors.append(self.channel_1, 'Reply message was not received by the sender') self.errors.verify_no_errors() @marks.testrail_id(702859) @@ -465,7 +473,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_2.chat_element_by_text(image_description).wait_for_visibility_of_element(10) if not self.channel_2.chat_element_by_text( image_description).image_in_message.is_element_image_similar_to_template('image_1_chat_view.png'): - self.errors.append("Not expected image is shown to the receiver") + self.errors.append(self.channel_2, "Not expected image is shown to the receiver") if not self.channel_1.chat_element_by_text(image_description).is_element_displayed(60): self.channel_1.hide_keyboard_if_shown() @@ -477,11 +485,11 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): if toast_element.is_element_displayed(): toast_element_text = toast_element.text if toast_element_text != self.channel_1.get_translation_by_key("photo-saved"): - self.errors.append( - "Shown message '%s' doesn't match expected '%s' after saving an image." % ( - toast_element_text, self.channel_1.get_translation_by_key("photo-saved"))) + self.errors.append(self.channel_1, + "Shown message '%s' doesn't match expected '%s' after saving an image." % ( + toast_element_text, self.channel_1.get_translation_by_key("photo-saved"))) else: - self.errors.append("Message about saving a photo is not shown.") + self.errors.append(self.channel_1, "Message about saving a photo is not shown.") self.channel_1.navigate_back_to_chat_view() self.channel_1.just_fyi("Check that image is saved in gallery") @@ -489,7 +497,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_1.allow_all_button.click_if_shown() if not self.channel_1.get_image_by_index(0).is_element_image_similar_to_template( "image_1_gallery_view.png"): - self.errors.append('Saved image is not shown in Recent') + self.errors.append(self.channel_1, 'Saved image is not shown in Recent') self.channel_1.click_system_back_button() self.home_2.just_fyi('Check share option on opened image') @@ -499,7 +507,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): try: self.channel_2.wait_for_current_package_to_be('com.google.android.apps.docs') except TimeoutException: - self.errors.append("Can't share image") + self.errors.append(self.channel_2, "Can't share image") self.channel_2.navigate_back_to_chat_view() self.channel_2.just_fyi("Can reply to images") @@ -511,20 +519,20 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): 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_description: - self.errors.append('Reply message was not received by the sender') + self.errors.append(self.channel_1, 'Reply message was not received by the sender') self.channel_2.just_fyi("Set a reaction for the image message") self.channel_2.set_reaction(message=image_description) try: self.channel_1.chat_element_by_text(image_description).emojis_below_message().wait_for_element_text(1) except (Failed, NoSuchElementException): - self.errors.append("Image message reaction is not shown for the sender") + self.errors.append(self.channel_1, "Image message reaction is not shown for the sender") self.channel_1.just_fyi("Set a reaction for the message reply") self.channel_2.set_reaction(message=image_description, emoji="love") try: self.channel_2.chat_element_by_text(message_text).emojis_below_message( emoji="love").wait_for_element_text(1) except (Failed, NoSuchElementException): - self.errors.append("Reply message reaction is not shown for the reply sender") + self.errors.append(self.channel_2, "Reply message reaction is not shown for the reply sender") self.errors.verify_no_errors() @@ -537,13 +545,14 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_1.send_message(emoji_message) for channel in self.channel_1, self.channel_2: if not channel.chat_element_by_text(emoji_unicode).is_element_displayed(30): - self.errors.append('Message with emoji was not sent or received in community channel') + self.errors.append(channel, 'Message with emoji was not sent or received in community channel') self.channel_1.just_fyi("Can copy and paste emojis") self.channel_1.copy_message_text(emoji_unicode) actual_copied_text = self.channel_1.driver.get_clipboard_text() if actual_copied_text != emoji_unicode: - self.errors.append('Emoji message was not copied, text in clipboard is %s' % actual_copied_text) + self.errors.append(self.channel_1, + 'Emoji message was not copied, text in clipboard is %s' % actual_copied_text) self.channel_1.just_fyi("Can reply to emojis") if not self.channel_2.chat_message_input.is_element_displayed(): @@ -557,7 +566,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): chat_element_1 = self.channel_1.chat_element_by_text(message_text) chat_element_1.wait_for_element(60) if chat_element_1.replied_message_text != emoji_unicode: - self.errors.append('Reply message is not reply to original message!') + self.errors.append(self.channel_1, 'Reply message is not reply to original message!') self.errors.verify_no_errors() @marks.testrail_id(702844) @@ -613,27 +622,30 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): try: self.channel_2.url_preview_composer.wait_for_element(20) except TimeoutException: - self.errors.append("No preview is loaded for url %s" % url) + self.errors.append(self.channel_1, "No preview is loaded for url %s" % url) self.channel_2.send_message_button.click() continue shown_title = self.channel_2.url_preview_composer_text.text if shown_title != data['title']: - self.errors.append("Preview text is not expected, it is '%s'" % shown_title) + self.errors.append(self.channel_2, "Preview text is not expected, it is '%s'" % shown_title) self.channel_2.send_message_button.click() message = self.channel_1.get_preview_message_by_text(url) message.wait_for_element(60) if not message.preview_image: - self.errors.append("No preview image is shown for %s" % url) + self.errors.append(self.channel_1, "No preview image is shown for %s" % url) shown_title = message.preview_title.text if shown_title != data['title']: - self.errors.append("Title is not equal expected for '%s', actual is '%s'" % (url, shown_title)) + self.errors.append(self.channel_1, + "Title is not equal expected for '%s', actual is '%s'" % (url, shown_title)) shown_description = message.preview_subtitle.text if shown_description != data['description']: - self.errors.append( - "Description is not equal expected for '%s', actual is '%s'" % (url, shown_description)) + self.errors.append(self.channel_1, + "Description is not equal expected for '%s', actual is '%s'" % ( + url, shown_description)) shown_link = message.preview_link.text if shown_link != data['link']: - self.errors.append("Link is not equal expected for '%s', actual is '%s'" % (url, shown_link)) + self.errors.append(self.channel_1, + "Link is not equal expected for '%s', actual is '%s'" % (url, shown_link)) self.channel_1.just_fyi("Set reaction and check it") message_with_reaction = list(preview_urls.values())[-1]['url'] @@ -645,7 +657,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_2.chat_element_by_text(message_with_reaction).emojis_below_message( emoji="laugh").wait_for_element_text(1) except (Failed, NoSuchElementException): - self.errors.append("Link message reaction is not shown for the sender") + self.errors.append(self.channel_2, "Link message reaction is not shown for the sender") self.errors.verify_no_errors() @@ -662,14 +674,14 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): 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_grey_dot.is_element_displayed(sec=30): - self.errors.append('New message community badge is not shown') + self.errors.append(self.home_1, '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 channel') if not channel_1_element.new_messages_grey_dot.is_element_displayed(): - self.errors.append('New messages channel badge is not shown on channel') + self.errors.append(self.channel_1, 'New messages channel badge is not shown on channel') channel_1_element.click() self.errors.verify_no_errors() @@ -696,7 +708,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.chat_1.just_fyi('Check that messages from blocked user are hidden in public chat and close app') if not self.chat_1.chat_element_by_text(message_to_disappear).is_element_disappeared(30): - self.errors.append("Messages from blocked user is not cleared in public chat ") + self.errors.append(self.chat_1, "Messages from blocked user is not cleared in public chat ") self.chat_1.navigate_back_to_home_view() # ToDo: enable when https://github.com/status-im/status-mobile/issues/19334 is fixed # self.home_1.chats_tab.click() @@ -715,8 +727,8 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.home_1.get_chat(self.channel_name, community_channel=True).click() for message in message_to_disappear, message_blocked: if self.chat_1.chat_element_by_text(message).is_element_displayed(30): - self.errors.append( - "'%s' from blocked user is fetched from offline in community channel" % message) + self.errors.append(self.chat_1, + "'%s' from blocked user is fetched from offline in community channel" % message) self.chat_1.just_fyi('Unblock user and check that can see further messages') # TODO: still no blocked users in new UI @@ -736,7 +748,8 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.home_1.get_chat(self.channel_name, community_channel=True).click() self.chat_1.hide_keyboard_if_shown() if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed(120): - self.errors.append("%s was not received in public chat after user unblock!" % message_unblocked) + self.errors.append(self.chat_1, + "%s was not received in public chat after user unblock!" % message_unblocked) self.errors.verify_no_errors() self.home_1.just_fyi("Add blocked user to contacts again after removing(removed automatically when blocked)") @@ -756,7 +769,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): unblocked = True except TimeoutException: unblocked = False - self.errors.append("Chat with unblocked user was not enabled after 1 minute") + self.errors.append(self.chat_1, "Chat with unblocked user was not enabled after 1 minute") if unblocked: self.home_2.just_fyi("Check message in 1-1 chat after unblock") @@ -767,9 +780,9 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.chat_2.chat_element_by_text(message_unblocked).wait_for_status_to_be(expected_status='Delivered', timeout=120) if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed(30): - self.errors.append("Message was not received in 1-1 chat after user unblock!") + self.errors.append(self.chat_1, "Message was not received in 1-1 chat after user unblock!") except TimeoutException: - self.errors.append('Message was not delivered after back up online.') + self.errors.append(self.chat_2, 'Message was not delivered after back up online.') self.errors.verify_no_errors() @@ -783,22 +796,23 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_2.send_message(self.text_message) community_1_element = self.community_1.get_chat(self.community_name, community=True) if not community_1_element.new_messages_grey_dot.is_element_displayed(90): - self.errors.append('New messages counter is not shown in home > Community element') + self.errors.append(self.community_1, 'New messages counter is not shown in home > Community element') community_1_element.click() channel_1_element = self.community_1.get_chat(self.channel_name, community_channel=True) if not channel_1_element.new_messages_grey_dot.is_element_displayed(): - self.errors.append("New messages counter is not shown in community channel element") + self.errors.append(self.community_1, "New messages counter is not shown in community channel element") self.community_1.click_system_back_button() mark_as_read_button = self.community_1.mark_all_messages_as_read_button self.home_1.community_floating_screen.wait_for_invisibility_of_element() community_1_element.long_press_until_element_is_shown(mark_as_read_button) mark_as_read_button.click() if community_1_element.new_messages_grey_dot.is_element_displayed(): - self.errors.append( - 'Unread messages badge is shown in community element while there are no unread messages') + self.errors.append(self.community_1, + 'Unread messages badge is shown in community element while there are no unread messages') community_1_element.click() if channel_1_element.new_messages_grey_dot.is_element_displayed(): self.errors.append( + self.community_1, "New messages badge is shown in community channel element while there are no unread messages") self.errors.verify_no_errors() @@ -827,9 +841,10 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.channel_1.just_fyi("Receiver is checking if messages were updated and deleted") if not self.channel_1.chat_element_by_text(message_after_edit).is_element_displayed(30): - self.errors.append("Updated message '%s' is not delivered to the receiver" % message_after_edit) + self.errors.append(self.channel_1, + "Updated message '%s' is not delivered to the receiver" % message_after_edit) if not self.channel_1.chat_element_by_text(message_to_delete).is_element_disappeared(): - self.errors.append("Message '%s' was not deleted for the receiver" % message_to_delete) + self.errors.append(self.channel_1, "Message '%s' was not deleted for the receiver" % message_to_delete) self.errors.verify_no_errors() @@ -890,12 +905,13 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): message_received = True if not self.channel_1.chat_element_by_text(self.username_1).is_element_displayed(): if self.channel_1.chat_message_input.is_element_displayed(): - self.errors.append("Message with the mention is not shown in the chat for the admin") + self.errors.append(self.channel_1, + "Message with the mention is not shown in the chat for the admin") else: - self.errors.append( - "Channel did not open by clicking on a notification with the mention for admin") + self.errors.append(self.channel_1, + "Channel did not open by clicking on a notification with the mention for admin") else: - self.errors.append("Push notification with the mention was not received by admin") + self.errors.append(self.channel_1, "Push notification with the mention was not received by admin") if not self.channel_1.chat_message_input.is_element_displayed(): self.channel_1.navigate_back_to_home_view() @@ -925,20 +941,20 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): self.channel_2.send_message_button.click() edit_done = True if chat_element.message_body_with_mention.text != expected_message: - self.errors.append("Edited message is not shown correctly for the sender") + self.errors.append(self.channel_2, "Edited message is not shown correctly for the sender") except NoSuchElementException: - self.errors.append("Can not edit a message with a mention") + self.errors.append(self.channel_2, "Can not edit a message with a mention") if edit_done: element = self.channel_1.chat_element_by_text(self.username_1).message_body_with_mention if not element.is_element_displayed(10) or element.text != expected_message: - self.errors.append("Edited message is not shown correctly for the (receiver) admin") + self.errors.append(self.channel_1, "Edited message is not shown correctly for the (receiver) admin") self.device_2.just_fyi("Sender checks the reaction for a message with a mention") try: self.channel_2.chat_element_by_text(self.username_1).emojis_below_message( emoji="sad").wait_for_element_text(1) except (Failed, NoSuchElementException): - self.errors.append("Message reaction is not shown for the sender") + self.errors.append(self.channel_2, "Message reaction is not shown for the sender") self.home_2.navigate_back_to_home_view() if not self.channel_1.chat_message_input.is_element_displayed(): @@ -957,12 +973,15 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): push_notification_element.click() if not self.channel_2.chat_element_by_text(self.username_2).is_element_displayed(): if self.channel_2.chat_message_input.is_element_displayed(): - self.errors.append("Message with the mention is not shown in the chat for the invited member") + self.errors.append(self.channel_2, + "Message with the mention is not shown in the chat for the invited member") else: self.errors.append( + self.channel_2, "Channel did not open by clicking on a notification with the mention for the invited member") else: - self.errors.append("Push notification with the mention was not received by the invited member") + self.errors.append(self.channel_2, + "Push notification with the mention was not received by the invited member") self.errors.verify_no_errors() @marks.testrail_id(702809) @@ -989,11 +1008,13 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): self.channel_2.send_message(message_to_send) if not self.channel_2.chat_element_by_text(message).is_element_displayed(): self.errors.append( - '%s is not displayed with markdown in community channel for the sender (device 2) \n' % message) + self.channel_2, + '%s is not displayed with markdown in community channel for the sender \n' % message) if not self.channel_1.chat_element_by_text(message).is_element_displayed(): self.errors.append( - '%s is not displayed with markdown in community channel for the recipient (device 1) \n' % message) + self.channel_1, + '%s is not displayed with markdown in community channel for the recipient \n' % message) for home in self.homes: home.navigate_back_to_home_view() @@ -1009,10 +1030,11 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): self.chat_1.send_message(message_to_send) if not self.chat_1.chat_element_by_text(message).is_element_displayed(30): self.errors.append( - '%s is not displayed with markdown in 1-1 chat for the sender (device 1) \n' % message) + self.chat_1, '%s is not displayed with markdown in 1-1 chat for the sender (device 1) \n' % message) if not self.chat_2.chat_element_by_text(message).is_element_displayed(30): self.errors.append( + self.chat_2, '%s is not displayed with markdown in 1-1 chat for the recipient (device 2) \n' % message) self.errors.verify_no_errors() @@ -1027,7 +1049,7 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): community_to_leave.leave_community_button.click() community_to_leave.leave_community_button.click() if not community.is_element_disappeared(): - self.errors.append('Community is still shown in the list after leave') + self.errors.append(self.home_2, 'Community is still shown in the list after leave') self.errors.verify_no_errors() @marks.xfail(reason="Can't navigate to a community channel before joining the community, " @@ -1058,12 +1080,13 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): if not self.community_2.get_channel(chan_name).is_element_displayed(): not_shown.append(chan_name) if not_shown: - self.errors.append("Not all channels are shown in community before joining: %s" % not_shown) + self.errors.append(self.community_2, + "Not all channels are shown in community before joining: %s" % not_shown) chan = self.community_2.get_channel("general") if chan.is_element_displayed(): chan.find_element().click() if not self.channel_2.chat_element_by_text(control_message_general_chat).is_element_displayed(20): - self.errors.append("Message in community channel is not visible for user before join") + self.errors.append(self.channel_2, "Message in community channel is not visible for user before join") else: not_shown.append("general") @@ -1078,7 +1101,7 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): try: self.home_1.notifications_unread_badge.wait_for_visibility_of_element(120) except TimeoutException: - self.errors.append("Unread indicator is not shown in notifications on membership request") + self.errors.append(self.home_1, "Unread indicator is not shown in notifications on membership request") self.home_1.open_activity_center_button.click() reply_element = self.home_1.get_element_from_activity_center_view(self.username_2) reply_element.title.swipe_right_on_element(width_percentage=2.5) @@ -1104,12 +1127,12 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): self.home_2.get_to_community_channel_from_home(community_name, dogs_channel) self.channel_2.chat_element_by_text(message_with_hashtag).click_on_link_inside_message_body() if not self.channel_2.chat_element_by_text(cats_message).is_element_displayed(30): - self.errors.append("Receiver was not navigated to the cats channel") + self.errors.append(self.channel_2, "Receiver was not navigated to the cats channel") self.home_1.just_fyi("Device 1 clicks on the message with hashtag in the community channel") self.channel_1.chat_element_by_text(message_with_hashtag).click_on_link_inside_message_body() if not self.channel_1.chat_element_by_text(cats_message).is_element_displayed(30): - self.errors.append("Sender was not navigated to the cats channel") + self.errors.append(self.channel_1, "Sender was not navigated to the cats channel") for home in self.homes: home.navigate_back_to_home_view() @@ -1123,12 +1146,12 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): self.home_1.get_chat(self.username_2).click() self.chat_1.chat_element_by_text(message_with_hashtag).click_on_link_inside_message_body() if self.chat_1.chat_element_by_text(control_message_1_1_chat).is_element_disappeared(): - self.errors.append("Receiver was navigated out of 1-1 chat") + self.errors.append(self.chat_1, "Receiver was navigated out of 1-1 chat") self.home_2.just_fyi("Device 2 clicks on the message with hashtag in 1-1 chat") self.chat_2.chat_element_by_text(message_with_hashtag).click_on_link_inside_message_body() if self.chat_2.chat_element_by_text(control_message_1_1_chat).is_element_disappeared(): - self.errors.append("Sender was navigated out of 1-1 chat") + self.errors.append(self.chat_2, "Sender was navigated out of 1-1 chat") self.errors.verify_no_errors() @@ -1169,21 +1192,23 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): if self.community_2.toast_content_element.is_element_displayed(10): cur_text = self.community_2.toast_content_element.text if cur_text != exp_text: - self.errors.append( - "Text \"%s\" in shown toast element doesn't match expected \"%s\"" % (cur_text, exp_text)) + self.errors.append(self.community_2, + "Text \"%s\" in shown toast element doesn't match expected \"%s\"" % ( + cur_text, exp_text)) else: - self.errors.append("Toast element with the text \"%s\" doesn't appear" % exp_text) + self.errors.append(self.community_2, "Toast element with the text \"%s\" doesn't appear" % exp_text) if not self.community_2.community_status_pending.is_element_displayed(): - self.errors.append("Pending status is not displayed") + self.errors.append(self.community_2, "Pending status is not displayed") general_channel = self.community_2.get_channel("general") if general_channel.is_element_displayed(): general_channel.find_element().click() if not self.channel_2.chat_element_by_text(control_message_general_chat).is_element_displayed(30): self.errors.append( + self.community_2, "Message in community channel is not visible for user before join, it was indicated as " \ "%s sent for the sender before he went offline" % ("" if message_sent else "not")) else: - self.errors.append("Community channel is not displayed for user before join") + self.errors.append(self.community_2, "Community channel is not displayed for user before join") self.community_2.toast_content_element.wait_for_invisibility_of_element(30) self.home_2.navigate_back_to_home_view() self.home_2.communities_tab.click() @@ -1191,7 +1216,7 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): if self.home_2.get_chat(community_name, community=True).is_element_displayed(): self.home_2.get_chat(community_name, community=True).click() else: - self.errors.append("%s is not listed inside Pending communities tab" % community_name) + self.errors.append(self.home_2, "%s is not listed inside Pending communities tab" % community_name) self.home_1.just_fyi("Device 1 goes back online") self.home_1.driver.activate_app(app_package) @@ -1202,13 +1227,14 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): if self.community_2.toast_content_element.is_element_displayed(60): cur_text = self.community_2.toast_content_element.text if cur_text != exp_text: - self.errors.append( - "Text \"%s\" in shown toast element doesn't match expected \"%s\"" % (cur_text, exp_text)) + self.errors.append(self.community_2, + "Text \"%s\" in shown toast element doesn't match expected \"%s\"" % ( + cur_text, exp_text)) # else: # self.errors.append("Toast element with the text \"%s\" doesn't appear" % exp_text) # ToDo: add verification when toast is fixed if not self.community_2.community_status_joined.is_element_displayed(): - self.errors.append("Joined status is not displayed") + self.errors.append(self.community_2, "Joined status is not displayed") self.community_2.close_community_view_button.click_until_absense_of_element( self.community_2.close_community_view_button) self.home_2.joined_communities_tab.click() @@ -1216,6 +1242,6 @@ class TestCommunityMultipleDeviceMergedTwo(MultipleSharedDeviceTestCase): if chat_element.is_element_displayed(30): chat_element.click() else: - self.errors.append("%s is not listed inside Joined communities tab" % community_name) + self.errors.append(self.home_2, "%s is not listed inside Joined communities tab" % community_name) self.errors.verify_no_errors() diff --git a/test/appium/tests/critical/test_deep_and_universal_links.py b/test/appium/tests/critical/test_deep_and_universal_links.py index dcae607e59..c97685129e 100644 --- a/test/appium/tests/critical/test_deep_and_universal_links.py +++ b/test/appium/tests/critical/test_deep_and_universal_links.py @@ -42,9 +42,9 @@ class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase): if self.channel.profile_send_contact_request_button.is_element_displayed(10): username_text = self.profile_view.contact_name_text.text if not (username_text.endswith(url[-6:]) or username_text == text): - self.errors.append("Incorrect username is shown for profile url %s" % url) + self.errors.append(self.channel, "Incorrect username is shown for profile url %s" % url) else: - self.errors.append("Profile was not opened by the profile url %s" % url) + self.errors.append(self.channel, "Profile was not opened by the profile url %s" % url) self.profile_view.close_button.click() self.errors.verify_no_errors() @@ -69,7 +69,7 @@ class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase): else: name_is_shown = shown_name_text.endswith(link[-6:]) if not self.channel.profile_send_contact_request_button.is_element_displayed(10) or not name_is_shown: - self.errors.append("Profile was not opened by the profile deep link %s" % link) + self.errors.append(self.channel, "Profile was not opened by the profile deep link %s" % link) self.browser_view.click_system_back_button() self.errors.verify_no_errors() @@ -103,11 +103,13 @@ class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase): self.browser_view.open_url(link) if text == snt_community_name: if self.community_view.community_title.text != text: - self.errors.append("Community '%s' was not requested to join by the deep link %s" % (text, link)) + self.errors.append(self.community_view, + "Community '%s' was not requested to join by the deep link %s" % (text, link)) else: if not self.community_view.join_button.is_element_displayed( 10) or self.community_view.community_title.text != text: - self.errors.append("Community '%s' was not requested to join by the deep link %s" % (text, link)) + self.errors.append(self.community_view, + "Community '%s' was not requested to join by the deep link %s" % (text, link)) if text != closed_community_name: # the last one self.home.navigate_back_to_home_view() self.home.browser_tab.click() @@ -123,7 +125,8 @@ class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase): self.home.open_link_from_google_search_app(profile_url, app_package) if not self.channel.profile_add_to_contacts_button.is_element_displayed( 10) or not self.profile_view.default_username_text.text.endswith(profile_url[-6:]): - self.errors.append("Profile was not opened by the url %s when user is logged in" % profile_url) + self.errors.append(self.profile_view, + "Profile was not opened by the url %s when user is logged in" % profile_url) self.home.just_fyi("Opening a community URL from google search bar when user is logged out") self.driver.terminate_app(app_package) @@ -131,7 +134,8 @@ class TestDeepLinksOneDevice(MultipleSharedDeviceTestCase): self.home.open_link_from_google_search_app(community_url, app_package) self.sign_in.sign_in(user_name=self.username) if not self.community_view.join_button.is_element_displayed(10): - self.errors.append("Closed community was not requested to join by the url %s" % community_url) + self.errors.append(self.community_view, + "Closed community was not requested to join by the url %s" % community_url) # ToDo: enable when https://github.com/status-im/status-mobile/issues/18074 is fixed # self.home.just_fyi("Opening a community channel URL from google search bar with no account created") diff --git a/test/appium/tests/critical/test_fallback.py b/test/appium/tests/critical/test_fallback.py index e60a7af374..5799bb37b5 100644 --- a/test/appium/tests/critical/test_fallback.py +++ b/test/appium/tests/critical/test_fallback.py @@ -72,9 +72,11 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): if device_element.is_element_displayed(): if not device_element.get_pair_button.is_element_displayed(): self.errors.append( + self.profile_1, "Pair button is absent for the device 2 inside Paired devices list of profile 1 before pairing") else: - self.errors.append("Device 2 is not shown in Paired devices list for device 1 before pairing") + self.errors.append(self.profile_1, + "Device 2 is not shown in Paired devices list for device 1 before pairing") self.profile_1.click_system_back_button(times=3) for home in self.home_1, self.home_2: @@ -84,9 +86,10 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): self.home_1.just_fyi("Checking pairing request on device 1") a_c_element = self.home_1.get_activity_center_element_by_text(transl['review-pairing-request']) if a_c_element.title.text != transl['new-device-detected']: - self.errors.append( - "Notification with title '%s' is not shown in the activity center for the device 1" % transl[ - 'new-device-detected']) + self.errors.append(self.home_1, + "Notification with title '%s' is not shown in the activity center for the device 1" % + transl[ + 'new-device-detected']) a_c_element.review_pairing_request_button.click() device_id_1 = self.home_1.get_new_device_installation_id() @@ -95,14 +98,15 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): self.home_2.just_fyi("Checking sync profile on device 2") a_c_element = self.home_2.get_activity_center_element_by_text(transl['more-details']) if a_c_element.title.text != transl['sync-your-profile']: - self.errors.append( - "Notification with title '%s' is not shown in the activity center for the device 2" % transl[ - 'sync-your-profile']) + self.errors.append(self.home_2, + "Notification with title '%s' is not shown in the activity center for the device 2" % + transl[ + 'sync-your-profile']) a_c_element.more_details_button.click() device_id_2 = self.home_2.get_new_device_installation_id() if device_id_1 != device_id_2: - self.errors.append("Device ids don't match on the activity center notifications") + self.errors.append(self.home_2, "Device ids don't match on the activity center notifications") self.home_1.just_fyi("Confirm pairing request on device 1") self.home_1.element_by_translation_id('pair-and-sync').click() @@ -121,9 +125,11 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): if device_element.is_element_displayed(): if not device_element.get_unpair_button.is_element_displayed(): self.errors.append( + self.profile_1, "Unpair button is absent for the device 2 inside Paired devices list of profile 1 after pairing") else: - self.errors.append("Device 2 is not shown in Paired devices list for device 1 after pairing") + self.errors.append(self.profile_1, + "Device 2 is not shown in Paired devices list for device 1 after pairing") self.home_2.just_fyi("Device 2: Check that the device 1 is shown paired devices list") self.home_2.profile_button.click() @@ -133,9 +139,11 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): if device_element.is_element_displayed(): if not device_element.get_unpair_button.is_element_displayed(): self.errors.append( + self.profile_2, "Unpair button is absent for the device 1 inside Paired devices list of profile 2 after pairing") else: - self.errors.append("Device 1 is not shown in Paired devices list for device 2 after pairing") + self.errors.append(self.profile_2, + "Device 1 is not shown in Paired devices list for device 2 after pairing") self.home_3.just_fyi("Device 3: send a message to user 1") self.home_3.chats_tab.click() @@ -153,7 +161,7 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): chat_view = chat_element.click() chat_view.chat_element_by_text(message).wait_for_visibility_of_element(60) except TimeoutException: - self.errors.append("Message is not received by the user %s" % index) + self.errors.append(home_view, "Message is not received by the user %s" % index) self.loop.run_until_complete( run_in_parallel(((_check_message, {'home_view': self.home_1, 'index': 1}), @@ -178,11 +186,12 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): wallet_1.close_account_button.click_until_presence_of_element(account_element) if regular_account_address != expected_addresses[1]: - self.errors.append("Newly added regular account address %s doesn't match expected %s" % ( + self.errors.append(wallet_1, "Newly added regular account address %s doesn't match expected %s" % ( regular_account_address, expected_addresses[1])) if regular_account_address not in expected_addresses: - self.errors.append("Newly added regular account address %s is not in the list of expected addresses %s" % ( - regular_account_address, expected_addresses)) + self.errors.append(wallet_1, + "Newly added regular account address %s is not in the list of expected addresses %s" % ( + regular_account_address, expected_addresses)) wallet_1.just_fyi("Device 1: add a new key pair account by importing recovery phrase") account_element.swipe_left_on_element() @@ -210,7 +219,7 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): ] for text in expected_texts_regular: if not wallet_1.default_key_pair_container.get_child_element_by_text_part(text).is_element_displayed(): - self.errors.append("Newly added regular account is not shown in default key pair list") + self.errors.append(wallet_1, "Newly added regular account is not shown in default key pair list") break expected_texts_key_pair = [ imported_key_pair_account_name, imported_key_pair_name, @@ -218,7 +227,7 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): ] for text in expected_texts_key_pair: if not wallet_1.added_key_pair_container.get_child_element_by_text_part(text).is_element_displayed(): - self.errors.append("Newly added regular account is not shown in default key pair list") + self.errors.append(wallet_1, "Newly added regular account is not shown in default key pair list") break wallet_1.just_fyi("Device 1: add a new key pair account by generating a new key pair") @@ -232,27 +241,30 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): expected_addresses = generate_wallet_address(passphrase=generated_passphrase, number=4) if generated_key_pair_account_address != expected_addresses[0]: - self.errors.append("Generated key pair account address %s doesn't match expected %s" % ( + self.errors.append(wallet_1, "Generated key pair account address %s doesn't match expected %s" % ( generated_key_pair_account_address, expected_addresses[0])) if generated_key_pair_account_address not in expected_addresses: - self.errors.append("Generated key pair account address %s is not in the list of expected addresses %s" % ( - generated_key_pair_account_address, expected_addresses)) + self.errors.append(wallet_1, + "Generated key pair account address %s is not in the list of expected addresses %s" % ( + generated_key_pair_account_address, expected_addresses)) self.home_2.just_fyi("Device 2: check imported accounts are shown before importing key pair") self.home_2.profile_button.click() self.profile_2.profile_wallet_button.click() self.profile_2.key_pairs_and_accounts_button.click() if not self.profile_2.get_missing_key_pair_by_name(key_pair_name=imported_key_pair_name).is_element_displayed(): - self.errors.append("New imported key pair is not shown in profile as missing before importing") + self.errors.append(self.profile_2, + "New imported key pair is not shown in profile as missing before importing") if not self.profile_2.get_missing_key_pair_by_name( key_pair_name=generated_key_pair_name).is_element_displayed(): - self.errors.append("Generated key pair is not shown in profile as missing before importing") + self.errors.append(self.profile_2, "Generated key pair is not shown in profile as missing before importing") if not self.profile_2.get_key_pair_account_by_name(account_name=regular_account_name).is_element_displayed(): self.errors.append( + self.profile_2, "Newly added regular account is not shown in profile as on device before importing key pair") self.profile_2.options_button.click() if not self.profile_2.import_by_entering_recovery_phrase_button.is_element_displayed(): - self.errors.append("Can not import key pair account from profile") + self.errors.append(self.profile_2, "Can not import key pair account from profile") self.profile_2.click_system_back_button(times=4) wallet_2.just_fyi("Device 2: import key pair") @@ -270,9 +282,11 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): address_text = self.profile_2.get_key_pair_account_by_name(account_name=regular_account_name).address.text if address_text != '...'.join((regular_account_address[:5], regular_account_address[-3:])): self.errors.append( + self.profile_2, "Incorrect wallet address if shown for regular account after importing: " + address_text) else: - self.errors.append("Newly added regular account is not shown in profile after importing key pair") + self.errors.append(self.profile_2, + "Newly added regular account is not shown in profile after importing key pair") account_element = self.profile_2.get_key_pair_account_by_name( account_name=imported_key_pair_account_name) @@ -281,14 +295,17 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): if address_text != '...'.join( (imported_key_pair_account_address[:5], imported_key_pair_account_address[-3:])): self.errors.append( + self.profile_2, "Incorrect wallet address if shown for imported key pair account after importing: " + address_text) else: self.errors.append( + self.profile_2, "Imported key pair account is not shown in profile as on device after importing key pair") if not self.profile_2.get_missing_key_pair_by_name( key_pair_name=generated_key_pair_name).is_element_displayed(): self.errors.append( + self.profile_2, "Generated key pair account is not shown in profile as missing after importing the first key pair") self.profile_2.click_system_back_button(times=3) @@ -306,14 +323,15 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): wallet_2.about_tab.click() der_path = wallet_2.account_about_derivation_path_text.text if der_path != regular_derivation_path: - self.errors.append("Incorrect derivation path %s is shown for the regular account" % der_path) + self.errors.append(wallet_2, "Incorrect derivation path %s is shown for the regular account" % der_path) wallet_2.close_account_button.click_until_presence_of_element(account_element) account_element.swipe_left_on_element() wallet_2.get_account_element(account_name=imported_key_pair_account_name).click() wallet_2.about_tab.click() der_path = wallet_2.account_about_derivation_path_text.text if der_path != imported_key_pair_derivation_path: - self.errors.append("Incorrect derivation path %s is shown for the imported key pair account" % der_path) + self.errors.append(wallet_2, + "Incorrect derivation path %s is shown for the imported key pair account" % der_path) wallet_2.close_account_button.click_until_presence_of_element(account_element) account_element.swipe_left_on_element() wallet_2.get_account_element(account_name=generated_key_pair_account_name).click() @@ -324,7 +342,8 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): wallet_2.about_tab.click() der_path = wallet_2.account_about_derivation_path_text.text if der_path != generated_key_pair_derivation_path: - self.errors.append("Incorrect derivation path %s is shown for the generated key pair account" % der_path) + self.errors.append(wallet_2, + "Incorrect derivation path %s is shown for the generated key pair account" % der_path) if not wallet_2.element_by_text_part(generated_key_pair_account_address).is_element_displayed(): self.errors.append( "Generated key pair address %s is absent in About tab" % generated_key_pair_account_address) @@ -345,14 +364,14 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): self.sign_in_2.passphrase_edit_box.send_keys(' '.join(['asset'] * 12)) self.sign_in_2.continue_button.click() if not self.sign_in_2.element_by_translation_id('seed-phrase-invalid').is_element_displayed(): - self.errors.append("Error message is not displayed for invalid recovery phrase") + self.errors.append(self.sign_in_2, "Error message is not displayed for invalid recovery phrase") self.sign_in_2.just_fyi("Device 2: try creating an account with another valid passphrase") self.sign_in_2.passphrase_edit_box.clear() self.sign_in_2.passphrase_edit_box.send_keys(transaction_senders['A']['passphrase']) self.sign_in_2.continue_button.click() if not self.sign_in_2.password_input.is_element_displayed(): - self.errors.append("Can't recover an access with a valid passphrase") + self.errors.append(self.sign_in_2, "Can't recover an access with a valid passphrase") self.sign_in_2.click_system_back_button(times=2) self.sign_in_2.just_fyi("Device 2: try recovering an account which is already synced") @@ -363,9 +382,10 @@ class TestFallbackMultipleDevice(MultipleSharedDeviceTestCase): self.sign_in_2.native_alert_title.wait_for_element() shown_text = self.sign_in_2.native_alert_title.text if shown_text != "Keys for this account already exist": - self.errors.append("Incorrect error message '%s' is shown for already synced account" % shown_text) + self.errors.append(self.sign_in_2, + "Incorrect error message '%s' is shown for already synced account" % shown_text) self.sign_in_2.cancel_button.click() except TimeoutException: - self.errors.append("Error is not shown for already synced account") + self.errors.append(self.sign_in_2, "Error is not shown for already synced account") self.errors.verify_no_errors() diff --git a/test/appium/tests/critical/test_wallet.py b/test/appium/tests/critical/test_wallet.py index 9c4c5c8293..128575f3fb 100644 --- a/test/appium/tests/critical/test_wallet.py +++ b/test/appium/tests/critical/test_wallet.py @@ -3,7 +3,7 @@ import time import pytest from _pytest.outcomes import Failed -from selenium.common import TimeoutException, NoSuchElementException +from selenium.common import NoSuchElementException from base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers from support.api.network_api import NetworkApi @@ -75,8 +75,9 @@ class TestWalletMultipleDevice(MultipleSharedDeviceTestCase): return if user_name == self.receiver_username and new_eth_amount >= exp_amount: return - self.errors.append( - "Eth amount in the %s's wallet is %s but should be %s" % (user_name, new_eth_amount, exp_amount)) + self.errors.append(wallet_view, + "Eth amount in the %s's wallet is %s but should be %s" % ( + user_name, new_eth_amount, exp_amount)) # ToDo: disable relogin when autoupdate feature is ready self.home_1.just_fyi("Relogin for getting an updated balance") @@ -119,10 +120,12 @@ class TestWalletMultipleDevice(MultipleSharedDeviceTestCase): activity_element.from_text == sender_address_short, activity_element.to_text == receiver_address_short)): self.errors.append( + wallet_view, "The last transaction is not listed in activity for the %s, expected timestamp is %s" % ('sender' if sender else 'receiver', expected_time)) except NoSuchElementException: - self.errors.append("Can't find the last transaction for the %s" % ('sender' if sender else 'receiver')) + self.errors.append(wallet_view, + "Can't find the last transaction for the %s" % ('sender' if sender else 'receiver')) finally: wallet_view.close_account_button.click_until_presence_of_element(wallet_view.show_qr_code_button) @@ -237,7 +240,7 @@ class TestWalletOneDevice(MultipleSharedDeviceTestCase): for asset in self.total_balance: if real_balance[asset] != self.total_balance[asset]: - self.errors.append("For the %s the wrong value %s is shown, expected %s in total" % + self.errors.append(self.wallet_view, "For the %s the wrong value %s is shown, expected %s in total" % (asset, real_balance[asset], self.total_balance[asset])) expected_balances = { 'Mainnet': self.mainnet_balance, @@ -253,7 +256,7 @@ class TestWalletOneDevice(MultipleSharedDeviceTestCase): real_balance[asset] = self.wallet_view.get_asset(asset).get_amount() for asset in expected_balances[network]: if real_balance[asset] != expected_balances[network][asset]: - self.errors.append("For the %s the wrong value %s is shown, expected %s on %s" % + self.errors.append(self.wallet_view, "For the %s the wrong value %s is shown, expected %s on %s" % (asset, real_balance[asset], expected_balances[network][asset], network)) self.wallet_view.set_network_in_wallet(network) @@ -274,16 +277,17 @@ class TestWalletOneDevice(MultipleSharedDeviceTestCase): self.home_view.show_qr_code_button.click() self.home_view.share_wallet_tab_button.click() if self.home_view.account_name_text.text != 'Account 1': - self.errors.append("Incorrect first account is shown on Share QR Code menu") + self.errors.append(self.home_view, "Incorrect first account is shown on Share QR Code menu") self.home_view.qr_code_image_element.swipe_left_on_element() try: self.home_view.account_name_text.wait_for_element_text(text=new_account_name, wait_time=3) except Failed: - self.errors.append("Can't swipe between accounts, newly added account is not shown") + self.errors.append(self.home_view, "Can't swipe between accounts, newly added account is not shown") else: shown_address = self.home_view.copy_wallet_address() if set(shown_address.split(':')) != set(new_wallet_address.split(':')): self.errors.append( + self.home_view, "Incorrect address '%s' is shown when swiping between accounts, expected one is '%s'" % ( shown_address, new_wallet_address)) self.home_view.click_system_back_button() @@ -292,9 +296,9 @@ class TestWalletOneDevice(MultipleSharedDeviceTestCase): if self.wallet_view.get_account_element(account_name=new_account_name).is_element_displayed(): self.wallet_view.remove_account(account_name=new_account_name) if self.wallet_view.get_account_element(account_name=new_account_name).is_element_displayed(): - self.errors.append("Account was not removed from wallet") + self.errors.append(self.wallet_view, "Account was not removed from wallet") else: - self.errors.append("Newly added account is not shown in the accounts list") + self.errors.append(self.wallet_view, "Newly added account is not shown in the accounts list") self.errors.verify_no_errors() @@ -316,12 +320,12 @@ class TestWalletOneDevice(MultipleSharedDeviceTestCase): self.home_view.show_qr_code_button.click() self.home_view.share_wallet_tab_button.click() if self.home_view.account_name_text.text != 'Account 1': - self.errors.append("Incorrect first account is shown on Share QR Code menu") + self.errors.append(self.home_view, "Incorrect first account is shown on Share QR Code menu") self.home_view.qr_code_image_element.swipe_left_on_element() try: self.home_view.account_name_text.wait_for_element_text(text=new_account_name, wait_time=3) except Failed: - self.errors.append("Can't swipe between accounts, account to watch is not shown") + self.errors.append(self.home_view, "Can't swipe between accounts, account to watch is not shown") else: shown_address = self.home_view.copy_wallet_address() if set(shown_address.split(':')) != {'eth', 'arb1', 'oeth', address_to_watch}: @@ -334,8 +338,8 @@ class TestWalletOneDevice(MultipleSharedDeviceTestCase): if self.wallet_view.get_account_element(account_name=new_account_name).is_element_displayed(): self.wallet_view.remove_account(account_name=new_account_name, watch_only=True) if self.wallet_view.get_account_element(account_name=new_account_name).is_element_displayed(): - self.errors.append("Account was not removed from wallet") + self.errors.append(self.wallet_view, "Account was not removed from wallet") else: - self.errors.append("Watch only account is not shown in the accounts list") + self.errors.append(self.wallet_view, "Watch only account is not shown in the accounts list") self.errors.verify_no_errors() diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index 11d319b654..2c8d2f146a 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -377,7 +377,7 @@ class HomeView(BaseView): if self.toast_content_element.is_element_displayed(10): self.toast_content_element.wait_for_invisibility_of_element() try: - self.notifications_unread_badge.wait_for_visibility_of_element(60) + self.notifications_unread_badge.wait_for_visibility_of_element(120) except TimeoutException: pass self.open_activity_center_button.click_until_presence_of_element(self.close_activity_centre)