diff --git a/test/appium/support/testrail_report.py b/test/appium/support/testrail_report.py index 3aa60b1df7..4f0736b4fb 100644 --- a/test/appium/support/testrail_report.py +++ b/test/appium/support/testrail_report.py @@ -129,6 +129,8 @@ class TestrailReport(BaseTestReport): test_cases['nightly']['group_chat'] = 50839 test_cases['nightly']['pairing'] = 50840 test_cases['nightly']['activity_center'] = 50833 + test_cases['nightly']['timeline'] = 50842 + test_cases['nightly']['community'] = 50841 ## Upgrade e2e test_cases['upgrade']['general'] = 881 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 56b9dde28f..124d203603 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 @@ -282,7 +282,7 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase): self.errors.verify_no_errors() @marks.testrail_id(5373) - def test_1_1_chat_emoji_and_link_send_and_open(self): + def test_1_1_chat_emoji_send_reply_and_open_link(self): self.home_1.just_fyi("Check that can send emoji in 1-1 chat") emoji_name = random.choice(list(emoji.EMOJI_UNICODE)) emoji_unicode = emoji.EMOJI_UNICODE[emoji_name] @@ -290,8 +290,35 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase): 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.chat_1.quote_message(emoji_unicode) + if self.chat_1.quote_username_in_message_input.text != "↪ You": + self.errors.append("'You' is not displayed in reply quote snippet replying to own message") + + 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 cancellation") + + self.chat_1.just_fyi("Send reply") + self.chat_1.quote_message(emoji_unicode) + reply_to_message_from_sender = "hey, reply" + self.chat_1.send_message(reply_to_message_from_sender) + + 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.home_1.just_fyi("Check that link can be opened and replied from 1-1 chat") + reply = 'reply to link' + url_message = 'Test with link: https://status.im/ here should be nothing unusual.' + self.chat_1.send_message(url_message) + self.chat_2.chat_element_by_text(url_message).wait_for_element(20) + self.chat_2.quote_message(url_message) + 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.home_1.just_fyi("Check that link can be opened from 1-1 chat") url_message = 'http://status.im' self.chat_1.send_message(url_message) self.chat_2.element_starts_with_text(url_message, 'button').click() @@ -410,16 +437,6 @@ class TestOneToOneChatMultipleSharedDevices(MultipleSharedDeviceTestCase): def test_1_1_chat_push_emoji(self): message_no_pn, message = 'No PN', 'Text push notification' - # TODO: Should be moved to group or test where no contact is added in prerequisites - # self.device_2.just_fyi("Device 2: check there is no PN when receiving new message to activity centre") - # self.device_2.put_app_to_background() - # if not self.chat_1.chat_message_input.is_element_displayed(): - # self.home_1.get_chat(username=self.default_username_2).click() - # self.chat_1.send_message(message_no_pn) - # self.device_2.open_notification_bar() - # if self.home_2.element_by_text(message_no_pn).is_element_displayed(): - # self.errors.append("Push notification with text was received for new message in activity centre") - # self.device_2.get_app_from_background() self.device_2.home_button.click() self.home_2.get_chat(self.default_username_1).click() self.home_2.profile_button.click() @@ -1086,6 +1103,7 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase): if pn: pn.click() else: + self.errors.append('No PN on mention in public chat! ') self.home_2.click_system_back_button(2) if self.home_2.element_starts_with_text(self.reciever['ens']).is_element_differs_from_template('mentioned.png', 2): self.errors.append('Mention is not highlighted!') diff --git a/test/appium/tests/medium/chats/test_chats.py b/test/appium/tests/medium/chats/test_chats.py index 9d6b7bb794..ef78c35363 100644 --- a/test/appium/tests/medium/chats/test_chats.py +++ b/test/appium/tests/medium/chats/test_chats.py @@ -5,29 +5,43 @@ import pytest from tests import marks from tests.users import ens_user -from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase +from tests.base_test_case import create_shared_drivers, MultipleSharedDeviceTestCase, MultipleDeviceTestCase from views.sign_in_view import SignInView +from views.chat_view import CommunityView +import pytest +from tests import marks +from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers +from views.sign_in_view import SignInView +import time +from tests import bootnode_address, mailserver_address, mailserver_ams, mailserver_hk, used_fleet, common_password +from tests.users import transaction_senders, basic_user, ens_user +from tests import marks +from tests.base_test_case import MultipleDeviceTestCase +from views.sign_in_view import SignInView @pytest.mark.xdist_group(name="two_2") @marks.medium -class TestPublicChatMultipleDeviceMergedMedium(MultipleSharedDeviceTestCase): +class TestTimelineHistoryNodesBootnodesMultipleDeviceMergedMedium(MultipleSharedDeviceTestCase): @classmethod def setup_class(cls): cls.drivers, cls.loop = create_shared_drivers(2) device_1, device_2 = SignInView(cls.drivers[0]), SignInView(cls.drivers[1]) cls.home_1, cls.home_2 = device_1.create_user(), device_2.create_user() - profile_1 = cls.home_1.profile_button.click() - cls.public_key_1, cls.username_1 = profile_1.get_public_key_and_username(return_username=True) - profile_1.home_button.click() + cls.profile_1, cls.profile_2 = cls.home_1.profile_button.click(), cls.home_2.profile_button.click() + cls.public_key_1, cls.username_1 = cls.profile_1.get_public_key_and_username(return_username=True) + cls.public_key_2, cls.username_2 = cls.profile_2.get_public_key_and_username(return_username=True) cls.text_message = 'hello' [home.home_button.click() for home in (cls.home_1, cls.home_2)] cls.public_chat_name = cls.home_1.get_random_chat_name() cls.chat_1, cls.chat_2 = cls.home_1.join_public_chat(cls.public_chat_name), cls.home_2.join_public_chat( cls.public_chat_name) cls.chat_1.send_message(cls.text_message) + [home.home_button.click() for home in (cls.home_1, cls.home_2)] + cls.home_1.add_contact(cls.public_key_2, add_in_contacts=False) + cls.home_2.add_contact(cls.public_key_1, add_in_contacts=False) - @marks.testrail_id(6342) + @marks.testrail_id(702284) def test_public_chat_timeline_different_statuses_reaction(self): emoji_message = random.choice(list(emoji.EMOJI_UNICODE)) emoji_unicode = emoji.EMOJI_UNICODE[emoji_message] @@ -61,7 +75,7 @@ class TestPublicChatMultipleDeviceMergedMedium(MultipleSharedDeviceTestCase): self.home_2.just_fyi('Check that can see user status without adding him as contact') self.home_2.home_button.click() - chat_2 = self.home_2.add_contact(self.public_key_1, add_in_contacts=False) + chat_2 = self.home_2.get_chat(self.username_1).click() chat_2.chat_options.click() timeline_2 = chat_2.view_profile_button.click() if not timeline_2.image_message_in_chat.is_element_displayed(40): @@ -133,6 +147,159 @@ class TestPublicChatMultipleDeviceMergedMedium(MultipleSharedDeviceTestCase): self.errors.verify_no_errors() + @marks.testrail_id(702285) + def test_profile_custom_bootnodes_enable_disable(self): + [home.home_button.double_click() for home in (self.home_1, self.home_2)] + self.home_1.profile_button.click() + self.profile_1.just_fyi('Add custom bootnode, enable bootnodes and check validation') + self.profile_1.advanced_button.click() + self.profile_1.bootnodes_button.click() + self.profile_1.add_bootnode_button.click() + self.profile_1.specify_name_input.set_value('test') + # TODO: blocked as validation is missing for bootnodes (rechecked 23.11.21, valid) + # profile_1.bootnode_address_input.set_value('invalid_bootnode_address') + # if not profile_1.element_by_text_part('Invalid format').is_element_displayed(): + # self.errors.append('Validation message about invalid format of bootnode is not shown') + # profile_1.save_button.click() + # if profile_1.add_bootnode_button.is_element_displayed(): + # self.errors.append('User was navigated to another screen when tapped on disabled "Save" button') + # profile_1.bootnode_address_input.clear() + self.profile_1.bootnode_address_input.set_value(bootnode_address) + self.profile_1.save_button.click() + self.profile_1.enable_bootnodes.click() + self.profile_1.home_button.double_click() + + self.profile_1.just_fyi('Add contact and send first message with enabled custom bootnodes') + chat_1 = self.home_1.get_chat(self.username_2).click() + message = 'test message' + chat_1.send_message(message) + chat_2 = self.home_2.get_chat(self.username_1).click() + chat_2.chat_element_by_text(message).wait_for_visibility_of_element() + + self.profile_1.just_fyi('Disable custom bootnodes') + chat_1.profile_button.double_click() + self.profile_1.advanced_button.click() + self.profile_1.bootnodes_button.click() + self.profile_1.enable_bootnodes.click() + self.profile_1.home_button.click() + + self.profile_1.just_fyi('Send message and check that it is received after disabling bootnodes') + self.home_1.get_chat(self.username_2).click() + message_1 = 'new message' + chat_1.send_message(message_1) + for chat in chat_1, chat_2: + if not chat.chat_element_by_text(message_1).is_element_displayed(): + self.errors.append('Message was not received after enabling bootnodes!') + self.errors.verify_no_errors() + + @marks.testrail_id(702286) + def test_profile_use_history_node_disable_enable(self): + [home.home_button.double_click() for home in (self.home_1, self.home_2)] + self.home_1.toggle_airplane_mode() + + self.home_2.just_fyi('send several messages to public channel') + message, message_no_history = 'message from offline', 'history node is disabled' + self.home_2.get_chat('#%s' % self.public_chat_name).click() + self.chat_2.send_message(message) + + self.profile_1.just_fyi( + 'disable use_history_node and check that no history is fetched but you can still send messages') + self.home_1.profile_button.click() + self.profile_1.sync_settings_button.click() + self.profile_1.mail_server_button.click() + self.profile_1.use_history_node_button.click() + self.home_1.toggle_airplane_mode() + self.profile_1.home_button.click() + self.home_1.get_chat('#%s' % self.public_chat_name).click() + if self.chat_1.chat_element_by_text(message).is_element_displayed(30): + self.errors.append('Chat history was fetched when use_history_node is disabled') + self.chat_1.send_message(message_no_history) + if not self.chat_2.chat_element_by_text(message_no_history).is_element_displayed(30): + self.errors.append('Message sent when use_history_node is disabled was not received') + self.home_1.reopen_app() + self.home_1.get_chat('#%s' % self.public_chat_name).click() + if self.chat_1.chat_element_by_text(message).is_element_displayed(30): + self.errors.append('History was fetched after relogin when use_history_node is disabled') + + self.home_1.just_fyi('enable use_history_node and check that history is fetched') + self.home_1.profile_button.click() + self.profile_1.sync_settings_button.click() + self.profile_1.mail_server_button.click() + self.profile_1.use_history_node_button.click() + self.profile_1.home_button.click(desired_view='chat') + if not self.chat_1.chat_element_by_text(message).is_element_displayed(60): + self.errors.append('History was not fetched after enabling use_history_node') + self.errors.verify_no_errors() + + @marks.testrail_id(702287) + def test_profile_can_not_connect_to_custom_history_node_add_delete(self): + self.home_1.profile_button.double_click() + self.home_2.home_button.double_click() + + self.profile_1.just_fyi('add non-working mailserver and connect to it') + self.profile_1.sync_settings_button.click() + self.profile_1.mail_server_button.click() + self.profile_1.mail_server_auto_selection_button.click() + self.profile_1.plus_button.click() + server_name = 'a_test' + self.profile_1.specify_name_input.set_value(server_name) + self.profile_1.mail_server_address_input.set_value('%s%s' % (mailserver_address[:-3], '553')) + self.profile_1.save_button.click() + self.profile_1.mail_server_by_name(server_name).click() + self.profile_1.mail_server_connect_button.wait_and_click() + self.profile_1.confirm_button.wait_and_click() + + self.profile_1.just_fyi('check that popup "Error connecting" will not reappear if tap on "Cancel"') + self.profile_1.element_by_translation_id('mailserver-error-title').wait_for_element(120) + self.profile_1.cancel_button.click() + + self.home_2.just_fyi('send several messages to public channel') + public_chat_name = self.home_2.get_random_chat_name() + message = 'test_message' + public_chat_2 = self.home_2.join_public_chat(public_chat_name) + public_chat_2.chat_message_input.send_keys(message) + public_chat_2.send_message_button.click() + public_chat_2.back_button.click() + + self.profile_1.just_fyi('join same public chat and try to reconnect via "Tap to reconnect" and check "Connecting"') + self.profile_1.home_button.double_click() + public_chat_1 = self.home_1.join_public_chat(public_chat_name) + public_chat_1.reopen_app() + + self.profile_1.just_fyi('check that still connected to custom mailserver after relogin') + self.home_1.profile_button.click() + self.profile_1.sync_settings_button.click() + if not self.profile_1.element_by_text(server_name).is_element_displayed(): + self.drivers[0].fail("Not connected to custom mailserver after re-login") + + self.profile_1.just_fyi('check that can RETRY to connect') + self.profile_1.element_by_translation_id('mailserver-error-title').wait_for_element(120) + public_chat_1.element_by_translation_id('mailserver-retry', uppercase=True).wait_and_click(60) + + self.profile_1.just_fyi('check that can pick another mailserver and receive messages') + self.profile_1.element_by_translation_id('mailserver-error-title').wait_for_element(120) + self.profile_1.element_by_translation_id('mailserver-pick-another', uppercase=True).wait_and_click(120) + mailserver = self.profile_1.return_mailserver_name(mailserver_ams, used_fleet) + self.profile_1.element_by_text(mailserver).click() + self.profile_1.confirm_button.click() + self.profile_1.home_button.click() + self.home_1.get_chat('#%s' % public_chat_name).click() + if not public_chat_1.chat_element_by_text(message).is_element_displayed(60): + self.errors.append("Chat history wasn't fetched") + + self.profile_1.just_fyi('delete custom mailserver') + self.home_1.profile_button.double_click() + self.profile_1.sync_settings_button.click() + self.profile_1.mail_server_button.click() + #self.profile_1.mail_server_auto_selection_button.click() + self.profile_1.element_by_text(server_name).scroll_and_click() + self.profile_1.mail_server_delete_button.scroll_and_click() + self.profile_1.mail_server_confirm_delete_button.click() + if self.profile_1.element_by_text(server_name).is_element_displayed(): + self.errors.append('Deleted custom mailserver is shown') + + self.errors.verify_no_errors() + @pytest.mark.xdist_group(name="three_2") @marks.medium @@ -675,3 +842,4 @@ class TestGroupChatMultipleDevice(MultipleSharedDeviceTestCase): if not chat.chat_element_by_text(join_system_message).is_element_displayed(): self.errors.append('%s is not shown after joining to group chat via invite' % join_system_message) self.errors.verify_no_errors() + diff --git a/test/appium/tests/medium/test_activity_center.py b/test/appium/tests/medium/test_activity_center.py index afa8b8422e..2c561ba9d0 100644 --- a/test/appium/tests/medium/test_activity_center.py +++ b/test/appium/tests/medium/test_activity_center.py @@ -5,7 +5,7 @@ from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_dri from views.sign_in_view import SignInView -@pytest.mark.xdist_group(name="activity_center_medium_2") +@pytest.mark.xdist_group(name="four_2") @marks.medium class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase): @@ -13,7 +13,7 @@ class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase): 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.home_1, cls.home_2 = cls.device_1.create_user(enable_notifications=True), 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, \ @@ -24,10 +24,17 @@ class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase): 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): + def test_activity_center_reject_chats_no_pn(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) + self.device_1.just_fyi("Device 2: check there is no PN when receiving new message to activity centre") + self.device_1.put_app_to_background() + self.device_1.open_notification_bar() + if self.home_1.element_by_text(self.message_from_sender).is_element_displayed(): + self.errors.append("Push notification with text was received for new message in activity centre") + self.device_1.click_system_back_button(2) + [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') @@ -93,51 +100,6 @@ class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase): 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]] @@ -187,4 +149,50 @@ class TestActivityCenterMultipleDeviceMedium(MultipleSharedDeviceTestCase): 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 + 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_for_element(30) + self.home_1.notifications_unread_badge.click_until_absense_of_element(self.home_1.plus_button) + + 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() diff --git a/test/appium/tests/medium/test_multiple_devices.py b/test/appium/tests/medium/test_multiple_devices.py index 69464a06da..c1266ac228 100644 --- a/test/appium/tests/medium/test_multiple_devices.py +++ b/test/appium/tests/medium/test_multiple_devices.py @@ -131,90 +131,6 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): self.errors.verify_no_errors() - @marks.testrail_id(6233) - # TODO: part about replying to emoji may be duplicated; reply to text should be in critical e2e - - # if in fact contains 1-2 mins, may be added to critical group - def test_chat_reply_to_text_emoji_in_1_1_public(self): - self.create_drivers(2) - device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - message_from_sender = "Message sender" - message_from_receiver = "Message receiver" - home_1, home_2 = device_1.create_user(), device_2.create_user() - - device_1.just_fyi('Both devices join to 1-1 chat') - device_2_public_key = home_2.get_public_key_and_username() - device_1_profile = home_1.profile_button.click() - device_1_username = device_1_profile.default_username_text.text - home_1.home_button.click() - - device_1.just_fyi("Sender adds receiver and quotes own message") - device_1_chat = home_1.add_contact(device_2_public_key) - device_1_chat.send_message(message_from_sender) - device_1_chat.quote_message(message_from_sender) - if device_1_chat.quote_username_in_message_input.text != "↪ You": - self.errors.append("'You' is not displayed in reply quote snippet replying to own message") - - device_1_chat.just_fyi("Clear quote and check there is not snippet anymore") - device_1_chat.cancel_reply_button.click() - if device_1_chat.cancel_reply_button.is_element_displayed(): - self.errors.append("Message quote kept in public chat input after it's cancelation") - - device_1_chat.just_fyi("Send reply") - device_1_chat.quote_message(message_from_sender) - reply_to_message_from_sender = message_from_sender + " reply" - device_1_chat.send_message(reply_to_message_from_sender) - - device_1.just_fyi("Receiver verifies received reply...") - home_2.home_button.click() - device_2_chat_item = home_2.get_chat(device_1_username) - device_2_chat_item.wait_for_visibility_of_element(20) - device_2_chat = device_2_chat_item.click() - if device_2_chat.chat_element_by_text(reply_to_message_from_sender).replied_message_text != message_from_sender: - self.errors.append("No reply received in 1-1 chat") - - device_1_chat.back_button.click() - device_2_chat.back_button.click() - - device_1.just_fyi('both devices joining the same public chat and send messages') - chat_name = device_1.get_random_chat_name() - for home in home_1, home_2: - home.join_public_chat(chat_name) - chat_public_1, chat_public_2 = home_1.get_chat_view(), home_2.get_chat_view() - chat_public_1.send_message(message_from_sender) - chat_public_2.quote_message(message_from_sender) - if chat_public_2.quote_username_in_message_input.text != ("↪ Replying to " + device_1_username): - self.errors.append( - " %s is not displayed in reply quote snippet replying to own message " % device_1_username) - - device_1.just_fyi('Message receiver verifies reply is present in received message') - chat_public_2.send_message(message_from_receiver) - public_replied_message = chat_public_1.chat_element_by_text(message_from_receiver) - if public_replied_message.replied_message_text != message_from_sender: - self.errors.append("Reply is not present in message received in public chat") - - device_1.just_fyi('Can reply to link') - link_message, reply = 'Test with link: https://status.im/ here should be nothing unusual.' \ - ' Just a regular reply.', 'reply to link' - chat_public_1.send_message(link_message) - chat_public_2.quote_message(link_message[:10]) - chat_public_2.send_message(reply) - public_replied_message = chat_public_1.chat_element_by_text(reply) - if public_replied_message.replied_message_text != link_message: - self.errors.append("Reply for '%s' not present in message received in public chat" % link_message) - - device_1.just_fyi('Can reply to emoji message') - reply = 'reply to emoji' - emoji_message = random.choice(list(emoji.EMOJI_UNICODE)) - emoji_unicode = emoji.EMOJI_UNICODE[emoji_message] - chat_public_1.send_message(emoji.emojize(emoji_message)) - chat_public_2.quote_message(emoji.emojize(emoji_message)) - chat_public_2.send_message(reply) - public_replied_message = chat_public_1.chat_element_by_text(reply) - if public_replied_message.replied_message_text != emoji_unicode: - self.errors.append("Reply for '%s' emoji not present in message received in public chat" % emoji_unicode) - - self.errors.verify_no_errors() - @marks.testrail_id(6326) # TODO: check if no duplicate checks 702155 def test_chat_mention_users_if_not_in_contacts(self): @@ -307,23 +223,25 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): message, message_2, message_3 = 'test message', 'test message2', 'test' chat_2.send_message(message) - chat_element = home_1.get_chat(default_username_2) + home_1.get_chat(default_username_2).click() + home_1.home_button.click() home_1.dapp_tab_button.click() chat_2.send_message(message_2) + home_1.home_button.counter.wait_for_element(30) if home_1.home_button.counter.text != '1': self.errors.append('New messages counter is not shown on Home button') device_1.home_button.click() - if chat_element.new_messages_counter.text != '1': + if home_1.get_chat(default_username_2).new_messages_counter.text != '1': self.errors.append('New messages counter is not shown on chat element') - chat_1 = chat_element.click() + chat_1 = home_1.get_chat(default_username_2).click() chat_1.add_to_contacts.click() home_1.home_button.double_click() if home_1.home_button.counter.is_element_displayed(): self.errors.append('New messages counter is shown on Home button for already seen message') - if chat_element.new_messages_counter.text == '1': + if home_1.get_chat(default_username_2).new_messages_counter.text == '1': self.errors.append('New messages counter is shown on chat element for already seen message') home_1.delete_chat_long_press(default_username_2) @@ -338,144 +256,6 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): self.errors.append("Preview message is still highlighted after opening ") self.errors.verify_no_errors() - @marks.testrail_id(700727) - # TODO: merge with any medium group that contains 3 types of chats - def test_chat_gap_in_public_and_no_gap_in_1_1_and_group(self): - self.create_drivers(2) - device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - home_1, home_2 = device_1.create_user(), device_2.create_user() - message_1 = "testing gap" - message_2 = "testing no gap" - pub_chat_name = home_1.get_random_chat_name() - group_chat_name = home_1.get_random_chat_name() - public_key_1, username_1 = home_1.get_public_key_and_username(True) - public_key_2, username_2 = home_2.get_public_key_and_username(True) - profile_1 = home_1.profile_button.click() - profile_1.sync_settings_button.click() - profile_1.sync_history_for_button.click() - profile_1.element_by_translation_id("two-minutes").click() - [home.home_button.click() for home in (home_1, home_2)] - - home_1.just_fyi("Creating 1-1 chat and sending message from device 1") - one_to_one_chat_1 = home_1.add_contact(public_key_2) - one_to_one_chat_1.send_message("HI") - home_1.get_back_to_home_view() - - home_1.just_fyi("Creating group chat and sending message from device 1") - group_chat_1 = home_1.create_group_chat([username_2], group_chat_name) - group_chat_1.send_message("HI") - home_1.get_back_to_home_view() - - home_1.just_fyi("Creating public chat and sending message from device 1") - pub_chat_1, pub_chat_2 = home_1.join_public_chat(pub_chat_name), home_2.join_public_chat(pub_chat_name) - pub_chat_1.send_message("HI") - device_1.toggle_airplane_mode() - - home_2.just_fyi("Joining public chat by device 2 and sending message") - pub_chat_2.send_message(message_1) - home_2.get_back_to_home_view() - - home_2.just_fyi("Joining 1-1 chat by device 2 and sending message") - one_to_one_chat_2 = home_2.add_contact(public_key_1) - one_to_one_chat_2.send_message(message_2) - home_2.get_back_to_home_view() - - home_2.just_fyi("Joining Group chat by device 2 and sending message") - group_chat_2 = home_2.get_chat(group_chat_name).click() - group_chat_2.join_chat_button.click() - group_chat_2.send_message(message_2) - - # Waiting for 3 minutes and then going back online - time.sleep(180) - device_1.toggle_airplane_mode() - - home_1.just_fyi("Checking gap in public chat and fetching messages") - if pub_chat_1.chat_element_by_text(message_1).is_element_displayed(10): - self.errors.append("Test message has been fetched automatically") - pub_chat_1.element_by_translation_id("fetch-messages").wait_and_click(60) - if not pub_chat_1.chat_element_by_text(message_1).is_element_displayed(10): - self.errors.append("Test message has not been fetched") - home_1.get_back_to_home_view() - - home_1.just_fyi("Checking that there is no gap in 1-1/group chat and messages fetched automatically") - for chat in [home_1.get_chat(username_2), home_1.get_chat(group_chat_name)]: - chat_view = chat.click() - if chat_view.element_by_translation_id("fetch-messages").is_element_displayed(10): - self.errors.append("Fetch messages button is displayed in {}} chat".format(chat.user_name_text.text)) - if not chat_view.chat_element_by_text(message_2).is_element_displayed(10): - self.errors.append("Message in {} chat has not been fetched automatically".format(chat.user_name_text.text)) - chat_view.back_button.click() - self.errors.verify_no_errors() - - @marks.testrail_id(695842) - @marks.flaky - def test_community_creating_accept_membership(self): - self.create_drivers(2) - home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user() - community_name, pub_chat_name, channel_name = "some name", home_1.get_random_chat_name(), "first_channel" - community_description, community_pic = "something in community", 'sauce_logo.png' - message, message_member = "message", "from member" - userkey_2, username_2 = home_2.get_public_key_and_username(return_username=True) - home_2.home_button.click() - community_1 = home_1.create_community(community_name, community_description, set_image=True, - file_name=community_pic) - channel_1 = community_1.add_channel(channel_name) - channel_1.send_message(message) - home_1.home_button.double_click() - - home_1.just_fyi("Sending community link to public chat") - community_1 = home_1.get_chat(community_name, community=True).click() - community_link_text = community_1.copy_community_link() - pub_1 = home_1.join_public_chat(pub_chat_name) - 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 = home_2.join_public_chat(pub_chat_name) - pub_2.element_by_text(community_name).wait_for_element(100) - community_message_2 = pub_2.get_community_link_preview_by_text(community_link_text) - if community_message_2.community_description != community_description: - self.errors.append( - "Community description '%s' does not match expected" % community_message_2.community_description) - if community_message_2.community_members_amount != 1: - self.errors.append("Members amount in resolved message '%s' does not match expected" % str( - community_message_2.community_members_amount)) - community_message_2.view() - community_2 = CommunityView(self.drivers[1]) - 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) - if community_1.community_membership_request_value.text != '1': - self.drivers[0].fail( - "Membership request value '%s' is not equal expected" % community_1.community_membership_request_value) - - home_1.just_fyi("Approve membership") - community_1.handle_membership_request(username_2, approve=True) - if not community_1.element_by_text(username_2).is_element_displayed(): - self.errors.append("New member %s is not shown as added to community on info page!" % username_2) - if not community_2.community_info_picture.is_element_image_similar_to_template(community_pic): - self.errors.append("Community image is different!") - channel_2 = community_2.get_chat(channel_name).click() - if not channel_2.chat_element_by_text(message).is_element_displayed(30): - self.errors.append("Message was not received in community channel!") - channel_2.send_message(message_member) - community_1.home_button.double_click() - home_1.get_chat(community_name, community=True).click() - chat_element_1 = community_1.get_chat(channel_name) - if not chat_element_1.new_messages_public_chat.is_element_displayed(): - self.errors.append("Unread messages counter is not shown for community channel!") - if not community_1.element_by_text(message_member).is_element_displayed(): - self.errors.append("Message from member is not shown for community channel!") - - 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): @@ -605,376 +385,6 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): self.errors.append("Transaction is shown as confirmed on mainnet, but was sent on ropsten!") self.errors.verify_no_errors() - @marks.testrail_id(6636) - def test_profile_show_profile_picture_and_online_indicator_settings(self): - # TODO: add check by make photo in this test - # profile_1.just_fyi("Set user Profile image by taking Photo") - # home_1.profile_button.click() - # profile_1.edit_profile_picture(file_name='sauce_logo.png', update_by='Make Photo') - # home_1.home_button.click(desired_view='chat') - # public_chat_1.chat_message_input.send_keys(message) - # public_chat_1.send_message_button.click() - # - # if public_chat_2.chat_element_by_text(message).member_photo.is_element_image_similar_to_template( - # 'sauce_logo.png'): - # self.drivers[0].fail('Profile picture was not updated in chat after making photo') - #### - self.create_drivers(2) - home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user(enable_notifications=True) - profile_1, profile_2 = home_1.profile_button.click(), home_2.profile_button.click() - public_key_1, default_username_1 = profile_1.get_public_key_and_username(return_username=True) - public_key_2, default_username_2 = profile_2.get_public_key_and_username(return_username=True) - logo_online, logo_default, logo_chats, logo_group = 'logo_new.png', 'sauce_logo.png', 'logo_chats_view.png', 'group_logo.png' - - [profile.home_button.click() for profile in (profile_1, profile_2)] - home_1.add_contact(public_key_2) - home_1.profile_button.click() - - profile_1.just_fyi("Set user Profile image from Gallery") - profile_1.edit_profile_picture(file_name=logo_default) - home_1.profile_button.click() - profile_1.swipe_down() - - profile_1.just_fyi('set status in profile') - device_1_status = 'My new update!' - timeline = profile_1.status_button.click() - timeline.set_new_status(device_1_status) - if not timeline.timeline_own_account_photo.is_element_image_similar_to_template(logo_default): - self.errors.append('Profile picture was not updated in timeline') - - profile_1.just_fyi('Check profile image it is not in mentions because user not in contacts yet') - one_to_one_chat_2 = home_2.add_contact(public_key_1, add_in_contacts=False) - one_to_one_chat_2.chat_message_input.set_value('@' + default_username_1) - one_to_one_chat_2.chat_message_input.click() - if one_to_one_chat_2.user_profile_image_in_mentions_list( - default_username_1).is_element_image_similar_to_template(logo_default): - self.errors.append('Profile picture is updated in 1-1 chat mentions list of contact not in Contacts list') - - profile_1.just_fyi('Check profile image is in mentions because now user was added in contacts') - one_to_one_chat_2.add_to_contacts.click() - one_to_one_chat_2.send_message("hey") - one_to_one_chat_2.chat_message_input.set_value('@' + default_username_1) - one_to_one_chat_2.chat_message_input.click() - if not one_to_one_chat_2.user_profile_image_in_mentions_list( - default_username_1).is_element_image_similar_to_template(logo_default): - self.errors.append('Profile picture was not updated in 1-1 chat mentions list') - home_1.reopen_app() - one_to_one_chat_2.get_back_to_home_view() - - profile_1.just_fyi('Check profile image is updated in Group chat view') - profile_2 = one_to_one_chat_2.profile_button.click() - profile_2.contacts_button.click() - profile_2.element_by_text(default_username_1).click() - profile_2.online_indicator.wait_for_visibility_of_element(180) - if not profile_2.profile_picture.is_element_image_similar_to_template('new_profile_online.png'): - self.errors.append('Profile picture was not updated on user Profile view') - profile_2.close_button.click() - home_2.home_button.double_click() - if not home_2.get_chat(default_username_1).chat_image.is_element_image_similar_to_template(logo_chats): - self.errors.append('User profile picture was not updated on Chats view') - - profile_1.just_fyi('Check profile image updated in user profile view in Group chat views') - group_chat_name, group_chat_message = 'new_group_chat', 'Trololo' - group_chat_2 = home_2.create_group_chat(user_names_to_add=[default_username_1]) - - group_chat_2.send_message('Message', wait_chat_input_sec=10) - group_chat_1 = home_1.get_chat(group_chat_name).click() - group_chat_1.join_chat_button.click() - group_chat_1.send_message(group_chat_message) - if not group_chat_2.chat_element_by_text(group_chat_message).member_photo.is_element_image_similar_to_template(logo_default): - self.errors.append('User profile picture was not updated in message Group chat view') - home_2.put_app_to_background() - - profile_1.just_fyi('Check profile image updated in group chat invite') - home_1.get_back_to_home_view() - new_group_chat = 'new_gr' - home_2.click_system_back_button() - home_2.open_notification_bar() - home_1.create_group_chat(user_names_to_add=[default_username_2], group_chat_name=new_group_chat) - - invite = group_chat_2.pn_invited_to_group_chat(default_username_1, new_group_chat) - pn = home_2.get_pn(invite) - if pn: - if not pn.group_chat_icon.is_element_image_similar_to_template(logo_group): - self.errors.append("Group chat invite is not updated with custom logo!") - pn.click() - else: - home_2.click_system_back_button(2) - - profile_1.just_fyi('Check profile image updated in on login view') - home_1.profile_button.click() - profile_1.logout() - sign_in_1 = home_1.get_sign_in_view() - if not sign_in_1.get_multiaccount_by_position(1).account_logo.is_element_image_similar_to_template( - logo_default): - self.errors.append('User profile picture was not updated on Multiaccounts list select login view') - sign_in_1.element_by_text(default_username_1).click() - if not sign_in_1.get_multiaccount_by_position(1).account_logo.is_element_image_similar_to_template( - logo_default): - self.errors.append('User profile picture was not updated on account login view') - sign_in_1.password_input.set_value(common_password) - sign_in_1.sign_in_button.click() - - profile_1.just_fyi('Remove user from contact and check there is no profile image displayed') - group_chat_2.profile_button.double_click() - profile_2.contacts_button.click() - profile_2.element_by_text(default_username_1).click() - one_to_one_chat_2.remove_from_contacts.click() - # Send message to User 2 so update of profile image picked up - group_chat_1 = home_1.get_chat('new_group_chat').click() - group_chat_1.send_message(group_chat_message) - one_to_one_chat_2.close_button.click() - one_to_one_chat_2.home_button.double_click() - if home_2.get_chat(default_username_1).chat_image.is_element_image_similar_to_template(logo_default): - self.errors.append('User profile picture is not default to default after user removed from Contacts') - - profile_2.just_fyi('Enable to see profile image from "Everyone" setting') - home_2.profile_button.double_click() - profile_2.privacy_and_security_button.click() - profile_2.show_profile_pictures_of.scroll_and_click() - profile_2.element_by_translation_id("everyone").click() - group_chat_1.send_message(group_chat_message) - profile_2.home_button.click(desired_view='home') - if not home_2.get_chat(default_username_1).chat_image.is_element_image_similar_to_template(logo_chats): - self.errors.append('User profile picture is not returned to default after user removed from Contacts') - self.errors.verify_no_errors() - - @marks.testrail_id(5432) - @marks.medium - # TODO: can be united with other 2-driver profile e2e - def test_profile_custom_bootnodes(self): - self.create_drivers(2) - home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user() - public_key = home_2.get_public_key_and_username() - - profile_1, profile_2 = home_1.profile_button.click(), home_2.profile_button.click() - username_1, username_2 = profile_1.default_username_text.text, profile_2.default_username_text.text - - profile_1.just_fyi('Add custom bootnode, enable bootnodes and check validation') - profile_1.advanced_button.click() - profile_1.bootnodes_button.click() - profile_1.add_bootnode_button.click() - profile_1.specify_name_input.set_value('test') - # TODO: blocked as validation is missing for bootnodes (rechecked 23.11.21, valid) - # profile_1.bootnode_address_input.set_value('invalid_bootnode_address') - # if not profile_1.element_by_text_part('Invalid format').is_element_displayed(): - # self.errors.append('Validation message about invalid format of bootnode is not shown') - # profile_1.save_button.click() - # if profile_1.add_bootnode_button.is_element_displayed(): - # self.errors.append('User was navigated to another screen when tapped on disabled "Save" button') - # profile_1.bootnode_address_input.clear() - profile_1.bootnode_address_input.set_value(bootnode_address) - profile_1.save_button.click() - profile_1.enable_bootnodes.click() - profile_1.home_button.click() - - profile_1.just_fyi('Add contact and send first message') - chat_1 = home_1.add_contact(public_key) - message = 'test message' - chat_1.chat_message_input.send_keys(message) - chat_1.send_message_button.click() - profile_2.home_button.click() - chat_2 = home_2.get_chat(username_1).click() - chat_2.chat_element_by_text(message).wait_for_visibility_of_element() - chat_2.add_to_contacts.click() - - profile_1.just_fyi('Disable custom bootnodes') - chat_1.profile_button.click() - profile_1.advanced_button.click() - profile_1.bootnodes_button.click() - profile_1.enable_bootnodes.click() - profile_1.home_button.click() - - profile_1.just_fyi('Send message and check that it is received after disabling bootnodes') - home_1.get_chat(username_2).click() - message_1 = 'new message' - chat_1.chat_message_input.send_keys(message_1) - chat_1.send_message_button.click() - for chat in chat_1, chat_2: - if not chat.chat_element_by_text(message_1).is_element_displayed(): - self.errors.append('Message was not received after enabling bootnodes!') - self.errors.verify_no_errors() - - @marks.testrail_id(5436) - @marks.flaky - # TODO: can be united with other 2-driver profile e2e - def test_profile_add_switch_delete_custom_history_node(self): - self.create_drivers(2) - sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - home_1, home_2 = sign_in_1.create_user(), sign_in_2.create_user() - public_key = home_2.get_public_key_and_username() - home_2.home_button.click() - - profile_1 = home_1.profile_button.click() - username_1 = profile_1.default_username_text.text - - profile_1.just_fyi('disable autoselection') - profile_1.sync_settings_button.click() - profile_1.mail_server_button.click() - mailserver = profile_1.return_mailserver_name(mailserver_hk, used_fleet) - profile_1.mail_server_auto_selection_button.click() - profile_1.mail_server_by_name(mailserver).click() - profile_1.confirm_button.click() - - profile_1.just_fyi('add custom mailserver (check address/name validation) and connect to it') - profile_1.plus_button.click() - server_name = 'test' - profile_1.save_button.click() - if profile_1.element_by_text(mailserver).is_element_displayed(): - self.errors.append('Could add custom mailserver with empty address and name') - profile_1.specify_name_input.set_value(server_name) - profile_1.mail_server_address_input.set_value(mailserver_address[:-3]) - profile_1.save_button.click() - if not profile_1.element_by_text_part("Invalid format").is_element_displayed(): - self.errors.append('could add custom mailserver with invalid address') - profile_1.mail_server_address_input.clear() - profile_1.mail_server_address_input.set_value(mailserver_address) - profile_1.save_button.click() - profile_1.mail_server_by_name(server_name).click() - profile_1.mail_server_connect_button.click() - profile_1.confirm_button.click() - if profile_1.element_by_text_part("Error connecting").is_element_displayed(40): - profile_1.retry_to_connect_to_mailserver() - profile_1.get_back_to_home_view() - profile_1.home_button.click() - - profile_1.just_fyi('start chat with user2 and check that all messages are delivered') - chat_1 = home_1.add_contact(public_key) - message = 'test message' - chat_1.chat_message_input.send_keys(message) - chat_1.send_message_button.click() - chat_2 = home_2.get_chat(username_1).click() - chat_2.chat_element_by_text(message).wait_for_visibility_of_element() - message_1 = 'new message' - chat_2.chat_message_input.send_keys(message_1) - chat_2.send_message_button.click() - chat_1.chat_element_by_text(message_1).wait_for_visibility_of_element() - - profile_1.just_fyi('delete custom mailserver') - chat_1.profile_button.click() - profile_1.sync_settings_button.click() - profile_1.mail_server_button.click() - profile_1.element_by_text(mailserver).scroll_to_element() - profile_1.element_by_text(mailserver).click() - profile_1.confirm_button.click() - profile_1.element_by_text(server_name).scroll_to_element() - profile_1.element_by_text(server_name).click() - profile_1.mail_server_delete_button.scroll_to_element() - profile_1.mail_server_delete_button.click() - profile_1.mail_server_confirm_delete_button.click() - if profile_1.element_by_text(server_name).is_element_displayed(): - self.errors.append('Deleted custom mailserver is shown') - profile_1.get_back_to_home_view() - profile_1.relogin() - chat_1.profile_button.click() - profile_1.sync_settings_button.click() - profile_1.mail_server_button.click() - if profile_1.element_by_text(server_name).is_element_displayed(): - self.errors.append('Deleted custom mailserver is shown after relogin') - - self.errors.verify_no_errors() - - @marks.testrail_id(5767) - # TODO: can be united with other 2-driver profile e2e - def test_profile_can_not_connect_to_history_node(self): - self.create_drivers(2) - home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user() - profile_1 = home_1.profile_button.click() - - profile_1.just_fyi('add non-working mailserver and connect to it') - profile_1.sync_settings_button.click() - profile_1.mail_server_button.click() - profile_1.mail_server_auto_selection_button.click() - profile_1.plus_button.click() - server_name = 'test' - profile_1.specify_name_input.set_value(server_name) - profile_1.mail_server_address_input.set_value('%s%s' % (mailserver_address[:-3], '553')) - profile_1.save_button.click() - profile_1.mail_server_by_name(server_name).click() - profile_1.mail_server_connect_button.wait_and_click() - profile_1.confirm_button.wait_and_click() - - profile_1.just_fyi('check that popup "Error connecting" will not reappear if tap on "Cancel"') - profile_1.element_by_translation_id('mailserver-error-title').wait_for_element(120) - profile_1.cancel_button.click() - - home_2.just_fyi('send several messages to public channel') - public_chat_name = home_2.get_random_chat_name() - message = 'test_message' - public_chat_2 = home_2.join_public_chat(public_chat_name) - public_chat_2.chat_message_input.send_keys(message) - public_chat_2.send_message_button.click() - public_chat_2.back_button.click() - - profile_1.just_fyi('join same public chat and try to reconnect via "Tap to reconnect" and check "Connecting"') - profile_1.home_button.click() - public_chat_1 = home_1.join_public_chat(public_chat_name) - public_chat_1.reopen_app() - - profile_1.just_fyi('check that still connected to custom mailserver after relogin') - home_1.profile_button.click() - profile_1.sync_settings_button.click() - if not profile_1.element_by_text(server_name).is_element_displayed(): - self.drivers[0].fail("Not connected to custom mailserver after re-login") - - profile_1.just_fyi('check that can RETRY to connect') - profile_1.element_by_translation_id('mailserver-error-title').wait_for_element(120) - public_chat_1.element_by_translation_id('mailserver-retry', uppercase=True).wait_and_click(60) - - profile_1.just_fyi('check that can pick another mailserver and receive messages') - profile_1.element_by_translation_id('mailserver-error-title').wait_for_element(120) - profile_1.element_by_translation_id('mailserver-pick-another', uppercase=True).wait_and_click(120) - mailserver = profile_1.return_mailserver_name(mailserver_ams, used_fleet) - profile_1.element_by_text(mailserver).click() - profile_1.confirm_button.click() - profile_1.home_button.click() - home_1.get_chat('#%s' % public_chat_name).click() - if not public_chat_1.chat_element_by_text(message).is_element_displayed(60): - self.errors.append("Chat history wasn't fetched") - - self.errors.verify_no_errors() - - @marks.testrail_id(6332) - # TODO: can be united with other 2-driver profile e2e - def test_profile_disable_use_history_node(self): - self.create_drivers(2) - home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user() - profile_1 = home_1.profile_button.click() - - home_2.just_fyi('send several messages to public channel') - public_chat_name = home_2.get_random_chat_name() - message, message_no_history = 'test_message', 'history node is disabled' - public_chat_2 = home_2.join_public_chat(public_chat_name) - public_chat_2.send_message(message) - - profile_1.just_fyi( - 'disable use_history_node and check that no history is fetched but you can still send messages') - profile_1.sync_settings_button.click() - profile_1.mail_server_button.click() - profile_1.use_history_node_button.click() - profile_1.home_button.click() - public_chat_1 = home_1.join_public_chat(public_chat_name) - if public_chat_1.chat_element_by_text(message).is_element_displayed(30): - self.errors.append('Chat history was fetched when use_history_node is disabled') - public_chat_1.send_message(message_no_history) - if not public_chat_2.chat_element_by_text(message_no_history).is_element_displayed(30): - self.errors.append('Message sent when use_history_node is disabled was not received') - public_chat_1.profile_button.click() - profile_1.relogin() - home_1.get_chat('#%s' % public_chat_name).click() - if public_chat_1.chat_element_by_text(message).is_element_displayed(30): - self.drivers[0].fail('History was fetched after relogin when use_history_node is disabled') - - profile_1.just_fyi('enable use_history_node and check that history is fetched') - home_1.profile_button.click() - profile_1.sync_settings_button.click() - profile_1.mail_server_button.click() - profile_1.use_history_node_button.click() - profile_1.home_button.click(desired_view='chat') - if not public_chat_1.chat_element_by_text(message).is_element_displayed(60): - self.errors.append('History was not fetched after enabling use_history_node') - self.errors.verify_no_errors() - @marks.testrail_id(6330) # TODO: can be re-done to 1-driver test (sending between different account) def test_wallet_can_send_tx_all_tokens_via_max_option(self): @@ -1012,3 +422,5 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): wallet_receiver.close_button.click() initial_balance = float(initial_balance) + float(amount) wallet_receiver.wait_balance_is_changed(asset='STT', initial_balance=str(initial_balance), scan_tokens=True) + + diff --git a/test/appium/tests/medium/test_profile_m.py b/test/appium/tests/medium/test_profile_m.py new file mode 100644 index 0000000000..59adff7724 --- /dev/null +++ b/test/appium/tests/medium/test_profile_m.py @@ -0,0 +1,268 @@ +from views.chat_view import CommunityView +import pytest +from tests import marks +from tests.base_test_case import MultipleSharedDeviceTestCase, create_shared_drivers +from views.sign_in_view import SignInView +import time +from tests import bootnode_address, mailserver_address, mailserver_ams, mailserver_hk, used_fleet, common_password +from tests.users import transaction_senders, basic_user, ens_user +from tests import marks +from tests.base_test_case import MultipleDeviceTestCase +from views.sign_in_view import SignInView + +@pytest.mark.xdist_group(name='five_2') +@marks.medium +class TestProfileGapsCommunityMediumMultipleDevicesMerged(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(enable_notifications=True) + cls.public_key_1, cls.default_username_1 = cls.home_1.get_public_key_and_username(return_username=True) + cls.public_key_2, cls.default_username_2 = cls.home_2.get_public_key_and_username(return_username=True) + [home.home_button.click() for home in (cls.home_1, cls.home_2)] + + cls.home_1.just_fyi("Creating 1-1 chats") + cls.chat_1 = cls.home_1.add_contact(cls.public_key_2) + cls.first_message = 'first message' + cls.chat_2 = cls.home_2.add_contact(cls.public_key_1, add_in_contacts=False) + [home.home_button.click() for home in (cls.home_1, cls.home_2)] + + cls.home_1.just_fyi("Creating group chat") + cls.group_chat_name = "gr_chat_%s" % cls.home_1.get_random_chat_name() + cls.group_chat_1 = cls.home_1.create_group_chat(user_names_to_add=[cls.default_username_2], + group_chat_name=cls.group_chat_name) + cls.group_chat_2 = cls.home_2.get_chat(cls.group_chat_name).click() + cls.group_chat_2.join_chat_button.click() + [home.home_button.click() for home in (cls.home_1, cls.home_2)] + + cls.home_1.just_fyi("Creating public chats") + cls.public_chat_name = cls.home_1.get_random_chat_name() + cls.public_chat_1, cls.public_chat_2 = cls.home_1.join_public_chat( + cls.public_chat_name), cls.home_2.join_public_chat(cls.public_chat_name) + + @marks.testrail_id(702281) + def test_profile_show_profile_picture_and_online_indicator_settings(self): + [home.home_button.double_click() for home in (self.home_1, self.home_2)] + logo_online, logo_default, logo_chats, logo_group = 'logo_new.png', 'sauce_logo.png', 'logo_chats_view.png', 'group_logo.png' + profile_1 = self.home_1.profile_button.click() + + profile_1.just_fyi("Set user Profile image from Gallery") + profile_1.edit_profile_picture(file_name=logo_default) + self.home_1.profile_button.click() + profile_1.swipe_down() + + profile_1.just_fyi('Set status in profile') + device_1_status = 'My new update!' + timeline = profile_1.status_button.click() + timeline.set_new_status(device_1_status) + if not timeline.timeline_own_account_photo.is_element_image_similar_to_template(logo_default): + self.errors.append('Profile picture was not updated in timeline') + + profile_1.just_fyi('Check profile image it is not in mentions because user not in contacts yet') + one_to_one_chat_2 = self.home_2.get_chat(self.default_username_1).click() + one_to_one_chat_2.chat_message_input.set_value('@' + self.default_username_1) + one_to_one_chat_2.chat_message_input.click() + if one_to_one_chat_2.user_profile_image_in_mentions_list( + self.default_username_1).is_element_image_similar_to_template(logo_default): + self.errors.append('Profile picture is updated in 1-1 chat mentions list of contact not in Contacts list') + + profile_1.just_fyi('Check profile image is in mentions because now user was added in contacts') + one_to_one_chat_2.add_to_contacts.click() + one_to_one_chat_2.send_message("hey") + one_to_one_chat_2.chat_message_input.set_value('@' + self.default_username_1) + one_to_one_chat_2.chat_message_input.click() + if not one_to_one_chat_2.user_profile_image_in_mentions_list( + self.default_username_1).is_element_image_similar_to_template(logo_default): + self.errors.append('Profile picture was not updated in 1-1 chat mentions list') + self.home_1.reopen_app() + one_to_one_chat_2.get_back_to_home_view() + + profile_1.just_fyi('Check profile image is updated in chat views') + profile_2 = one_to_one_chat_2.profile_button.click() + profile_2.contacts_button.click() + profile_2.element_by_text(self.default_username_1).click() + profile_2.online_indicator.wait_for_visibility_of_element(180) + if not profile_2.profile_picture.is_element_image_similar_to_template('new_profile_online.png'): + self.errors.append('Profile picture was not updated on user Profile view') + profile_2.close_button.click() + self.home_2.home_button.double_click() + if not self.home_2.get_chat(self.default_username_1).chat_image.is_element_image_similar_to_template(logo_chats): + self.errors.append('User profile picture was not updated on Chats view') + + profile_1.just_fyi('Check profile image updated in user profile view in Group chat views') + group_chat_message = 'wuuuut' + self.home_2.get_chat(self.group_chat_name).click() + self.group_chat_2.send_message('Message', wait_chat_input_sec=10) + group_chat_1 = self.home_1.get_chat(self.group_chat_name).click() + group_chat_1.send_message(group_chat_message) + self.group_chat_2.chat_element_by_text(group_chat_message).wait_for_element(20) + if not self.group_chat_2.chat_element_by_text(group_chat_message).member_photo.is_element_image_similar_to_template( + logo_default): + self.errors.append('User profile picture was not updated in message Group chat view') + self.home_2.put_app_to_background() + + profile_1.just_fyi('Check profile image updated in group chat invite') + self.home_1.get_back_to_home_view() + new_group_chat = 'new_gr' + self.home_2.click_system_back_button() + self.home_2.open_notification_bar() + self.home_1.create_group_chat(user_names_to_add=[self.default_username_2], group_chat_name=new_group_chat) + + invite = self.group_chat_2.pn_invited_to_group_chat(self.default_username_1, new_group_chat) + pn = self.home_2.get_pn(invite) + if pn: + if not pn.group_chat_icon.is_element_image_similar_to_template(logo_group): + self.errors.append("Group chat invite is not updated with custom logo!") + pn.click() + else: + self.errors.append("No invite PN is arrived!") + self.home_2.click_system_back_button(2) + + profile_1.just_fyi('Check profile image updated in on login view') + self.home_1.profile_button.click() + profile_1.logout() + sign_in_1 = self.home_1.get_sign_in_view() + if not sign_in_1.get_multiaccount_by_position(1).account_logo.is_element_image_similar_to_template( + logo_default): + self.errors.append('User profile picture was not updated on Multiaccounts list select login view') + sign_in_1.element_by_text(self.default_username_1).click() + if not sign_in_1.get_multiaccount_by_position(1).account_logo.is_element_image_similar_to_template( + logo_default): + self.errors.append('User profile picture was not updated on account login view') + sign_in_1.password_input.set_value(common_password) + sign_in_1.sign_in_button.click() + + profile_1.just_fyi('Remove user from contact and check there is no profile image displayed') + self.home_2.profile_button.double_click() + profile_2.contacts_button.click() + profile_2.element_by_text(self.default_username_1).click() + one_to_one_chat_2.remove_from_contacts.click() + # Send message to User 2 so update of profile image picked up + group_chat_message = "woho" + group_chat_1 = self.home_1.get_chat(self.group_chat_name).click() + group_chat_1.send_message(group_chat_message) + one_to_one_chat_2.get_back_to_home_view() + one_to_one_chat_2.home_button.double_click() + if self.home_2.get_chat(self.default_username_1).chat_image.is_element_image_similar_to_template(logo_default): + self.errors.append('User profile picture is not default to default after user removed from Contacts') + + profile_2.just_fyi('Enable to see profile image from "Everyone" setting') + self.home_2.profile_button.double_click() + profile_2.privacy_and_security_button.click() + profile_2.show_profile_pictures_of.scroll_and_click() + profile_2.element_by_translation_id("everyone").click() + group_chat_1.send_message(group_chat_message) + profile_2.home_button.click(desired_view='home') + if not self.home_2.get_chat(self.default_username_1).chat_image.is_element_image_similar_to_template(logo_chats): + self.errors.append('User profile picture is not returned to default after user removed from Contacts') + self.errors.verify_no_errors() + + @marks.testrail_id(702282) + def test_profile_chat_two_minutes_gap_in_public_and_no_gap_in_1_1_chat_and_group_chat(self): + [home.home_button.double_click() for home in (self.home_1, self.home_2)] + profile_1 = self.home_1.profile_button.click() + profile_1.sync_settings_button.click() + profile_1.sync_history_for_button.click() + profile_1.element_by_translation_id("two-minutes").click() + self.device_1.toggle_airplane_mode() + message_gap = "OOps, that should not be fetched automatically for pub chat" + + self.home_2.just_fyi("Send message to all chats") + for chat_name in (self.default_username_1, self.group_chat_name, '#%s' % self.public_chat_name): + self.home_2.get_chat(chat_name).click() + self.chat_2.send_message(message_gap) + self.chat_2.home_button.click() + + # Waiting for 3 minutes and then going back online + time.sleep(130) + self.device_1.toggle_airplane_mode() + + self.home_1.just_fyi("Checking gap in public chat and fetching messages") + profile_1.home_button.click() + pub_chat_1 = self.home_1.get_chat('#%s' % self.public_chat_name).click() + if pub_chat_1.chat_element_by_text(message_gap).is_element_displayed(10): + self.errors.append("Test message has been fetched automatically") + pub_chat_1.element_by_translation_id("fetch-messages").wait_and_click(60) + if not pub_chat_1.chat_element_by_text(message_gap).is_element_displayed(10): + self.errors.append("Test message has not been fetched") + self.home_1.get_back_to_home_view() + + self.home_1.just_fyi("Checking that there is no gap in 1-1/group chat and messages fetched automatically") + for chat in [self.home_1.get_chat(self.default_username_2), self.home_1.get_chat(self.group_chat_name)]: + chat_view = chat.click() + if chat_view.element_by_translation_id("fetch-messages").is_element_displayed(10): + self.errors.append("Fetch messages button is displayed in {}} chat".format(chat.user_name_text.text)) + if not chat_view.chat_element_by_text(message_gap).is_element_displayed(10): + self.errors.append( + "Message in {} chat has not been fetched automatically".format(chat.user_name_text.text)) + chat_view.back_button.click() + self.errors.verify_no_errors() + + @marks.testrail_id(702283) + def test_community_create_approve_membership(self): + [home.home_button.double_click() for home in (self.home_1, self.home_2)] + community_name, channel_name = "some name", "first_channel" + community_description, community_pic = "something in community", 'sauce_logo.png' + message, message_member = "message", "from member" + community_1 = self.home_1.create_community(community_name, community_description, set_image=True, + file_name=community_pic) + channel_1 = community_1.add_channel(channel_name) + channel_1.send_message(message) + self.home_1.home_button.double_click() + + self.home_1.just_fyi("Sending community link to public chat") + community_1 = self.home_1.get_chat(community_name, community=True).click() + community_link_text = community_1.copy_community_link() + pub_1 = self.home_1.get_chat('#%s' % self.public_chat_name).click() + pub_1.chat_message_input.paste_text_from_clipboard() + pub_1.send_message_button.click() + pub_1.get_back_to_home_view() + + self.home_2.just_fyi("Tapping on community link and request membership") + pub_2 = self.home_2.get_chat('#%s' % self.public_chat_name).click() + pub_2.element_by_text(community_name).wait_for_element(100) + community_message_2 = pub_2.get_community_link_preview_by_text(community_link_text) + if community_message_2.community_description != community_description: + self.errors.append( + "Community description '%s' does not match expected" % community_message_2.community_description) + if community_message_2.community_members_amount != 1: + self.errors.append("Members amount in resolved message '%s' does not match expected" % str( + community_message_2.community_members_amount)) + community_message_2.view() + community_2 = CommunityView(self.drivers[1]) + 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") + + self.home_1.just_fyi("Checking pending membership") + community_1 = self.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) + if community_1.community_membership_request_value.text != '1': + self.drivers[0].fail( + "Membership request value '%s' is not equal expected" % community_1.community_membership_request_value) + + self.home_1.just_fyi("Approve membership") + community_1.handle_membership_request(self.default_username_2, approve=True) + if not community_1.element_by_text(self.default_username_2).is_element_displayed(): + self.errors.append("New member %s is not shown as added to community on info page!" % self.default_username_2) + if not community_2.community_info_picture.is_element_image_similar_to_template(community_pic): + self.errors.append("Community image is different!") + channel_2 = community_2.get_chat(channel_name).click() + if not channel_2.chat_element_by_text(message).is_element_displayed(30): + self.errors.append("Message was not received in community channel!") + channel_2.send_message(message_member) + community_1.home_button.double_click() + self.home_1.get_chat(community_name, community=True).click() + chat_element_1 = community_1.get_chat(channel_name) + if not chat_element_1.new_messages_public_chat.is_element_displayed(): + self.errors.append("Unread messages counter is not shown for community channel!") + if not community_1.element_by_text(message_member).is_element_displayed(): + self.errors.append("Message from member is not shown for community channel!") + + self.errors.verify_no_errors() + + diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index 627b6fb388..b8f9ca554a 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -239,7 +239,6 @@ class HomeView(BaseView): chat_in_ac = ActivityCenterChatElement(self.driver, username[:25]) chat_in_ac.wait_for_element(20) chat_in_ac.click() - self.home_button.double_click() return chat_element def get_chat_from_home_view(self, username):