From f47c816ce012b98094c9f675de653d220f07ec22 Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Thu, 26 Nov 2020 18:33:43 +0100 Subject: [PATCH] fix e2e and align to new 11465 Signed-off-by: Churikova Tetiana --- .../tests/atomic/account_management/test_keycard.py | 1 + .../atomic/account_management/test_wallet_management.py | 8 ++++++-- test/appium/tests/atomic/chats/test_chats_management.py | 7 ++----- .../tests/atomic/transactions/test_keycard_wallet.py | 1 + test/appium/tests/atomic/transactions/test_wallet.py | 2 ++ test/appium/views/base_view.py | 7 ++++++- test/appium/views/chat_view.py | 7 ++++++- test/appium/views/send_transaction_view.py | 2 +- test/appium/views/wallet_view.py | 5 +++-- 9 files changed, 28 insertions(+), 12 deletions(-) diff --git a/test/appium/tests/atomic/account_management/test_keycard.py b/test/appium/tests/atomic/account_management/test_keycard.py index facf95d28d..1b625100a8 100644 --- a/test/appium/tests/atomic/account_management/test_keycard.py +++ b/test/appium/tests/atomic/account_management/test_keycard.py @@ -356,6 +356,7 @@ class TestCreateAccount(SingleDeviceTestCase): sign_in.sign_in(position=2, keycard=True) sign_in.wallet_button.click() wallet_view.set_up_wallet() + wallet_view.wait_balance_is_changed('ETH') wallet_view.accounts_status_account.click() transaction_amount_keycard = wallet_view.get_unique_amount() wallet_view.send_transaction(amount=transaction_amount_keycard, recipient=recipient, keycard=True, sign_transaction=True) 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 8d2af693f6..29d6be7c41 100644 --- a/test/appium/tests/atomic/account_management/test_wallet_management.py +++ b/test/appium/tests/atomic/account_management/test_wallet_management.py @@ -109,6 +109,7 @@ class TestWalletManagement(SingleDeviceTestCase): @marks.testrail_id(5358) @marks.medium + @marks.transaction def test_backup_recovery_phrase_warning_from_wallet(self): sign_in = SignInView(self.driver) sign_in.create_user() @@ -274,8 +275,7 @@ class TestWalletManagement(SingleDeviceTestCase): @marks.testrail_id(6244) @marks.high def test_add_and_delete_watch_only_account_to_multiaccount_instance(self): - sign_in_view = SignInView(self.driver) - sign_in_view.create_user() + sign_in_view = SignInView(self.driver).create_user() wallet_view = sign_in_view.wallet_button.click() wallet_view.set_up_wallet() @@ -314,6 +314,10 @@ class TestWalletManagement(SingleDeviceTestCase): wallet_view.yes_button.click() if account_button.is_element_displayed(): self.driver.fail('Account was not deleted') + + # forcing app to update balance + wallet_view.put_app_to_background_and_back() + for asset in ('ETH', 'ADI', 'STT'): wallet_view.wait_balance_is_equal_expected_amount(asset, 0) diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index 4a1430ee31..09f550d727 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -594,11 +594,8 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): additional_text = 'and more' chat_1.send_as_keyevent(additional_text) chat_1.send_message_button.click() - chat_1.chat_element_by_text('%s %s' % (nickname, additional_text)).click() - for element in (chat_1.element_by_text(username_2), chat_1.remove_from_contacts): - if not element.is_element_displayed(): - self.errors.append('Was not redirected to user profile after tapping on mention by nickname!') - chat_1.get_back_to_home_view() + if not chat_1.chat_element_by_text('%s %s' % (nickname, additional_text)).is_element_displayed(): + self.errors.append("Nickname is not resolved on send message") device_1.just_fyi('check contact list in Profile after setting nickname') profile_1 = chat_1.profile_button.click() diff --git a/test/appium/tests/atomic/transactions/test_keycard_wallet.py b/test/appium/tests/atomic/transactions/test_keycard_wallet.py index 33e018eb01..af76560dd6 100644 --- a/test/appium/tests/atomic/transactions/test_keycard_wallet.py +++ b/test/appium/tests/atomic/transactions/test_keycard_wallet.py @@ -104,6 +104,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): self.errors.verify_no_errors() @marks.testrail_id(6292) + @marks.transaction @marks.medium def test_keycard_send_funds_between_accounts_in_multiaccount_instance(self): sign_in_view = SignInView(self.driver) diff --git a/test/appium/tests/atomic/transactions/test_wallet.py b/test/appium/tests/atomic/transactions/test_wallet.py index 144712d821..98ff200fe5 100644 --- a/test/appium/tests/atomic/transactions/test_wallet.py +++ b/test/appium/tests/atomic/transactions/test_wallet.py @@ -238,6 +238,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): self.driver.fail("Connection status text '%s' doesn't match expected 'Offline'" % connection_text) @marks.testrail_id(6225) + @marks.transaction @marks.medium def test_send_funds_between_accounts_in_multiaccount_instance(self): sign_in_view = SignInView(self.driver) @@ -462,6 +463,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): wallet_view.asset_by_name(symbol).scroll_to_element() if not wallet_view.asset_by_name(symbol).is_element_displayed(): self.errors.append('Custom token is not shown on Wallet view') + wallet_view.accounts_status_account.scroll_to_element(direction='up') wallet_view.accounts_status_account.click() recipient = "0x" + basic_user['address'] amount = '0.0%s' % str(random.randint(10000, 99999)) + '1' diff --git a/test/appium/views/base_view.py b/test/appium/views/base_view.py index 8b4b2aec02..f3a58cd493 100644 --- a/test/appium/views/base_view.py +++ b/test/appium/views/base_view.py @@ -515,6 +515,11 @@ class BaseView(object): for _ in range(times): self.driver.press_keycode(4) + def put_app_to_background_and_back(self, time_in_background=1): + self.driver.press_keycode(187) + time.sleep(time_in_background) + self.status_in_background_button.click() + def click_system_home_button(self): self.driver.info('Press system Home button') self.driver.press_keycode(3) @@ -706,7 +711,7 @@ class BaseView(object): profile_view.share_my_profile_button.click() profile_view.public_key_text.wait_for_visibility_of_element() public_key = profile_view.public_key_text.text - self.close_share_popup() + self.click_system_back_button() user_data = (public_key, default_username) if return_username else public_key return user_data diff --git a/test/appium/views/chat_view.py b/test/appium/views/chat_view.py index b88323e80f..8ce3d8acf6 100644 --- a/test/appium/views/chat_view.py +++ b/test/appium/views/chat_view.py @@ -425,6 +425,11 @@ class ChatElementByText(BaseElement): except NoSuchElementException: ChatView(self.driver).reconnect() + def click_on_text(self): + self.locator = self.Locator.xpath_selector(self.message_locator + + "/ancestor::android.view.ViewGroup[@content-desc='chat-item']/android.view.ViewGroup") + self.click() + @property @@ -611,7 +616,7 @@ class StikerMessageItem(BaseElement): class ImageChatItem(BaseElement): def __init__(self, driver): super().__init__(driver) - self.locator = self.Locator.xpath_selector('//*[@content-desc="chat-item"]//android.widget.ImageView') + self.locator = self.Locator.accessibility_id('message-image') class HistoryTimeMarker(BaseText): diff --git a/test/appium/views/send_transaction_view.py b/test/appium/views/send_transaction_view.py index e1c6cfcb52..66cd87b7f4 100644 --- a/test/appium/views/send_transaction_view.py +++ b/test/appium/views/send_transaction_view.py @@ -375,7 +375,7 @@ class SendTransactionView(BaseView): self.chose_recipient_button.click() self.enter_recipient_address_input.set_value(address) self.enter_recipient_address_input.click() - self.done_button.click() + self.done_button.click_until_absense_of_element(self.done_button) def sign_transaction(self, sender_password: str = common_password, keycard=False, default_gas_price=True): if not default_gas_price: diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index 5417dc3b2c..a863afb53e 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -493,7 +493,8 @@ class WalletView(BaseView): elif self.asset_by_name(asset).is_element_present() and self.get_asset_amount_by_name(asset) == initial_balance: counter += 10 time.sleep(10) - self.swipe_down() + # temp until Refresh button will be included in pull-to refresh + self.put_app_to_background_and_back() self.driver.info('Waiting %s seconds for %s to update' % (counter,asset)) elif not self.asset_by_name(asset).is_element_present(10): # temp until Refresh button will be included in pull-to refresh @@ -585,7 +586,7 @@ class WalletView(BaseView): else: send_transaction_view.set_recipient_address(kwargs.get('recipient')) if kwargs.get('sign_transaction', True): - send_transaction_view.sign_transaction_button.click() + send_transaction_view.sign_transaction_button.click_until_presence_of_element(send_transaction_view.network_fee_button) send_transaction_view.sign_transaction(keycard=kwargs.get('keycard', False), default_gas_price=kwargs.get('default_gas_price', False), sender_password=kwargs.get('sender_password', common_password))