diff --git a/test/appium/tests/atomic/account_management/test_profile.py b/test/appium/tests/atomic/account_management/test_profile.py index 0b8b2b2072..4f52890618 100644 --- a/test/appium/tests/atomic/account_management/test_profile.py +++ b/test/appium/tests/atomic/account_management/test_profile.py @@ -78,6 +78,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase): sign_in_view.just_fyi("Start syncing in offline popup") sign_in_view.element_by_text("Start syncing").click() + sign_in_view.element_by_text_part(offline_banner_text).wait_for_invisibility_of_element(10) if sign_in_view.element_by_text_part(offline_banner_text).is_element_displayed(): self.driver.fail("Popup about offline history is shown") 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 022e3a9feb..134917c497 100644 --- a/test/appium/tests/atomic/account_management/test_wallet_management.py +++ b/test/appium/tests/atomic/account_management/test_wallet_management.py @@ -278,28 +278,27 @@ class TestWalletManagement(SingleDeviceTestCase): @marks.testrail_id(6224) @marks.critical - def test_add_account_to_multiaccount_instance(self): + def test_add_account_to_multiaccount_instance_generate_new(self): sign_in_view = SignInView(self.driver) sign_in_view.create_user() wallet_view = sign_in_view.wallet_button.click() wallet_view.set_up_wallet() wallet_view.add_account_button.click() - wallet_view.add_an_account_button.click() - wallet_view.generate_new_account_button.click() - wallet_view.generate_account_button.click() - if wallet_view.element_by_text('Account added').is_element_displayed(): - self.driver.fail('Account is added without password') - wallet_view.enter_your_password_input.send_keys('000000') - wallet_view.generate_account_button.click() - if not wallet_view.element_by_text_part('Password seems to be incorrect').is_element_displayed(): - self.driver.fail("Incorrect password validation is not performed") - wallet_view.enter_your_password_input.clear() - wallet_view.enter_your_password_input.send_keys(common_password) - wallet_view.generate_account_button.click() + wallet_view.generate_an_account_button.click() + wallet_view.add_account_generate_account_button.click() account_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) wallet_view.account_name_input.send_keys(account_name) wallet_view.account_color_button.select_color_by_position(1) - wallet_view.finish_button.click() + if wallet_view.get_account_options_by_name(account_name).is_element_displayed(): + self.driver.fail('Account is added without password') + wallet_view.enter_your_password_input.send_keys('000000') + wallet_view.add_account_generate_account_button.click() + # TODO: blocked due to #8567 + # if not wallet_view.element_by_text_part('Password seems to be incorrect').is_element_displayed(): + # self.driver.fail("Incorrect password validation is not performed") + wallet_view.enter_your_password_input.clear() + wallet_view.enter_your_password_input.send_keys(common_password) + wallet_view.add_account_generate_account_button.click() account_button = wallet_view.get_account_by_name(account_name) if not account_button.is_element_displayed(): self.driver.fail('Account was not added') @@ -318,10 +317,9 @@ class TestWalletManagement(SingleDeviceTestCase): wallet_view.add_account_button.click() wallet_view.add_watch_only_address_button.click() wallet_view.enter_address_input.send_keys(basic_user['address']) - wallet_view.next_button.click() account_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) wallet_view.account_name_input.send_keys(account_name) - wallet_view.finish_button.click() + wallet_view.add_account_generate_account_button.click() account_button = wallet_view.get_account_by_name(account_name) if not account_button.is_element_displayed(): self.driver.fail('Account was not added') @@ -357,6 +355,86 @@ class TestWalletManagement(SingleDeviceTestCase): self.errors.verify_no_errors() + @marks.testrail_id(6271) + @marks.high + def test_add_account_to_multiaccount_instance_seed_phrase(self): + sign_in_view = SignInView(self.driver) + sign_in_view.create_user() + wallet_view = sign_in_view.wallet_button.click() + wallet_view.set_up_wallet() + + wallet_view.just_fyi('Add account from seed phrase') + wallet_view.add_account_button.click() + wallet_view.enter_a_seed_phrase_button.click() + wallet_view.enter_your_password_input.send_keys(common_password) + + wallet_view.enter_seed_phrase_input.set_value('') + account_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) + wallet_view.account_name_input.send_keys(account_name) + wallet_view.add_account_generate_account_button.click() + if wallet_view.get_account_options_by_name(account_name).is_element_displayed(): + self.driver.fail('Account is added without seed phrase') + wallet_view.enter_seed_phrase_input.set_value(str(wallet_users['C']['passphrase']).upper()) + wallet_view.add_account_generate_account_button.click() + + account_button = wallet_view.get_account_by_name(account_name) + if not account_button.is_element_displayed(): + self.driver.fail('Account was not added') + + wallet_view.just_fyi('Check that overall balance is changed after adding account') + for asset in ('ETHro', 'ADI'): + wallet_view.wait_balance_is_changed(asset) + + wallet_view.just_fyi('Check account view and send option') + wallet_view.get_account_by_name(account_name).click() + if not wallet_view.send_transaction_button.is_element_displayed(): + self.errors.append('Send button is not shown on account added with seed phrase') + wallet_view.receive_transaction_button.click() + if wallet_view.address_text.text[2:] != wallet_users['C']['address']: + self.errors.append( + 'Wrong address %s is shown in "Receive" popup ' % wallet_view.address_text.text) + self.errors.verify_no_errors() + + @marks.testrail_id(6272) + @marks.high + def test_add_account_to_multiaccount_instance_private_key(self): + sign_in_view = SignInView(self.driver) + sign_in_view.create_user() + wallet_view = sign_in_view.wallet_button.click() + wallet_view.set_up_wallet() + + wallet_view.just_fyi('Add account from private key') + wallet_view.add_account_button.click() + wallet_view.enter_a_private_key_button.click() + wallet_view.enter_your_password_input.send_keys(common_password) + + wallet_view.enter_a_private_key_input.set_value(wallet_users['C']['private_key'][0:9]) + account_name = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10)) + wallet_view.account_name_input.send_keys(account_name) + wallet_view.add_account_generate_account_button.click() + if wallet_view.get_account_options_by_name(account_name).is_element_displayed(): + self.driver.fail('Account is added with wrong private key') + wallet_view.enter_a_private_key_input.set_value(wallet_users['C']['private_key']) + wallet_view.add_account_generate_account_button.click() + + account_button = wallet_view.get_account_by_name(account_name) + if not account_button.is_element_displayed(): + self.driver.fail('Account was not added') + + wallet_view.just_fyi('Check that overall balance is changed after adding account') + for asset in ('ETHro', 'ADI'): + wallet_view.wait_balance_is_changed(asset) + + wallet_view.just_fyi('Check individual account view, receive option') + wallet_view.get_account_by_name(account_name).click() + if not wallet_view.send_transaction_button.is_element_displayed(): + self.errors.append('Send button is not shown on account added with private key') + wallet_view.receive_transaction_button.click() + if wallet_view.address_text.text[2:] != wallet_users['C']['address']: + self.errors.append( + 'Wrong address %s is shown in "Receive" popup account ' % wallet_view.address_text.text) + self.errors.verify_no_errors() + @marks.testrail_id(5406) @marks.critical diff --git a/test/appium/tests/users.py b/test/appium/tests/users.py index 459b9d5b36..0d71915171 100644 --- a/test/appium/tests/users.py +++ b/test/appium/tests/users.py @@ -44,9 +44,10 @@ wallet_users['B']['public_key'] = "0x04f3c372522a087bd6895a67b669601e6b6825b2ee7 wallet_users['C'] = dict() wallet_users['C']['passphrase'] = "purchase ensure mistake crystal person similar shaft family shield clog risk market" wallet_users['C']['username'] = "Mellow Virtual Nubiangoat" -wallet_users['C']['address'] = "8dce052ccda2f6f6b555759cee6957e04a6ddf5b" +wallet_users['C']['address'] = "8DcE052cCda2F6F6B555759cEe6957e04A6dDf5B" wallet_users['C']['public_key'] = "0x040e562b69362e7e57492bca50b6095acfa636c48b85eef2bc0e4180b6e99fc5e73f45c3" \ "40837da01728d4585695fda7f1de2ed193a1dd4080291d90812e1cae77" +wallet_users['C']['private_key'] = '7800C28310576645BBF6BF6355F7AA4CEC659B1713AF7E7713E1A33097A3DDF6' wallet_users['D'] = dict() wallet_users['D']['passphrase'] = "hen mango since lottery laundry flag report whisper cycle rate festival carry" diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index 447b98ae17..403541589c 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -268,50 +268,59 @@ class AddAccountButton(BaseButton): self.locator = self.Locator.text_selector('Add account') -class AddAnAccountButton(BaseButton): +class GenerateAnAccountButton(BaseButton): def __init__(self, driver): - super(AddAnAccountButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Add an account') + super(GenerateAnAccountButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('add-account-sheet-generate') class AddAWatchOnlyAddressButton(BaseButton): def __init__(self, driver): super(AddAWatchOnlyAddressButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Add a watch-only address') + self.locator = self.Locator.accessibility_id('add-account-sheet-watch') + +class EnterASeedPhraseButton(BaseButton): + def __init__(self, driver): + super(EnterASeedPhraseButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('add-account-sheet-seed') + +class EnterAPrivateKeyButton(BaseButton): + def __init__(self, driver): + super(EnterAPrivateKeyButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('add-account-sheet-private-key') class EnterAddressInput(BaseEditBox): def __init__(self, driver): super(EnterAddressInput, self).__init__(driver) - self.locator = self.Locator.text_selector('Enter address') + self.locator = self.Locator.accessibility_id('add-account-enter-watch-address') + +class EnterSeedPhraseInput(BaseEditBox): + def __init__(self, driver): + super(EnterSeedPhraseInput, self).__init__(driver) + self.locator = self.Locator.accessibility_id('add-account-enter-seed') + +class EnterPrivateKeyInput(BaseEditBox): + def __init__(self, driver): + super(EnterPrivateKeyInput, self).__init__(driver) + self.locator = self.Locator.accessibility_id('add-account-enter-private-key') class DeleteAccountButton(BaseButton): def __init__(self, driver): super(DeleteAccountButton, self).__init__(driver) self.locator = self.Locator.text_selector('Delete account') -class GenerateNewAccountButton(BaseButton): - def __init__(self, driver): - super(GenerateNewAccountButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Generate keys') class EnterYourPasswordInput(BaseEditBox): def __init__(self, driver): super(EnterYourPasswordInput, self).__init__(driver) - self.locator = self.Locator.xpath_selector( - "//android.widget.TextView[@text='Enter your password']/following-sibling::android.widget.EditText") + self.locator = self.Locator.accessibility_id('add-account-enter-password') -class GenerateAccountButton(BaseButton): - def __init__(self, driver): - super(GenerateAccountButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Generate keys') - class AccountNameInput(BaseEditBox): def __init__(self, driver): super(AccountNameInput, self).__init__(driver) - self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Account name']" - "/following-sibling::android.view.ViewGroup/android.widget.EditText") + self.locator = self.Locator.accessibility_id('add-account-enter-account-name') class AccountColorButton(BaseButton): @@ -325,11 +334,11 @@ class AccountColorButton(BaseButton): self.driver.find_element_by_xpath( "//*[@text='Cancel']/../preceding-sibling::android.widget.ScrollView/*/*[%s]" % position).click() - -class FinishButton(BaseButton): +# Add account on Generate An Account screen +class AddAccountGenerateAnAccountButton(BaseButton): def __init__(self, driver): - super(FinishButton, self).__init__(driver) - self.locator = self.Locator.text_selector('Finish') + super(AddAccountGenerateAnAccountButton, self).__init__(driver) + self.locator = self.Locator.accessibility_id('add-account-add-account-button') class AccountSettingsButton(BaseButton): def __init__(self, driver): @@ -380,16 +389,18 @@ class WalletView(BaseView): self.view_in_cryptokitties_button = ViewInCryptoKittiesButton(self.driver) self.set_currency_button = SetCurrencyButton(self.driver) self.add_account_button = AddAccountButton(self.driver) - self.add_an_account_button = AddAnAccountButton(self.driver) + self.generate_an_account_button = GenerateAnAccountButton(self.driver) self.add_watch_only_address_button = AddAWatchOnlyAddressButton(self.driver) + self.enter_a_seed_phrase_button = EnterASeedPhraseButton(self.driver) + self.enter_a_private_key_button = EnterAPrivateKeyButton(self.driver) self.enter_address_input = EnterAddressInput(self.driver) + self.enter_seed_phrase_input = EnterSeedPhraseInput(self.driver) + self.enter_a_private_key_input = EnterPrivateKeyInput(self.driver) self.delete_account_button = DeleteAccountButton(self.driver) - self.generate_new_account_button = GenerateNewAccountButton(self.driver) self.enter_your_password_input = EnterYourPasswordInput(self.driver) - self.generate_account_button = GenerateAccountButton(self.driver) self.account_name_input = AccountNameInput(self.driver) self.account_color_button = AccountColorButton(self.driver) - self.finish_button = FinishButton(self.driver) + self.add_account_generate_account_button = AddAccountGenerateAnAccountButton(self.driver) # individual account settings self.account_settings_button = AccountSettingsButton(self.driver) @@ -561,10 +572,7 @@ class WalletView(BaseView): def add_account(self, account_name: str, password: str = common_password): self.add_account_button.click() - self.add_an_account_button.click() - self.generate_new_account_button.click() - self.generate_account_button.click() + self.generate_an_account_button.click() self.enter_your_password_input.send_keys(password) - self.generate_account_button.click() self.account_name_input.send_keys(account_name) - self.finish_button.click() + self.add_account_generate_account_button.click()