mirror of
https://github.com/status-im/status-react.git
synced 2025-01-22 16:59:40 +00:00
e2e: new activity center flow
This commit is contained in:
parent
ae10908984
commit
c13be92505
@ -1238,11 +1238,20 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
|||||||
self.public_key_2, self.default_username_2 = users[1]
|
self.public_key_2, self.default_username_2 = users[1]
|
||||||
|
|
||||||
self.profile_1.switch_push_notifications()
|
self.profile_1.switch_push_notifications()
|
||||||
self.profile_1.chats_tab.click()
|
|
||||||
self.chat_1 = self.home_1.add_contact(self.public_key_2)
|
self.profile_1.just_fyi("Sending contact request via Profile > Contacts")
|
||||||
|
self.profile_1.click_system_back_button_until_element_is_shown(self.profile_1.contacts_button)
|
||||||
|
self.profile_1.add_contact_via_contacts_list(self.public_key_2)
|
||||||
|
self.chat_1 = self.profile_1.open_contact_from_profile(self.default_username_2)
|
||||||
|
|
||||||
|
self.home_2.just_fyi("Accepting contact request from activity centre")
|
||||||
|
self.home_2.chats_tab.click()
|
||||||
|
self.home_2.handle_contact_request(self.default_username_1)
|
||||||
|
|
||||||
|
self.profile_1.just_fyi("Sending message to contact via Profile > Contacts > Send message")
|
||||||
|
self.chat_1.profile_send_message.click()
|
||||||
self.chat_1.send_message('hey')
|
self.chat_1.send_message('hey')
|
||||||
self.home_2.click_system_back_button_until_element_is_shown()
|
self.home_2.click_system_back_button_until_element_is_shown()
|
||||||
self.home_2.chats_tab.click()
|
|
||||||
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
|
self.chat_2 = self.home_2.get_chat(self.default_username_1).click()
|
||||||
self.message_1, self.message_2, self.message_3, self.message_4 = \
|
self.message_1, self.message_2, self.message_3, self.message_4 = \
|
||||||
"Message 1", "Message 2", "Message 3", "Message 4"
|
"Message 1", "Message 2", "Message 3", "Message 4"
|
||||||
@ -1383,9 +1392,10 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
|
|||||||
message = 'profile_photo'
|
message = 'profile_photo'
|
||||||
self.chat_1.send_message(message)
|
self.chat_1.send_message(message)
|
||||||
self.chat_2.chat_element_by_text(message).wait_for_visibility_of_element(30)
|
self.chat_2.chat_element_by_text(message).wait_for_visibility_of_element(30)
|
||||||
if not self.chat_2.chat_element_by_text(message).member_photo.is_element_differs_from_template("member2.png",
|
# Should be checked in CR flow, as for now no way to start chat with user until he is added to contacts
|
||||||
diff=5):
|
# if not self.chat_2.chat_element_by_text(message).member_photo.is_element_differs_from_template("member2.png",
|
||||||
self.errors.append("Image of user in 1-1 chat is updated even when user is not added to contacts!")
|
# diff=5):
|
||||||
|
# self.errors.append("Image of user in 1-1 chat is updated even when user is not added to contacts!")
|
||||||
|
|
||||||
self.chat_1.just_fyi("Users add to contacts each other")
|
self.chat_1.just_fyi("Users add to contacts each other")
|
||||||
[home.click_system_back_button_until_element_is_shown() for home in (self.home_1, self.home_2)]
|
[home.click_system_back_button_until_element_is_shown() for home in (self.home_1, self.home_2)]
|
||||||
|
@ -58,14 +58,16 @@ class TestPairingMultipleDevicesMerged(MultipleSharedDeviceTestCase):
|
|||||||
if self.home_2.notifications_unread_badge.is_element_displayed():
|
if self.home_2.notifications_unread_badge.is_element_displayed():
|
||||||
self.home_2.notifications_unread_badge.click()
|
self.home_2.notifications_unread_badge.click()
|
||||||
for chat in activity_centre.keys():
|
for chat in activity_centre.keys():
|
||||||
from views.home_view import ActivityCenterChatElement
|
from views.home_view import ActivityCenterElement
|
||||||
chat_in_ac = ActivityCenterChatElement(self.driver, chat_name=chat)
|
chat_in_ac = ActivityCenterElement(self.driver, username=chat)
|
||||||
if not chat_in_ac.is_element_displayed():
|
if not chat_in_ac.is_element_displayed():
|
||||||
self.errors.append('No chat "%s" in activity centre' % chat)
|
self.errors.append('No chat "%s" in activity centre' % chat)
|
||||||
else:
|
else:
|
||||||
if not chat_in_ac.chat_message_preview != activity_centre[chat]:
|
pass
|
||||||
self.errors.append('No chat preview for "%s" in activity centre, "%s" instead' %
|
# Old UI
|
||||||
chat, chat_in_ac.chat_message_preview)
|
# if not chat_in_ac.chat_message_preview != activity_centre[chat]:
|
||||||
|
# self.errors.append('No chat preview for "%s" in activity centre, "%s" instead' %
|
||||||
|
# chat, chat_in_ac.chat_message_preview)
|
||||||
else:
|
else:
|
||||||
self.home_2.driver.fail("No unread messages in Activity centre!")
|
self.home_2.driver.fail("No unread messages in Activity centre!")
|
||||||
self.errors.verify_no_errors()
|
self.errors.verify_no_errors()
|
||||||
|
@ -93,54 +93,15 @@ class ChatElement(SilentButton):
|
|||||||
return ChatImage(self.driver)
|
return ChatImage(self.driver)
|
||||||
|
|
||||||
|
|
||||||
class ActivityCenterChatElement(SilentButton):
|
class ActivityCenterElement(SilentButton):
|
||||||
def __init__(self, driver, chat_name):
|
def __init__(self, driver, username):
|
||||||
self.chat_name = chat_name
|
self.chat_name = username
|
||||||
super().__init__(driver,
|
super().__init__(driver,
|
||||||
xpath="//*[@content-desc='chat-name-or-sender-text'][starts-with(@text,'%s')]/../.." % chat_name)
|
xpath="//*[contains(@text, '%s')]/ancestor::*[@content-desc='activity']" % username)
|
||||||
|
|
||||||
def navigate(self):
|
|
||||||
from views.chat_view import ChatView
|
|
||||||
return ChatView(self.driver)
|
|
||||||
|
|
||||||
def click(self):
|
|
||||||
from views.chat_view import ChatView
|
|
||||||
desired_element = ChatView(self.driver).chat_message_input
|
|
||||||
self.click_until_presence_of_element(desired_element=desired_element)
|
|
||||||
|
|
||||||
return self.navigate()
|
|
||||||
|
|
||||||
@property
|
|
||||||
def chat_image(self):
|
|
||||||
class ChatImage(BaseElement):
|
|
||||||
def __init__(self, driver, parent_locator: str):
|
|
||||||
super().__init__(driver, xpath="%s//*[@content-desc='current-account-photo']" % parent_locator)
|
|
||||||
|
|
||||||
return ChatImage(self.driver, self.locator)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def chat_message_preview(self):
|
|
||||||
class ChatMessagePreview(BaseElement):
|
|
||||||
def __init__(self, driver, parent_locator: str):
|
|
||||||
super().__init__(driver, xpath="%s//*[@content-desc='chat-message-text']" % parent_locator)
|
|
||||||
|
|
||||||
return ChatMessagePreview(self.driver, self.locator).text
|
|
||||||
|
|
||||||
@property
|
|
||||||
def chat_name_indicator_text(self):
|
|
||||||
class ChatNameIndicatorText(BaseElement):
|
|
||||||
def __init__(self, driver, parent_locator: str):
|
|
||||||
super().__init__(driver,
|
|
||||||
xpath="(%s//*[@content-desc='chat-name-container']//android.widget.TextView)[last()]" % parent_locator)
|
|
||||||
|
|
||||||
try:
|
|
||||||
return ChatNameIndicatorText(self.driver, self.locator).text
|
|
||||||
except NoSuchElementException:
|
|
||||||
return ''
|
|
||||||
|
|
||||||
def accept_contact_request(self):
|
def accept_contact_request(self):
|
||||||
try:
|
try:
|
||||||
accept_element = Button(self.driver, xpath=self.locator + '/*[@content-desc="accept-cr"]').find_element()
|
accept_element = Button(self.driver, xpath=self.locator + '/*[@content-desc="accept-contact-request"]').find_element()
|
||||||
except NoSuchElementException:
|
except NoSuchElementException:
|
||||||
return ''
|
return ''
|
||||||
if accept_element:
|
if accept_element:
|
||||||
@ -148,13 +109,109 @@ class ActivityCenterChatElement(SilentButton):
|
|||||||
|
|
||||||
def decline_contact_request(self):
|
def decline_contact_request(self):
|
||||||
try:
|
try:
|
||||||
decline_element = Button(self.driver, xpath=self.locator + '/*[@content-desc="decline-cr"]').find_element()
|
decline_element = Button(self.driver, xpath=self.locator + '/*[@content-desc="decline-contact-request"]').find_element()
|
||||||
except NoSuchElementException:
|
except NoSuchElementException:
|
||||||
return ''
|
return ''
|
||||||
if decline_element:
|
if decline_element:
|
||||||
decline_element.click()
|
decline_element.click()
|
||||||
|
|
||||||
|
|
||||||
|
# Old UI
|
||||||
|
# def __init__(self, driver, chat_name):
|
||||||
|
# self.chat_name = chat_name
|
||||||
|
# super().__init__(driver,
|
||||||
|
# xpath="//*[@content-desc='chat-name-or-sender-text'][starts-with(@text,'%s')]/../.." % chat_name)
|
||||||
|
|
||||||
|
# def navigate(self):
|
||||||
|
# from views.chat_view import ChatView
|
||||||
|
# return ChatView(self.driver)
|
||||||
|
#
|
||||||
|
# def click(self):
|
||||||
|
# from views.chat_view import ChatView
|
||||||
|
# desired_element = ChatView(self.driver).chat_message_input
|
||||||
|
# self.click_until_presence_of_element(desired_element=desired_element)
|
||||||
|
#
|
||||||
|
# return self.navigate()
|
||||||
|
#
|
||||||
|
# @property
|
||||||
|
# def chat_image(self):
|
||||||
|
# class ChatImage(BaseElement):
|
||||||
|
# def __init__(self, driver, parent_locator: str):
|
||||||
|
# super().__init__(driver, xpath="%s//*[@content-desc='current-account-photo']" % parent_locator)
|
||||||
|
#
|
||||||
|
# return ChatImage(self.driver, self.locator)
|
||||||
|
#
|
||||||
|
# @property
|
||||||
|
# def chat_message_preview(self):
|
||||||
|
# class ChatMessagePreview(BaseElement):
|
||||||
|
# def __init__(self, driver, parent_locator: str):
|
||||||
|
# super().__init__(driver, xpath="%s//*[@content-desc='chat-message-text']" % parent_locator)
|
||||||
|
#
|
||||||
|
# return ChatMessagePreview(self.driver, self.locator).text
|
||||||
|
#
|
||||||
|
# @property
|
||||||
|
# def chat_name_indicator_text(self):
|
||||||
|
# class ChatNameIndicatorText(BaseElement):
|
||||||
|
# def __init__(self, driver, parent_locator: str):
|
||||||
|
# super().__init__(driver,
|
||||||
|
# xpath="(%s//*[@content-desc='chat-name-container']//android.widget.TextView)[last()]" % parent_locator)
|
||||||
|
#
|
||||||
|
# try:
|
||||||
|
# return ChatNameIndicatorText(self.driver, self.locator).text
|
||||||
|
# except NoSuchElementException:
|
||||||
|
# return ''
|
||||||
|
#
|
||||||
|
# def accept_contact_request(self):
|
||||||
|
# try:
|
||||||
|
# accept_element = Button(self.driver, xpath=self.locator + '/*[@content-desc="accept-cr"]').find_element()
|
||||||
|
# except NoSuchElementException:
|
||||||
|
# return ''
|
||||||
|
# if accept_element:
|
||||||
|
# accept_element.click()
|
||||||
|
#
|
||||||
|
# def decline_contact_request(self):
|
||||||
|
# try:
|
||||||
|
# decline_element = Button(self.driver, xpath=self.locator + '/*[@content-desc="decline-cr"]').find_element()
|
||||||
|
# except NoSuchElementException:
|
||||||
|
# return ''
|
||||||
|
# if decline_element:
|
||||||
|
# decline_element.click()
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# class PushNotificationElement(SilentButton):
|
||||||
|
# def __init__(self, driver, pn_text):
|
||||||
|
# self.pn_text = pn_text
|
||||||
|
# super().__init__(driver, xpath="//*[@text='%s']" % pn_text)
|
||||||
|
#
|
||||||
|
# @property
|
||||||
|
# def icon(self):
|
||||||
|
# class PnIconElement(BaseElement):
|
||||||
|
# def __init__(self, driver, parent_locator):
|
||||||
|
# super().__init__(driver,
|
||||||
|
# xpath="%s/../../../../*/*[@resource-id='android:id/message_icon']" % parent_locator)
|
||||||
|
#
|
||||||
|
# return PnIconElement(self.driver, self.locator)
|
||||||
|
#
|
||||||
|
# @property
|
||||||
|
# def username(self):
|
||||||
|
# class PnUsername(BaseElement):
|
||||||
|
# def __init__(self, driver, parent_locator):
|
||||||
|
# super().__init__(driver,
|
||||||
|
# xpath="%s/../../*[@resource-id='android:id/message_name']" % parent_locator)
|
||||||
|
#
|
||||||
|
# return PnUsername(self.driver, self.locator).text
|
||||||
|
#
|
||||||
|
# @property
|
||||||
|
# def group_chat_icon(self):
|
||||||
|
# class GroupChatIconElement(BaseElement):
|
||||||
|
# def __init__(self, driver, parent_locator):
|
||||||
|
# super().__init__(driver,
|
||||||
|
# xpath="%s/../../../../*[@resource-id='android:id/right_icon_container']" % parent_locator)
|
||||||
|
#
|
||||||
|
# return GroupChatIconElement(self.driver, self.locator)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PushNotificationElement(SilentButton):
|
class PushNotificationElement(SilentButton):
|
||||||
def __init__(self, driver, pn_text):
|
def __init__(self, driver, pn_text):
|
||||||
self.pn_text = pn_text
|
self.pn_text = pn_text
|
||||||
@ -209,6 +266,7 @@ class HomeView(BaseView):
|
|||||||
self.notifications_button = Button(self.driver, accessibility_id="notifications-button")
|
self.notifications_button = Button(self.driver, accessibility_id="notifications-button")
|
||||||
self.notifications_unread_badge = BaseElement(self.driver, accessibility_id="notifications-unread-badge")
|
self.notifications_unread_badge = BaseElement(self.driver, accessibility_id="notifications-unread-badge")
|
||||||
self.open_activity_center_button = Button(self.driver, accessibility_id="open-activity-center-button")
|
self.open_activity_center_button = Button(self.driver, accessibility_id="open-activity-center-button")
|
||||||
|
self.close_activity_centre = Button(self.driver, accessibility_id="close-activity-center")
|
||||||
|
|
||||||
self.notifications_select_button = Button(self.driver, translation_id="select")
|
self.notifications_select_button = Button(self.driver, translation_id="select")
|
||||||
self.notifications_reject_and_delete_button = Button(self.driver, accessibility_id="reject-and-delete"
|
self.notifications_reject_and_delete_button = Button(self.driver, accessibility_id="reject-and-delete"
|
||||||
@ -261,7 +319,7 @@ class HomeView(BaseView):
|
|||||||
if not chat_element.is_element_displayed(10):
|
if not chat_element.is_element_displayed(10):
|
||||||
if self.notifications_unread_badge.is_element_displayed(30):
|
if self.notifications_unread_badge.is_element_displayed(30):
|
||||||
self.open_activity_center_button.click()
|
self.open_activity_center_button.click()
|
||||||
chat_in_ac = ActivityCenterChatElement(self.driver, username[:25])
|
chat_in_ac = ActivityCenterElement(self.driver, username[:25])
|
||||||
chat_in_ac.wait_for_element(20)
|
chat_in_ac.wait_for_element(20)
|
||||||
chat_in_ac.click()
|
chat_in_ac.click()
|
||||||
return chat_element
|
return chat_element
|
||||||
@ -273,20 +331,21 @@ class HomeView(BaseView):
|
|||||||
|
|
||||||
def get_chat_from_activity_center_view(self, chat_name):
|
def get_chat_from_activity_center_view(self, chat_name):
|
||||||
self.driver.info("Looking for chat: '%s'" % chat_name)
|
self.driver.info("Looking for chat: '%s'" % chat_name)
|
||||||
chat_element = ActivityCenterChatElement(self.driver, chat_name[:25])
|
chat_element = ActivityCenterElement(self.driver, chat_name[:25])
|
||||||
return chat_element
|
return chat_element
|
||||||
|
|
||||||
def handle_contact_request(self, username: str, accept=True):
|
def handle_contact_request(self, username: str, accept=True):
|
||||||
if self.notifications_unread_badge.is_element_displayed(30):
|
if self.notifications_unread_badge.is_element_displayed(30):
|
||||||
self.open_activity_center_button.click()
|
self.open_activity_center_button.click()
|
||||||
chat_element = ActivityCenterChatElement(self.driver, username[:25])
|
chat_element = ActivityCenterElement(self.driver, username[:25])
|
||||||
if accept:
|
if accept:
|
||||||
self.driver.info("Accepting contact request for %s" % username)
|
self.driver.info("Accepting contact request for %s" % username)
|
||||||
chat_element.accept_contact_request()
|
chat_element.accept_contact_request()
|
||||||
chat_element.click()
|
|
||||||
else:
|
else:
|
||||||
self.driver.info("Rejecting contact request for %s" % username)
|
self.driver.info("Rejecting contact request for %s" % username)
|
||||||
chat_element.decline_contact_request()
|
chat_element.decline_contact_request()
|
||||||
|
self.close_activity_centre.click()
|
||||||
|
self.chats_tab.wait_for_visibility_of_element()
|
||||||
|
|
||||||
def get_username_below_start_new_chat_button(self, username_part):
|
def get_username_below_start_new_chat_button(self, username_part):
|
||||||
return Text(self.driver,
|
return Text(self.driver,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user