diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index 71210873e7..842c8f237f 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -22,7 +22,7 @@ class TestrailReport(BaseTestReport): self.user = environ.get('TESTRAIL_USER') self.run_id = None - #self.suite_id = 48 + # self.suite_id = 48 self.suite_id = 5274 self.project_id = 14 @@ -124,6 +124,7 @@ class TestrailReport(BaseTestReport): test_cases['pr']['critical'] = 50955 test_cases['pr']['one_to_one_chat'] = 50956 test_cases['pr']['deep_links'] = 50967 + test_cases['pr']['group_chat'] = 50964 ## Nightly e2e # test_cases['nightly']['medium'] = 736 @@ -145,8 +146,6 @@ class TestrailReport(BaseTestReport): # test_cases['nightly']['keycard'] = 50850 # test_cases['nightly']['wallet'] = 50851 - test_cases['nightly']['group_chat'] = 50964 - ## Upgrade e2e # test_cases['upgrade']['general'] = 881 diff --git a/test/appium/tests/critical/chats/test_group_chat.py b/test/appium/tests/critical/chats/test_group_chat.py index 0a75958b36..2d01f191a4 100644 --- a/test/appium/tests/critical/chats/test_group_chat.py +++ b/test/appium/tests/critical/chats/test_group_chat.py @@ -1,8 +1,9 @@ import pytest -from tests import marks + +from tests import marks, run_in_parallel from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers -from views.sign_in_view import SignInView from views.chat_view import ChatView +from views.sign_in_view import SignInView @pytest.mark.xdist_group(name="one_3") @@ -197,3 +198,112 @@ class TestGroupChatMultipleDeviceMerged(MultipleSharedDeviceTestCase): self.homes[0].relogin() if self.homes[0].get_chat_from_home_view(self.chat_name).is_element_displayed(): self.drivers[0].fail('Deleted %s is present after relaunch app' % self.chat_name) + + +@pytest.mark.xdist_group(name="three_2") +@marks.new_ui_critical +class TestGroupChatMediumMultipleDeviceNewUI(MultipleSharedDeviceTestCase): + + def prepare_devices(self): + self.drivers, self.loop = create_shared_drivers(2) + self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) + self.loop.run_until_complete(run_in_parallel(((self.device_1.create_user,), (self.device_2.create_user,)))) + self.home_1, self.home_2 = self.device_1.get_home_view(), self.device_2.get_home_view() + self.home_1.browser_tab.click() # temp, until profile is on browser tab + self.profile_1 = self.home_1.get_profile_view() + self.default_username_1 = self.profile_1.default_username_text.text + self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True) + self.profile_1.add_contact_via_contacts_list(self.public_key_2) + self.home_2.click_system_back_button_until_element_is_shown() + self.home_1.click_system_back_button_until_element_is_shown() + self.home_1.chats_tab.click() + self.home_2.chats_tab.click() + self.home_2.handle_contact_request(self.default_username_1) + self.home_2.click_system_back_button_until_element_is_shown() + self.group_chat_name = "Group Chat" + self.group_chat_1 = self.home_1.create_group_chat(user_names_to_add=[self.default_username_2], + group_chat_name=self.group_chat_name, + new_ui=True) + self.group_chat_2 = self.home_2.get_chat(self.group_chat_name).click() + self.group_chat_2.join_chat_button.click_if_shown() + self.message_1, self.message_2, self.message_3, self.message_4 = \ + "Message 1", "Message 2", "Message 3", "Message 4" + + @marks.testrail_id(702732) + def test_group_chat_pin_messages(self): + self.home_1.just_fyi("Enter group chat and pin message there. It's pinned for both members.") + + self.group_chat_1.send_message(self.message_1) + self.group_chat_1.pin_message(self.message_1, "pin-to-chat") + if not (self.group_chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed(30) and + self.group_chat_2.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!") + + self.home_1.just_fyi("Check that non admin user can not unpin messages") + self.group_chat_2.chat_element_by_text(self.message_1).long_press_element() + if self.group_chat_2.element_by_translation_id("unpin-from-chat").is_element_displayed(): + self.errors.append("Unpin option is available for non-admin user") + self.group_chat_2.click_system_back_button() + + # not implemented yet : + + # self.home_1.just_fyi("Grant another user with admin rights and check he can unpin message now") + # self.group_chat_1.chat_options.click() + # group_info = self.group_chat_1.group_info.click() + # options = group_info.get_username_options(self.default_username_2).click() + # options.make_admin_button.click() + # self.group_chat_2.click_system_back_button() + # self.group_chat_2.pin_message(self.message_1, action="unpin") + # if (self.group_chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed() and + # self.group_chat_2.chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed()): + # self.errors.append("Message failed to be unpinned by user who granted admin permissions!") + + self.home_1.just_fyi("Send, pin messages and check they are pinned") + for message in self.message_2, self.message_3: + # here group_chat_1 should be changed to group_chat_2 after enabling the previous block + self.group_chat_1.send_message(message) + self.group_chat_1.pin_message(message, 'pin-to-chat') + if not (self.group_chat_1.chat_element_by_text(message).pinned_by_label.is_element_displayed(30) and + self.group_chat_2.chat_element_by_text(message).pinned_by_label.is_element_displayed(30)): + self.errors.append("%s is not pinned in group chat!" % message) + + self.home_1.just_fyi("Check that a user can not pin more than 3 messages") + self.group_chat_1.send_message(self.message_4) + self.group_chat_1.pin_message(self.message_4, 'pin-to-chat') + if self.group_chat_1.pin_limit_popover.is_element_displayed(30): + self.group_chat_1.view_pinned_messages_button.click_until_presence_of_element( + self.group_chat_1.pinned_messages_list) + self.group_chat_1.pinned_messages_list.message_element_by_text( + self.message_2).click_inside_element_by_coordinate() + self.group_chat_1.element_by_translation_id('unpin-from-chat').double_click() + self.group_chat_1.chat_element_by_text(self.message_4).click() + self.group_chat_1.pin_message(self.message_4, 'pin-to-chat') + if not (self.group_chat_1.chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30) and + self.group_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 group chat after unpinning previous one") + else: + self.errors.append("Can pin more than 3 messages in group chat") + + self.home_1.just_fyi("Check pinned messages count and content") + for chat_number, group_chat in enumerate([self.group_chat_1, self.group_chat_2]): + count = group_chat.pinned_messages_count.text + if count != '3': + self.errors.append( + "Pinned messages count %s doesn't match expected 3 for user %s" % (count, chat_number + 1)) + group_chat.pinned_messages_count.click() + for message in self.message_1, self.message_3, self.message_4: + pinned_by = group_chat.pinned_messages_list.get_message_pinned_by_text(message) + if pinned_by.is_element_displayed(): + text = pinned_by.text.strip() + expected_text = "You" if chat_number == 0 else self.default_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) + ) + else: + self.errors.append( + "Message '%s' is missed on Pinned messages list for user %s" % (message, chat_number + 1) + ) + + self.errors.verify_no_errors() diff --git a/test/appium/tests/medium/test_chats_m.py b/test/appium/tests/medium/test_chats_m.py index 41821625dc..26d48a8a41 100644 --- a/test/appium/tests/medium/test_chats_m.py +++ b/test/appium/tests/medium/test_chats_m.py @@ -1112,109 +1112,3 @@ class TestMutualContactRequests(MultipleSharedDeviceTestCase): chat_2.just_fyi('Verify cannot send messages to user whos request has been declined') if chat_2.chat_message_input.is_element_displayed(): self.drivers[1].fail('Chat input field is displayed in 1-1 chat with user whos cr was declined') - - -@pytest.mark.xdist_group(name="three_2") -@marks.new_ui_medium -class TestGroupChatMediumMultipleDeviceNewUI(MultipleSharedDeviceTestCase): - - def prepare_devices(self): - self.drivers, self.loop = create_shared_drivers(2) - self.device_1, self.device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - self.home_1 = self.device_1.create_user(enable_notifications=True) - self.home_2 = self.device_2.create_user(enable_notifications=True) - self.home_1.browser_tab.click() # temp, until profile is on browser tab - self.profile_1 = self.home_1.get_profile_view() - self.default_username_1 = self.profile_1.default_username_text.text - self.public_key_2, self.default_username_2 = self.home_2.get_public_key_and_username(return_username=True) - self.profile_1.add_contact_via_contacts_list(self.public_key_2) - self.home_2.click_system_back_button_until_element_is_shown() - self.home_1.click_system_back_button_until_element_is_shown() - self.home_1.chats_tab.click() - self.home_2.chats_tab.click() - self.home_2.handle_contact_request(self.default_username_1) - self.home_2.click_system_back_button_until_element_is_shown() - self.group_chat_name = "Group Chat" - self.group_chat_1 = self.home_1.create_group_chat(user_names_to_add=[self.default_username_2], - group_chat_name=self.group_chat_name, - new_ui=True) - self.group_chat_2 = self.home_2.get_chat(self.group_chat_name).click() - self.group_chat_2.join_chat_button.click_if_shown() - self.message_1, self.message_2, self.message_3, self.message_4 = \ - "Message 1", "Message 2", "Message 3", "Message 4" - - - @marks.testrail_id(702732) - def test_group_chat_pin_messages(self): - self.home_1.just_fyi("Enter group chat and pin message there. It's pinned for both members.") - - self.group_chat_1.send_message(self.message_1) - self.group_chat_1.pin_message(self.message_1, "pin-to-chat") - if not (self.group_chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed(30) and - self.group_chat_2.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!") - - self.home_1.just_fyi("Check that non admin user can not unpin messages") - self.group_chat_2.chat_element_by_text(self.message_1).long_press_element() - if self.group_chat_2.element_by_translation_id("unpin-from-chat").is_element_displayed(): - self.errors.append("Unpin option is available for non-admin user") - self.group_chat_2.click_system_back_button() - - # not implemented yet : - - # self.home_1.just_fyi("Grant another user with admin rights and check he can unpin message now") - # self.group_chat_1.chat_options.click() - # group_info = self.group_chat_1.group_info.click() - # options = group_info.get_username_options(self.default_username_2).click() - # options.make_admin_button.click() - # self.group_chat_2.click_system_back_button() - # self.group_chat_2.pin_message(self.message_1, action="unpin") - # if (self.group_chat_1.chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed() and - # self.group_chat_2.chat_element_by_text(self.message_1).pinned_by_label.is_element_displayed()): - # self.errors.append("Message failed to be unpinned by user who granted admin permissions!") - - for message in self.message_2, self.message_3: - # here group_chat_1 should be changed to group_chat_2 after enabling the previous block - self.group_chat_1.send_message(message) - self.group_chat_1.pin_message(message, 'pin-to-chat') - if not (self.group_chat_1.chat_element_by_text(message).pinned_by_label.is_element_displayed(30) and - self.group_chat_2.chat_element_by_text(message).pinned_by_label.is_element_displayed(30)): - self.errors.append("%s is not pinned in group chat!" % message) - - self.group_chat_1.send_message(self.message_4) - self.group_chat_1.pin_message(self.message_4, 'pin-to-chat') - if self.group_chat_1.pin_limit_popover.is_element_displayed(30): - self.group_chat_1.view_pinned_messages_button.click() - self.group_chat_1.pinned_messages_list.message_element_by_text( - self.message_2).click_inside_element_by_coordinate() - self.group_chat_1.element_by_translation_id('unpin-from-chat').click() - self.group_chat_1.chat_element_by_text(self.message_4).click() - self.group_chat_1.pin_message(self.message_4, 'pin-to-chat') - if not (self.group_chat_1.chat_element_by_text(self.message_4).pinned_by_label.is_element_displayed(30) and - self.group_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 group chat after unpinning previous one") - else: - self.errors.append("Can pin more than 3 messages in group chat") - - for chat_number, group_chat in enumerate([self.group_chat_1, self.group_chat_2]): - count = group_chat.pinned_messages_count.text - if count != '3': - self.errors.append( - "Pinned messages count %s doesn't match expected 3 for user %s" % (count, chat_number + 1)) - group_chat.pinned_messages_count.click() - for message in self.message_1, self.message_3, self.message_4: - pinned_by = group_chat.pinned_messages_list.get_message_pinned_by_text(message) - if pinned_by.is_element_displayed(): - text = pinned_by.text.strip() - expected_text = "You" if chat_number == 0 else self.default_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) - ) - else: - self.errors.append( - "Message '%s' is missed on Pinned messages list for user %s" % (message, chat_number + 1) - ) - - self.errors.verify_no_errors() diff --git a/test/appium/tests/medium/test_deeplink_chat_share_profile.py b/test/appium/tests/medium/test_deeplink_chat_share_profile.py index b8740c5624..a323f45c60 100644 --- a/test/appium/tests/medium/test_deeplink_chat_share_profile.py +++ b/test/appium/tests/medium/test_deeplink_chat_share_profile.py @@ -1,12 +1,11 @@ import pytest -from selenium.common.exceptions import NoSuchElementException +from selenium.common.exceptions import NoSuchElementException, TimeoutException from tests import marks, test_dapp_url from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase from tests.users import dummy_user, transaction_senders, basic_user, \ ens_user_message_sender, ens_user from views.sign_in_view import SignInView -from views.chat_view import ChatView @pytest.mark.xdist_group(name="two_1") @@ -377,9 +376,12 @@ class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase): deep_link = 'status-im://%s' % chat_name self.sign_in.open_weblink_and_login(deep_link) chat = self.sign_in.get_chat_view() - if not chat.user_name_text_new_UI.text == '#' + chat_name: - self.errors.append("Public chat '%s' is not opened" % chat_name) - self.errors.verify_no_errors() + # ToDo: change to the next line when accessibility id is added for user_name_text_new_UI + # if not chat.user_name_text_new_UI.text == '#' + chat_name: + try: + chat.element_by_text(text=" #" + chat_name, element_type="text").wait_for_visibility_of_element() + except TimeoutException: + self.drivers[0].fail("Public chat '%s' is not opened" % chat_name) @marks.testrail_id(702775) @marks.xfail(reason="Profile is often not opened in e2e builds for some reason. Needs to be investigated.") @@ -393,8 +395,7 @@ class TestDeeplinkOneDeviceNewUI(MultipleSharedDeviceTestCase): for text in ens_user['username'], self.sign_in.get_translation_by_key("add-to-contacts"): if not chat.element_by_text(text).scroll_to_element(10): - self.driver.fail("User profile screen is not opened") - self.errors.verify_no_errors() + self.drivers[0].fail("User profile screen is not opened") # @marks.testrail_id(702777) # @marks.skip(reason="Skipping until chat names are implemented in new UI")