e2e: block user test

This commit is contained in:
Churikova Tetiana 2023-03-08 11:31:42 +01:00
parent 7a299b9b86
commit 0345871b66
No known key found for this signature in database
GPG Key ID: EDE559EC439D18A0
7 changed files with 98 additions and 76 deletions

View File

@ -463,7 +463,7 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
self.chat_1.just_fyi('Add user to contacts, mention it by nickname check contact list in Profile') self.chat_1.just_fyi('Add user to contacts, mention it by nickname check contact list in Profile')
chat_element.member_photo.click() chat_element.member_photo.click()
self.chat_1.profile_add_to_contacts.click() self.chat_1.profile_add_to_contacts_button.click()
if not self.chat_1.remove_from_contacts.is_element_displayed(): if not self.chat_1.remove_from_contacts.is_element_displayed():
self.errors.append("'Add to contacts' is not changed to 'Remove from contacts'") self.errors.append("'Add to contacts' is not changed to 'Remove from contacts'")
self.chat_1.close_button.click() self.chat_1.close_button.click()
@ -528,66 +528,6 @@ class TestContactBlockMigrateKeycardMultipleSharedDevices(MultipleSharedDeviceTe
self.errors.append('Contact is shown in Profile after removing user from contacts') self.errors.append('Contact is shown in Profile after removing user from contacts')
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(702176)
def test_contact_block_unblock_public_chat_offline(self):
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
self.chat_1.just_fyi('Block user')
self.home_1.get_chat("#%s" % self.pub_chat_name).click()
chat_element = self.chat_1.chat_element_by_text(self.message)
chat_element.find_element()
chat_element.member_photo.click()
self.chat_1.block_contact()
self.chat_1.just_fyi('messages from blocked user are hidden in public chat and close app')
if self.chat_1.chat_element_by_text(self.message).is_element_displayed():
self.errors.append("Messages from blocked user is not cleared in public chat ")
self.chat_1.home_button.click()
if self.home_1.element_by_text(self.nick).is_element_displayed():
self.errors.append("1-1 chat from blocked user is not removed!")
self.chat_1.toggle_airplane_mode()
self.home_2.just_fyi('send message to public chat while device 1 is offline')
message_blocked, message_unblocked = "Message from blocked user", "Hurray! unblocked"
self.home_2.get_chat("#%s" % self.pub_chat_name).click()
self.chat_2.send_message(message_blocked)
self.chat_1.just_fyi('check that new messages from blocked user are not delivered')
self.chat_1.toggle_airplane_mode()
self.home_1.get_chat("#%s" % self.pub_chat_name).click()
for message in self.message, message_blocked:
if self.chat_1.chat_element_by_text(message).is_element_displayed():
self.errors.append(
"'%s' from blocked user is fetched from offline in public chat" % message)
self.home_1.just_fyi('Verify input field is disabled in 1-1 chat with blocked user')
self.home_1.home_button.double_click()
chat_1_1 = self.home_1.add_contact(self.public_key_2, add_in_contacts=False)
if chat_1_1.chat_message_input.is_element_displayed():
self.errors.append("Chat input field is displayed in chat with blocked user")
self.home_1.home_button.double_click()
self.home_1.get_chat("#%s" % self.pub_chat_name).click()
self.chat_2.just_fyi('Unblock user and check that can see further messages')
profile_1 = self.home_1.get_profile_view()
self.chat_1.profile_button.double_click()
profile_1.contacts_button.wait_and_click()
profile_1.blocked_users_button.wait_and_click()
profile_1.element_by_text(self.nick).click()
self.chat_1.unblock_contact_button.click()
self.chat_1.close_button.click()
[home.home_button.click(desired_view='chat') for home in [self.home_1, self.home_2]]
self.chat_2.send_message(message_unblocked)
self.chat_2.home_button.double_click()
self.home_2.add_contact(self.sender['public_key'])
self.chat_2.send_message(message_unblocked)
if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed():
self.errors.append("Message was not received in public chat after user unblock!")
self.chat_1.home_button.click()
self.home_1.get_chat(self.nick, wait_time=30).click()
if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed():
self.errors.append("Message was not received in 1-1 chat after user unblock!")
self.errors.verify_no_errors()
@marks.testrail_id(702188) @marks.testrail_id(702188)
@marks.xfail( @marks.xfail(
@ -806,11 +746,11 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
self.chat_1.just_fyi('Check redirect to user profile on mention by nickname tap') self.chat_1.just_fyi('Check redirect to user profile on mention by nickname tap')
self.chat_1.chat_element_by_text(updated_message).click() self.chat_1.chat_element_by_text(updated_message).click()
if not self.chat_1.profile_block_contact.is_element_displayed(): if not self.chat_1.profile_block_contact_button.is_element_displayed():
self.errors.append( self.errors.append(
'No redirect to user profile after tapping on message with mention (nickname) in 1-1 chat') 'No redirect to user profile after tapping on message with mention (nickname) in 1-1 chat')
else: else:
self.chat_1.profile_send_message.click() self.chat_1.profile_send_message_button.click()
self.chat_2.just_fyi("Check message with mention for ENS owner") self.chat_2.just_fyi("Check message with mention for ENS owner")
self.home_2.get_chat(self.sender['username']).click() self.home_2.get_chat(self.sender['username']).click()
@ -911,7 +851,7 @@ class TestEnsStickersMultipleDevicesMerged(MultipleSharedDeviceTestCase):
# self.chat_2.close_sticker_view_icon.click() # self.chat_2.close_sticker_view_icon.click()
self.chat_2.chat_item.long_press_element() self.chat_2.chat_item.long_press_element()
self.chat_2.element_by_text('View Details').click() self.chat_2.element_by_text('View Details').click()
self.chat_2.profile_send_message.wait_and_click() self.chat_2.profile_send_message_button.wait_and_click()
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(702158) @marks.testrail_id(702158)

View File

@ -367,6 +367,13 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.home_2.handle_contact_request(self.default_username_1) self.home_2.handle_contact_request(self.default_username_1)
self.text_message = 'hello' self.text_message = 'hello'
self.home_2.just_fyi("Send message to contact (need for blocking contact) test")
self.chat_1 = self.home_1.get_chat(self.default_username_2).click()
self.chat_1.send_message('hey')
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
self.chat_2.send_message(self.text_message)
[home.click_system_back_button_until_element_is_shown() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi("Open community to message") self.home_1.just_fyi("Open community to message")
self.home_1.communities_tab.click() self.home_1.communities_tab.click()
self.community_name = self.home_1.get_random_chat_name() self.community_name = self.home_1.get_random_chat_name()
@ -539,6 +546,77 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
channel_1_element.click() channel_1_element.click()
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(702894)
def test_community_contact_block_unblock_offline(self):
[home.jump_to_card_by_text('# %s' % self.channel_name) for home in [self.home_1, self.home_2]]
self.channel_2.just_fyi("Sending message before block")
message_to_disappear = "I should not be in chat"
self.channel_2.send_message(message_to_disappear)
self.chat_1.just_fyi('Block user')
self.channel_1.chat_element_by_text(message_to_disappear).wait_for_visibility_of_element(30)
chat_element = self.channel_1.chat_element_by_text(message_to_disappear)
chat_element.find_element()
chat_element.member_photo.click()
self.channel_1.block_contact()
self.chat_1.just_fyi('messages from blocked user are hidden in public chat and close app')
if self.chat_1.chat_element_by_text(message_to_disappear).is_element_displayed():
self.errors.append("Messages from blocked user is not cleared in public chat ")
self.chat_1.jump_to_messages_home()
if self.home_1.element_by_text(self.default_username_2).is_element_displayed():
self.errors.append("1-1 chat from blocked user is not removed!")
self.chat_1.toggle_airplane_mode()
self.home_2.just_fyi('send message to public chat while device 1 is offline')
message_blocked, message_unblocked = "Message from blocked user", "Hurray! unblocked"
self.channel_2.send_message(message_blocked)
self.chat_1.just_fyi('check that new messages from blocked user are not delivered')
self.chat_1.toggle_airplane_mode()
self.home_1.jump_to_card_by_text('# %s' % self.channel_name)
for message in message_to_disappear, message_blocked:
if self.chat_1.chat_element_by_text(message).is_element_displayed(30):
self.errors.append(
"'%s' from blocked user is fetched from offline in community channel" % message)
self.chat_2.just_fyi('Unblock user and check that can see further messages')
# TODO: still no blocked users in new UI
profile_1 = self.home_1.get_profile_view()
self.home_1.jump_to_messages_home()
self.chat_1.profile_button.click()
profile_1.contacts_button.wait_and_click()
profile_1.blocked_users_button.wait_and_click()
profile_1.element_by_text(self.default_username_2).click()
self.chat_1.unblock_contact_button.click()
self.chat_1.close_button.click()
self.chat_1.click_system_back_button_until_element_is_shown()
self.home_2.just_fyi("Check that can send message in community after unblock")
[home.jump_to_card_by_text('# %s' % self.channel_name) for home in [self.home_1, self.home_2]]
self.chat_2.send_message(message_unblocked)
if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed(30):
self.errors.append("Message was not received in public chat after user unblock!")
# TODO: 15279 - user is not removed from contacts mutually
# self.home_2.just_fyi("Add blocked user to contacts again after removing(removed automatically when blocked)")
# chat_element = self.channel_1.chat_element_by_text(message_unblocked)
# chat_element.find_element()
# chat_element.member_photo.click()
# self.channel_1.profile_add_to_contacts_button.click()
# self.channel_1.profile_send_message_button.click()
# self.chat_1.send_message("piy")
#
# self.home_2.just_fyi("Check message in 1-1 chat after unblock")
# self.home_2.jump_to_messages_home()
# self.home_2.get_chat(self.default_username_1).click()
# self.chat_2.send_message(message_unblocked)
# # self.home_1.get_chat(self.default_username_2, wait_time=30).click()
# if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed():
# self.errors.append("Message was not received in 1-1 chat after user unblock!")
self.errors.verify_no_errors()
# @marks.testrail_id(702842) # @marks.testrail_id(702842)
# Skipped until implemented in NEW UI # Skipped until implemented in NEW UI
# def test_community_mark_all_messages_as_read(self): # def test_community_mark_all_messages_as_read(self):

View File

@ -788,7 +788,7 @@ class TestGroupChatMultipleDeviceMediumMerged(MultipleSharedDeviceTestCase):
if not group_info_1.user_admin(self.usernames[0]).is_element_displayed(): if not group_info_1.user_admin(self.usernames[0]).is_element_displayed():
self.errors.append("Admin user is not marked as admin") self.errors.append("Admin user is not marked as admin")
group_info_1.get_user_from_group_info(self.usernames[0]).click() group_info_1.get_user_from_group_info(self.usernames[0]).click()
if self.chats[0].profile_block_contact.is_element_displayed(): if self.chats[0].profile_block_contact_button.is_element_displayed():
self.errors.append("Admin is redirected to own profile on tapping own username from group info") self.errors.append("Admin is redirected to own profile on tapping own username from group info")
self.chats[0].just_fyi('Made admin another user and check system message') self.chats[0].just_fyi('Made admin another user and check system message')

View File

@ -610,6 +610,10 @@ class BaseView(object):
self.jump_to_button.click() self.jump_to_button.click()
self.communities_tab.click() self.communities_tab.click()
def jump_to_card_by_text(self, text: str):
self.jump_to_button.click()
self.element_by_text(text).click()
def reopen_app(self, password=common_password): def reopen_app(self, password=common_password):
self.driver.close_app() self.driver.close_app()
self.driver.launch_app() self.driver.launch_app()

View File

@ -746,13 +746,13 @@ class ChatView(BaseView):
# Contact's profile # Contact's profile
self.contact_profile_picture = ProfilePictureElement(self.driver) self.contact_profile_picture = ProfilePictureElement(self.driver)
self.profile_send_message = ProfileSendMessageButton(self.driver) self.profile_send_message_button = ProfileSendMessageButton(self.driver)
self.profile_block_contact = ProfileBlockContactButton(self.driver) self.profile_block_contact_button = ProfileBlockContactButton(self.driver)
self.confirm_block_contact_button = Button(self.driver, accessibility_id="block-contact-confirm") self.confirm_block_contact_button = Button(self.driver, accessibility_id="block-contact-confirm")
self.unblock_contact_button = UnblockContactButton(self.driver) self.unblock_contact_button = UnblockContactButton(self.driver)
self.profile_mute_contact = Button(self.driver, accessibility_id="Mute-item-button") self.profile_mute_contact = Button(self.driver, accessibility_id="Mute-item-button")
self.profile_unmute_contact = Button(self.driver, accessibility_id="Unmute-item-button") self.profile_unmute_contact = Button(self.driver, accessibility_id="Unmute-item-button")
self.profile_add_to_contacts = Button(self.driver, accessibility_id="Add to contacts-item-button") self.profile_add_to_contacts_button = Button(self.driver, accessibility_id="Add to contacts-item-button")
self.profile_remove_from_contacts = Button(self.driver, accessibility_id="Remove from contacts-item-button") self.profile_remove_from_contacts = Button(self.driver, accessibility_id="Remove from contacts-item-button")
self.profile_details = Button(self.driver, accessibility_id="share-button") self.profile_details = Button(self.driver, accessibility_id="share-button")
self.profile_nickname = Text(self.driver, self.profile_nickname = Text(self.driver,
@ -966,7 +966,7 @@ class ChatView(BaseView):
def view_profile_long_press(self, message=str): def view_profile_long_press(self, message=str):
self.chat_element_by_text(message).long_press_element() self.chat_element_by_text(message).long_press_element()
self.view_profile_by_avatar_button.wait_and_click() self.view_profile_by_avatar_button.wait_and_click()
self.profile_block_contact.wait_for_visibility_of_element(5) self.profile_block_contact_button.wait_for_visibility_of_element(5)
def wait_ens_name_resolved_in_chat(self, message=str, username_value=str): def wait_ens_name_resolved_in_chat(self, message=str, username_value=str):
self.driver.info("Waiting ENS name '%s' is resolved in chat" % username_value) self.driver.info("Waiting ENS name '%s' is resolved in chat" % username_value)
@ -1038,7 +1038,7 @@ class ChatView(BaseView):
def block_contact(self): def block_contact(self):
self.driver.info("Block contact from other user profile") self.driver.info("Block contact from other user profile")
self.profile_block_contact.click() self.profile_block_contact_button.click()
self.confirm_block_contact_button.click() self.confirm_block_contact_button.click()
def open_user_profile_from_public_chat(self, message): def open_user_profile_from_public_chat(self, message):

View File

@ -300,10 +300,10 @@ class HomeView(BaseView):
chat = self.get_chat_view() chat = self.get_chat_view()
chat.public_key_edit_box.click() chat.public_key_edit_box.click()
chat.public_key_edit_box.send_keys(public_key) chat.public_key_edit_box.send_keys(public_key)
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_block_contact) chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_block_contact_button)
if remove_from_contacts and chat.profile_remove_from_contacts.is_element_displayed(): if remove_from_contacts and chat.profile_remove_from_contacts.is_element_displayed():
chat.profile_remove_from_contacts.click() chat.profile_remove_from_contacts.click()
chat.profile_add_to_contacts.click() chat.profile_add_to_contacts_button.click()
if nickname: if nickname:
chat.set_nickname(nickname) chat.set_nickname(nickname)
self.click_system_back_button_until_element_is_shown() self.click_system_back_button_until_element_is_shown()
@ -339,8 +339,8 @@ class HomeView(BaseView):
self.add_a_contact_chat_bottom_sheet_button.click() self.add_a_contact_chat_bottom_sheet_button.click()
chat.public_key_edit_box.click() chat.public_key_edit_box.click()
chat.public_key_edit_box.send_keys(key) chat.public_key_edit_box.send_keys(key)
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts) chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts_button)
chat.profile_add_to_contacts.click() chat.profile_add_to_contacts_button.click()
self.click_system_back_button_until_element_is_shown() self.click_system_back_button_until_element_is_shown()
def create_community(self, name: str, description="some_description", set_image=False, file_name='sauce_logo.png', def create_community(self, name: str, description="some_description", set_image=False, file_name='sauce_logo.png',

View File

@ -369,8 +369,8 @@ class ProfileView(BaseView):
chat = self.get_chat_view() chat = self.get_chat_view()
chat.public_key_edit_box.click() chat.public_key_edit_box.click()
chat.public_key_edit_box.send_keys(public_key) chat.public_key_edit_box.send_keys(public_key)
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts) chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts_button)
chat.profile_add_to_contacts.click() chat.profile_add_to_contacts_button.click()
self.click_system_back_button_until_element_is_shown() self.click_system_back_button_until_element_is_shown()
def switch_push_notifications(self): def switch_push_notifications(self):