e2e: activity center

This commit is contained in:
Churikova Tetiana 2023-03-20 13:58:09 +01:00
parent 6d006c0ea9
commit a74da63c32
No known key found for this signature in database
GPG Key ID: EDE559EC439D18A0
3 changed files with 124 additions and 8 deletions

View File

@ -153,13 +153,27 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.errors.verify_no_errors()
@marks.testrail_id(702851)
def test_activity_center_contact_request_accept(self):
def test_activity_center_contact_request_accept_swipe_mark_all_as_read(self):
self.device_2.just_fyi('Device2 re-sends a contact request to Device1')
self.home_2.add_contact(self.public_key_1, remove_from_contacts=True)
self.device_1.just_fyi('Device1 accepts pending contact request and check contact list')
self.device_1.just_fyi('Device1 accepts pending contact request by swiping')
self.home_1.chats_tab.click()
self.home_1.handle_contact_request(username=self.default_username_2)
self.home_1.notifications_unread_badge.wait_for_visibility_of_element(30)
self.home_1.open_activity_center_button.click()
self.home_1.just_fyi("Mark all as read")
cr_element = self.home_1.get_element_from_activity_center_view(self.default_username_2)
self.home_1.more_options_activity_button.click()
self.home_1.mark_all_read_activity_button.click()
if cr_element.is_element_displayed():
self.errors.append("Contact request is still shown in activity centre after marking all messages as read!")
self.home_1.just_fyi("Check that can accept contact request from read notifications")
self.home_1.activity_unread_filter_button.click()
cr_element.swipe_right_on_element()
self.home_1.activity_notification_swipe_button.click()
self.home_1.close_activity_centre.click()
self.home_1.contacts_tab.click()
if not self.home_1.contact_details(username=self.default_username_2).is_element_displayed(20):
self.errors.append("Contact was not added to contact list after accepting contact request (as receiver)")
@ -246,7 +260,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(702947)
def test_activity_center_reply_read_unread_delete_filter(self):
def test_activity_center_reply_read_unread_delete_filter_swipe(self):
message_to_reply, reply_to_message_from_sender = 'something to reply to', 'this is a reply'
self.home_1.jump_to_communities_home()
self.home_1.get_chat(self.community_name, community=True).click()
@ -315,5 +329,89 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
if reply_element.is_element_displayed():
self.errors.append("Reply is still shown after removing from activity centre!")
self.home_1.just_fyi("Reset filter to show all AC notifications again")
self.home_1.reply_activity_tab_button.click()
self.home_1.mention_activity_tab_button.click()
self.home_1.all_activity_tab_button.click()
self.home_1.close_activity_centre.click()
self.errors.verify_no_errors()
@marks.testrail_id(702957)
def test_activity_center_mentions(self):
self.home_1.jump_to_communities_home()
self.home_2.jump_to_card_by_text('# %s' % self.channel_name)
self.device_2.just_fyi("Invited member sends a message with a mention")
self.channel_2.mention_user(self.default_username_1)
self.channel_2.send_message_button.click()
self.home_1.just_fyi("Checking unread indicators")
self.home_1.notifications_unread_badge.wait_for_visibility_of_element(120)
community_element_1 = self.home_1.get_chat(self.community_name, community=True)
for unread_counter in community_element_1.new_messages_counter, self.home_1.communities_tab.counter:
if not unread_counter.is_element_displayed(60):
self.errors.append('New message counter badge is not shown while mentioned!')
if int(unread_counter.text) != 1:
self.errors.append('New message counter badge is not 1, it is %s!' % unread_counter.text)
self.home_1.just_fyi("Checking mention attributes in activity center")
self.home_1.open_activity_center_button.click()
mention_element = self.home_1.get_element_from_activity_center_view('@%s' % self.default_username_1)
if mention_element.title.text != 'Mention':
self.errors.append("Expected title is not shown, '%s' is instead!" % mention_element.title)
if not mention_element.unread_indicator.is_element_displayed():
self.errors.append("No unread dot is shown on activity center element (mention)!")
if mention_element.message_body.text != '@%s' % self.default_username_1:
self.errors.append("Mention body in activity center does not match expected, it is %s!" % mention_element.message_body.text)
self.home_1.just_fyi("Tap on it and check redirect to channel")
mention_element.click()
if not self.channel_1.chat_element_by_text(self.default_username_1).is_element_displayed():
self.errors.append("Was not redirected to chat after tapping on mention!")
self.errors.verify_no_errors()
@marks.testrail_id(702958)
def test_activity_center_admin_notification_accept_swipe(self):
self.home_2.just_fyi("Clearing history")
self.home_2.jump_to_messages_home()
self.home_2.clear_chat_long_press(self.default_username_1)
[home.jump_to_communities_home() for home in (self.home_1, self.home_2)]
self.home_1.just_fyi("Open community to message")
self.home_1.communities_tab.click()
community_name = 'commun_to_check_notif'
self.channel_name = self.home_1.get_random_chat_name()
self.home_1.create_community(name=community_name, description='community to test', require_approval=True)
self.home_1.click_system_back_button_until_element_is_shown()
community_element = self.home_1.get_chat(community_name, community=True)
self.community_1.share_community(community_element, self.default_username_2)
self.home_1.just_fyi("Request access to community")
self.home_2.jump_to_messages_home()
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
self.chat_2.element_by_text_part('View').click()
self.community_2.request_access_button.click()
self.community_2.jump_to_communities_home()
self.home_1.just_fyi("Checking unread indicators")
self.home_1.notifications_unread_badge.wait_for_visibility_of_element(120)
self.home_1.open_activity_center_button.click()
reply_element = self.home_1.get_element_from_activity_center_view(self.default_username_2)
if reply_element.title.text != 'Join request':
self.errors.append("Expected title is not shown, '%s' is instead!" % reply_element.title)
if not reply_element.unread_indicator.is_element_displayed():
self.errors.append("No unread dot is shown on activity center element!")
reply_element.swipe_right_on_element()
self.home_1.activity_notification_swipe_button.click()
self.home_1.close_activity_centre.click()
self.home_2.just_fyi("Checking that community appeared on thr list")
if not self.home_2.element_by_text_part(community_name).is_element_displayed(30):
self.errors.append("Community is not appeared in the list after accepting admin request from activity centre")
self.errors.verify_no_errors()

View File

@ -347,6 +347,8 @@ class CommunityView(HomeView):
self.community_info_picture = Button(self.driver, accessibility_id="chat-icon")
self.leave_community_button = Button(self.driver, translation_id="leave-community")
self.edit_community_button = Button(self.driver, translation_id="edit-community")
self.share_community_button = Button(self.driver, accessibility_id="share-community")
self.share_community_link_button = Button(self.driver, accessibility_id="share-community-link")
# Members
self.invite_people_button = Button(self.driver, accessibility_id="community-invite-people")
@ -418,11 +420,21 @@ class CommunityView(HomeView):
self.share_invite_button.click_until_presence_of_element(self.invite_button)
self.back_button.click_until_presence_of_element(self.plus_button)
def share_community(self, coummunity_element, user_names_to_share):
if isinstance(user_names_to_share, str):
user_names_to_share = [user_names_to_share]
self.driver.info("Share to %s community" % ', '.join(map(str, user_names_to_share)))
coummunity_element.long_press_until_element_is_shown(self.share_community_button)
self.share_community_button.click()
for user_name in user_names_to_share:
user_contact = self.element_by_text_part(user_name)
user_contact.scroll_and_click()
self.share_community_link_button.click()
class PreviewMessage(ChatElementByText):
def __init__(self, driver, text: str):
super().__init__(driver, text=text)
# self.locator += "/android.view.ViewGroup/android.view.ViewGroup"
@staticmethod
def return_element_or_empty(obj):
@ -670,7 +682,7 @@ class ChatView(BaseView):
self.clear_history_button = Button(self.driver, translation_id="clear-history")
self.reply_message_button = Button(self.driver, translation_id="message-reply")
self.share_chat_button = Button(self.driver, accessibility_id="share-chat-button")
self.clear_button = Button(self.driver, translation_id="clear", uppercase=True)
self.clear_button = Button(self.driver, translation_id="clear-history")
self.view_profile_button = ViewProfileButton(self.driver)
self.view_profile_by_avatar_button = Button(self.driver, accessibility_id="member-photo")
self.user_options = Button(self.driver, accessibility_id="options")

View File

@ -126,6 +126,10 @@ class ActivityCenterElement(SilentButton):
def unread_indicator(self):
return Button(self.driver, xpath=self.locator + '//*[@content-desc="activity-unread-indicator"]')
@property
def message_body(self):
return Button(self.driver, xpath=self.locator + '//*[@content-desc="activity-message-body"]')
def handle_cr(self, element_accessibility: str):
try:
accept_element = Button(self.driver,
@ -220,7 +224,7 @@ class HomeView(BaseView):
# Options on long tap
self.chats_menu_invite_friends_button = Button(self.driver, accessibility_id="chats-menu-invite-friends-button")
self.delete_chat_button = Button(self.driver, translation_id="delete-chat")
self.clear_history_button = Button(self.driver, accessibility_id="clear-history-button")
self.clear_history_button = Button(self.driver, accessibility_id="clear-history")
self.mark_all_messages_as_read_button = Button(self.driver, accessibility_id="mark-all-read-button")
# Connection icons
@ -252,11 +256,13 @@ class HomeView(BaseView):
self.setup_chat_button = Button(self.driver, accessibility_id="next-button")
# Activity centre
self.all_activity_tab_button = ActivityTabButton(self.driver, translation_id="all")
self.mention_activity_tab_button = ActivityTabButton(self.driver, accessibility_id="tab-mention")
self.reply_activity_tab_button = ActivityTabButton(self.driver, accessibility_id="tab-reply")
self.activity_notification_swipe_button = Button(self.driver, accessibility_id="notification-swipe")
self.activity_unread_filter_button = Button(self.driver, accessibility_id="selector-filter")
self.more_options_activity_button = Button(self.driver, accessibility_id="activity-center-open-more")
self.mark_all_read_activity_button = Button(self.driver, translation_id="mark-all-notifications-as-read")
def wait_for_syncing_complete(self):
self.driver.info('Waiting for syncing to complete')