e2e: fixes shell nav (#16545)

This commit is contained in:
Tetiana Churikova 2023-07-12 11:21:39 +02:00 committed by GitHub
parent 2e397f0065
commit 7282ba04bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 31 deletions

View File

@ -979,8 +979,9 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
url_message = 'http://status.im' url_message = 'http://status.im'
self.chat_1.send_message(url_message) self.chat_1.send_message(url_message)
try: try:
self.chat_2.element_starts_with_text(url_message, 'button').wait_for_visibility_of_element(120) element = self.chat_2.chat_view_element_starts_with_text(url_message)
self.chat_2.element_starts_with_text(url_message, 'button').click_inside_element_by_coordinate(0.2, 0.5) element.wait_for_visibility_of_element(120)
element.click_inside_element_by_coordinate(0.2, 0.5)
web_view = self.chat_2.open_in_status_button.click() web_view = self.chat_2.open_in_status_button.click()
if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60): if not web_view.element_by_text('Private, Secure Communication').is_element_displayed(60):
self.errors.append('URL was not opened from 1-1 chat') self.errors.append('URL was not opened from 1-1 chat')
@ -1082,7 +1083,7 @@ class TestOneToOneChatMultipleSharedDevicesNewUi(MultipleSharedDeviceTestCase):
@marks.testrail_id(702745) @marks.testrail_id(702745)
def test_1_1_chat_non_latin_messages_stack_update_profile_photo(self): def test_1_1_chat_non_latin_messages_stack_update_profile_photo(self):
self.home_1.click_system_back_button_until_element_is_shown() self.home_1.jump_to_messages_home()
self.home_1.profile_button.click() self.home_1.profile_button.click()
self.profile_1.edit_profile_picture('sauce_logo.png') self.profile_1.edit_profile_picture('sauce_logo.png')
self.profile_1.click_system_back_button_until_element_is_shown() self.profile_1.click_system_back_button_until_element_is_shown()

View File

@ -343,8 +343,10 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
@marks.testrail_id(702808) @marks.testrail_id(702808)
def test_group_chat_offline_pn(self): def test_group_chat_offline_pn(self):
[self.homes[i].click_system_back_button_until_element_is_shown() for i in range(3)] self.homes[0].click_system_back_button_until_element_is_shown()
[self.homes[i].jump_to_messages_home() for i in range(3)]
for i in range(1, 3): for i in range(1, 3):
self.homes[i].groups_tab.click()
self.homes[i].get_chat(self.chat_name).click() self.homes[i].get_chat(self.chat_name).click()
message_1, message_2 = 'message from old member', 'message from new member' message_1, message_2 = 'message from old member', 'message from new member'
@ -364,6 +366,10 @@ class TestGroupChatMultipleDeviceMergedNewUI(MultipleSharedDeviceTestCase):
else: else:
self.errors.append('Messages PN was not fetched from offline') self.errors.append('Messages PN was not fetched from offline')
self.homes[0].click_system_back_button() self.homes[0].click_system_back_button()
# workaround for app closed after opening notifications
if not self.homes[0].chats_tab.is_element_displayed():
self.drivers[0].launch_app()
SignInView(self.drivers[0]).sign_in()
self.homes[0].chats_tab.click() self.homes[0].chats_tab.click()
self.homes[0].get_chat(self.chat_name).click() self.homes[0].get_chat(self.chat_name).click()

View File

@ -350,7 +350,7 @@ class TestCommunityOneDeviceMerged(MultipleSharedDeviceTestCase):
@marks.testrail_id(703133) @marks.testrail_id(703133)
def test_restore_multiaccount_with_waku_backup_remove_switch(self): def test_restore_multiaccount_with_waku_backup_remove_switch(self):
self.home.click_system_back_button_until_element_is_shown() self.home.jump_to_communities_home()
profile = self.home.profile_button.click() profile = self.home.profile_button.click()
profile.logout() profile.logout()
self.sign_in.recover_access(passphrase=waku_user.seed, second_user=True) self.sign_in.recover_access(passphrase=waku_user.seed, second_user=True)
@ -453,12 +453,13 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.home_2.handle_contact_request(self.username_1) self.home_2.handle_contact_request(self.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.home_2.just_fyi("Send message to contact (need for blocking contact) test")
self.chat_1 = self.home_1.get_chat(self.username_2).click() self.chat_1 = self.home_1.get_chat(self.username_2).click()
self.chat_1.send_message('hey') self.chat_1.send_message('hey')
self.chat_2 = self.home_2.get_chat(self.username_1).click() self.chat_2 = self.home_2.get_chat(self.username_1).click()
self.chat_2.send_message(self.text_message) # self.chat_2.send_message(self.text_message)
[home.click_system_back_button_until_element_is_shown() for home in self.homes] # [home.click_system_back_button_until_element_is_shown() for home in self.homes]
self.home_1.click_system_back_button_until_element_is_shown()
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()
@ -472,7 +473,9 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.community_1.send_invite_to_community(self.community_name, self.username_2) self.community_1.send_invite_to_community(self.community_name, self.username_2)
self.home_1.get_to_community_channel_from_home(self.community_name) self.home_1.get_to_community_channel_from_home(self.community_name)
self.chat_2 = self.home_2.get_chat(self.username_1).click() # self.chat_2 = self.home_2.get_chat(self.username_1).click()
self.home_2.just_fyi("Send message to contact (need for blocking contact) test")
self.chat_2.send_message(self.text_message)
self.chat_2.element_by_text_part('View').click() self.chat_2.element_by_text_part('View').click()
self.community_2.join_community() self.community_2.join_community()
self.channel_2 = self.community_2.get_channel(self.channel_name).click() self.channel_2 = self.community_2.get_channel(self.channel_name).click()
@ -487,6 +490,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.errors.append("Timestamp is not shown, expected: '%s', in fact: '%s'" % self.errors.append("Timestamp is not shown, expected: '%s', in fact: '%s'" %
(", ".join(sent_time_variants), timestamp)) (", ".join(sent_time_variants), timestamp))
self.channel_1.verify_message_is_under_today_text(message, self.errors) self.channel_1.verify_message_is_under_today_text(message, self.errors)
self.channel_2.send_message("one more message")
new_message = "new message" new_message = "new message"
self.channel_1.send_message(new_message) self.channel_1.send_message(new_message)
self.channel_2.verify_message_is_under_today_text(new_message, self.errors, 60) self.channel_2.verify_message_is_under_today_text(new_message, self.errors, 60)
@ -773,13 +777,19 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
self.channel_1.block_contact() self.channel_1.block_contact()
self.chat_1.just_fyi('Check that messages from blocked user are hidden in public chat and close app') self.chat_1.just_fyi('Check that 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(): if not self.chat_1.chat_element_by_text(message_to_disappear).is_element_disappeared(30):
self.errors.append("Messages from blocked user is not cleared in public chat ") self.errors.append("Messages from blocked user is not cleared in public chat ")
self.chat_1.jump_to_messages_home() self.chat_1.jump_to_messages_home()
if self.home_1.element_by_text(self.username_2).is_element_displayed(): if self.home_1.element_by_text(self.username_2).is_element_displayed():
self.errors.append("1-1 chat from blocked user is not removed!") self.errors.append("1-1 chat from blocked user is not removed!")
self.chat_1.toggle_airplane_mode() self.chat_1.toggle_airplane_mode()
# workaround for app closed after airplane mode
if not self.home_1.chats_tab.is_element_displayed() and \
not self.chat_1.chat_floating_screen.is_element_displayed():
self.device_1.driver.launch_app()
self.device_1.sign_in()
self.home_2.just_fyi('Send message to public chat while device 1 is offline') 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" message_blocked, message_unblocked = "Message from blocked user", "Hurray! unblocked"
self.channel_2.send_message(message_blocked) self.channel_2.send_message(message_blocked)
@ -950,6 +960,7 @@ class TestCommunityMultipleDeviceMerged(MultipleSharedDeviceTestCase):
@marks.testrail_id(702845) @marks.testrail_id(702845)
def test_community_leave(self): def test_community_leave(self):
self.home_2.click_system_back_button_until_element_is_shown()
self.home_2.jump_to_communities_home() self.home_2.jump_to_communities_home()
community = self.home_2.get_chat(self.community_name, community=True) community = self.home_2.get_chat(self.community_name, community=True)
community_to_leave = CommunityView(self.drivers[1]) community_to_leave = CommunityView(self.drivers[1])

View File

@ -68,14 +68,9 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
self.home_2.jump_to_messages_home() self.home_2.jump_to_messages_home()
self.home_2.open_activity_center_button.click() self.home_2.open_activity_center_button.click()
self.home_2.activity_unread_filter_button.click() self.home_2.activity_unread_filter_button.click()
activity_center_element = self.home_2.get_element_from_activity_center_view(self.username_1) if not self.home_2.element_by_text_part(self.home_2.get_translation_by_key("add-me-to-your-contacts")).is_element_displayed(30):
message_element = activity_center_element.message_body
message_element.wait_for_element(30)
message_text = message_element.text
if message_text != self.home_2.get_translation_by_key("add-me-to-your-contacts"):
self.errors.append( self.errors.append(
"Pending contact request is not shown on unread notification element on Activity center!," "Pending contact request is not shown on unread notification element on Activity center!")
" actual is '%s'" % message_text)
self.home_2.close_activity_centre.click() self.home_2.close_activity_centre.click()
self.errors.verify_no_errors() self.errors.verify_no_errors()
@ -83,7 +78,7 @@ class TestActivityCenterContactRequestMultipleDevicePR(MultipleSharedDeviceTestC
@marks.testrail_id(702851) @marks.testrail_id(702851)
def test_activity_center_contact_request_accept_swipe_mark_all_as_read(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.device_2.just_fyi('Device2 re-sends a contact request to Device1')
self.home_2.click_system_back_button_until_element_is_shown() self.home_2.jump_to_messages_home()
self.home_2.add_contact(self.public_key_1, remove_from_contacts=True) self.home_2.add_contact(self.public_key_1, remove_from_contacts=True)
self.device_1.just_fyi('Device1 accepts pending contact request by swiping') self.device_1.just_fyi('Device1 accepts pending contact request by swiping')
@ -261,10 +256,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
@marks.testrail_id(702957) @marks.testrail_id(702957)
def test_activity_center_mentions(self): def test_activity_center_mentions(self):
if not self.channel_2.chat_message_input.is_element_displayed(): if not self.channel_2.chat_message_input.is_element_displayed():
self.home_2.click_system_back_button_until_element_is_shown() self.channel_2.jump_to_card_by_text('# %s' % self.channel_name)
self.home_2.communities_tab.click()
self.home_2.get_chat(self.community_name, community=True).click()
self.community_2.get_channel(self.channel_name).click()
self.home_1.jump_to_communities_home() self.home_1.jump_to_communities_home()
self.device_2.just_fyi("Invited member sends a message with a mention") self.device_2.just_fyi("Invited member sends a message with a mention")
@ -300,8 +292,7 @@ class TestActivityMultipleDevicePR(MultipleSharedDeviceTestCase):
@marks.testrail_id(702958) @marks.testrail_id(702958)
def test_activity_center_admin_notification_accept_swipe(self): def test_activity_center_admin_notification_accept_swipe(self):
self.home_2.just_fyi("Clearing history") self.home_2.just_fyi("Clearing history")
self.home_2.click_system_back_button_until_element_is_shown() self.home_2.jump_to_messages_home()
self.home_2.chats_tab.click()
self.home_2.clear_chat_long_press(self.username_1) self.home_2.clear_chat_long_press(self.username_1)
[home.jump_to_communities_home() for home in (self.home_1, self.home_2)] [home.jump_to_communities_home() for home in (self.home_1, self.home_2)]

View File

@ -253,6 +253,10 @@ class BaseView(object):
self.browser_tab = BrowserTab(self.driver) self.browser_tab = BrowserTab(self.driver)
self.wallet_tab = WalletTab(self.driver) self.wallet_tab = WalletTab(self.driver)
# Floating screens (introduced by https://github.com/status-im/status-mobile/pull/16438)
self.chat_floating_screen = BaseElement(self.driver, accessibility_id=":chat-floating-screen")
self.community_floating_screen = BaseElement(self.driver, accessibility_id=":community-overview-floating-screen")
self.jump_to_button = Button(self.driver, accessibility_id="jump-to") self.jump_to_button = Button(self.driver, accessibility_id="jump-to")
self.yes_button = Button(self.driver, xpath="//*[@text='YES' or @text='GOT IT']") self.yes_button = Button(self.driver, xpath="//*[@text='YES' or @text='GOT IT']")
@ -299,6 +303,7 @@ class BaseView(object):
self.airplane_mode_button = AirplaneModeButton(self.driver) self.airplane_mode_button = AirplaneModeButton(self.driver)
self.enter_qr_edit_box = EnterQRcodeEditBox(self.driver) self.enter_qr_edit_box = EnterQRcodeEditBox(self.driver)
self.element_types = { self.element_types = {
'base': BaseElement, 'base': BaseElement,
'button': Button, 'button': Button,
@ -378,13 +383,13 @@ class BaseView(object):
def click_system_back_button_until_element_is_shown(self, attempts=3, element='home'): def click_system_back_button_until_element_is_shown(self, attempts=3, element='home'):
counter = 0 counter = 0
if self.chat_floating_screen.is_element_displayed(2) or self.community_floating_screen.is_element_displayed(2):
self.driver.press_keycode(4)
if element == 'home': if element == 'home':
element = self.chats_tab element = self.chats_tab
elif element == 'chat': elif element == 'chat':
chat = self.get_chat_view() chat = self.get_chat_view()
element = chat.chat_message_input element = chat.chat_message_input
# Old UI
# element = self.home_button
while not element.is_element_displayed(1) and counter <= attempts: while not element.is_element_displayed(1) and counter <= attempts:
self.driver.press_keycode(4) self.driver.press_keycode(4)
try: try:

View File

@ -980,7 +980,7 @@ class ChatView(BaseView):
def edit_message_in_chat(self, message_to_edit, message_to_update): def edit_message_in_chat(self, message_to_edit, message_to_update):
self.driver.info("Looking for message '%s' to edit it" % message_to_edit) self.driver.info("Looking for message '%s' to edit it" % message_to_edit)
element = self.element_by_translation_id("edit-message") element = self.element_by_translation_id("edit-message")
self.element_by_text_part(message_to_edit).long_press_until_element_is_shown(element) self.chat_view_element_starts_with_text(message_to_edit).long_press_until_element_is_shown(element)
element.click() element.click()
self.chat_message_input.clear() self.chat_message_input.clear()
self.chat_message_input.send_keys(message_to_update) self.chat_message_input.send_keys(message_to_update)
@ -988,7 +988,7 @@ class ChatView(BaseView):
def delete_message_in_chat(self, message, everyone=True): def delete_message_in_chat(self, message, everyone=True):
self.driver.info("Looking for message '%s' to delete it" % message) self.driver.info("Looking for message '%s' to delete it" % message)
self.element_by_text_part(message).long_press_element() self.chat_view_element_starts_with_text(message).long_press_element()
for_everyone, for_me = self.element_by_translation_id("delete-for-everyone"), self.element_by_translation_id( for_everyone, for_me = self.element_by_translation_id("delete-for-everyone"), self.element_by_translation_id(
"delete-for-me") "delete-for-me")
for_everyone.click() if everyone else for_me.click() for_everyone.click() if everyone else for_me.click()
@ -998,9 +998,9 @@ class ChatView(BaseView):
self.element_by_text_part(message_text).long_press_element() self.element_by_text_part(message_text).long_press_element()
self.element_by_translation_id("copy-text").click() self.element_by_translation_id("copy-text").click()
def quote_message(self, message=str): def quote_message(self, message: str):
self.driver.info("Quoting '%s' message" % message) self.driver.info("Quoting '%s' message" % message)
self.element_by_text_part(message).long_press_until_element_is_shown(self.reply_message_button) self.chat_view_element_starts_with_text(message).long_press_until_element_is_shown(self.reply_message_button)
self.reply_message_button.click() self.reply_message_button.click()
def set_reaction(self, message: str, emoji: str = 'thumbs-up', emoji_message=False): def set_reaction(self, message: str, emoji: str = 'thumbs-up', emoji_message=False):
@ -1225,3 +1225,7 @@ class ChatView(BaseView):
def authors_for_reaction(self, emoji: str): def authors_for_reaction(self, emoji: str):
return Button(self.driver, accessibility_id='authors-for-reaction-%s' % emojis[emoji]) return Button(self.driver, accessibility_id='authors-for-reaction-%s' % emojis[emoji])
def chat_view_element_starts_with_text(self, text: str):
return BaseElement(self.driver,
xpath="//*[@content-desc=':chat-floating-screen']//*[starts-with(@text,'%s')]" % text)

View File

@ -253,7 +253,7 @@ class SignInView(BaseView):
if not second_user: if not second_user:
self.i_m_new_in_status_button.click_until_presence_of_element(self.generate_keys_button) self.i_m_new_in_status_button.click_until_presence_of_element(self.generate_keys_button)
else: else:
self.show_profiles_button.click() self.show_profiles_button.wait_and_click(20)
self.plus_profiles_button.click() self.plus_profiles_button.click()
self.create_new_profile_button.click() self.create_new_profile_button.click()
self.use_recovery_phrase_button.click() self.use_recovery_phrase_button.click()