e2e: Updated error message in 702783

This commit is contained in:
Yevheniia Berdnyk 2023-06-26 12:59:29 +03:00
parent ab16ca34dd
commit cd32806c96
No known key found for this signature in database
GPG Key ID: 0642C73C66214825
5 changed files with 72 additions and 21 deletions

View File

@ -1243,9 +1243,8 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
home.get_chat(self.username_2 if i == 0 else self.username_1).click()
try:
chat_element.wait_for_status_to_be(expected_status='Delivered', timeout=120)
except TimeoutException:
self.errors.append(
'Message status was not delivered after back up online, it is "%s"!' % status)
except TimeoutException as e:
self.errors.append('%s after back up online!' % e.msg)
self.home_1.just_fyi('Device1 goes back online and checks that 1-1 chat will be fetched')
if not self.chat_1.chat_element_by_text(message_1).is_element_displayed(60):

View File

@ -367,9 +367,34 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
self.home.just_fyi("Check contacts/blocked users")
self.home.chats_tab.click()
self.home.contacts_tab.click()
for contact in waku_user.contacts:
if not self.home.element_by_text(contact).is_element_displayed(30):
self.errors.append("Contact %s was not restored from backup!" % contact)
contacts_number = self.home.get_contact_rows_count()
if contacts_number != len(waku_user.contacts):
self.errors.append(
"Incorrect contacts number restored: %s instead of %s" % (contacts_number, len(waku_user.contacts)))
else:
for i in range(contacts_number):
self.home.click_system_back_button_until_element_is_shown()
contact_row = self.home.contact_details_row(index=i + 1)
shown_name_text = contact_row.username_text.text
if shown_name_text in waku_user.contacts:
waku_user.contacts.remove(shown_name_text)
continue
else:
contact_row.click()
shown_name_text = profile.default_username_text.text
if shown_name_text in waku_user.contacts:
waku_user.contacts.remove(shown_name_text)
continue
else:
chat = self.home.get_chat_view()
chat.profile_send_message_button.click()
shown_name_text = chat.user_name_text_new_UI.text
if shown_name_text in waku_user.contacts:
waku_user.contacts.remove(shown_name_text)
continue
if waku_user.contacts:
self.errors.append(
"Contact(s) was (were) not restored from backup: %s!" % ", ".join(waku_user.contacts))
if not pytest_config_global['pr_number']:
self.home.just_fyi("Perform back up")

View File

@ -104,13 +104,13 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
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.username_2).is_element_displayed(20):
if not self.home_1.contact_details_row(username=self.username_2).is_element_displayed(20):
self.errors.append("Contact was not added to contact list after accepting contact request (as receiver)")
self.device_2.just_fyi('Device1 check that contact appeared in contact list mutually')
self.home_2.chats_tab.click()
self.home_2.contacts_tab.click()
if not self.home_2.contact_details(username=self.username_1).is_element_displayed(20):
if not self.home_2.contact_details_row(username=self.username_1).is_element_displayed(20):
self.errors.append("Contact was not added to contact list after accepting contact request (as sender)")
self.errors.verify_no_errors()

View File

@ -714,7 +714,9 @@ class ChatView(BaseView):
# Chat header
self.user_name_text = Text(self.driver, accessibility_id="chat-name-text")
self.user_name_text_new_UI = Text(self.driver, xpath="//android.view.ViewGroup/android.widget.TextView")
self.user_name_text_new_UI = Text(
self.driver,
xpath="//*[@content-desc='user-avatar']/../following-sibling::android.widget.TextView")
self.add_to_contacts = Button(self.driver, accessibility_id="add-to-contacts-button")
## Options
self.chat_options = ChatOptionsButton(self.driver)

View File

@ -22,7 +22,8 @@ class ActivityTabButton(Button):
@property
def counter(self):
return BaseElement(self.driver, xpath='//*[@content-desc="%s"]//*[@content-desc="notification-dot"]'% self.accessibility_id)
return BaseElement(self.driver,
xpath='//*[@content-desc="%s"]//*[@content-desc="notification-dot"]' % self.accessibility_id)
class ChatElement(SilentButton):
@ -31,11 +32,13 @@ class ChatElement(SilentButton):
self.community = community
self.community_channel = community_channel
if self.community_channel is True:
super().__init__(driver,
xpath="//*[@content-desc='chat-name-text']//*[starts-with(@text,'# %s')]/../.." % username_part)
super().__init__(
driver,
xpath="//*[@content-desc='chat-name-text']//*[starts-with(@text,'# %s')]/../.." % username_part)
else:
super().__init__(driver,
xpath="//*[@content-desc='chat-name-text'][starts-with(@text,'%s')]/.." % username_part)
super().__init__(
driver,
xpath="//*[@content-desc='chat-name-text'][starts-with(@text,'%s')]/.." % username_part)
def navigate(self):
if self.community:
@ -86,6 +89,7 @@ class ChatElement(SilentButton):
class NoMessageText(Text):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, xpath="%s//*[@content-desc='no-messages-text']" % parent_locator)
return NoMessageText(self.driver, self.locator)
@property
@ -121,7 +125,7 @@ class ActivityCenterElement(SilentButton):
@property
def title(self):
return Button(self.driver, xpath=self.locator+'//*[@content-desc="activity-title"]')
return Button(self.driver, xpath=self.locator + '//*[@content-desc="activity-title"]')
@property
def unread_indicator(self):
@ -183,6 +187,21 @@ class PushNotificationElement(SilentButton):
return GroupChatIconElement(self.driver, self.locator)
class ContactDetailsRow(BaseElement):
def __init__(self, driver, username=None, index=None):
main_locator = "//*[@content-desc='user-list']"
if username:
xpath_locator = "%s[*[contains(@text,'%s')]]" % (main_locator, username)
elif index:
xpath_locator = "%s[%s]" % (main_locator, index)
else:
xpath_locator = main_locator
super().__init__(driver, xpath=xpath_locator)
self.options_button = Button(self.driver, xpath="(%s//android.widget.ImageView)[2]" % xpath_locator)
self.username_text = Text(self.driver, xpath="(%s//android.widget.TextView)[2]" % xpath_locator)
class HomeView(BaseView):
def __init__(self, driver):
super().__init__(driver)
@ -206,7 +225,7 @@ class HomeView(BaseView):
self.notifications_unread_badge = BaseElement(self.driver, accessibility_id="activity-center-unread-count")
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_reject_and_delete_button = Button(self.driver, accessibility_id="reject-and-delete"
"-activity-center")
@ -220,8 +239,11 @@ class HomeView(BaseView):
self.groups_tab = Button(self.driver, accessibility_id="tab-groups")
self.contacts_tab = Button(self.driver, accessibility_id="tab-contacts")
self.contact_new_badge = Button(self.driver, accessibility_id="notification-dot")
self.pending_contact_request_button = Button(self.driver, accessibility_id="open-activity-center-contact-requests")
self.pending_contact_request_text = Text(self.driver, xpath='//*[@content-desc="pending-contact-requests-count"]/android.widget.TextView')
self.pending_contact_request_button = Button(self.driver,
accessibility_id="open-activity-center-contact-requests")
self.pending_contact_request_text = Text(
self.driver,
xpath='//*[@content-desc="pending-contact-requests-count"]/android.widget.TextView')
# Tabs and elements on community home view
self.pending_communities_tab = Button(self.driver, accessibility_id="pending-tab")
@ -362,7 +384,7 @@ class HomeView(BaseView):
self.driver.info("## Group chat %s is created successfully!" % group_chat_name, device=False)
return chat
def send_contact_request_via_bottom_sheet(self, key:str):
def send_contact_request_via_bottom_sheet(self, key: str):
chat = self.get_chat_view()
self.new_chat_button.click()
self.add_a_contact_chat_bottom_sheet_button.click()
@ -458,5 +480,8 @@ class HomeView(BaseView):
expected_element = PushNotificationElement(self.driver, pn_text)
return expected_element if expected_element.is_element_displayed(60) else False
def contact_details(self, username):
return Button(self.driver, xpath="//*[contains(@text,'%s')]/../android.view.ViewGroup/android.widget.ImageView" % username)
def contact_details_row(self, username=None, index=None):
return ContactDetailsRow(self.driver, username=username, index=index)
def get_contact_rows_count(self):
return len(ContactDetailsRow(self.driver).find_elements())