Skip to content

Commit

Permalink
e2e: 1 more group
Browse files Browse the repository at this point in the history
  • Loading branch information
churik committed Apr 8, 2022
1 parent 2ddf4cf commit 56a1df0
Show file tree
Hide file tree
Showing 24 changed files with 607 additions and 504 deletions.
2 changes: 1 addition & 1 deletion test/appium/support/api/network_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def find_transaction_by_unique_amount(self, address, amount, token=False, decima
self.log("Failed iterate transactions(Etherscan unexpected error): " + str(e))
continue

def wait_for_confirmation_of_transaction(self, address, amount, confirmations=6, token=False):
def wait_for_confirmation_of_transaction(self, address, amount, confirmations=3, token=False):
start_time = time.time()
if token:
token_info = "token transaction"
Expand Down
1 change: 1 addition & 0 deletions test/appium/support/testrail_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def get_regression_cases(self):
test_cases['upgrade'] = dict()
## PR e2e
test_cases['pr']['critical'] = 730
test_cases['pr']['contacts'] = 50831
test_cases['pr']['public_chat'] = 50654
test_cases['pr']['one_to_one_chat'] = 50655
test_cases['pr']['group_chat'] = 50656
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def test_onboarding_add_new_multiaccount_username_by_position_pass_validation(se
class TestRestoreOneDeviceMerged(MultipleSharedDeviceTestCase):
@classmethod
def setup_class(cls):
cls.user = transaction_senders['A']
cls.user = transaction_senders['ETH_ADI_STT_2']
cls.drivers, cls.loop = create_shared_drivers(1)
cls.sign_in = SignInView(cls.drivers[0])
cls.passphrase = fill_string_with_char(cls.user['passphrase'].upper(), ' ', 3, True, True)
Expand Down Expand Up @@ -376,6 +376,110 @@ def test_restore_validation_seed_phrase_field(self):
self.sign_in.click_system_back_button()
self.errors.verify_no_errors()

@marks.testrail_id(702189)
@marks.transaction
def test_restore_account_migrate_multiaccount_to_keycard_no_db_saved_add_wallet_sign_tx(self):
self.sign_in.driver.close_app()
self.sign_in.driver.launch_app()
self.sign_in.sign_in(password=self.password)
self.home.home_button.wait_for_visibility_of_element(30)
profile = self.home.profile_button.click()
profile.profile_button.double_click()
profile.privacy_and_security_button.click()
profile.element_by_translation_id("manage-keys-and-storage").scroll_and_click()
profile.logout_dialog.logout_button.wait_and_click()
profile.logout_button.wait_for_invisibility_of_element(30)
if not self.sign_in.element_by_translation_id("move-keystore-file").is_element_displayed():
self.errors.append("Was not redirected to Key management screen when Manage keys from logged in state!")

self.home.just_fyi("Checking keycard banner and starting migrate multiaccount to keycard: no db saved")
self.sign_in.close_button.click()
self.sign_in.back_button.click()
self.sign_in.multi_account_on_login_button.wait_for_visibility_of_element(30)
self.sign_in.get_multiaccount_by_position(1).click()
if not self.sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is not shown on login screen for ordinary multiaccount")
self.sign_in.options_button.click()
self.sign_in.manage_keys_and_storage_button.click()
if not self.sign_in.element_by_text(self.user['username']).is_element_displayed():
self.driver.fail("Default username is not shown when migrating multiaccount to keycard!")

self.home.just_fyi("Checking validation of seed phrase during migration")
self.sign_in.enter_seed_phrase_next_button.click()
if self.sign_in.seedphrase_input.is_element_displayed():
self.sign_in.driver.fail("Proceeded to seedphrase input without confirmed Actions")
self.sign_in.move_keystore_file_option.click()
self.sign_in.reset_database_checkbox.click()
self.sign_in.enter_seed_phrase_next_button.click()
self.sign_in.seedphrase_input.set_value(transaction_senders['A']['passphrase'])
self.sign_in.choose_storage_button.click()
if not self.sign_in.element_by_translation_id("seed-key-uid-mismatch").is_element_displayed():
self.driver.fail("Can proceed with seed phrase of another user")
self.sign_in.element_by_translation_id("try-again").click()
self.sign_in.seedphrase_input.set_value(self.user['passphrase'][:-1])
self.sign_in.choose_storage_button.click()
if not self.sign_in.custom_seed_phrase_label.is_element_displayed():
self.driver.fail("Can proceed with invalid seed phrase")
self.sign_in.cancel_button.click()
self.sign_in.seedphrase_input.set_value(self.user['passphrase'])
self.sign_in.choose_storage_button.click()
if not self.sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is not shown on Key management screen")
self.sign_in.keycard_required_option.click()
if self.sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is shown when keycard storage is chosen")

self.sign_in.just_fyi("Finishing migration to keycard")
self.sign_in.confirm_button.click()
keycard = self.sign_in.move_and_reset_button.click()
keycard.begin_setup_button.click()
keycard.connect_card_button.wait_and_click()
keycard.enter_default_pin()
keycard.enter_default_pin()
if not self.sign_in.element_by_translation_id("migration-successful").is_element_displayed(30):
self.driver.fail("No popup about successfull migration is shown!")
self.sign_in.ok_button.click()
self.sign_in.maybe_later_button.wait_and_click(30)
self.sign_in.lets_go_button.wait_and_click(30)

self.sign_in.just_fyi('Check that after migrating account with assets is restored')
wallet = self.sign_in.wallet_button.click()
for asset in ['ETH', 'ADI', 'STT']:
if wallet.get_asset_amount_by_name(asset) == 0:
self.errors.append('Asset %s was not restored' % asset)

self.sign_in.just_fyi('Check that after migration wallet address matches expected')
address = wallet.get_wallet_address()
if address != '0x%s' % self.user['address']:
self.errors.append('Restored address %s does not match expected' % address)

self.sign_in.just_fyi('Check that after migration username and public key match expected')
public_key, default_username = self.sign_in.get_public_key_and_username(return_username=True)
profile = self.sign_in.get_profile_view()
if public_key != self.user['public_key']:
self.errors.append('Public key %s does not match expected' % public_key)
if default_username != self.user['username']:
self.errors.append('Default username %s does not match expected' % default_username)
profile.logout()

self.sign_in.just_fyi(
'Check that can login with migrated account, keycard banner is not shown and no option to migrate')
self.sign_in.get_multiaccount_by_position(1).click()
if self.sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is shown on migrated keycard multiaccount")
keycard.one_button.wait_for_visibility_of_element(10)
keycard.enter_default_pin()
if not self.sign_in.home_button.is_element_displayed(30):
self.driver.fail('Keycard user is not logged in')

self.sign_in.just_fyi('Check that can add another wallet account and send transaction')
self.home.wallet_button.click()
wallet.add_account(account_name="another_keycard_account", keycard=True)
transaction_amount_added = wallet.get_unique_amount()
wallet.send_transaction(amount=transaction_amount_added, recipient=transaction_senders['ETH_8']['address'],
keycard=True, sign_transaction=True)
self.errors.verify_no_errors()


class TestCreateAccount(SingleDeviceTestCase):

Expand Down
135 changes: 0 additions & 135 deletions test/appium/tests/atomic/account_management/test_keycard.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,141 +6,6 @@

class TestCreateAccount(SingleDeviceTestCase):

@marks.testrail_id(6645)
@marks.critical
def test_restore_account_migrate_multiaccount_to_keycard(self):
sign_in = SignInView(self.driver)
user = transaction_senders['ETH_ADI_STT_2']
seed = user['passphrase']
home = sign_in.recover_access(passphrase=seed)
profile = home.profile_button.click()
profile.privacy_and_security_button.click()
profile.element_by_translation_id("manage-keys-and-storage").scroll_and_click()
profile.logout_dialog.logout_button.wait_and_click()
profile.logout_button.wait_for_invisibility_of_element(30)
if not sign_in.element_by_translation_id("move-keystore-file").is_element_displayed():
self.errors.append("Was not redirected to Key management screen when Manage keys from logged in state!")

home.just_fyi("Checking keycard banner and starting migrate multiaccount to keycard: no db saved")
sign_in.close_button.click()
sign_in.back_button.click()
sign_in.multi_account_on_login_button.wait_for_visibility_of_element(30)
sign_in.get_multiaccount_by_position(1).click()
if not sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is not shown on login screen for ordinary multiaccount")
sign_in.options_button.click()
sign_in.manage_keys_and_storage_button.click()
if not sign_in.element_by_text(user['username']).is_element_displayed():
self.driver.fail("Default username is not shown when migrating multiaccount to keycard!")

home.just_fyi("Checking validation of seed phrase during migration")
sign_in.enter_seed_phrase_next_button.click()
if sign_in.seedphrase_input.is_element_displayed():
self.driver.fail("Proceeded to seedphrase input without confirmed Actions")
sign_in.move_keystore_file_option.click()
sign_in.reset_database_checkbox.click()
sign_in.enter_seed_phrase_next_button.click()
sign_in.seedphrase_input.set_value(transaction_senders['A']['passphrase'])
sign_in.choose_storage_button.click()
if not sign_in.element_by_translation_id("seed-key-uid-mismatch").is_element_displayed():
self.driver.fail("Can proceed with seed phrase of another user")
sign_in.element_by_translation_id("try-again").click()
sign_in.seedphrase_input.set_value(seed[:-1])
sign_in.choose_storage_button.click()
if not sign_in.custom_seed_phrase_label.is_element_displayed():
self.driver.fail("Can proceed with invalid seed phrase")
sign_in.cancel_button.click()
sign_in.seedphrase_input.set_value(seed)
sign_in.choose_storage_button.click()
if not sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is not shown on Key management screen")
sign_in.keycard_required_option.click()
if sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is shown when keycard storage is chosen")

home.just_fyi("Finishing migration to keycard")
sign_in.confirm_button.click()
keycard = sign_in.move_and_reset_button.click()
keycard.begin_setup_button.click()
keycard.connect_card_button.wait_and_click()
keycard.enter_default_pin()
keycard.enter_default_pin()
if not sign_in.element_by_translation_id("migration-successful").is_element_displayed(30):
self.driver.fail("No popup about successfull migration is shown!")
sign_in.ok_button.click()
sign_in.maybe_later_button.wait_and_click(30)
sign_in.lets_go_button.wait_and_click(30)

sign_in.just_fyi('Check that after migrating account with assets is restored')
wallet = sign_in.wallet_button.click()
for asset in ['ETH', 'ADI', 'STT']:
if wallet.get_asset_amount_by_name(asset) == 0:
self.errors.append('Asset %s was not restored' % asset)

sign_in.just_fyi('Check that after migration wallet address matches expected')
address = wallet.get_wallet_address()
if address != '0x%s' % user['address']:
self.errors.append('Restored address %s does not match expected' % address)

sign_in.just_fyi('Check that after migration username and public key match expected')
public_key, default_username = sign_in.get_public_key_and_username(return_username=True)
profile = sign_in.get_profile_view()
if public_key != user['public_key']:
self.errors.append('Public key %s does not match expected' % public_key)
if default_username != user['username']:
self.errors.append('Default username %s does not match expected' % default_username)
profile.logout()

sign_in.just_fyi(
'Check that can login with migrated account, keycard banner is not shown and no option to migrate')
sign_in.get_multiaccount_by_position(1).click()
if sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is shown on migrated keycard multiaccount")
keycard.one_button.wait_for_visibility_of_element(10)
keycard.enter_default_pin()
if not sign_in.home_button.is_element_displayed(30):
self.driver.fail('Keycard user is not logged in')

sign_in.just_fyi('Check that can add another wallet account and send transaction')
home.wallet_button.click()
wallet.add_account(account_name="another_keycard_account", keycard=True)
transaction_amount_added = wallet.get_unique_amount()
wallet.send_transaction(amount=transaction_amount_added, recipient=transaction_senders['ETH_8']['address'],
keycard=True, sign_transaction=True)
self.driver.reset()
home = sign_in.recover_access(passphrase=seed)
contact, nickname, message = transaction_senders['A'], 'my_friend', 'some message'
chat = home.add_contact(contact['public_key'], nickname=nickname)
chat.send_message(message)
profile = home.profile_button.click()
profile.logout()

home.just_fyi("Checking migration to keycard: db saved (1-1 chat, nickname, messages)")
sign_in.options_button.click()
sign_in.manage_keys_and_storage_button.click()
sign_in.move_keystore_file_option.click()
sign_in.enter_seed_phrase_next_button.click()
sign_in.seedphrase_input.set_value(seed)
sign_in.choose_storage_button.click()
sign_in.keycard_required_option.click()
sign_in.confirm_button.click()
sign_in.migration_password_input.set_value(common_password)
sign_in.confirm_button.click()
keycard.begin_setup_button.click()
keycard.connect_card_button.wait_and_click()
keycard.enter_default_pin()
keycard.enter_default_pin()
if not sign_in.element_by_translation_id("migration-successful").is_element_displayed(30):
self.driver.fail("No popup about successfull migration is shown!")
sign_in.ok_button.click()
home.home_button.wait_for_element(30)
home.get_chat(nickname).click()
if chat.add_to_contacts.is_element_displayed():
self.errors.append("User was removed from contacts after migration to kk")
if not chat.chat_element_by_text(message).is_element_displayed():
self.errors.append("Message from 1-1 was removed from contacts after migration to kk")
self.errors.verify_no_errors()

@marks.testrail_id(5742)
@marks.medium
def test_keycard_interruption_creating_onboarding_flow(self):
Expand Down
Loading

0 comments on commit 56a1df0

Please sign in to comment.