From cd04acde3adfebbcfab0e702b279c99b1bd8116d Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Mon, 13 Jul 2020 18:06:19 +0200 Subject: [PATCH] e2e for separate keystore Signed-off-by: Churikova Tetiana --- .../account_management/test_create_account.py | 5 +- .../atomic/account_management/test_keycard.py | 59 ++++++++++++++++++- test/appium/views/sign_in_view.py | 10 ++-- test/appium/views/wallet_view.py | 2 - 4 files changed, 66 insertions(+), 10 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 bc24b99e82..c022ee2350 100644 --- a/test/appium/tests/atomic/account_management/test_create_account.py +++ b/test/appium/tests/atomic/account_management/test_create_account.py @@ -1,6 +1,6 @@ import random -from tests import marks, common_password, get_current_time, unique_password +from tests import marks, common_password, unique_password from tests.base_test_case import SingleDeviceTestCase from views.sign_in_view import SignInView from tests.users import basic_user @@ -41,7 +41,8 @@ class TestCreateAccount(SingleDeviceTestCase): sign_in = SignInView(self.driver) sign_in.get_started_button.click() sign_in.generate_key_button.click() - account_button = sign_in.get_account_by_position(random.randint(1, 4)) + from views.sign_in_view import MultiAccountButton + account_button = sign_in.get_multiaccount_by_position(position=random.randint(1, 4), element_class=MultiAccountButton) username = account_button.username.text account_button.click() sign_in.next_button.click() diff --git a/test/appium/tests/atomic/account_management/test_keycard.py b/test/appium/tests/atomic/account_management/test_keycard.py index 75161c5359..c492b487ab 100644 --- a/test/appium/tests/atomic/account_management/test_keycard.py +++ b/test/appium/tests/atomic/account_management/test_keycard.py @@ -1,4 +1,4 @@ -from tests import marks, pair_code +from tests import marks, pair_code, common_password from tests.base_test_case import SingleDeviceTestCase from views.sign_in_view import SignInView from views.keycard_view import KeycardView @@ -43,7 +43,7 @@ class TestCreateAccount(SingleDeviceTestCase): sign_in = SignInView(self.driver) sign_in.recover_access(passphrase=basic_user['passphrase'], keycard=True) - sign_in.just_fyi('Check that after restring account with assets is restored') + sign_in.just_fyi('Check that after restoring account with assets is restored') wallet_view = sign_in.wallet_button.click() wallet_view.set_up_wallet() for asset in ['ETH', 'ADI', 'STT']: @@ -245,3 +245,58 @@ class TestCreateAccount(SingleDeviceTestCase): self.errors.verify_no_errors() + @marks.testrail_id(6311) + @marks.medium + def test_same_seed_added_inside_multiaccount_and_keycard(self): + sign_in = SignInView(self.driver) + recipient = "0x" + transaction_senders['G']['address'] + + sign_in.just_fyi('Restore keycard multiaccount and logout') + sign_in.recover_access(passphrase=basic_user['passphrase'], keycard=True) + profile_view = sign_in.profile_button.click() + profile_view.logout() + + sign_in.just_fyi('Create new multiaccount') + sign_in.your_keys_more_icon.click() + sign_in.generate_new_key_button.click() + sign_in.generate_key_button.click() + sign_in.next_button.click() + sign_in.next_button.click() + sign_in.create_password_input.set_value(common_password) + sign_in.next_button.click() + sign_in.confirm_your_password_input.set_value(common_password) + sign_in.next_button.click() + sign_in.maybe_later_button.click_until_presence_of_element(sign_in.lets_go_button) + sign_in.lets_go_button.click() + + sign_in.just_fyi('Add to wallet seed phrase for restored multiaccount') + wallet_view = sign_in.wallet_button.click() + wallet_view.set_up_wallet() + wallet_view.add_account_button.click() + wallet_view.enter_a_seed_phrase_button.click() + wallet_view.enter_your_password_input.send_keys(common_password) + account_name = 'subacc' + wallet_view.account_name_input.send_keys(account_name) + wallet_view.enter_seed_phrase_input.set_value(basic_user['passphrase']) + wallet_view.add_account_generate_account_button.click() + wallet_view.get_account_by_name(account_name).click() + + sign_in.just_fyi('Send transaction from added account and log out') + transaction_amount_added = wallet_view.get_unique_amount() + wallet_view.send_transaction(amount=transaction_amount_added, recipient=recipient, sign_transaction=True) + wallet_view.profile_button.click() + profile_view.logout() + + sign_in.just_fyi('Login to keycard account and send another transaction') + sign_in.sign_in(position=2, keycard=True) + sign_in.wallet_button.click() + wallet_view.set_up_wallet() + wallet_view.accounts_status_account.click() + transaction_amount_keycard = wallet_view.get_unique_amount() + wallet_view.send_transaction(amount=transaction_amount_keycard, recipient=recipient, keycard=True, sign_transaction=True) + + sign_in.just_fyi('Check both transactions from keycard multiaccount and from added account in network') + for amount in [transaction_amount_keycard, transaction_amount_added]: + self.network_api.find_transaction_by_unique_amount(basic_user['address'], amount) + + self.errors.verify_no_errors() \ No newline at end of file diff --git a/test/appium/views/sign_in_view.py b/test/appium/views/sign_in_view.py index 2f9d84bbbd..510b9ac839 100644 --- a/test/appium/views/sign_in_view.py +++ b/test/appium/views/sign_in_view.py @@ -297,10 +297,11 @@ class SignInView(BaseView): self.profile_button.wait_for_visibility_of_element(30) return self.get_home_view() - def sign_in(self, password=common_password, keycard=False): + def sign_in(self, password=common_password, keycard=False, position=1): self.rooted_device_continue() self.multi_account_on_login_button.wait_for_visibility_of_element(10) - self.multi_account_on_login_button.click() + self.get_multiaccount_by_position(position).click() + if keycard: from views.keycard_view import KeycardView keycard_view = KeycardView(self.driver) @@ -311,8 +312,9 @@ class SignInView(BaseView): self.sign_in_button.click() return self.get_home_view() - def get_account_by_position(self, position: int): - account_button = MultiAccountButton(self.driver, position) + + def get_multiaccount_by_position(self, position: int, element_class=MultiAccountOnLoginButton): + account_button = element_class(self.driver, position) if account_button.is_element_displayed(): return account_button else: diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index c3494b94f4..de8dbd4361 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -254,7 +254,6 @@ class StatusAccountTotalValueText(BaseText): class SendTransactionButton(BaseButton): - def __init__(self, driver): super(SendTransactionButton, self).__init__(driver) self.locator = self.Locator.xpath_selector("//*[@text='Send']") @@ -270,7 +269,6 @@ class SendTransactionButton(BaseButton): class ReceiveTransactionButton(BaseButton): - def __init__(self, driver): super(ReceiveTransactionButton, self).__init__(driver) self.locator = self.Locator.xpath_selector("//*[@text='Receive']")