From 53c9963a4613ee621a27396ed44319ad7f5d8a25 Mon Sep 17 00:00:00 2001 From: yevh-berdnyk Date: Thu, 16 Aug 2018 19:47:13 +0300 Subject: [PATCH] False failures fix: assets, transaction users Signed-off-by: yevh-berdnyk --- .../atomic/account_management/test_profile.py | 4 ++-- .../atomic/account_management/test_sign_in.py | 5 ++++- .../test_wallet_management.py | 1 + .../tests/atomic/chats/test_chats_management.py | 3 ++- test/appium/tests/atomic/chats/test_commands.py | 9 ++++++--- .../tests/atomic/chats/test_one_to_one.py | 5 ++++- .../atomic/dapps_and_browsing/test_browsing.py | 2 +- .../transactions/test_daaps_transactions.py | 17 ++++++++++------- .../tests/atomic/transactions/test_wallet.py | 12 +++++++----- test/appium/views/wallet_view.py | 3 ++- 10 files changed, 39 insertions(+), 22 deletions(-) diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index 30bf4117f4..3e781f4c97 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -129,8 +129,8 @@ class TestProfileSingleDevice(SingleDeviceTestCase): profile_view.get_back_to_home_view() wallet_view = profile_view.wallet_button.click() wallet_view.set_up_wallet() - assert '€' in wallet_view.total_amount_text.text - assert 'EUR' == wallet_view.currency_text.text + if 'EUR' != wallet_view.currency_text.text: + pytest.fail('EUR currency is not displayed') @marks.testrail_id(3707) def test_add_custom_network(self): diff --git a/test/appium/tests/atomic/account_management/test_sign_in.py b/test/appium/tests/atomic/account_management/test_sign_in.py index 342d9af775..04a51f04a7 100644 --- a/test/appium/tests/atomic/account_management/test_sign_in.py +++ b/test/appium/tests/atomic/account_management/test_sign_in.py @@ -1,3 +1,4 @@ +import pytest import random from tests import marks, common_password @@ -68,4 +69,6 @@ class TestSignInOffline(MultipleDeviceTestCase): sign_in.accept_agreements() home = sign_in.sign_in() home.home_button.wait_for_visibility_of_element() - assert home.connection_status.text == 'Offline' + connection_text = home.connection_status.text + if connection_text != 'Offline': + pytest.fail("Connection status text '%s' doesn't match expected 'Offline'" % connection_text) diff --git a/test/appium/tests/atomic/account_management/test_wallet_management.py b/test/appium/tests/atomic/account_management/test_wallet_management.py index 5f23cbe814..2f386a8b32 100644 --- a/test/appium/tests/atomic/account_management/test_wallet_management.py +++ b/test/appium/tests/atomic/account_management/test_wallet_management.py @@ -87,6 +87,7 @@ class TestWalletManagement(SingleDeviceTestCase): wallet.asset_checkbox_by_name(select_asset).click() wallet.asset_checkbox_by_name(deselect_asset).click() wallet.done_button.click() + wallet.asset_by_name(select_asset).scroll_to_element() if not wallet.asset_by_name(select_asset).is_element_displayed(): self.errors.append('%s asset is not shown in wallet' % select_asset) if wallet.asset_by_name(deselect_asset).is_element_displayed(): diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index f967c15d16..1ad8141b20 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -129,7 +129,8 @@ class TestChatManagement(SingleDeviceTestCase): start_new_chat.start_new_chat_button.click() start_new_chat.public_key_edit_box.set_value(group_chat_users['B_USER']['public_key'][:-1]) start_new_chat.confirm() - if not start_new_chat.element_by_text('Please scan a valid contact code').is_element_displayed(): + warning_text = start_new_chat.element_by_text('Please enter or scan a valid contact code or username') + if not warning_text.is_element_displayed(): pytest.fail('Error is not shown for invalid public key') @marks.testrail_id(2175) diff --git a/test/appium/tests/atomic/chats/test_commands.py b/test/appium/tests/atomic/chats/test_commands.py index 9ef2acbcf0..c46510f466 100644 --- a/test/appium/tests/atomic/chats/test_commands.py +++ b/test/appium/tests/atomic/chats/test_commands.py @@ -1,4 +1,5 @@ import pytest +import random from _pytest.outcomes import Failed from decimal import Decimal as d from selenium.common.exceptions import TimeoutException @@ -357,14 +358,15 @@ class TestCommandsSingleDevices(SingleDeviceTestCase): def test_logcat_send_transaction_in_1_1_chat(self): sender = transaction_users['C_USER'] sign_in = SignInView(self.driver) - home = sign_in.recover_access(passphrase=sender['passphrase'], password=sender['password']) + password = random.randint(100000, 1000000) + home = sign_in.recover_access(passphrase=sender['passphrase'], password=password) wallet = home.wallet_button.click() wallet.set_up_wallet() wallet.home_button.click() chat = home.add_contact(transaction_users['D_USER']['public_key']) amount = chat.get_unique_amount() - chat.send_transaction_in_1_1_chat('ETH', amount, sender['password']) - chat.check_no_values_in_logcat(password=sender['password']) + chat.send_transaction_in_1_1_chat('ETH', amount, password) + chat.check_no_values_in_logcat(password=password) @marks.testrail_id(3736) @marks.smoke_1 @@ -466,6 +468,7 @@ class TestCommandsSingleDevices(SingleDeviceTestCase): send_transaction.back_button.click() chat_view.commands_button.click() chat_view.send_command.click() + chat_view.asset_by_name('STT').scroll_to_element() chat_view.asset_by_name('STT').click() chat_view.send_as_keyevent(str(round(stt_value + 1))) chat_view.send_message_button.click() 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 4134321da9..db77a157da 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -1,3 +1,4 @@ +import pytest import random import string import emoji @@ -499,7 +500,9 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase): message_input.send_keys(message_text) message_input.delete_last_symbols(2) - assert message_input.text == message_text[:-2] + current_text = message_input.text + if current_text != message_text[:-2]: + pytest.fail("Message input text '%s' doesn't match expected '%s'" % (current_text, message_text[:-2])) message_input.cut_text() diff --git a/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py b/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py index 07a317f9f4..d69d8d287d 100644 --- a/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py +++ b/test/appium/tests/atomic/dapps_and_browsing/test_browsing.py @@ -92,7 +92,7 @@ class TestBrowsing(SingleDeviceTestCase): start_new_chat.confirm() browsing_view = start_new_chat.get_base_web_view() browsing_view.wait_for_d_aap_to_load() - assert browsing_view.element_by_text('Google').is_element_displayed() + browsing_view.element_by_text('Google').find_element() @marks.testrail_id(1397) @marks.smoke_1 diff --git a/test/appium/tests/atomic/transactions/test_daaps_transactions.py b/test/appium/tests/atomic/transactions/test_daaps_transactions.py index 147db720f1..0b02450df4 100644 --- a/test/appium/tests/atomic/transactions/test_daaps_transactions.py +++ b/test/appium/tests/atomic/transactions/test_daaps_transactions.py @@ -1,6 +1,7 @@ import pytest +import random -from tests import transaction_users, marks, common_password +from tests import transaction_users, marks from tests.base_test_case import SingleDeviceTestCase from views.sign_in_view import SignInView @@ -64,30 +65,32 @@ class TestTransactionDApp(SingleDeviceTestCase): def test_logcat_send_transaction_from_daap(self): sender = transaction_users['B_USER'] sign_in_view = SignInView(self.driver) - sign_in_view.recover_access(sender['passphrase'], sender['password']) + password = random.randint(100000, 1000000) + sign_in_view.recover_access(sender['passphrase'], password) wallet_view = sign_in_view.wallet_button.click() wallet_view.set_up_wallet() status_test_dapp = sign_in_view.open_status_test_dapp() status_test_dapp.wait_for_d_aap_to_load() status_test_dapp.assets_button.click() send_transaction_view = status_test_dapp.request_stt_button.click() - send_transaction_view.sign_transaction(sender['password']) - send_transaction_view.check_no_values_in_logcat(password=sender['password']) + send_transaction_view.sign_transaction(password) + send_transaction_view.check_no_values_in_logcat(password=password) @marks.logcat @marks.testrail_id(3775) def test_logcat_sign_message_from_daap(self): sign_in_view = SignInView(self.driver) - sign_in_view.create_user() + password = random.randint(100000, 1000000) + sign_in_view.create_user(password=password) status_test_dapp = sign_in_view.open_status_test_dapp() status_test_dapp.wait_for_d_aap_to_load() status_test_dapp.transactions_button.click() send_transaction_view = status_test_dapp.sign_message_button.click() send_transaction_view.sign_transaction_button.click_until_presence_of_element( send_transaction_view.enter_password_input) - send_transaction_view.enter_password_input.send_keys(common_password) + send_transaction_view.enter_password_input.send_keys(password) send_transaction_view.sign_transaction_button.click() - send_transaction_view.check_no_values_in_logcat(password=common_password) + send_transaction_view.check_no_values_in_logcat(password=password) @marks.testrail_id(1380) @marks.smoke_1 diff --git a/test/appium/tests/atomic/transactions/test_wallet.py b/test/appium/tests/atomic/transactions/test_wallet.py index 9049e5b745..b5e82b409f 100644 --- a/test/appium/tests/atomic/transactions/test_wallet.py +++ b/test/appium/tests/atomic/transactions/test_wallet.py @@ -160,7 +160,8 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): sender = transaction_users['E_USER'] recipient = transaction_users['F_USER'] sign_in_view = SignInView(self.driver) - sign_in_view.recover_access(sender['passphrase'], sender['password']) + password = random.randint(100000, 1000000) + sign_in_view.recover_access(sender['passphrase'], password) home_view = sign_in_view.get_home_view() wallet_view = home_view.wallet_button.click() wallet_view.set_up_wallet() @@ -173,8 +174,8 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): send_transaction.enter_recipient_address_button.click() send_transaction.enter_recipient_address_input.set_value(recipient['address']) send_transaction.done_button.click() - send_transaction.sign_transaction(sender['password']) - send_transaction.check_no_values_in_logcat(password=sender['password']) + send_transaction.sign_transaction(password) + send_transaction.check_no_values_in_logcat(password=password) @marks.testrail_id(3746) @marks.smoke_1 @@ -242,7 +243,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): @marks.testrail_id(1405) def test_send_valid_amount_after_insufficient_funds_error(self): - sender = transaction_users['H_USER'] + sender = transaction_users['G_USER'] sign_in_view = SignInView(self.driver) sign_in_view.recover_access(sender['passphrase'], sender['password']) wallet_view = sign_in_view.wallet_button.click() @@ -260,7 +261,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): send_transaction.confirm() send_transaction.chose_recipient_button.click() send_transaction.enter_recipient_address_button.click() - send_transaction.enter_recipient_address_input.set_value(transaction_users['G_USER']['address']) + send_transaction.enter_recipient_address_input.set_value(transaction_users['H_USER']['address']) send_transaction.done_button.click() send_transaction.sign_transaction(sender['password']) self.network_api.find_transaction_by_unique_amount(sender['address'], valid_amount) @@ -302,6 +303,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): "'Insufficient funds' error is now shown when sending %s ETH from wallet with balance %s" % ( round(eth_value + 1), eth_value)) send_transaction.select_asset_button.click() + send_transaction.asset_by_name('STT').scroll_to_element() send_transaction.asset_by_name('STT').click() send_transaction.amount_edit_box.set_value(round(stt_value + 1)) if not error_text.is_element_displayed(): diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index 43f91abbee..c3456db0ec 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -211,12 +211,13 @@ class WalletView(BaseView): def get_usd_total_value(self): import re - return float(re.sub('[$,]', '', self.usd_total_value.text)) + return float(re.sub('[~,]', '', self.usd_total_value.text)) def get_eth_value(self): return float(self.eth_asset_value.text) def get_stt_value(self): + self.stt_asset_value.scroll_to_element() return float(self.stt_asset_value.text) def verify_currency_balance(self, expected_rate: int, errors: list):