From c3e599721f4d9e7160469c0cd0d64e3bb51d41c8 Mon Sep 17 00:00:00 2001 From: diana Date: Mon, 16 May 2022 11:07:23 +0200 Subject: [PATCH] e2e: medium activity center --- test/appium/support/testrail_report.py | 1 + .../tests/medium/test_activity_center.py | 190 +++++++++++++++ .../tests/medium/test_multiple_devices.py | 230 ------------------ 3 files changed, 191 insertions(+), 230 deletions(-) create mode 100644 test/appium/tests/medium/test_activity_center.py diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index 9c9d371fa2..efe28acc29 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -128,6 +128,7 @@ class TestrailReport(BaseTestReport): test_cases['nightly']['chat_2'] = 50838 test_cases['nightly']['group_chat'] = 50839 test_cases['nightly']['pairing'] = 50840 + test_cases['nightly']['activity_center'] = 50833 ## Upgrade e2e test_cases['upgrade']['general'] = 881 diff --git a/test/appium/tests/medium/test_activity_center.py b/test/appium/tests/medium/test_activity_center.py new file mode 100644 index 0000000000..afa8b8422e --- /dev/null +++ b/test/appium/tests/medium/test_activity_center.py @@ -0,0 +1,190 @@ +import pytest + +from tests import marks +from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers +from views.sign_in_view import SignInView + + +@pytest.mark.xdist_group(name="activity_center_medium_2") +@marks.medium +class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase): + + @classmethod + def setup_class(cls): + cls.drivers, cls.loop = create_shared_drivers(2) + cls.device_1, cls.device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1]) + cls.home_1, cls.home_2 = cls.device_1.create_user(), cls.device_2.create_user() + cls.public_key_user_1, cls.username_1 = cls.home_1.get_public_key_and_username(return_username=True) + cls.public_key_user_2, cls.username_2 = cls.home_2.get_public_key_and_username(return_username=True) + [cls.group_chat_name_1, cls.group_chat_name_2, cls.group_chat_name_3, cls.group_chat_name_4, \ + cls.group_chat_name_5] = "GroupChat1", "GroupChat2", "GroupChat3", "GroupChat4", "GroupChat5" + + cls.message_from_sender = "Message sender" + cls.home_2.home_button.double_click() + cls.device_2_one_to_one_chat = cls.home_2.add_contact(cls.public_key_user_1) + + @marks.testrail_id(702183) + def test_activity_center_reject_chats(self): + self.device_2.just_fyi('Device2 sends a message in 1-1 chat to Device1') + self.device_2_one_to_one_chat.send_message(self.message_from_sender) + + [home.home_button.double_click() for home in [self.home_1, self.home_2]] + + self.device_2.just_fyi('Device2 creates Group chat 1 with Device1') + self.home_2.create_group_chat([self.username_1], group_chat_name=self.group_chat_name_1) + self.home_2.home_button.double_click() + self.home_1.home_button.double_click() + + self.device_1.just_fyi('Device1 rejects both chats and verifies they disappeared and not in Chats too') + self.home_1.notifications_unread_badge.wait_and_click(20) + self.home_1.notifications_select_button.click() + self.home_1.element_by_text_part(self.username_2[:10]).click() + self.home_1.element_by_text_part(self.group_chat_name_1).click() + self.home_1.notifications_reject_and_delete_button.click() + if self.home_1.element_by_text_part(self.username_2[:20]).is_element_displayed(2): + self.errors.append("1-1 chat is on Activity Center view after action made on it") + if self.home_1.element_by_text_part(self.group_chat_name_1).is_element_displayed(2): + self.errors.append("Group chat is on Activity Center view after action made on it") + self.home_1.home_button.double_click() + if self.home_1.element_by_text_part(self.username_2[:20]).is_element_displayed(2): + self.errors.append("1-1 chat is added on home after rejection") + if self.home_1.element_by_text_part(self.group_chat_name_1).is_element_displayed(2): + self.errors.append("Group chat is added on home after rejection") + + self.home_1.just_fyi("Verify there are still no chats after relogin") + self.home_1.reopen_app() + if self.home_1.element_by_text_part(self.username_2[:20]).is_element_displayed(2): + self.errors.append("1-1 chat appears on Chats view after relogin") + if self.home_1.element_by_text_part(self.group_chat_name_1).is_element_displayed(2): + self.errors.append("Group chat appears on Chats view after relogin") + self.home_1.notifications_button.click() + if self.home_1.element_by_text_part(self.username_2[:20]).is_element_displayed(2): + self.errors.append("1-1 chat request reappears back in Activity Center view after relogin") + if self.home_1.element_by_text_part(self.group_chat_name_1).is_element_displayed(2): + self.errors.append("Group chat request reappears back in Activity Center view after relogin") + + self.errors.verify_no_errors() + + @marks.testrail_id(702184) + def test_activity_center_accept_chats(self): + [home.home_button.double_click() for home in [self.home_1, self.home_2]] + + self.device_2.just_fyi('Device2 sends a message in 1-1 and creates Group chat 2') + self.home_2.get_chat_from_home_view(self.username_1).click() + self.device_2_one_to_one_chat.send_message(self.message_from_sender) + self.device_2_one_to_one_chat.home_button.double_click() + self.home_2.create_group_chat([self.username_1], group_chat_name=self.group_chat_name_2) + + self.device_1.just_fyi('Device1 accepts both chats (via Select All button) and verifies they disappeared ' + 'from activity center view but present on Chats view') + self.home_1.notifications_unread_badge.wait_and_click(20) + self.home_1.notifications_select_button.click() + self.home_1.notifications_select_all.click() + self.home_1.notifications_accept_and_add_button.click() + if self.home_1.element_by_text_part(self.username_2[:20]).is_element_displayed(2): + self.errors.append("1-1 chat request stays on Activity Center view after it was accepted") + if self.home_1.element_by_text_part(self.group_chat_name_2).is_element_displayed(2): + self.errors.append("Group chat request stays on Activity Center view after it was accepted") + self.home_1.home_button.double_click() + if not self.home_1.element_by_text_part(self.username_2[:20]).is_element_displayed(2): + self.errors.append("1-1 chat is not added on home after accepted from Activity Center") + if not self.home_1.element_by_text_part(self.group_chat_name_2).is_element_displayed(2): + self.errors.append("Group chat is not added on home after accepted from Activity Center") + + self.errors.verify_no_errors() + + @marks.testrail_id(702185) + def test_activity_center_notifications_on_mentions_in_groups_and_empty_state(self): + [home.home_button.double_click() for home in [self.home_1, self.home_2]] + + self.device_2.just_fyi('Device2 creates Group chat 3') + self.home_2.create_group_chat([self.username_1], group_chat_name=self.group_chat_name_3) + self.home_2.home_button.double_click() + + self.home_1.just_fyi("Device1 joins Group chat 3") + group_chat_1 = self.home_1.get_chat(self.group_chat_name_3).click() + group_chat_1.join_chat_button.click() + group_chat_1.home_button.double_click() + + self.home_2.just_fyi("Device2 mentions Device1 in Group chat 3") + chat_2 = self.home_2.get_chat_from_home_view(self.group_chat_name_3).click() + chat_2.select_mention_from_suggestion_list(self.username_1, self.username_1[:2]) + chat_2.send_as_keyevent("group") + group_chat_message = self.username_1 + " group" + chat_2.send_message_button.click() + + self.home_1.just_fyi("Device1 checks unread indicator on Activity center bell") + if not self.home_1.notifications_unread_badge.is_element_displayed(): + self.errors.append("Unread badge is NOT shown after receiving mentions from Group") + self.home_1.notifications_unread_badge.wait_and_click(30) + + self.home_1.just_fyi("Check that notification from group is presented in Activity Center") + if not self.home_1.get_chat_from_activity_center_view(self.username_2).chat_message_preview == group_chat_message: + self.errors.append("No mention in Activity Center for Group Chat") + + self.home_1.just_fyi("Open group chat where user mentioned") + self.home_1.get_chat_from_activity_center_view(self.username_2).click() + self.home_1.home_button.double_click() + + self.home_1.just_fyi("Check there are no unread messages counter on chats after message is read") + if (self.home_1.notifications_unread_badge.is_element_present() or + self.home_1.get_chat_from_home_view(self.group_chat_name_3).new_messages_counter.text == "1"): + self.errors.append("Unread message indicator is kept after message is read in chat") + + self.home_1.just_fyi("Check there is an empty view on Activity Center") + self.home_1.notifications_button.click() + if not self.home_1.element_by_translation_id('empty-activity-center').is_element_present(): + self.errors.append("Activity Center still has some chats after user opened all of them") + + self.errors.verify_no_errors() + + @marks.testrail_id(702187) + def test_activity_center_accept_chats_only_from_contacts(self): + [home.home_button.double_click() for home in [self.home_1, self.home_2]] + + if self.home_1.get_chat_from_home_view(self.username_2).is_element_displayed(): + self.home_1.delete_chat_long_press(self.username_2) + + self.device_1.just_fyi('Device1 sets permissions to accept chat requests only from trusted contacts') + profile_1 = self.home_1.profile_button.click() + profile_1.privacy_and_security_button.click() + profile_1.accept_new_chats_from.click() + profile_1.accept_new_chats_from_contacts_only.click() + profile_1.profile_button.click() + + self.device_1.just_fyi('Device2 creates 1-1 chat Group chats') + self.home_2.home_button.double_click() + self.home_2.get_chat(self.username_1).click() + self.device_2_one_to_one_chat.send_message(self.message_from_sender) + self.device_2_one_to_one_chat.home_button.double_click() + self.home_2.create_group_chat([self.username_1], group_chat_name=self.group_chat_name_4) + + self.device_1.just_fyi('Device1 check there are no any chats in Activity Center nor Chats view') + self.home_1.home_button.double_click() + if self.home_1.element_by_text_part(self.username_2).is_element_displayed() or self.home_1.element_by_text_part( + self.group_chat_name_4).is_element_displayed(): + self.errors.append("Chats are present on Chats view despite they created by non-contact") + self.home_1.notifications_button.click() + if self.home_1.element_by_text_part(self.username_2).is_element_displayed() or self.home_1.element_by_text_part( + self.group_chat_name_4).is_element_displayed(): + self.errors.append("Chats are present in Activity Center view despite they created by non-contact") + + self.device_1.just_fyi('Device1 adds Device2 in Contacts so chat requests should be visible now') + self.home_1.home_button.double_click() + self.home_1.add_contact(self.public_key_user_2) + + self.device_1.just_fyi('Device2 creates 1-1 chat Group chats once again') + self.home_2.home_button.double_click() + self.home_2.get_chat_from_home_view(self.username_1).click() + self.device_2_one_to_one_chat.send_message(self.message_from_sender) + self.device_2_one_to_one_chat.home_button.double_click() + self.home_2.create_group_chat([self.username_1], group_chat_name=self.group_chat_name_5) + + self.device_1.just_fyi('Device1 verifies 1-1 chat Group chats are visible') + self.home_1.home_button.double_click() + if not self.home_1.element_by_text_part( + self.username_2).is_element_displayed() or not self.home_1.element_by_text_part( + self.group_chat_name_5).is_element_displayed(): + self.errors.append("Chats are not present on Chats view while they have to!") + + self.errors.verify_no_errors() \ No newline at end of file diff --git a/test/appium/tests/medium/test_multiple_devices.py b/test/appium/tests/medium/test_multiple_devices.py index 5628950427..69464a06da 100644 --- a/test/appium/tests/medium/test_multiple_devices.py +++ b/test/appium/tests/medium/test_multiple_devices.py @@ -476,236 +476,6 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): self.errors.verify_no_errors() - @marks.testrail_id(695782) - # TODO: combine with other tests for activity centre - def test_activity_center_can_accept_or_reject_multiple_chats_from(self): - self.create_drivers(2) - device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - message_from_sender = "Message sender" - group_chat_name_1 = "GroupChat1" - group_chat_name_2 = "GroupChat2" - home_1, home_2 = device_1.create_user(), device_2.create_user() - - device_1.just_fyi('Device1 adds Devices and creates 1-1 and Group chat with it') - public_key_user_1, username_1 = home_1.get_public_key_and_username(return_username=True) - public_key_user_2, username_2 = home_2.get_public_key_and_username(return_username=True) - home_1.home_button.click() - device_1_one_to_one_chat = home_1.add_contact(public_key_user_2) - device_1_one_to_one_chat.send_message(message_from_sender) - device_1_one_to_one_chat.home_button.click() - - home_1.create_group_chat([username_2], group_chat_name=group_chat_name_1) - home_1.home_button.click() - home_2.home_button.click() - - device_1.just_fyi('Device2 rejects both chats and verifies they disappeared and not in Chats too') - home_2.notifications_button.click() - home_2.notifications_select_button.click() - home_2.element_by_text_part(username_1[:10]).click() - home_2.element_by_text_part(group_chat_name_1).click() - home_2.notifications_reject_and_delete_button.click() - - if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): - self.errors.append("1-1 chat is on Activity Center view after action made on it") - if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2): - self.errors.append("Group chat is on Activity Center view after action made on it") - home_2.home_button.click() - if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): - self.errors.append("1-1 chat is added on home after rejection") - if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2): - self.errors.append("Group chat is added on home after rejection") - - home_2.just_fyi("Verify there are still no chats after relogin") - home_2.relogin() - if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): - self.errors.append("1-1 chat appears on Chats view after relogin") - if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2): - self.errors.append("Group chat appears on Chats view after relogin") - home_2.notifications_button.click() - if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): - self.errors.append("1-1 chat request reappears back in Activity Center view after relogin") - if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2): - self.errors.append("Group chat request reappears back in Activity Center view after relogin") - home_2.home_button.click() - - device_1.just_fyi('Device1 creates 1-1 and Group chat again') - home_1.get_chat_from_home_view(username_2).click() - device_1_one_to_one_chat.send_message('Some text here') - device_1_one_to_one_chat.home_button.click() - home_1.create_group_chat([username_2], group_chat_name=group_chat_name_2) - - device_1.just_fyi('Device2 accepts both chats (via Select All button) and verifies they disappeared ' - 'from activity center view but present on Chats view') - home_2.notifications_button.click() - home_2.notifications_select_button.click() - home_2.notifications_select_all.click() - home_2.notifications_accept_and_add_button.click() - - if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): - self.errors.append("1-1 chat request stays on Activity Center view after it was accepted") - if home_2.element_by_text_part(group_chat_name_2).is_element_displayed(2): - self.errors.append("Group chat request stays on Activity Center view after it was accepted") - home_2.home_button.click() - - if not home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): - self.errors.append("1-1 chat is not added on home after accepted from Activity Center") - if not home_2.element_by_text_part(group_chat_name_2).is_element_displayed(2): - self.errors.append("Group chat is not added on home after accepted from Activity Center") - - self.errors.verify_no_errors() - - @marks.testrail_id(695845) - def test_activity_center_notification_in_for_mention_in_community_and_group_chat(self): - self.create_drivers(2) - home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user() - community_name, gr_chat_name, channel_name = "some name", home_1.get_random_chat_name(), "first_channel" - community_description = "something in community" - message, message_member = "message", "from member" - userkey_2, username_2 = home_2.get_public_key_and_username(return_username=True) - userkey_1, username_1 = home_1.get_public_key_and_username(return_username=True) - home_1.home_button.click() - one_to_one_1 = home_1.add_contact(userkey_2) - one_to_one_1.home_button.click() - home_2.home_button.click() - home_1.just_fyi("Create community on Device_1") - - community_1 = home_1.create_community(community_name, community_description, set_image=True) - channel_1 = community_1.add_channel(channel_name) - channel_1.send_message(message) - home_1.home_button.double_click() - - home_1.just_fyi("Joining Group chat, receiving community link in there") - one_to_one_2 = home_2.add_contact(userkey_1) - one_to_one_2.home_button.click() - community_1 = home_1.get_chat(community_name, community=True).click() - community_link_text = community_1.copy_community_link() - pub_1 = home_1.create_group_chat(user_names_to_add=[username_2], group_chat_name=gr_chat_name) - - pub_2 = home_2.get_chat(gr_chat_name).click() - pub_2.join_chat_button.click() - pub_1.chat_message_input.paste_text_from_clipboard() - pub_1.send_message_button.click() - pub_1.get_back_to_home_view() - - home_2.just_fyi("Tapping on community link and request membership") - pub_2.element_by_text(community_name).wait_for_element(60) - community_message_2 = pub_2.get_community_link_preview_by_text(community_link_text) - community_2 = community_message_2.view() - community_2.request_access_button.click() - if not community_2.membership_request_pending_text.is_element_displayed(): - self.errors.append("Membership request is not pending") - - home_1.just_fyi("Checking pending membership") - community_1 = home_1.get_chat(community_name, community=True).click() - community_1.community_options_button.click() - community_1.community_info_button.click() - community_1.community_membership_request_value.wait_for_element(60) - - home_1.just_fyi("Approve membership") - community_1.handle_membership_request(username_2, approve=True) - channel_2 = community_2.get_chat(channel_name).click() - channel_2.select_mention_from_suggestion_list(username_1, username_1[:2]) - channel_2.send_as_keyevent("community") - channel_mesage = username_1 + " community" - channel_2.send_message_button.click() - community_1.home_button.double_click() - channel_2.home_button.click() - home_2.get_chat_from_home_view(gr_chat_name).click() - pub_2.select_mention_from_suggestion_list(username_1, username_1[:2]) - pub_2.send_as_keyevent("group") - group_chat_message = username_1 + " group" - pub_2.send_message_button.click() - - if not home_1.notifications_unread_badge.is_element_displayed(): - self.errors.append("Unread badge is NOT shown after receiving mentions from Group and Community") - home_1.notifications_unread_badge.wait_and_click(30) - - home_1.just_fyi("Check there are two notifications from two chats are present in Activity Center") - if home_1.get_chat_from_activity_center_view(username_2).chat_message_preview == group_chat_message: - home_1.just_fyi("Open group chat where user mentioned and return to Activity Center") - home_1.get_chat_from_activity_center_view(username_2).click() - home_1.home_button.click() - home_1.notifications_button.click() - else: - self.errors.append("No mention in Activity Center for Group Chat") - - if home_1.get_chat_from_activity_center_view(username_2).chat_message_preview == channel_mesage: - home_1.just_fyi("Open community chat where user mentioned and return to Activity Center") - home_1.get_chat_from_activity_center_view(username_2).click() - home_1.home_button.click() - else: - self.errors.append("No mention in Activity Center for community chat") - - home_1.just_fyi("Check there are no unread messages counters on chats after message read") - if (home_1.notifications_unread_badge.is_element_present() or - home_1.get_chat_from_home_view(gr_chat_name).new_messages_counter.text == "1" or - home_1.get_chat_from_home_view(community_name).new_messages_counter.text == "1"): - self.errors.append("Unread message indicator is kept after all messages read in chats") - - home_1.just_fyi("Check there is an empty view on Activity Center") - home_1.notifications_button.click() - if not home_1.element_by_translation_id('empty-activity-center').is_element_present(): - self.errors.append("It appears Activity Center still has some chats after user opened all of them") - - self.errors.verify_no_errors() - - @marks.testrail_id(695771) - # TODO: combine with other tests for activity centre - def test_activity_center_profile_accept_new_group_from_trusted_contacts(self): - self.create_drivers(2) - device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - message_from_sender = "Message sender" - group_chat_name_1 = "GroupChat1" - group_chat_name_2 = "GroupChat2" - home_1, home_2 = device_1.create_user(), device_2.create_user() - - device_1.just_fyi('Device1 sets permissions to accept chat requests only from trusted contacts') - profile_1 = home_1.profile_button.click() - profile_1.privacy_and_security_button.click() - profile_1.accept_new_chats_from.click() - profile_1.accept_new_chats_from_contacts_only.click() - profile_1.profile_button.click() - public_key_user_1, username_1 = profile_1.get_public_key_and_username(return_username=True) - public_key_user_2, username_2 = home_2.get_public_key_and_username(return_username=True) - - device_1.just_fyi('Device2 creates 1-1 chat Group chats') - home_2.home_button.click() - one_to_one_device_2 = home_2.add_contact(public_key_user_1) - one_to_one_device_2.send_message(message_from_sender) - one_to_one_device_2.home_button.click() - home_2.create_group_chat([username_1], group_chat_name=group_chat_name_1) - - device_1.just_fyi('Device1 check there are no any chats in Activity Center nor Chats view') - - home_1.home_button.click() - if home_1.element_by_text_part(username_2).is_element_displayed() or home_1.element_by_text_part( - group_chat_name_1).is_element_displayed(): - self.errors.append("Chats are present on Chats view despite they created by non-contact") - home_1.notifications_button.click() - if home_1.element_by_text_part(username_2).is_element_displayed() or home_1.element_by_text_part( - group_chat_name_1).is_element_displayed(): - self.errors.append("Chats are present in Activity Center view despite they created by non-contact") - - device_1.just_fyi('Device1 adds Device2 in Contacts so chat requests should be visible now') - home_1.home_button.click() - home_1.add_contact(public_key_user_2) - - device_1.just_fyi('Device2 creates 1-1 chat Group chats once again') - home_2.home_button.click() - home_2.get_chat_from_home_view(username_1).click() - one_to_one_device_2.send_message(message_from_sender) - one_to_one_device_2.home_button.click() - home_2.create_group_chat([username_1], group_chat_name=group_chat_name_2) - - device_1.just_fyi('Device1 verifies 1-1 chat Group chats are visible') - - home_1.home_button.click() - if not home_1.element_by_text_part(username_2).is_element_displayed() or not home_1.element_by_text_part( - group_chat_name_2).is_element_displayed(): - self.errors.append("Chats are not present on Chats view while they have to!") - - self.errors.verify_no_errors() - @marks.testrail_id(6294) # TODO: may be merged with 6295 to group and add more tx tests def test_keycard_1_1_chat_command_request_and_send_tx_stt_in_1_1_chat_offline_opened_from_push(self):