activity center: align e2e

Signed-off-by: Serhy <sergii@status.im>
This commit is contained in:
Serhy 2021-04-19 11:37:46 +03:00
parent ed4e227144
commit f4530d4d03
No known key found for this signature in database
GPG Key ID: 5D7C4B9E2B6F500B
6 changed files with 43 additions and 20 deletions

View File

@ -35,7 +35,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
sign_in.just_fyi('Delete 2nd multiaccount') sign_in.just_fyi('Delete 2nd multiaccount')
public_key, username = sign_in.get_public_key_and_username(return_username=True) public_key, username = sign_in.get_public_key_and_username(return_username=True)
profile.privacy_and_security_button.click() profile.privacy_and_security_button.click()
profile.delete_my_profile_button.click() profile.delete_my_profile_button.scroll_and_click()
for text in (username, delete_alert_warning): for text in (username, delete_alert_warning):
if not profile.element_by_text(text).is_element_displayed(): if not profile.element_by_text(text).is_element_displayed():
self.errors.append('Required %s is not shown when deleting multiaccount' % text) self.errors.append('Required %s is not shown when deleting multiaccount' % text)
@ -50,7 +50,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
sign_in.sign_in() sign_in.sign_in()
sign_in.profile_button.click() sign_in.profile_button.click()
profile.privacy_and_security_button.click() profile.privacy_and_security_button.click()
profile.delete_my_profile_button.click() profile.delete_my_profile_button.scroll_and_click()
profile.delete_my_profile_password_input.set_value(common_password) profile.delete_my_profile_password_input.set_value(common_password)
profile.delete_profile_button.click() profile.delete_profile_button.click()
profile.ok_button.click() profile.ok_button.click()

View File

@ -33,7 +33,7 @@ class TestChatManagement(SingleDeviceTestCase):
i+=1 i+=1
home.relogin() home.relogin()
for chat_name in one_to_one, public, group: for chat_name in one_to_one, public, group:
if home.get_chat(chat_name).is_element_displayed(): if home.get_chat_from_home_view(chat_name).is_element_displayed():
self.driver.fail('Deleted %s is present after relaunch app' % chat_name) self.driver.fail('Deleted %s is present after relaunch app' % chat_name)
@marks.testrail_id(5387) @marks.testrail_id(5387)
@ -65,13 +65,13 @@ class TestChatManagement(SingleDeviceTestCase):
i+=1 i+=1
chat.get_back_to_home_view() chat.get_back_to_home_view()
for chat_name in one_to_one, public, group: for chat_name in one_to_one, public, group:
if home.get_chat(chat_name).is_element_displayed(): if home.get_chat_from_home_view(chat_name).is_element_displayed():
self.errors.append('Deleted %s chat is shown, but the chat has been deleted' % chat_name) self.errors.append('Deleted %s chat is shown, but the chat has been deleted' % chat_name)
self.driver.close_app() self.driver.close_app()
self.driver.launch_app() self.driver.launch_app()
sign_in.sign_in() sign_in.sign_in()
for chat_name in one_to_one, public, group: for chat_name in one_to_one, public, group:
if home.get_chat(chat_name).is_element_displayed(): if home.get_chat_from_home_view(chat_name).is_element_displayed():
self.errors.append('Deleted %s is shown after re-login, but the chat has been deleted' % chat_name) self.errors.append('Deleted %s is shown after re-login, but the chat has been deleted' % chat_name)
# TODO: blocked due to #11683 - enable after fix # TODO: blocked due to #11683 - enable after fix
@ -707,7 +707,10 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
chat_1.block_contact() chat_1.block_contact()
device_1.just_fyi('no 1-1, messages from blocked user are hidden in public chat') device_1.just_fyi('no 1-1, messages from blocked user are hidden in public chat')
if home_1.get_chat(basic_user['username']).is_element_displayed(): from views.home_view import ChatElement
blocked_chat_user = ChatElement(self.drivers[0], basic_user['username'])
if blocked_chat_user.is_element_displayed():
home_1.driver.fail("Chat with blocked user '%s' is not deleted" % device_2.driver.number) home_1.driver.fail("Chat with blocked user '%s' is not deleted" % device_2.driver.number)
public_chat_after_block_1 = home_1.join_public_chat(chat_name) public_chat_after_block_1 = home_1.join_public_chat(chat_name)
if public_chat_after_block_1.chat_element_by_text(message_before_block_2).is_element_displayed(): if public_chat_after_block_1.chat_element_by_text(message_before_block_2).is_element_displayed():
@ -723,10 +726,8 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
chat_2.get_back_to_home_view() chat_2.get_back_to_home_view()
home_2.join_public_chat(chat_name) home_2.join_public_chat(chat_name)
chat_public_2 = home_2.get_chat_view() chat_public_2 = home_2.get_chat_view()
[chat_public_2.send_message(message_after_block_2) for _ in range(2)]
for _ in range(2):
chat_public_2.chat_message_input.send_keys(message_after_block_2)
chat_public_2.send_message_button.click()
device_1.just_fyi("check that new messages and push notifications don't arrive from blocked user") device_1.just_fyi("check that new messages and push notifications don't arrive from blocked user")
device_1.open_notification_bar() device_1.open_notification_bar()
@ -737,8 +738,10 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
if public_chat_after_block_1.chat_element_by_text(message_after_block_2).is_element_displayed(): if public_chat_after_block_1.chat_element_by_text(message_after_block_2).is_element_displayed():
self.errors.append("Message from blocked user '%s' is received" % device_2.driver.number) self.errors.append("Message from blocked user '%s' is received" % device_2.driver.number)
public_chat_after_block_1.get_back_to_home_view() public_chat_after_block_1.get_back_to_home_view()
if home_1.get_chat(basic_user['username']).is_element_displayed(): if home_1.notifications_unread_badge.is_element_displayed():
device_2.driver.fail("Chat with blocked user is reappeared after receiving new messages") device_1.driver.fail("Unread badge is shown after receiving new message from blocked user")
if blocked_chat_user.is_element_displayed():
device_2.driver.fail("Chat with blocked user is reappeared after receiving new messages in home view")
device_1.open_notification_bar() device_1.open_notification_bar()
home_1.stop_status_service_button.click() home_1.stop_status_service_button.click()
@ -756,7 +759,9 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
device_1.click_system_home_button() device_1.click_system_home_button()
self.drivers[0].launch_app() self.drivers[0].launch_app()
device_1.sign_in() device_1.sign_in()
if home_1.get_chat(basic_user['username']).is_element_displayed(): if home_1.notifications_unread_badge.is_element_displayed():
device_1.driver.fail("Unread badge is shown after after fetching new messages from offline")
if blocked_chat_user.is_element_displayed():
self.errors.append("Chat with blocked user is reappeared after fetching new messages from offline") self.errors.append("Chat with blocked user is reappeared after fetching new messages from offline")
home_1.join_public_chat(chat_name) home_1.join_public_chat(chat_name)
home_1.get_chat_view() home_1.get_chat_view()

View File

@ -109,6 +109,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
devices_chat[0].add_members_to_group_chat([devices_username[2]]) devices_chat[0].add_members_to_group_chat([devices_username[2]])
devices_home[2].toggle_airplane_mode() devices_home[2].toggle_airplane_mode()
devices_home[2].connection_offline_icon.wait_for_invisibility_of_element(60) devices_home[2].connection_offline_icon.wait_for_invisibility_of_element(60)
if not devices_home[2].get_chat(chat_name).is_element_displayed(): if not devices_home[2].get_chat(chat_name).is_element_displayed():
self.drivers[0].fail('Invite to group chat was not fetched from offline') self.drivers[0].fail('Invite to group chat was not fetched from offline')
devices_chat[2] = devices_home[2].get_chat(chat_name).click() devices_chat[2] = devices_home[2].get_chat(chat_name).click()

View File

@ -460,14 +460,16 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
device_2_chat = device_2_home.add_contact(device_1_public_key) device_2_chat = device_2_home.add_contact(device_1_public_key)
message = 'test message' message, message_2= 'test message', 'test message2'
device_2_chat.chat_message_input.send_keys(message) device_2_chat.send_message(message)
device_2_chat.send_message_button.click() chat_element = device_1_home.get_chat(default_username_2)
device_1.dapp_tab_button.click()
device_2_chat.send_message(message_2)
if device_1_home.home_button.counter.text != '1': if device_1_home.home_button.counter.text != '1':
self.errors.append('New messages counter is not shown on Home button') self.errors.append('New messages counter is not shown on Home button')
device_1.home_button.click()
chat_element = device_1_home.get_chat(default_username_2)
if chat_element.new_messages_counter.text != '1': if chat_element.new_messages_counter.text != '1':
self.errors.append('New messages counter is not shown on chat element') self.errors.append('New messages counter is not shown on chat element')

View File

@ -77,6 +77,10 @@ class HomeView(BaseView):
self.invite_friends_button = Button(self.driver, accessibility_id="invite-friends-button") self.invite_friends_button = Button(self.driver, accessibility_id="invite-friends-button")
self.stop_status_service_button = Button(self.driver, accessibility_id="STOP") self.stop_status_service_button = Button(self.driver, accessibility_id="STOP")
# Notification centre
self.notifications_button = Button(self.driver, accessibility_id="notifications-button")
self.notifications_unread_badge = Button(self.driver, accessibility_id="notifications-unread-badge")
# Options on long tap # Options on long tap
self.chats_menu_invite_friends_button = Button(self.driver, accessibility_id="chats-menu-invite-friends-button") self.chats_menu_invite_friends_button = Button(self.driver, accessibility_id="chats-menu-invite-friends-button")
self.delete_chat_button = Button(self.driver, accessibility_id="delete-chat-button") self.delete_chat_button = Button(self.driver, accessibility_id="delete-chat-button")
@ -113,7 +117,18 @@ class HomeView(BaseView):
def get_chat(self, username): def get_chat(self, username):
self.driver.info("**Looking for chat '%s'**" % username) self.driver.info("**Looking for chat '%s'**" % username)
return ChatElement(self.driver, username[:25]) chat_element = ChatElement(self.driver, username[:25])
if not chat_element.is_element_displayed():
self.notifications_unread_badge.wait_and_click(30)
chat_element.wait_for_element(20)
chat_element.click()
self.home_button.double_click()
return chat_element
def get_chat_from_home_view(self, username):
self.driver.info("**Looking for chat '%s'**" % username)
chat_element = ChatElement(self.driver, username[:25])
return chat_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, xpath="//*[@content-desc='enter-contact-code-input']/../..//*[starts-with(@text,'%s')]" % username_part) return Text(self.driver, xpath="//*[@content-desc='enter-contact-code-input']/../..//*[starts-with(@text,'%s')]" % username_part)

View File

@ -97,8 +97,8 @@ class WalletView(BaseView):
self.manage_assets_button = Button(self.driver, accessibility_id="wallet-manage-assets") self.manage_assets_button = Button(self.driver, accessibility_id="wallet-manage-assets")
self.scan_tokens_button = Button(self.driver, accessibility_id="wallet-scan-token") self.scan_tokens_button = Button(self.driver, accessibility_id="wallet-scan-token")
self.stt_check_box = Button(self.driver, xpath="//*[@text='STT']/../android.view.ViewGroup[@content-desc='checkbox']") self.stt_check_box = Button(self.driver, xpath="//*[@text='STT']/../android.view.ViewGroup[@content-desc='checkbox']")
self.all_assets_full_names = Text(self.driver, xpath="//*[@content-desc='checkbox']/../../android.widget.TextView[1]") self.all_assets_full_names = Text(self.driver, xpath="//*[@content-desc='checkbox']/../android.widget.TextView[1]")
self.all_assets_symbols = Button(self.driver, xpath="//*[@content-desc='checkbox']/../../android.widget.TextView[2]") self.all_assets_symbols = Button(self.driver, xpath="//*[@content-desc='checkbox']/../android.widget.TextView[2]")
self.currency_item_text = Text(self.driver, xpath="//*[@content-desc='currency-item']//android.widget.TextView") self.currency_item_text = Text(self.driver, xpath="//*[@content-desc='currency-item']//android.widget.TextView")