From 04b7357646e5cfe01356beb00649861b7edfb65c Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Fri, 14 Jan 2022 17:51:54 +0100 Subject: [PATCH] e2e: fixes Signed-off-by: Churikova Tetiana --- ci/tests/Jenkinsfile.e2e-prs | 3 ++- .../account_management/test_create_account.py | 12 +++++------- .../atomic/account_management/test_keycard.py | 4 +++- .../atomic/account_management/test_profile.py | 19 ++++++++++--------- .../atomic/chats/test_chats_management.py | 4 ++-- .../tests/atomic/chats/test_communities.py | 10 +++++----- .../tests/atomic/chats/test_one_to_one.py | 6 +++--- .../atomic/dapps_and_browsing/test_dapps.py | 2 -- .../tests/atomic/transactions/test_wallet.py | 12 +++++++----- test/appium/views/base_element.py | 9 +++++++-- test/appium/views/dapps_view.py | 7 ++++++- test/appium/views/home_view.py | 2 +- test/appium/views/keycard_view.py | 3 ++- test/appium/views/transactions_view.py | 1 + test/appium/views/wallet_view.py | 2 +- test/appium/views/web_views/base_web_view.py | 1 + 16 files changed, 56 insertions(+), 41 deletions(-) diff --git a/ci/tests/Jenkinsfile.e2e-prs b/ci/tests/Jenkinsfile.e2e-prs index b931a00450..a12189940e 100644 --- a/ci/tests/Jenkinsfile.e2e-prs +++ b/ci/tests/Jenkinsfile.e2e-prs @@ -8,11 +8,12 @@ pipeline { description: 'Name of the branch to checkout and build.', defaultValue: 'develop', ) +/* Commented to use TEST_MARKERS values from job params string( name: 'TEST_MARKERS', description: 'Marker expression for matching tests to run.', defaultValue: 'critical or high', - ) + ) */ string( name: 'APK_NAME', description: 'Filename of APK uploaded to SauceLabs, path, or URL.', diff --git a/test/appium/tests/atomic/account_management/test_create_account.py b/test/appium/tests/atomic/account_management/test_create_account.py index 68e48124ab..663c30755c 100644 --- a/test/appium/tests/atomic/account_management/test_create_account.py +++ b/test/appium/tests/atomic/account_management/test_create_account.py @@ -102,6 +102,7 @@ class TestCreateAccount(SingleDeviceTestCase): from views.sign_in_view import MultiAccountButton account_button = sign_in.get_multiaccount_by_position(position=random.randint(1, 4), element_class=MultiAccountButton) + pub_chat = 'status' username = account_button.username.text account_button.click() sign_in.next_button.click() @@ -111,21 +112,18 @@ class TestCreateAccount(SingleDeviceTestCase): sign_in.next_button.click() [element.wait_and_click(10) for element in (sign_in.maybe_later_button, sign_in.lets_go_button)] home = sign_in.get_home_view() - texts = ["chat-and-transact", "follow-your-interests"] + texts = ["chat-and-transact", "invite-friends"] for text in texts: if not home.element_by_translation_id(text).is_element_displayed(): self.errors.append("'%s' text is not shown" % self.get_translation_by_key(text)) - for chat in ('#status', '#crypto'): - sign_in.element_by_text(chat).click() - sign_in.back_button.click_until_presence_of_element(home.search_input) + home.join_public_chat(pub_chat) profile = home.profile_button.click() shown_username = profile.default_username_text.text if shown_username != username: self.errors.append("Default username '%s' doesn't match '%s'" % (shown_username, username)) - profile.home_button.click_until_presence_of_element(home.element_by_text('#status')) + profile.home_button.double_click() home.cross_icon_inside_welcome_screen_button.click() - for chat in ('#status', '#crypto'): - home.delete_chat_long_press(chat) + home.delete_chat_long_press('#%s' % pub_chat) if home.element_by_text(texts[0]).is_element_displayed(): self.errors.append("'%s' text is shown, but welcome view was closed" % texts[0]) home.relogin() diff --git a/test/appium/tests/atomic/account_management/test_keycard.py b/test/appium/tests/atomic/account_management/test_keycard.py index 24d1f8e748..0aa2ff3c01 100644 --- a/test/appium/tests/atomic/account_management/test_keycard.py +++ b/test/appium/tests/atomic/account_management/test_keycard.py @@ -489,8 +489,10 @@ class TestCreateAccount(SingleDeviceTestCase): profile.create_keycard_backup_button.scroll_and_click() sign_in.seedphrase_input.set_value(seed) sign_in.next_button.click() + keycard.return_card_to_factory_settings_checkbox.enable() keycard.begin_setup_button.click() - keycard.enter_another_pin() + keycard.yes_button.wait_and_click() + [keycard.enter_another_pin() for _ in range(2)] keycard.element_by_translation_id("keycard-backup-success-title").wait_for_element(30) keycard.ok_button.click() diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index 866f6304c5..2020a56608 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -1219,7 +1219,6 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase): @marks.testrail_id(695856) @marks.medium - #@marks.flaky def test_pair_devices_sync_photo_community_group_chats(self): self.create_drivers(2) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) @@ -1238,11 +1237,12 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase): device_1.just_fyi('join Status community, create community, create group chat, edit user picture') # Follow Status community - home_1.element_by_text(comm_joined_name).scroll_and_click() - from views.chat_view import CommunityView - comm_to_join_1 = CommunityView(self.drivers[0]) - comm_to_join_1.follow_button.wait_and_click() - comm_to_join_1.home_button.double_click() + # TODO: no predefined community to follow now + # home_1.element_by_text(comm_joined_name).scroll_and_click() + # from views.chat_view import CommunityView + # comm_to_join_1 = CommunityView(self.drivers[0]) + # comm_to_join_1.follow_button.wait_and_click() + # comm_to_join_1.home_button.double_click() # Create community as admin, add channel, send message comm_before_1 = home_1.create_community(comm_before_sync_name) channel_before_1 = comm_before_1.add_channel(channel) @@ -1271,9 +1271,10 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase): device_2.just_fyi('check that created/joined community and profile details are updated') home_2 = profile_2.home_button.click() - for community in (comm_before_sync_name, comm_joined_name): - if not home_2.get_chat(community, community=True).is_element_displayed(): - self.errors.append('Community %s was not appeared after initial sync' % community) + # TODO: no predefined community to follow + # for community in (comm_before_sync_name, comm_joined_name): + if not home_2.get_chat(comm_before_sync_name, community=True).is_element_displayed(): + self.errors.append('Community %s was not appeared after initial sync' % comm_before_sync_name) comm_before_2 = home_2.get_chat(comm_before_sync_name, community=True).click() channel_2 = comm_before_2.get_chat(channel).click() if not channel_2.chat_element_by_text(message).is_element_displayed(30): diff --git a/test/appium/tests/atomic/chats/test_chats_management.py b/test/appium/tests/atomic/chats/test_chats_management.py index cc1186aa30..297d4ae3f9 100644 --- a/test/appium/tests/atomic/chats/test_chats_management.py +++ b/test/appium/tests/atomic/chats/test_chats_management.py @@ -986,10 +986,10 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase): chat_1.get_back_to_home_view() home_1.add_contact(public_key=basic_user['public_key']) chat_1.chat_message_input.send_keys('@') - if not (chat_1.search_user_in_mention_suggestion_list(ens_nickname_value).is_element_displayed() or + if (chat_1.search_user_in_mention_suggestion_list(ens_nickname_value).is_element_displayed() or chat_1.search_user_in_mention_suggestion_list( sender['username']).is_element_displayed()): - self.errors.append('ENS-owner user is not available in mention suggestion list') + self.errors.append('ENS-owner user who is not in 1-1 chat is available in mention suggestion list') device_1.just_fyi('Check there is no random user in different public chat') chat_1.get_back_to_home_view() diff --git a/test/appium/tests/atomic/chats/test_communities.py b/test/appium/tests/atomic/chats/test_communities.py index ed1f962808..8bbc65f7eb 100644 --- a/test/appium/tests/atomic/chats/test_communities.py +++ b/test/appium/tests/atomic/chats/test_communities.py @@ -81,7 +81,7 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase): def test_notification_in_activity_center_for_mention_in_community_and_group_chat(self): self.create_drivers(2) home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user() - community_name, pub_chat_name, channel_name = "some name", home_1.get_random_chat_name(), "first_channel" + community_name, gr_chat_name, channel_name = "some name", home_1.get_random_chat_name(), "first_channel" community_description = "something in community" message, message_member = "message", "from member" userkey_2, username_2 = home_2.get_public_key_and_username(return_username=True) @@ -102,9 +102,9 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase): one_to_one_2.home_button.click() community_1 = home_1.get_chat(community_name, community=True).click() community_link_text = community_1.copy_community_link() - pub_1 = home_1.create_group_chat(user_names_to_add=[username_2], group_chat_name=pub_chat_name) + pub_1 = home_1.create_group_chat(user_names_to_add=[username_2], group_chat_name=gr_chat_name) - pub_2 = home_2.get_chat(pub_chat_name).click() + pub_2 = home_2.get_chat(gr_chat_name).click() pub_2.join_chat_button.click() pub_1.chat_message_input.paste_text_from_clipboard() pub_1.send_message_button.click() @@ -133,7 +133,7 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase): channel_2.send_message_button.click() community_1.home_button.double_click() channel_2.home_button.click() - home_2.get_chat_from_home_view(pub_chat_name).click() + home_2.get_chat_from_home_view(gr_chat_name).click() pub_2.select_mention_from_suggestion_list(username_1, username_1[:2]) pub_2.send_as_keyevent("group") group_chat_message = username_1 + " group" @@ -161,7 +161,7 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase): home_1.just_fyi("Check there are no unread messages counters on chats after message read") if (home_1.notifications_unread_badge.is_element_present() or - home_1.get_chat_from_home_view(pub_chat_name).new_messages_counter.text == "1" or + home_1.get_chat_from_home_view(gr_chat_name).new_messages_counter.text == "1" or home_1.get_chat_from_home_view(community_name).new_messages_counter.text == "1"): self.errors.append("Unread message indicator is kept after all messages read in chats") 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 c9a939c0af..137edf1d4d 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -381,9 +381,8 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): private_chat_2.chat_options.click() timeline_device_1 = private_chat_2.view_profile_button.click() for element in timeline_device_1.element_by_text(status_1), timeline_device_1.image_message_in_chat: - element.scroll_to_element() - if not element.is_element_displayed(): - self.drivers[0].fail('Status of another user not shown when open another user profile') + if not element.is_element_displayed(40): + self.errors.append('Status of another user not shown when open another user profile') private_chat_2.close_button.click() home_2.just_fyi('check options on long-press image for receiver') @@ -411,6 +410,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): self.errors.append("Image is not displayed in reply") home_2.just_fyi('check share and save options on opened image') + private_chat_2.image_message_in_chat.scroll_to_element(direction='up') private_chat_2.image_message_in_chat.click() private_chat_2.share_image_icon_button.click() private_chat_2.share_via_messenger() diff --git a/test/appium/tests/atomic/dapps_and_browsing/test_dapps.py b/test/appium/tests/atomic/dapps_and_browsing/test_dapps.py index 12a876a320..7d1b95f48c 100644 --- a/test/appium/tests/atomic/dapps_and_browsing/test_dapps.py +++ b/test/appium/tests/atomic/dapps_and_browsing/test_dapps.py @@ -107,8 +107,6 @@ class TestDApps(SingleDeviceTestCase): home.just_fyi('check that can change account') profile.dapp_tab_button.click() - if profile.element_by_text("Can't find web3 library").is_element_displayed(): - status_test_dapp.browser_refresh_page_button.wait_and_click() if not status_test_dapp.element_by_text_part(account_name).is_element_displayed(): self.errors.append("No expected account %s is shown in authorize web3 popup for wallet" % account_name) status_test_dapp.allow_button.click() diff --git a/test/appium/tests/atomic/transactions/test_wallet.py b/test/appium/tests/atomic/transactions/test_wallet.py index e0be1e84fa..8f53db56de 100644 --- a/test/appium/tests/atomic/transactions/test_wallet.py +++ b/test/appium/tests/atomic/transactions/test_wallet.py @@ -251,7 +251,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): amount=transaction_amount_1) wallet.close_button.click() sub_account_address = wallet.get_wallet_address(account_name)[2:] - self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount) + self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount_1) self.network_api.verify_balance_is_updated(updated_balance, status_account_address) wallet.find_transaction_in_history(amount=transaction_amount) wallet.find_transaction_in_history(amount=format(float(transaction_amount_1), '.11f').rstrip('0')) @@ -626,7 +626,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): @marks.transaction @marks.medium def test_custom_gas_settings(self): - sender = wallet_users['A'] + sender = wallet_users['B'] sign_in = SignInView(self.driver) sign_in.recover_access(sender['passphrase']) wallet = sign_in.wallet_button.click() @@ -663,7 +663,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): send_transaction.per_gas_price_limit_input: { 'default': default_price, - 'value': '4,000000001', + 'value': '24,000000001', '-2': 'invalid-number', } } @@ -679,14 +679,16 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): wallet.just_fyi("Set custom fee and check that it will be applied") send_transaction.save_fee_button.scroll_and_click() - if send_transaction.get_network_fee_from_bottom_sheet() != '0.000088': + if wallet.element_by_translation_id("change-tip").is_element_displayed(): + wallet.element_by_translation_id("continue-anyway").click() + if send_transaction.get_network_fee_from_bottom_sheet() != '0.000528': self.driver.fail( "Custom fee is not applied, in fact it is %s " % send_transaction.get_network_fee_from_bottom_sheet()) send_transaction.sign_transaction() self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=3) transaction = wallet.find_transaction_in_history(amount=amount, return_hash=True) expected_params = { - 'fee_cap': '4.000000001', + 'fee_cap': '24.000000001', 'tip_cap': '2.5', 'gas_limit': '22000' } diff --git a/test/appium/views/base_element.py b/test/appium/views/base_element.py index fc35630465..0ebbfec192 100644 --- a/test/appium/views/base_element.py +++ b/test/appium/views/base_element.py @@ -406,10 +406,15 @@ class CheckBox(Button): def __init__(self, driver, **kwargs): super(Button, self).__init__(driver, **kwargs) + def __define_desired_element(self, elem_accessibility): + return ':%s' % elem_accessibility if ':' in self.accessibility_id else elem_accessibility + def enable(self): - super(CheckBox, self).click_until_presence_of_element(Button(self.driver, accessibility_id="checkbox-on")) + self.click_until_presence_of_element(Button(self.driver, + accessibility_id=self.__define_desired_element("checkbox-on"))) return self.navigate() def disable(self): - super(CheckBox, self).click_until_presence_of_element(Button(self.driver, accessibility_id="checkbox-off")) + self.click_until_presence_of_element(Button(self.driver, + accessibility_id=self.__define_desired_element("checkbox-off"))) return self.navigate() diff --git a/test/appium/views/dapps_view.py b/test/appium/views/dapps_view.py index 692873e096..8a261ba63d 100644 --- a/test/appium/views/dapps_view.py +++ b/test/appium/views/dapps_view.py @@ -55,7 +55,12 @@ class DappsView(BaseView): def open_url(self, url): self.driver.info("Open url '%s'" % url) - self.enter_url_editbox.wait_for_visibility_of_element(10) + from views.web_views.base_web_view import BaseWebView + web_view = BaseWebView(self.driver) + if not self.enter_url_editbox.is_element_displayed(): + web_view.open_tabs_button.wait_and_click() + web_view.open_new_tab_plus_button.click() + self.enter_url_editbox.wait_for_visibility_of_element(20) self.enter_url_editbox.click() self.enter_url_editbox.send_keys(url) self.confirm() diff --git a/test/appium/views/home_view.py b/test/appium/views/home_view.py index 8e438428ba..b99c1b00c6 100644 --- a/test/appium/views/home_view.py +++ b/test/appium/views/home_view.py @@ -234,7 +234,7 @@ class HomeView(BaseView): def get_chat(self, username, community=False,wait_time=30): self.driver.info("Looking for chat: '%s'" % username) chat_element = ChatElement(self.driver, username[:25], community=community) - if not chat_element.is_element_displayed(): + if not chat_element.is_element_displayed(10): self.notifications_unread_badge.wait_and_click(wait_time) chat_in_ac = ActivityCenterChatElement(self.driver, username[:25]) chat_in_ac.wait_for_element(20) diff --git a/test/appium/views/keycard_view.py b/test/appium/views/keycard_view.py index 067b0996b4..5dec41ef87 100644 --- a/test/appium/views/keycard_view.py +++ b/test/appium/views/keycard_view.py @@ -1,4 +1,4 @@ -from views.base_element import Button, Text, EditBox, SilentButton +from views.base_element import Button, Text, EditBox, SilentButton, CheckBox from views.base_view import BaseView @@ -14,6 +14,7 @@ class KeycardView(BaseView): self.pair_code_input = EditBox(self.driver, xpath="//android.widget.EditText") self.pair_to_this_device_button = Button(self.driver, translation_id="pair-card") self.connect_pairing_card_button = Button(self.driver, accessibility_id="connect-pairing-card") + self.return_card_to_factory_settings_checkbox = CheckBox(self.driver, accessibility_id=":checkbox-off") # Keyboard self.zero_button = SilentButton(self.driver, accessibility_id="numpad-button-0") diff --git a/test/appium/views/transactions_view.py b/test/appium/views/transactions_view.py index 7ecb113959..3265f306f3 100644 --- a/test/appium/views/transactions_view.py +++ b/test/appium/views/transactions_view.py @@ -93,6 +93,7 @@ class TransactionTable(BaseElement): except NoSuchElementException: from views.base_view import BaseView BaseView(self.driver).pull_to_refresh() + element.scroll_to_element() self.driver.fail('Transaction %s %s was not found on Wallet/Transaction screen' % (amount, asset)) def get_transactions_number(self): diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index 66c9f7d03c..af3ea5fd6a 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -361,7 +361,7 @@ class WalletView(BaseView): keycard_view.enter_default_pin() else: self.enter_your_password_input.send_keys(password) - self.add_account_generate_account_button.click() + self.add_account_generate_account_button.click_until_presence_of_element(self.accounts_status_account) self.driver.info("## Account is added!", device=False) def get_collectibles_amount(self, collectibles='CryptoKitties'): diff --git a/test/appium/views/web_views/base_web_view.py b/test/appium/views/web_views/base_web_view.py index cfcd935cf2..abd4ac174e 100644 --- a/test/appium/views/web_views/base_web_view.py +++ b/test/appium/views/web_views/base_web_view.py @@ -30,6 +30,7 @@ class BaseWebView(BaseView): self.new_tab_button = Button(self.driver, accessibility_id="new-tab") self.continue_anyway_button = Button(self.driver, translation_id="continue-anyway") self.open_tabs_button = Button(self.driver, accessibility_id="browser-open-tabs") + self.open_new_tab_plus_button = Button(self.driver, accessibility_id="plus-button") self.close_all_button = Button(self.driver, accessibility_id="close-all") self.empty_tab_button = Button(self.driver, accessibility_id="tab-itemEmpty tab") self.camera_image_in_dapp = BaseElement(self.driver, class_name="android.widget.Image")