From d3fefb6238e57c998d70503abcb94490ed3b529c Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Tue, 29 Jun 2021 17:55:55 +0200 Subject: [PATCH] e2e: fixes, align, e2e for sync Signed-off-by: Churikova Tetiana --- .../atomic/account_management/test_profile.py | 2 +- .../atomic/chats/test_chats_management.py | 2 +- .../tests/atomic/chats/test_commands.py | 15 ++++++----- .../atomic/chats/test_keycard_commands.py | 16 +++++++----- .../tests/atomic/chats/test_one_to_one.py | 2 +- test/appium/tests/atomic/chats/test_public.py | 26 +++++++++++++++++++ .../transactions/test_dapps_transactions.py | 7 +++-- .../test_keycard_dapps_transactions.py | 3 ++- test/appium/views/keycard_view.py | 5 ++-- test/appium/views/profile_view.py | 2 ++ test/appium/views/sign_in_view.py | 4 +-- test/appium/views/wallet_view.py | 20 +++++++------- 12 files changed, 69 insertions(+), 35 deletions(-) diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index a75fa74790..7f8d13dbbd 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -1195,7 +1195,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase): 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): + if not device_2_public.chat_element_by_text(public_chat_message).is_element_displayed(90): 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') diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index 3ed7e9a16a..26c8e72735 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -835,7 +835,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): chat_public_1, chat_public_2 = home_1.get_chat_view(), home_2.get_chat_view() chat_public_1.send_message(message_from_sender) chat_public_2.quote_message(message_from_sender) - if chat_public_2.quote_username_in_message_input.text != ("↪ " + device_1_username): + if chat_public_2.quote_username_in_message_input.text != ("↪ Replying to " + device_1_username): self.errors.append( " %s is not displayed in reply quote snippet replying to own message " % device_1_username) diff --git a/test/appium/tests/atomic/chats/test_commands.py b/test/appium/tests/atomic/chats/test_commands.py index a5e636a74c..a8578f4ab9 100644 --- a/test/appium/tests/atomic/chats/test_commands.py +++ b/test/appium/tests/atomic/chats/test_commands.py @@ -148,13 +148,16 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase): send_message = chat_2_sender_message.sign_and_send.click() send_message.next_button.click() send_message.sign_transaction() - - home_2.just_fyi('Check that transaction message is updated with new status after offline') - chat_2.toggle_airplane_mode() - self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True) - chat_2.toggle_airplane_mode() - [message.transaction_status.wait_for_element_text(message.confirmed, wait_time=60) for message in + [message.transaction_status.wait_for_element_text(message.pending, wait_time=60) for message in (chat_2_sender_message, chat_1_request_message)] + + # TODO: blocked because of #12256 + # home_2.just_fyi('Check that transaction message is updated with new status after offline') + # chat_2.toggle_airplane_mode() + # self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True) + # chat_2.toggle_airplane_mode() + #[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() @marks.testrail_id(6265) diff --git a/test/appium/tests/atomic/chats/test_keycard_commands.py b/test/appium/tests/atomic/chats/test_keycard_commands.py index 307c79c7a5..669b408dfc 100644 --- a/test/appium/tests/atomic/chats/test_keycard_commands.py +++ b/test/appium/tests/atomic/chats/test_keycard_commands.py @@ -143,13 +143,17 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase): send_message = chat_2_sender_message.sign_and_send.click() send_message.next_button.click() send_message.sign_transaction(keycard=True) + [message.transaction_status.wait_for_element_text(message.pending, wait_time=60) for message in + (chat_2_sender_message, chat_1_request_message)] - home_2.just_fyi('Check that transaction message is updated with new status after offline') - chat_2.toggle_airplane_mode() - self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True) - chat_2.toggle_airplane_mode() - [message.transaction_status.wait_for_element_text(message.confirmed, wait_time=60) for message in - (chat_2_sender_message, chat_1_request_message)] + # TODO: blocked because of #12256 + # home_2.just_fyi('Check that transaction message is updated with new status after offline') + # chat_2.toggle_airplane_mode() + # self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True) + # chat_2.toggle_airplane_mode() + # chat_1_request_message.transaction_status.wait_for_element_text(chat_1_request_message.confirmed, wait_time=60) + # [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() 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 6671b41251..ca691e885b 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -336,7 +336,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): device_2_home.just_fyi('reply to image message') device_2_chat.reply_message_button.click() - if device_2_chat.quote_username_in_message_input.text != "↪ %s" % device_1_username: + if device_2_chat.quote_username_in_message_input.text != "↪ Replying to %s" % device_1_username: self.errors.append("Username is not displayed in reply quote snippet replying to image message") reply_to_message_from_receiver = "image reply" device_2_chat.send_message(reply_to_message_from_receiver) diff --git a/test/appium/tests/atomic/chats/test_public.py b/test/appium/tests/atomic/chats/test_public.py index 1a68527c01..68d349e880 100644 --- a/test/appium/tests/atomic/chats/test_public.py +++ b/test/appium/tests/atomic/chats/test_public.py @@ -218,4 +218,30 @@ class TestPublicChatSingleDevice(SingleDeviceTestCase): if not home_view.element_by_text(tag_message).is_element_displayed(): self.errors.append('Could not find the public chat in user chat list.') + times = { + "three-days" : '5 days', + "one-week" : '12 days', + "one-month" : ['43 days', '42 days', '41 days', '40 days'], + } + + signin.just_fyi("Check that can fetch more history") + home_view.element_by_text(tag_message).click() + profile = home_view.profile_button.click() + profile.sync_settings_button.click() + profile.sync_history_for_button.click() + for period in times: + profile.just_fyi("Checking %s period" % period) + profile.element_by_translation_id(period).click() + profile.home_button.click(desired_view='chat') + chat.element_by_text_part(fetch_more).wait_and_click(120) + if period != "one-month": + if not profile.element_by_text_part(times[period]).is_element_displayed(30): + self.errors.append("'Quiet here for %s' is not shown after fetching more history" % times[period]) + else: + variants = times[period] + res = any(profile.element_by_text_part(variant).is_element_displayed(30) for variant in variants) + if not res: + self.errors.append("History is not fetched for one month!" ) + home_view.profile_button.click(desired_element_text=profile.get_translation_by_key("default-sync-period")) + self.errors.verify_no_errors() diff --git a/test/appium/tests/atomic/transactions/test_dapps_transactions.py b/test/appium/tests/atomic/transactions/test_dapps_transactions.py index 9ddbd0769d..a35fc73a64 100644 --- a/test/appium/tests/atomic/transactions/test_dapps_transactions.py +++ b/test/appium/tests/atomic/transactions/test_dapps_transactions.py @@ -12,18 +12,17 @@ class TestTransactionDApp(SingleDeviceTestCase): def test_request_stt_from_daap(self): sender = transaction_senders['K'] home = SignInView(self.driver).recover_access(sender['passphrase'], unique_password) + wallet = home.wallet_button.click() + initial_amount_STT = wallet.get_asset_amount_by_name('STT') status_test_dapp = home.open_status_test_dapp() status_test_dapp.wait_for_d_aap_to_load() status_test_dapp.assets_button.click() send_transaction = status_test_dapp.request_stt_button.click() - if not send_transaction.onboarding_message.is_element_displayed(): self.driver.fail('It seems onboarding screen is not shown.') home.ok_got_it_button.click() home.cancel_button.click() - wallet = home.wallet_button.click() - initial_amount_STT = wallet.get_asset_amount_by_name('STT') - wallet.dapp_tab_button.click(desired_element_text='Request STT') + #wallet.dapp_tab_button.click(desired_element_text='Request STT') send_transaction = status_test_dapp.request_stt_button.click() send_transaction.sign_transaction(unique_password) status_test_dapp.wallet_button.click() diff --git a/test/appium/tests/atomic/transactions/test_keycard_dapps_transactions.py b/test/appium/tests/atomic/transactions/test_keycard_dapps_transactions.py index 2c4e3869d9..f41cabeadc 100644 --- a/test/appium/tests/atomic/transactions/test_keycard_dapps_transactions.py +++ b/test/appium/tests/atomic/transactions/test_keycard_dapps_transactions.py @@ -15,6 +15,7 @@ class TestTransactionDApp(SingleDeviceTestCase): home_view = sign_in_view.recover_access(sender['passphrase'], keycard=True) wallet_view = home_view.wallet_button.click() wallet_view.set_up_wallet() + wallet_view.asset_by_name('STT').wait_for_element(30) initial_amount_STT = wallet_view.get_asset_amount_by_name('STT') status_test_dapp = home_view.open_status_test_dapp() status_test_dapp.wait_for_d_aap_to_load() @@ -24,7 +25,7 @@ class TestTransactionDApp(SingleDeviceTestCase): status_test_dapp.wallet_button.click() send_transaction_view.just_fyi('Verify that wallet balance is updated') - wallet_view.wait_balance_is_changed('STT', initial_amount_STT) + wallet_view.wait_balance_is_changed('STT', initial_amount_STT, scan_tokens=True) send_transaction_view.just_fyi('Check logcat for sensitive data') values_in_logcat = send_transaction_view.find_values_in_logcat(mnemonic=sender['passphrase'], diff --git a/test/appium/views/keycard_view.py b/test/appium/views/keycard_view.py index 02f1d0ab83..9a1657b5a2 100644 --- a/test/appium/views/keycard_view.py +++ b/test/appium/views/keycard_view.py @@ -23,10 +23,9 @@ class KeycardView(BaseView): self.confirm_seed_phrase_edit_box = EditBox(self.driver, accessibility_id="enter-word") def enter_default_pin(self): - self.driver.info("**Enter default pin 121212**") - for _ in range(3): + self.driver.info("**Enter default pin 111111**") + for _ in range(6): self.one_button.click() - self.two_button.click() def enter_another_pin(self): self.driver.info("**Enter not-default pin 222222**") diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 5303ff8e36..8883fbe733 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -223,6 +223,8 @@ class ProfileView(BaseView): suffix="/following-sibling::android.widget.Switch[1]") self.ask_me_when_on_mobile_network = Button(self.driver, translation_id="mobile-network-ask-me", suffix="/following-sibling::android.widget.Switch[1]") + ##Sync history data + self.sync_history_for_button = Button(self.driver, accessibility_id="default-sync-period-button") ## History nodes self.mail_server_button = Button(self.driver, accessibility_id="offline-messages-settings-button") self.mail_server_address_input = EditBox(self.driver, translation_id="mailserver-address", diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index c2c3ce1af2..b17448f086 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -206,8 +206,8 @@ class SignInView(BaseView): def sign_in(self, password=common_password, keycard=False, position=1): self.driver.info("**Sign in (password:%s, keycard:%s)**" % (password, str(keycard))) - self.multi_account_on_login_button.wait_for_visibility_of_element(30) - self.get_multiaccount_by_position(position).click() + if self.multi_account_on_login_button.is_element_displayed(30): + self.get_multiaccount_by_position(position).click() if keycard: from views.keycard_view import KeycardView diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index 76a9a5b5af..863b30cf31 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -152,25 +152,25 @@ class WalletView(BaseView): if counter >= wait_time: self.driver.fail('Balance %s %s is not changed during %s seconds!' % (asset, initial_balance,wait_time)) elif self.asset_by_name(asset).is_element_present() and self.get_asset_amount_by_name(asset) == initial_balance: - if not self.transaction_history_button.is_element_displayed(): - self.wallet_account_by_name(self.status_account_name).click() - if (counter/60).is_integer(): - self.pull_to_refresh() - counter+=20 + # if not self.transaction_history_button.is_element_displayed(): + # self.wallet_account_by_name(self.status_account_name).click() + # if (counter/60).is_integer(): + # self.pull_to_refresh() + # counter+=20 self.wallet_button.double_click() - counter += 10 - time.sleep(10) - self.driver.info('*Waiting %ss for %s updated balance*' % (counter,asset)) - elif not self.asset_by_name(asset).is_element_present(10): counter += 10 time.sleep(10) if scan_tokens: self.scan_tokens() + self.driver.info('*Waiting %ss for %s updated balance*' % (counter,asset)) + elif not self.asset_by_name(asset).is_element_present(10): + counter += 10 + time.sleep(10) self.swipe_up() self.driver.info('*Waiting %s seconds for %s to display asset*' % (counter, asset)) else: self.driver.info('**Balance is updated!**') - self.wallet_button.double_click() + # self.wallet_button.double_click() self.element_by_translation_id("wallet-total-value").scroll_to_element(direction='up') return self