Skip to content

Commit d891d11

Browse files
committed
Merge branch 'mute-for-specific-amount-of-time' of https://www.github.com/status-im/status-mobile into mute-for-specific-amount-of-time
2 parents f86dde4 + d4a9e67 commit d891d11

File tree

7 files changed

+98
-76
lines changed

7 files changed

+98
-76
lines changed

test/appium/tests/critical/chats/test_1_1_public_chats.py

+4-64
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ def test_contact_add_remove_mention_default_username_nickname_public_chat(self):
463463

464464
self.chat_1.just_fyi('Add user to contacts, mention it by nickname check contact list in Profile')
465465
chat_element.member_photo.click()
466-
self.chat_1.profile_add_to_contacts.click()
466+
self.chat_1.profile_add_to_contacts_button.click()
467467
if not self.chat_1.remove_from_contacts.is_element_displayed():
468468
self.errors.append("'Add to contacts' is not changed to 'Remove from contacts'")
469469
self.chat_1.close_button.click()
@@ -528,66 +528,6 @@ def test_contact_add_remove_mention_default_username_nickname_public_chat(self):
528528
self.errors.append('Contact is shown in Profile after removing user from contacts')
529529
self.errors.verify_no_errors()
530530

531-
@marks.testrail_id(702176)
532-
def test_contact_block_unblock_public_chat_offline(self):
533-
[home.home_button.double_click() for home in [self.home_1, self.home_2]]
534-
535-
self.chat_1.just_fyi('Block user')
536-
self.home_1.get_chat("#%s" % self.pub_chat_name).click()
537-
chat_element = self.chat_1.chat_element_by_text(self.message)
538-
chat_element.find_element()
539-
chat_element.member_photo.click()
540-
self.chat_1.block_contact()
541-
542-
self.chat_1.just_fyi('messages from blocked user are hidden in public chat and close app')
543-
if self.chat_1.chat_element_by_text(self.message).is_element_displayed():
544-
self.errors.append("Messages from blocked user is not cleared in public chat ")
545-
self.chat_1.home_button.click()
546-
if self.home_1.element_by_text(self.nick).is_element_displayed():
547-
self.errors.append("1-1 chat from blocked user is not removed!")
548-
self.chat_1.toggle_airplane_mode()
549-
550-
self.home_2.just_fyi('send message to public chat while device 1 is offline')
551-
message_blocked, message_unblocked = "Message from blocked user", "Hurray! unblocked"
552-
self.home_2.get_chat("#%s" % self.pub_chat_name).click()
553-
self.chat_2.send_message(message_blocked)
554-
555-
self.chat_1.just_fyi('check that new messages from blocked user are not delivered')
556-
self.chat_1.toggle_airplane_mode()
557-
self.home_1.get_chat("#%s" % self.pub_chat_name).click()
558-
for message in self.message, message_blocked:
559-
if self.chat_1.chat_element_by_text(message).is_element_displayed():
560-
self.errors.append(
561-
"'%s' from blocked user is fetched from offline in public chat" % message)
562-
563-
self.home_1.just_fyi('Verify input field is disabled in 1-1 chat with blocked user')
564-
self.home_1.home_button.double_click()
565-
chat_1_1 = self.home_1.add_contact(self.public_key_2, add_in_contacts=False)
566-
if chat_1_1.chat_message_input.is_element_displayed():
567-
self.errors.append("Chat input field is displayed in chat with blocked user")
568-
self.home_1.home_button.double_click()
569-
self.home_1.get_chat("#%s" % self.pub_chat_name).click()
570-
571-
self.chat_2.just_fyi('Unblock user and check that can see further messages')
572-
profile_1 = self.home_1.get_profile_view()
573-
self.chat_1.profile_button.double_click()
574-
profile_1.contacts_button.wait_and_click()
575-
profile_1.blocked_users_button.wait_and_click()
576-
profile_1.element_by_text(self.nick).click()
577-
self.chat_1.unblock_contact_button.click()
578-
self.chat_1.close_button.click()
579-
[home.home_button.click(desired_view='chat') for home in [self.home_1, self.home_2]]
580-
self.chat_2.send_message(message_unblocked)
581-
self.chat_2.home_button.double_click()
582-
self.home_2.add_contact(self.sender['public_key'])
583-
self.chat_2.send_message(message_unblocked)
584-
if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed():
585-
self.errors.append("Message was not received in public chat after user unblock!")
586-
self.chat_1.home_button.click()
587-
self.home_1.get_chat(self.nick, wait_time=30).click()
588-
if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed():
589-
self.errors.append("Message was not received in 1-1 chat after user unblock!")
590-
self.errors.verify_no_errors()
591531

592532
@marks.testrail_id(702188)
593533
@marks.xfail(
@@ -806,11 +746,11 @@ def test_ens_mention_nickname_1_1_chat(self):
806746

807747
self.chat_1.just_fyi('Check redirect to user profile on mention by nickname tap')
808748
self.chat_1.chat_element_by_text(updated_message).click()
809-
if not self.chat_1.profile_block_contact.is_element_displayed():
749+
if not self.chat_1.profile_block_contact_button.is_element_displayed():
810750
self.errors.append(
811751
'No redirect to user profile after tapping on message with mention (nickname) in 1-1 chat')
812752
else:
813-
self.chat_1.profile_send_message.click()
753+
self.chat_1.profile_send_message_button.click()
814754

815755
self.chat_2.just_fyi("Check message with mention for ENS owner")
816756
self.home_2.get_chat(self.sender['username']).click()
@@ -911,7 +851,7 @@ def test_sticker_1_1_public_chat_mainnet(self):
911851
# self.chat_2.close_sticker_view_icon.click()
912852
self.chat_2.chat_item.long_press_element()
913853
self.chat_2.element_by_text('View Details').click()
914-
self.chat_2.profile_send_message.wait_and_click()
854+
self.chat_2.profile_send_message_button.wait_and_click()
915855
self.errors.verify_no_errors()
916856

917857
@marks.testrail_id(702158)

test/appium/tests/critical/test_public_chat_browsing.py

+78
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,13 @@ def prepare_devices(self):
367367
self.home_2.handle_contact_request(self.default_username_1)
368368
self.text_message = 'hello'
369369

370+
self.home_2.just_fyi("Send message to contact (need for blocking contact) test")
371+
self.chat_1 = self.home_1.get_chat(self.default_username_2).click()
372+
self.chat_1.send_message('hey')
373+
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
374+
self.chat_2.send_message(self.text_message)
375+
[home.click_system_back_button_until_element_is_shown() for home in (self.home_1, self.home_2)]
376+
370377
self.home_1.just_fyi("Open community to message")
371378
self.home_1.communities_tab.click()
372379
self.community_name = self.home_1.get_random_chat_name()
@@ -539,6 +546,77 @@ def test_community_unread_messages_badge(self):
539546
channel_1_element.click()
540547
self.errors.verify_no_errors()
541548

549+
@marks.testrail_id(702894)
550+
def test_community_contact_block_unblock_offline(self):
551+
[home.jump_to_card_by_text('# %s' % self.channel_name) for home in [self.home_1, self.home_2]]
552+
553+
self.channel_2.just_fyi("Sending message before block")
554+
message_to_disappear = "I should not be in chat"
555+
self.channel_2.send_message(message_to_disappear)
556+
557+
self.chat_1.just_fyi('Block user')
558+
self.channel_1.chat_element_by_text(message_to_disappear).wait_for_visibility_of_element(30)
559+
chat_element = self.channel_1.chat_element_by_text(message_to_disappear)
560+
chat_element.find_element()
561+
chat_element.member_photo.click()
562+
self.channel_1.block_contact()
563+
564+
self.chat_1.just_fyi('messages from blocked user are hidden in public chat and close app')
565+
if self.chat_1.chat_element_by_text(message_to_disappear).is_element_displayed():
566+
self.errors.append("Messages from blocked user is not cleared in public chat ")
567+
self.chat_1.jump_to_messages_home()
568+
if self.home_1.element_by_text(self.default_username_2).is_element_displayed():
569+
self.errors.append("1-1 chat from blocked user is not removed!")
570+
self.chat_1.toggle_airplane_mode()
571+
572+
self.home_2.just_fyi('send message to public chat while device 1 is offline')
573+
message_blocked, message_unblocked = "Message from blocked user", "Hurray! unblocked"
574+
self.channel_2.send_message(message_blocked)
575+
576+
self.chat_1.just_fyi('check that new messages from blocked user are not delivered')
577+
self.chat_1.toggle_airplane_mode()
578+
self.home_1.jump_to_card_by_text('# %s' % self.channel_name)
579+
for message in message_to_disappear, message_blocked:
580+
if self.chat_1.chat_element_by_text(message).is_element_displayed(30):
581+
self.errors.append(
582+
"'%s' from blocked user is fetched from offline in community channel" % message)
583+
584+
self.chat_2.just_fyi('Unblock user and check that can see further messages')
585+
# TODO: still no blocked users in new UI
586+
profile_1 = self.home_1.get_profile_view()
587+
self.home_1.jump_to_messages_home()
588+
self.chat_1.profile_button.click()
589+
profile_1.contacts_button.wait_and_click()
590+
profile_1.blocked_users_button.wait_and_click()
591+
profile_1.element_by_text(self.default_username_2).click()
592+
self.chat_1.unblock_contact_button.click()
593+
self.chat_1.close_button.click()
594+
self.chat_1.click_system_back_button_until_element_is_shown()
595+
596+
self.home_2.just_fyi("Check that can send message in community after unblock")
597+
[home.jump_to_card_by_text('# %s' % self.channel_name) for home in [self.home_1, self.home_2]]
598+
self.chat_2.send_message(message_unblocked)
599+
if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed(30):
600+
self.errors.append("Message was not received in public chat after user unblock!")
601+
602+
# TODO: 15279 - user is not removed from contacts mutually
603+
# self.home_2.just_fyi("Add blocked user to contacts again after removing(removed automatically when blocked)")
604+
# chat_element = self.channel_1.chat_element_by_text(message_unblocked)
605+
# chat_element.find_element()
606+
# chat_element.member_photo.click()
607+
# self.channel_1.profile_add_to_contacts_button.click()
608+
# self.channel_1.profile_send_message_button.click()
609+
# self.chat_1.send_message("piy")
610+
#
611+
# self.home_2.just_fyi("Check message in 1-1 chat after unblock")
612+
# self.home_2.jump_to_messages_home()
613+
# self.home_2.get_chat(self.default_username_1).click()
614+
# self.chat_2.send_message(message_unblocked)
615+
# # self.home_1.get_chat(self.default_username_2, wait_time=30).click()
616+
# if not self.chat_1.chat_element_by_text(message_unblocked).is_element_displayed():
617+
# self.errors.append("Message was not received in 1-1 chat after user unblock!")
618+
self.errors.verify_no_errors()
619+
542620
# @marks.testrail_id(702842)
543621
# Skipped until implemented in NEW UI
544622
# def test_community_mark_all_messages_as_read(self):

test/appium/tests/medium/test_chats_m.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ def test_group_chat_make_admin(self):
788788
if not group_info_1.user_admin(self.usernames[0]).is_element_displayed():
789789
self.errors.append("Admin user is not marked as admin")
790790
group_info_1.get_user_from_group_info(self.usernames[0]).click()
791-
if self.chats[0].profile_block_contact.is_element_displayed():
791+
if self.chats[0].profile_block_contact_button.is_element_displayed():
792792
self.errors.append("Admin is redirected to own profile on tapping own username from group info")
793793

794794
self.chats[0].just_fyi('Made admin another user and check system message')

test/appium/views/base_view.py

+4
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,10 @@ def jump_to_communities_home(self):
610610
self.jump_to_button.click()
611611
self.communities_tab.click()
612612

613+
def jump_to_card_by_text(self, text: str):
614+
self.jump_to_button.click()
615+
self.element_by_text(text).click()
616+
613617
def reopen_app(self, password=common_password):
614618
self.driver.close_app()
615619
self.driver.launch_app()

test/appium/views/chat_view.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -746,13 +746,13 @@ def __init__(self, driver):
746746

747747
# Contact's profile
748748
self.contact_profile_picture = ProfilePictureElement(self.driver)
749-
self.profile_send_message = ProfileSendMessageButton(self.driver)
750-
self.profile_block_contact = ProfileBlockContactButton(self.driver)
749+
self.profile_send_message_button = ProfileSendMessageButton(self.driver)
750+
self.profile_block_contact_button = ProfileBlockContactButton(self.driver)
751751
self.confirm_block_contact_button = Button(self.driver, accessibility_id="block-contact-confirm")
752752
self.unblock_contact_button = UnblockContactButton(self.driver)
753753
self.profile_mute_contact = Button(self.driver, accessibility_id="Mute-item-button")
754754
self.profile_unmute_contact = Button(self.driver, accessibility_id="Unmute-item-button")
755-
self.profile_add_to_contacts = Button(self.driver, accessibility_id="Add to contacts-item-button")
755+
self.profile_add_to_contacts_button = Button(self.driver, accessibility_id="Add to contacts-item-button")
756756
self.profile_remove_from_contacts = Button(self.driver, accessibility_id="Remove from contacts-item-button")
757757
self.profile_details = Button(self.driver, accessibility_id="share-button")
758758
self.profile_nickname = Text(self.driver,
@@ -966,7 +966,7 @@ def add_remove_same_reaction(self, message: str, emoji: str = 'thumbs-up'):
966966
def view_profile_long_press(self, message=str):
967967
self.chat_element_by_text(message).long_press_element()
968968
self.view_profile_by_avatar_button.wait_and_click()
969-
self.profile_block_contact.wait_for_visibility_of_element(5)
969+
self.profile_block_contact_button.wait_for_visibility_of_element(5)
970970

971971
def wait_ens_name_resolved_in_chat(self, message=str, username_value=str):
972972
self.driver.info("Waiting ENS name '%s' is resolved in chat" % username_value)
@@ -1038,7 +1038,7 @@ def play_audio_message(self, listen_time=5):
10381038

10391039
def block_contact(self):
10401040
self.driver.info("Block contact from other user profile")
1041-
self.profile_block_contact.click()
1041+
self.profile_block_contact_button.click()
10421042
self.confirm_block_contact_button.click()
10431043

10441044
def open_user_profile_from_public_chat(self, message):

test/appium/views/home_view.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,10 @@ def add_contact(self, public_key, nickname='', remove_from_contacts=False):
300300
chat = self.get_chat_view()
301301
chat.public_key_edit_box.click()
302302
chat.public_key_edit_box.send_keys(public_key)
303-
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_block_contact)
303+
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_block_contact_button)
304304
if remove_from_contacts and chat.profile_remove_from_contacts.is_element_displayed():
305305
chat.profile_remove_from_contacts.click()
306-
chat.profile_add_to_contacts.click()
306+
chat.profile_add_to_contacts_button.click()
307307
if nickname:
308308
chat.set_nickname(nickname)
309309
self.click_system_back_button_until_element_is_shown()
@@ -339,8 +339,8 @@ def send_contact_request_via_bottom_sheet(self, key:str):
339339
self.add_a_contact_chat_bottom_sheet_button.click()
340340
chat.public_key_edit_box.click()
341341
chat.public_key_edit_box.send_keys(key)
342-
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts)
343-
chat.profile_add_to_contacts.click()
342+
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts_button)
343+
chat.profile_add_to_contacts_button.click()
344344
self.click_system_back_button_until_element_is_shown()
345345

346346
def create_community(self, name: str, description="some_description", set_image=False, file_name='sauce_logo.png',

test/appium/views/profile_view.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,8 @@ def add_contact_via_contacts_list(self, public_key):
369369
chat = self.get_chat_view()
370370
chat.public_key_edit_box.click()
371371
chat.public_key_edit_box.send_keys(public_key)
372-
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts)
373-
chat.profile_add_to_contacts.click()
372+
chat.view_profile_new_contact_button.click_until_presence_of_element(chat.profile_add_to_contacts_button)
373+
chat.profile_add_to_contacts_button.click()
374374
self.click_system_back_button_until_element_is_shown()
375375

376376
def switch_push_notifications(self):

0 commit comments

Comments
 (0)