From 59000d5698b3e419aa818bd7a46ec25d88383ace Mon Sep 17 00:00:00 2001 From: yevh-berdnyk Date: Fri, 23 Aug 2019 13:24:52 +0300 Subject: [PATCH] False failed tests fix Signed-off-by: Churikova Tetiana --- .../account_management/test_create_account.py | 9 +++------ .../atomic/account_management/test_profile.py | 2 +- .../atomic/account_management/test_recover.py | 17 +++++++++-------- .../tests/atomic/chats/test_group_chat.py | 10 ++-------- .../tests/atomic/chats/test_one_to_one.py | 2 +- .../tests/atomic/transactions/test_wallet.py | 4 ++-- test/appium/views/profile_view.py | 17 +++++------------ 7 files changed, 23 insertions(+), 38 deletions(-) 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 e0773d3d56..99d9304682 100644 --- a/test/appium/tests/atomic/account_management/test_create_account.py +++ b/test/appium/tests/atomic/account_management/test_create_account.py @@ -77,12 +77,9 @@ class TestCreateAccount(SingleDeviceTestCase): if not home_view.element_by_text(text).is_element_displayed(): self.errors.append("'%s' text is not shown" % text) profile_view = home_view.profile_button.click() - shown_username_1 = profile_view.username_set_by_user_text.text - shown_username_2 = profile_view.default_username_text.text - if shown_username_1 != username: - self.errors.append("Profile username '%s' doesn't match '%s'" % (shown_username_1, username)) - if shown_username_2 != username: - self.errors.append("Default username '%s' doesn't match '%s'" % (shown_username_2, username)) + shown_username = profile_view.default_username_text.text + if shown_username != username: + self.errors.append("Default username '%s' doesn't match '%s'" % (shown_username, username)) self.verify_no_errors() @marks.testrail_id(5460) diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index a62c15a210..962ae6fbff 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -23,7 +23,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase): profile_view.home_button.click() sign_in_view.profile_button.click() profile_view.swipe_down() - if not profile_view.profile_picture.is_element_image_equals_template(): + if not profile_view.profile_picture.is_element_image_equals_template('sauce_logo_profile.png'): self.driver.fail('Profile picture was not updated') @marks.testrail_id(5454) diff --git a/test/appium/tests/atomic/account_management/test_recover.py b/test/appium/tests/atomic/account_management/test_recover.py index af4b68a924..3aab4c07ee 100644 --- a/test/appium/tests/atomic/account_management/test_recover.py +++ b/test/appium/tests/atomic/account_management/test_recover.py @@ -159,16 +159,17 @@ class TestRecoverAccessFromSignInScreen(SingleDeviceTestCase): @marks.testrail_id(5394) @marks.high - def test_uppercase_is_replaced_by_lowercase_automatically(self): - passphrase = transaction_senders['A']['passphrase'] + def test_account_recovery_with_uppercase_recovery_phrase(self): + user = transaction_senders['A'] + passphrase = user['passphrase'] capitalized_passphrase = passphrase.upper() signin_view = SignInView(self.driver) - recover_access_view = signin_view.access_key_button.click() - recover_access_view.enter_seed_phrase_button.click() - recover_access_view.passphrase_input.click() - recover_access_view.send_as_keyevent(capitalized_passphrase) - if recover_access_view.passphrase_input.text != passphrase: - self.driver.fail('Upper case was not replaced by lower case!') + signin_view.recover_access(capitalized_passphrase) + profile_view = signin_view.profile_button.click() + username = profile_view.default_username_text.text + public_key = signin_view.get_public_key() + if username != user['username'] or public_key != user['public_key']: + self.driver.fail('Incorrect user was recovered') @marks.testrail_id(5719) @marks.medium diff --git a/test/appium/tests/atomic/chats/test_group_chat.py b/test/appium/tests/atomic/chats/test_group_chat.py index ee449bb4bc..97c6422e67 100644 --- a/test/appium/tests/atomic/chats/test_group_chat.py +++ b/test/appium/tests/atomic/chats/test_group_chat.py @@ -25,12 +25,9 @@ def create_users(driver_1, driver_2): return device_1_sign_in.create_user(), device_2_sign_in.create_user() -def get_username(device_home, default=True): +def get_username(device_home): device_profile_view = device_home.profile_button.click() - if default: - username = device_profile_view.default_username_text.text - else: - username = device_profile_view.username_set_by_user_text.text + username = device_profile_view.default_username_text.text device_home.home_button.click() return username @@ -228,14 +225,12 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase): chat_name = device_1_home.get_public_chat_name() device_1_chat, device_2_chat = create_and_join_group_chat(device_1_home, device_2_home, chat_name) device_2_default_username = get_username(device_2_home) - device_2_custom_username = get_username(device_2_home, False) # device 1: get options for device 2 in group chat and remove him options = device_1_chat.get_user_options(device_2_default_username) options.remove_user_button.click() # device 2: check that removed user can see that he is removed - user2_left_chat_system_message_for_user_2 = return_left_chat_system_message(device_2_custom_username) # TODO: should be reworked after https://github.com/status-im/status-react/pull/8487: replaced with default username # if not device_1_chat.chat_element_by_text(user2_left_chat_system_message_for_user_2).is_element_displayed(): @@ -266,7 +261,6 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase): device_1_home, device_2_home = create_users(self.drivers[0], self.drivers[1]) chat_name = device_1_home.get_public_chat_name() device_2_default_username = get_username(device_2_home) - device_2_custom_username = get_username(device_2_home, False) # device 2: add contacts device_2_home.add_contact(chat_member['public_key']) 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 33246942ff..8b7dda3ec6 100644 --- a/test/appium/tests/atomic/chats/test_one_to_one.py +++ b/test/appium/tests/atomic/chats/test_one_to_one.py @@ -144,7 +144,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase): self.errors.append("Default username '%s' is not shown in one-to-one chat" % default_username_1) device_2_chat.chat_options.click() device_2_chat.view_profile_button.click() - if not device_2_chat.contact_profile_picture.is_element_image_equals_template(): + if not device_2_chat.contact_profile_picture.is_element_image_equals_template('sauce_logo.png'): self.errors.append("Updated profile picture is not shown in one-to-one chat") self.verify_no_errors() diff --git a/test/appium/tests/atomic/transactions/test_wallet.py b/test/appium/tests/atomic/transactions/test_wallet.py index 4f7e33b029..9e0ae54023 100644 --- a/test/appium/tests/atomic/transactions/test_wallet.py +++ b/test/appium/tests/atomic/transactions/test_wallet.py @@ -114,11 +114,11 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): send_transaction.enter_recipient_address_input.set_value(recipient['address']) send_transaction.done_button.click() send_transaction.sign_transaction_button.click() - send_transaction.sign_with_password.click() + send_transaction.sign_with_password.click_until_presence_of_element(send_transaction.enter_password_input) send_transaction.enter_password_input.click() send_transaction.enter_password_input.send_keys('wrong_password') send_transaction.sign_button.click() - send_transaction.find_full_text('Wrong password', 20) + send_transaction.find_text_part('Wrong password', 20) @marks.testrail_id(1452) def test_transaction_appears_in_history(self): diff --git a/test/appium/views/profile_view.py b/test/appium/views/profile_view.py index 5bcfb7b4b6..8e0c47605a 100644 --- a/test/appium/views/profile_view.py +++ b/test/appium/views/profile_view.py @@ -101,13 +101,6 @@ class ConfirmLogoutButton(BaseButton): self.locator = self.Locator.text_selector('LOG OUT') -class UserNameSetByUserText(BaseText): - def __init__(self, driver): - super(UserNameSetByUserText, self).__init__(driver) - self.locator = self.Locator.xpath_selector( - '//android.widget.ImageView[@content-desc="chat-icon"]/../android.widget.TextView[1]') - - class DefaultUserNameText(BaseText): def __init__(self, driver): super(DefaultUserNameText, self).__init__(driver) @@ -122,7 +115,6 @@ class ShareMyProfileButton(BaseButton): self.locator = self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="icon"])[1]') - class ProfilePictureElement(BaseElement): def __init__(self, driver): super(ProfilePictureElement, self).__init__(driver) @@ -133,7 +125,8 @@ class EditPictureButton(BaseButton): def __init__(self, driver): super(EditPictureButton, self).__init__(driver) - self.locator = self.Locator.xpath_selector('//android.view.ViewGroup[@content-desc="edit-profile-photo-button"]') + self.locator = self.Locator.xpath_selector( + '//android.view.ViewGroup[@content-desc="edit-profile-photo-button"]') class ConfirmEditButton(BaseButton): @@ -310,16 +303,19 @@ class FaqButton(BaseButton): from views.web_views.base_web_view import BaseWebView return BaseWebView(self.driver) + class AboutButton(BaseButton): def __init__(self, driver): super(AboutButton, self).__init__(driver) self.locator = self.Locator.accessibility_id("about-button") + class VersionText(BaseText): def __init__(self, driver): super(VersionText, self).__init__(driver) self.locator = self.Locator.xpath_selector("//*[@content-desc='version'][1]") + class BootnodesButton(BaseButton): def __init__(self, driver): @@ -510,7 +506,6 @@ class ProfileView(BaseView): self.main_currency_button = MainCurrencyButton(self.driver) - self.username_set_by_user_text = UserNameSetByUserText(self.driver) self.default_username_text = DefaultUserNameText(self.driver) self.share_my_profile_button = ShareMyProfileButton(self.driver) self.profile_picture = ProfilePictureElement(self.driver) @@ -627,14 +622,12 @@ class ProfileView(BaseView): self.element_by_text(element_text).click() picture.click() - def remove_profile_picture(self): if not AbstractTestCase().environment == 'sauce': raise NotImplementedError('Test case is implemented to run on SauceLabs only') self.profile_picture.click() self.remove_picture_button.click() - def logout(self): self.logout_button.click() return self.logout_dialog.logout_button.click()