e2e: connecting status handling

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2021-02-16 15:57:20 +01:00
parent 7c04bb9076
commit 4f094c174d
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
9 changed files with 130 additions and 137 deletions

View File

@ -58,90 +58,6 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append('No redirected to carousel view after deleting last multiaccount')
self.errors.verify_no_errors()
@marks.testrail_id(5741)
@marks.high
def test_mobile_data_usage_popup_continue_syncing(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
sign_in_view.just_fyi("Enable mobile network to see popup and enable syncing")
sign_in_view.toggle_mobile_data()
if not sign_in_view.element_by_translation_id("mobile-syncing-sheet-title").is_element_displayed():
self.driver.fail('No popup about Mobile data is shown')
sign_in_view.wait_for_element_starts_with_text('Continue syncing').click()
sign_in_view.just_fyi("Check that selected option is stored in Profile")
profile_view = sign_in_view.profile_button.click()
profile_view.sync_settings_button.click()
profile_view.element_by_translation_id("mobile-network-settings").click()
if not profile_view.use_mobile_data.attribute_value('checked'):
self.errors.append("Use mobile data option is enabled after 'Continue syncing' selected")
if profile_view.ask_me_when_on_mobile_network.attribute_value('checked'):
self.errors.append("'Ask me when on mobile network' option not enabled even it was checked when 'Continue"
"syncing' selected!")
sign_in_view.just_fyi("Check that can join public chat and send message")
chat_name = sign_in_view.get_random_chat_name()
home = profile_view.get_back_to_home_view()
chat = home.join_public_chat(chat_name)
message = 'test message'
chat.chat_message_input.send_keys(message)
chat.send_message_button.click()
if not chat.chat_element_by_text(message).is_element_displayed():
self.errors.append("Message was not sent!")
self.errors.verify_no_errors()
@marks.testrail_id(6228)
@marks.high
def test_mobile_data_usage_popup_stop_syncing(self):
sign_in = SignInView(self.driver)
sign_in.create_user()
offline_banner_text = sign_in.get_translation_by_key("mobile-network-sheet-offline")
sign_in.just_fyi("Enable mobile network to see popup and stop syncing")
sign_in.toggle_mobile_data()
sign_in.element_by_translation_id("mobile-network-stop-syncing").wait_and_click()
if not sign_in.wait_for_element_starts_with_text(offline_banner_text, 120):
self.driver.fail('No popup about offline history is shown')
sign_in.element_by_text_part(offline_banner_text).click()
for id in "mobile-network-sheet-offline", "mobile-network-start-syncing", "mobile-network-go-to-settings":
if not sign_in.element_by_translation_id(id).is_element_displayed():
self.driver.fail("%s is not shown" % sign_in.get_translation_by_key(id))
sign_in.just_fyi("Start syncing in offline popup")
sign_in.element_by_translation_id("mobile-network-start-syncing").click()
sign_in.element_by_text_part(offline_banner_text).wait_for_invisibility_of_element(10)
if sign_in.element_by_text_part(offline_banner_text).is_element_displayed():
self.driver.fail("Popup about offline history is shown")
@marks.testrail_id(6229)
@marks.high
def test_mobile_data_usage_settings(self):
sign_in_view = SignInView(self.driver).create_user()
profile_view = sign_in_view.profile_button.click()
sign_in_view.just_fyi("Check default preferences")
profile_view.sync_settings_button.click()
profile_view.element_by_translation_id("mobile-network-settings").click()
if profile_view.use_mobile_data.text != 'OFF':
self.errors.append("Mobile data is enabled by default")
if profile_view.ask_me_when_on_mobile_network.text != "ON":
self.errors.append("'Ask me when on mobile network' is not enabled by default")
sign_in_view.just_fyi("Disable 'ask me when on mobile network' and check that it is not shown")
profile_view.ask_me_when_on_mobile_network.click()
sign_in_view.toggle_mobile_data()
if sign_in_view.element_by_translation_id("mobile-network-start-syncing").is_element_displayed(20):
self.errors.append("Popup is shown, but 'ask me when on mobile network' is disabled")
sign_in_view.just_fyi("Check 'Restore default' setting")
profile_view.element_by_text('Restore Defaults').click()
if profile_view.use_mobile_data.attribute_value("checked"):
self.errors.append("Mobile data is enabled by default")
if not profile_view.ask_me_when_on_mobile_network.attribute_value("checked"):
self.errors.append("'Ask me when on mobile network' is not enabled by default")
self.errors.verify_no_errors()
@marks.testrail_id(5323)
@marks.critical
def test_share_copy_contact_code_and_wallet_address(self):
@ -877,15 +793,20 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
profile_1.home_button.click()
public_chat_1 = home_1.join_public_chat(public_chat_name)
public_chat_1.relogin()
if not public_chat_1.element_by_text_part("Connecting").is_element_displayed(20):
self.errors.append("Indicator doesn't show 'Connecting'")
profile_1.just_fyi('check that still connected to custom mailserver after relogin')
home_1.profile_button.click()
profile_1.sync_settings_button.click()
if not profile_1.element_by_text(server_name).is_element_displayed():
self.drivers[0].fail("Not connected to custom mailserver after re-login")
profile_1.just_fyi('check that can RETRY to connect')
for _ in range(2):
public_chat_1.element_by_translation_id('mailserver-retry', 'button', uppercase=True).wait_and_click(60)
profile_1.element_by_translation_id(id='mailserver-error-title').wait_for_element(60)
public_chat_1.element_by_translation_id(id='mailserver-retry', uppercase=True).wait_and_click(60)
profile_1.just_fyi('check that can pick another mailserver and receive messages')
public_chat_1.element_by_translation_id('mailserver-pick-another', 'button', uppercase=True).wait_and_click(60)
profile_1.element_by_translation_id(id='mailserver-error-title').wait_for_element(60)
profile_1.element_by_translation_id(id='mailserver-pick-another', uppercase=True).wait_and_click(120)
mailserver = profile_1.return_mailserver_name(mailserver_ams, used_fleet)
profile_1.element_by_text(mailserver).click()
profile_1.confirm_button.click()
@ -1140,6 +1061,86 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6228)
@marks.high
def test_mobile_data_usage_complex_settings(self):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
device_1_home = device_1.create_user()
public_chat_name, public_chat_message = 'e2e-started-before', 'message to pub chat'
device_1_public = device_1_home.join_public_chat(public_chat_name)
device_1_public.send_message(public_chat_message)
device_1_home.just_fyi('set mobile data to "OFF" and check that peer-to-peer connection is still working')
device_2_home = device_2.create_user()
device_2_home.toggle_mobile_data()
device_2_home.mobile_connection_off_icon.wait_for_visibility_of_element(20)
for element in device_2_home.continue_syncing_button, device_2_home.stop_syncing_button, device_2_home.remember_my_choice_checkbox:
if not element.is_element_displayed(10):
self.drivers[0].fail('Element %s is not not shown in "Syncing mobile" bottom sheet' % element.locator)
device_2_home.stop_syncing_button.click()
if not device_2_home.mobile_connection_off_icon.is_element_displayed():
self.drivers[0].fail('No mobile connection OFF icon is shown')
device_2_home.mobile_connection_off_icon.click()
for element in device_2_home.connected_to_n_peers_text, device_2_home.waiting_for_wi_fi:
if not element.is_element_displayed():
self.errors.append("Element '%s' is not shown in Connection status bottom sheet" % element.locator)
device_2_home.click_system_back_button()
device_2_public = device_2_home.join_public_chat(public_chat_name)
if device_2_public.chat_element_by_text(public_chat_message).is_element_displayed(30):
self.errors.append("Chat history was fetched with mobile data fetching off")
public_chat_new_message = 'new message'
device_1_public.send_message(public_chat_new_message)
if not device_2_public.chat_element_by_text(public_chat_new_message).is_element_displayed(30):
self.errors.append("Peer-to-peer connection is not working when mobile data fetching is off")
device_2_home.just_fyi('set mobile data to "ON"')
device_2_home.home_button.click()
device_2_home.mobile_connection_off_icon.click()
device_2_home.use_mobile_data_switch.click()
if not device_2_home.connected_to_node_text.is_element_displayed(10):
self.errors.append("Not connected to history node after enabling fetching on mobile data")
device_2_home.click_system_back_button()
device_2_home.mobile_connection_on_icon.wait_for_visibility_of_element(10)
if not device_2_home.mobile_connection_on_icon.is_element_displayed():
self.errors.append('No mobile connection ON icon is shown')
device_2_home.get_chat('#%s'% public_chat_name).click()
if not device_2_public.chat_element_by_text(public_chat_message).is_element_displayed(30):
self.errors.append("Chat history was not fetched with mobile data fetching ON")
device_2_home.just_fyi('check redirect to sync settings by tappin "Sync" in connection status bottom sheet')
device_2_home.home_button.click()
device_2_home.mobile_connection_on_icon.click()
device_2_home.connection_settings_button.click()
if not device_2_home.element_by_translation_id("mobile-network-use-mobile").is_element_displayed():
self.errors.append("Was not redirected to sync settings after tapping on Settings in connection bottom sheet")
device_1_home.just_fyi("Check default preferences in Sync settings")
device_1_profile = device_1_home.profile_button.click()
device_1_profile.sync_settings_button.click()
if not device_1_profile.element_by_translation_id("mobile-network-use-wifi").is_element_displayed():
self.errors.append("Mobile data is enabled by default")
device_1_profile.element_by_translation_id("mobile-network-use-wifi").click()
if device_1_profile.ask_me_when_on_mobile_network.text != "ON":
self.errors.append("'Ask me when on mobile network' is not enabled by default")
device_1_profile.just_fyi("Disable 'ask me when on mobile network' and check that it is not shown")
device_1_profile.ask_me_when_on_mobile_network.click()
device_1_profile.toggle_mobile_data()
if device_1_profile.element_by_translation_id("mobile-network-start-syncing").is_element_displayed(20):
self.errors.append("Popup is shown, but 'ask me when on mobile network' is disabled")
device_1_profile.just_fyi("Check 'Restore default' setting")
device_1_profile.element_by_text('Restore Defaults').click()
if device_1_profile.use_mobile_data.attribute_value("checked"):
self.errors.append("Mobile data is enabled by default")
if not device_1_profile.ask_me_when_on_mobile_network.attribute_value("checked"):
self.errors.append("'Ask me when on mobile network' is not enabled by default")
self.errors.verify_no_errors()
@marks.testrail_id(5680)
@marks.high
@marks.skip

View File

@ -138,7 +138,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
home_2.just_fyi('Check that transaction message is fetched from offline and sign transaction')
device_2.sign_in()
home_2.connection_status.wait_for_invisibility_of_element(30)
home_2.connection_offline_icon.wait_for_invisibility_of_element(30)
home_2.get_chat(recipient_username).click()
chat_2_sender_message = chat_2.get_outgoing_transaction()
if not chat_2_sender_message.is_element_displayed():
@ -153,8 +153,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
chat_2.toggle_airplane_mode()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15, token=True)
chat_2.toggle_airplane_mode()
chat_2.connection_status.wait_for_invisibility_of_element(30)
[message.transaction_status.wait_for_element_text(message.confirmed) for message in
[message.transaction_status.wait_for_element_text(message.confirmed, wait_time=60) for message in
(chat_2_sender_message, chat_1_request_message)]
self.errors.verify_no_errors()

View File

@ -98,7 +98,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
devices_home[2].toggle_airplane_mode()
devices_chat[0].add_members_to_group_chat([devices_username[2]])
devices_home[2].toggle_airplane_mode()
devices_home[2].connection_status.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():
self.drivers[0].fail('Invite to group chat was not fetched from offline')
devices_chat[2] = devices_home[2].get_chat(chat_name).click()
@ -112,10 +112,9 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
devices_chat[2].join_chat_button.click()
devices_chat[2].send_message(message_after_adding)
devices_chat[0].toggle_airplane_mode()
devices_chat[0].connection_status.wait_for_invisibility_of_element(60)
for key in devices_chat:
if not devices_chat[key].chat_element_by_text(message_after_adding).is_element_displayed(
20):
40):
self.errors.append("Message with text '%s' was not received" % message_after_adding)
devices_chat[0].just_fyi('Send message from old member and check that it is fetched')

View File

@ -112,7 +112,6 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
profile_2 = wallet_2.profile_button.click()
profile_2.airplane_mode_button.click()
device_2.home_button.double_click()
# device_2.click_system_home_button()
chat_element = home_1.get_chat(sender['username'])
chat_element.wait_for_visibility_of_element(30)
chat_1 = chat_element.click()
@ -138,9 +137,10 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
# if not device_2.element_by_text(transaction_request_pn).is_element_displayed(60):
# self.errors.append("Push notification is not received after going back from offline")
# device_2.element_by_text(transaction_request_pn).click()
home_2.connection_status.wait_for_invisibility_of_element(120)
home_2.connection_offline_icon.wait_for_invisibility_of_element(120)
home_2.get_chat(recipient_username).click()
chat_2_sender_message = chat_2.get_outgoing_transaction()
chat_2_sender_message.wait_for_visibility_of_element(60)
chat_2_sender_message.transaction_status.wait_for_element_text(chat_2_sender_message.address_received)
send_message = chat_2_sender_message.sign_and_send.click()
send_message.next_button.click()
@ -150,8 +150,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
chat_2.toggle_airplane_mode()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True)
chat_2.toggle_airplane_mode()
chat_2.connection_status.wait_for_invisibility_of_element(60)
[message.transaction_status.wait_for_element_text(message.confirmed) for message in
[message.transaction_status.wait_for_element_text(message.confirmed, wait_time=60) for message in
(chat_2_sender_message, chat_1_request_message)]
self.errors.verify_no_errors()

View File

@ -102,25 +102,22 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
home_1.just_fyi('turn on airplane mode and check that offline status is shown on home view')
home_1.toggle_airplane_mode()
home_1.connection_status.wait_for_visibility_of_element(15)
if home_1.connection_status.text != 'Offline':
self.errors.append('Offline status is not shown in home screen')
home_1.connection_offline_icon.wait_and_click(20)
for element in home_1.not_connected_to_node_text, home_1.not_connected_to_peers_text:
if not element.is_element_displayed():
self.errors.append('Element "%s" is not shown in Connection status screen if device is offline' % element.locator)
home_1.click_system_back_button()
profile_2 = home_2.profile_button.click()
username_2 = profile_2.default_username_text.text
profile_2.get_back_to_home_view()
chat_2 = home_2.add_contact(public_key_1)
message_1 = 'test message'
chat_2.send_message(message_1)
home_2.just_fyi('turn on airplane mode and check that offline status is shown on chat view')
chat_2.toggle_airplane_mode()
chat_2.element_by_text('Offline').wait_for_visibility_of_element(15)
if chat_2.connection_status.text != 'Offline':
self.errors.append('Offline status is not shown in 1-1 chat')
home_1.just_fyi('go back online and check that 1-1 chat will be fetched')
home_1.toggle_airplane_mode()
home_1.connection_status.wait_for_invisibility_of_element(30)
chat_element = home_1.get_chat(username_2)
chat_element.wait_for_visibility_of_element(30)
chat_1 = chat_element.click()
@ -129,8 +126,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
home_1.just_fyi('checking offline fetching for another message')
chat_2.toggle_airplane_mode()
home_1.toggle_airplane_mode()
chat_2.element_by_text('Connecting to peers...').wait_for_invisibility_of_element(60)
chat_2.connection_status.wait_for_invisibility_of_element(60)
message_2 = 'one more message'
chat_2.send_message(message_2)
home_1.toggle_airplane_mode()
@ -148,7 +143,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
home_1 = profile_1.get_back_to_home_view()
public_key_2 = home_2.get_public_key_and_username()
profile_2 = home_2.get_profile_view()
profile_2.switch_network('Mainnet with upstream RPC')
profile_2.switch_network()
chat_1 = home_1.add_contact(public_key_2)
message = 'test message'
@ -431,7 +426,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
device_2_chat = chat_element.click()
if not device_2_chat.chat_element_by_text(message).is_element_displayed():
self.errors.append("Message with text '%s' was not received" % message)
device_2_chat.connection_status.wait_for_invisibility_of_element(60)
device_2_chat.add_to_contacts.click()
device_2_chat.get_back_to_home_view()

View File

@ -231,9 +231,8 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
self.driver.launch_app()
SignInView(self.driver).sign_in()
home.home_button.wait_for_visibility_of_element()
connection_text = home.connection_status.text
if connection_text != 'Offline':
self.driver.fail("Connection status text '%s' doesn't match expected 'Offline'" % connection_text)
home.connection_offline_icon.wait_for_visibility_of_element(20)
@marks.testrail_id(6225)
@marks.transaction

View File

@ -221,13 +221,12 @@ class BaseView(object):
self.next_button = Button(self.driver, translation_id="next")
self.add_button = Button(self.driver, translation_id="add")
self.save_button = Button(self.driver, translation_id="save")
self.done_button = Button(self.driver, translation_id="done") #self.locator = self.Locator.xpath_selector("//*[@content-desc='done-button' or contains(@text, 'Done')]")
self.done_button = Button(self.driver, translation_id="done")
self.delete_button = Button(self.driver, translation_id="delete", uppercase=True)
self.ok_continue_button = Button(self.driver, xpath="//*[@text='OK, CONTINUE' or @text='Okay, continue']")
self.discard_button = Button(self.driver, xpath="//*[@text='DISCARD']")
self.confirm_button = Button(self.driver, translation_id='confirm', uppercase=True)
self.connection_status = Text(self.driver,
xpath="//*[@content-desc='connection-status-text']/android.widget.TextView")
self.cross_icon = Button(self.driver, xpath="(//android.view.ViewGroup[@content-desc='icon'])[1]")
self.native_close_button = Button(self.driver, id="android:id/aerr_close")
self.show_roots_button = Button(self.driver, accessibility_id="Show roots")
@ -515,22 +514,6 @@ class BaseView(object):
self.element_by_text_part(text).click()
return self.get_chat_view()
def reconnect(self):
self.driver.info("**Reconnecting**")
connect_status = self.connection_status
for i in range(3):
if connect_status.is_element_displayed(5, ignored_exceptions=StaleElementReferenceException):
if 'Tap to reconnect' in connect_status.text:
try:
connect_status.click()
except AttributeError:
pass
try:
connect_status.wait_for_invisibility_of_element()
except TimeoutException as e:
if i == 2:
e.msg = "Device %s: Can't reconnect to mail server after 3 attempts" % self.driver.number
raise e
def find_values_in_logcat(self, **kwargs):
logcat = self.logcat

View File

@ -114,7 +114,7 @@ class ChatElementByText(Text):
try:
return super(ChatElementByText, self).find_element()
except NoSuchElementException:
ChatView(self.driver).reconnect()
self.wait_for_visibility_of_element(20)
@property
def image_in_reply(self):

View File

@ -34,9 +34,9 @@ class ChatElement(SilentButton):
return super(ChatElement, self).find_element()
except NoSuchElementException as e:
if i == 0:
HomeView(self.driver).reconnect()
self.wait_for_visibility_of_element(20)
else:
e.msg = 'Device %s: Unable to find chat with user %s' % (self.driver.number, self.username)
e.msg = 'Device %s: Unable to find chat with name %s' % (self.driver.number, self.username)
raise e
@property
@ -75,6 +75,25 @@ class HomeView(BaseView):
self.clear_history_button = Button(self.driver, accessibility_id="clear-history-button")
self.mark_all_messages_as_read_button = Button(self.driver, accessibility_id="mark-all-read-button")
# Connection icons
self.mobile_connection_off_icon = Button(self.driver, accessibility_id="conn-button-mobile-sync-off")
self.mobile_connection_on_icon = Button(self.driver, accessibility_id="conn-button-mobile-sync")
self.connection_offline_icon = Button(self.driver, accessibility_id="conn-button-offline")
# Sync using mobile data bottom sheet
self.continue_syncing_button = Button(self.driver, accessibility_id="mobile-network-continue-syncing")
self.stop_syncing_button = Button(self.driver, accessibility_id="mobile-network-stop-syncing")
self.remember_my_choice_checkbox = Button(self.driver, xpath="//*[@content-desc='remember-choice']//*[@content-desc='checkbox']")
# Connection status bottom sheet
self.connected_to_n_peers_text = Text(self.driver, accessibility_id="connected-to-n-peers")
self.connected_to_node_text = Text(self.driver, accessibility_id="connected-to-mailserver")
self.waiting_for_wi_fi = Text(self.driver, accessibility_id="waiting-wi-fi")
self.use_mobile_data_switch = Button(self.driver, accessibility_id="mobile-network-use-mobile")
self.connection_settings_button = Button(self.driver, accessibility_id="settings")
self.not_connected_to_node_text = Text(self.driver, accessibility_id="not-connected-nodes")
self.not_connected_to_peers_text = Text(self.driver, accessibility_id="not-connected-to-peers")
def wait_for_syncing_complete(self):
self.driver.info('**Waiting for syncing complete:**')
while True: