diff --git a/test/appium/support/test_rerun.py b/test/appium/support/test_rerun.py index 086fe72fba..418d96fa2e 100644 --- a/test/appium/support/test_rerun.py +++ b/test/appium/support/test_rerun.py @@ -15,6 +15,7 @@ RERUN_ERRORS = [ "503 Service Unavailable", "AttributeError: 'NoneType' object has no attribute 'find_element'", "[Errno 104] Connection reset by peer" + "AttributeError: 'NoneType' object has no attribute" ] diff --git a/test/appium/tests/atomic/chats/test_commands.py b/test/appium/tests/atomic/chats/test_commands.py index a7040efd05..1316bccdff 100644 --- a/test/appium/tests/atomic/chats/test_commands.py +++ b/test/appium/tests/atomic/chats/test_commands.py @@ -1,3 +1,5 @@ +from selenium.common.exceptions import TimeoutException + from tests import marks, transaction_users, common_password from tests.base_test_case import MultipleDeviceTestCase from views.sign_in_view import SignInView @@ -7,40 +9,55 @@ from views.sign_in_view import SignInView @marks.transaction class TestCommands(MultipleDeviceTestCase): - @marks.skip - @marks.testrail_case_id(3697) + @marks.testrail_case_id(3742) def test_network_mismatch_for_send_request_commands(self): - recipient = transaction_users['C_USER'] sender = self.senders['d_user'] = transaction_users['D_USER'] self.create_drivers(2) device_1_sign_in, device_2_sign_in = SignInView(self.drivers[0]), SignInView(self.drivers[1]) - for user_details in (sender, device_1_sign_in), (recipient, device_2_sign_in): - user_details[1].recover_access(passphrase=user_details[0]['passphrase'], - password=user_details[0]['password']) + device_1_sign_in.recover_access(passphrase=sender['passphrase'], password=sender['password']) + device_2_sign_in.create_user() device_1_home, device_2_home = device_1_sign_in.get_home_view(), device_2_sign_in.get_home_view() - device_2_profile = device_2_home.profile_button.click() + public_key = device_2_home.get_public_key() + device_2_profile = device_2_home.get_profile_view() device_2_profile.switch_network('Mainnet with upstream RPC') device_2_sign_in.click_account_by_position(0) device_2_sign_in.sign_in() - device_1_chat = device_1_home.add_contact(recipient['public_key']) + device_1_chat = device_1_home.add_contact(public_key) amount_1 = device_1_chat.get_unique_amount() device_1_chat.send_transaction_in_1_1_chat(amount_1, common_password, wallet_set_up=True) - assert device_1_chat.chat_element_by_text(amount_1).status.text == 'Sent' + status_text_1 = device_1_chat.chat_element_by_text(amount_1).status.text + if status_text_1 != 'Sent': + self.errors.append("Message about sent funds has status '%s' instead of 'Sent'" % status_text_1) device_2_chat = device_2_home.get_chat_with_user(sender['username']).click() chat_element_1 = device_2_chat.chat_element_by_text(amount_1) - chat_element_1.wait_for_visibility_of_element(120) - assert chat_element_1.status.text == 'Network mismatch' - assert chat_element_1.contains_text('On testnet') + try: + chat_element_1.wait_for_visibility_of_element(120) + if chat_element_1.status.text != 'Network mismatch': + self.errors.append("'Network mismatch' warning is not shown for send transaction message") + if not chat_element_1.contains_text('testnet'): + self.errors.append("Sent transaction message doesn't contain text 'testnet'") + except TimeoutException: + self.errors.append('Sent transaction message was not received') amount_2 = device_1_chat.get_unique_amount() device_1_chat.request_transaction_in_1_1_chat(amount_2) - assert device_1_chat.chat_element_by_text(amount_2).status.text == 'Sent' + status_text_2 = device_1_chat.chat_element_by_text(amount_2).status.text + if status_text_2 != 'Sent': + self.errors.append("Request funds message has status '%s' instead of 'Sent'" % status_text_2) chat_element_2 = device_2_chat.chat_element_by_text(amount_2) - chat_element_2.wait_for_visibility_of_element(120) - assert chat_element_2.status.text == 'Network mismatch' - assert chat_element_2.contains_text('On testnet') - assert chat_element_2.contains_text('Transaction Request') + try: + chat_element_2.wait_for_visibility_of_element(120) + if chat_element_2.status.text != 'Network mismatch': + self.errors.append("'Network mismatch' warning is not shown for request funds message") + if not chat_element_2.contains_text('On testnet'): + self.errors.append("Request funds message doesn't contain text 'testnet'") + if not chat_element_2.contains_text('Transaction Request'): + self.errors.append("Request funds message doesn't contain text 'Transaction Request'") + except TimeoutException: + self.errors.append('Request funds message was not received') + + self.verify_no_errors() diff --git a/test/appium/tests/atomic/chats/test_one_to_one.py b/test/appium/tests/atomic/chats/test_one_to_one.py index ada44b6bb6..04cdb4b4e3 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -74,7 +74,7 @@ class TestMessagesOneToOneChat(MultipleDeviceTestCase): chat_1 = chat_element.click() chat_1.chat_element_by_text(message_2).wait_for_visibility_of_element(180) - @marks.testrail_case_id(3701) + @marks.testrail_case_id(3741) def test_resend_message_offline(self): self.create_drivers(2, offline_mode=True) device_1, device_2 = self.drivers[0], self.drivers[1] @@ -93,7 +93,7 @@ class TestMessagesOneToOneChat(MultipleDeviceTestCase): chat_1.chat_message_input.send_keys(message) chat_1.send_message_button.click() progress_time = chat_1.chat_element_by_text(message).progress_bar.measure_time_while_element_is_shown() - if not 9 < progress_time < 11: + if not 9 < progress_time < 15: self.errors.append('Progress indicator is shown during %s seconds' % progress_time) device_1.set_network_connection(2) # turning on WiFi connection @@ -113,7 +113,7 @@ class TestMessagesOneToOneChat(MultipleDeviceTestCase): self.verify_no_errors() - @marks.testrail_case_id(3710) + @marks.testrail_case_id(3743) def test_messaging_in_different_networks(self): self.create_drivers(2, offline_mode=True) device_1, device_2 = self.drivers[0], self.drivers[1] diff --git a/test/appium/tests/atomic/test_sign_in.py b/test/appium/tests/atomic/test_sign_in.py index 3c4b68687c..f8f494baff 100644 --- a/test/appium/tests/atomic/test_sign_in.py +++ b/test/appium/tests/atomic/test_sign_in.py @@ -7,7 +7,7 @@ from views.sign_in_view import SignInView @marks.sign_in class TestSignIn(MultipleDeviceTestCase): - @marks.testrail_case_id(1432) + @marks.testrail_case_id(3740) def test_offline_login(self): self.create_drivers(1, offline_mode=True) driver = self.drivers[0] diff --git a/test/appium/tests/test_profile.py b/test/appium/tests/test_profile.py index bd8514b872..ccb7261dfb 100644 --- a/test/appium/tests/test_profile.py +++ b/test/appium/tests/test_profile.py @@ -163,6 +163,7 @@ class TestProfileView(SingleDeviceTestCase): sign_in_view.do_not_share.wait_for_element(10) sign_in_view.do_not_share.click_until_presence_of_element(sign_in_view.home_button) profile_view = sign_in_view.profile_button.click() + profile_view.swipe_down() assert profile_view.username_text.text == '%s %s' % (username, emoji.EMOJI_UNICODE[emoji_name]) profile_view.logout_button.click() profile_view.confirm_logout_button.click() diff --git a/test/appium/tests/test_transaction.py b/test/appium/tests/test_transaction.py index 44fca8982b..17249beb37 100644 --- a/test/appium/tests/test_transaction.py +++ b/test/appium/tests/test_transaction.py @@ -29,8 +29,6 @@ class TestTransaction(SingleDeviceTestCase): home_view.add_contact(recipient['public_key']) chat_view = home_view.get_chat_with_user(recipient['username']).click() chat_view.send_transaction_in_1_1_chat(transaction_amount, common_password) - send_transaction_view = chat_view.get_send_transaction_view() - send_transaction_view.back_button.click() self.network_api.find_transaction_by_unique_amount(recipient['address'], transaction_amount) chat_view.get_back_to_home_view() home_view.wallet_button.click() diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index 1758bd22d1..e53983c287 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -1,4 +1,6 @@ import time + +import pytest from selenium.common.exceptions import TimeoutException from tests import info from views.base_element import BaseButton, BaseEditBox, BaseText, BaseElement @@ -342,14 +344,11 @@ class ChatView(BaseView): else: self.send_message_button.click_until_presence_of_element(send_transaction_view.sign_transaction_button) send_transaction_view.sign_transaction(password) - send_transaction_view.find_text_part(amount) - try: - self.find_full_text('Sent', 10) - except TimeoutException: - try: - self.find_full_text('Delivered', 10) - except TimeoutException: - self.find_full_text('Seen', 3) + chat_elem = self.chat_element_by_text(amount) + chat_elem.wait_for_visibility_of_element() + chat_elem.progress_bar.wait_for_invisibility_of_element() + if chat_elem.status.text not in ('Sent', 'Delivered', 'Seen'): + pytest.fail('Sent transaction message was not sent') def send_transaction_in_group_chat(self, amount, password, recipient): self.commands_button.click() diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index ea17928691..409f485ec4 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -126,8 +126,8 @@ class HomeView(BaseView): def get_public_key(self): profile_view = self.profile_button.click() profile_view.share_my_contact_key_button.click() - time.sleep(4) - public_key = profile_view.get_text_from_qr() + profile_view.public_key_text.wait_for_visibility_of_element() + public_key = profile_view.public_key_text.text profile_view.cross_icon.click() return public_key diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 4ef5fb0356..1968d75adb 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -289,6 +289,7 @@ class ProfileView(BaseView): raise NotImplementedError('Test case is implemented to run on SauceLabs only') self.profile_picture.template = file_name self.edit_button.click() + self.swipe_down() self.edit_picture_button.click() self.select_from_gallery_button.click() if self.allow_button.is_element_displayed(sec=10):