e2e for importing accounts

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-03-02 17:07:46 +01:00 committed by Andrey Shovkoplyas
parent f645d3fbb5
commit 7b7f567361
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
4 changed files with 136 additions and 48 deletions

View File

@ -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")

View File

@ -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

View File

@ -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"

View File

@ -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()