From 5561aff9551f0ac1aac3bb63210e80ef2926ffcd Mon Sep 17 00:00:00 2001 From: Churikova Tetiana Date: Fri, 25 Oct 2019 16:33:56 +0200 Subject: [PATCH] e2e account settings Signed-off-by: Churikova Tetiana --- .../tests/atomic/chats/test_group_chat.py | 15 ++++++--- .../tests/atomic/transactions/test_wallet.py | 33 +++++++++++++++++++ test/appium/views/wallet_view.py | 24 +++++++++++++- 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/test/appium/tests/atomic/chats/test_group_chat.py b/test/appium/tests/atomic/chats/test_group_chat.py index 7ec2f39254..81eded5fd6 100644 --- a/test/appium/tests/atomic/chats/test_group_chat.py +++ b/test/appium/tests/atomic/chats/test_group_chat.py @@ -33,18 +33,18 @@ def get_username(device_home): def create_new_group_chat(device_1_home, device_2_home, chat_name): - # device 2: get public key and default username + device_2_home.just_fyi('get public key and default username') device_2_public_key = device_2_home.get_public_key() device_2_default_username = get_username(device_2_home) - # device 1: add device 2 as contact + device_1_home.just_fyi('add device 2 as contact') device_1_chat = device_1_home.add_contact(device_2_public_key) device_1_chat.get_back_to_home_view() - # device 1: create group chat with some user + device_1_home.just_fyi('create group chat with some user') device_1_chat = device_1_home.create_group_chat([device_2_default_username], chat_name) - # device 2: open group chat + device_2_home.just_fyi('navigate to group chat') device_2_chat = device_2_home.get_chat_with_user(chat_name).click() return device_1_chat, device_2_chat @@ -66,6 +66,13 @@ 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_1_home.plus_button.click() + + device_1_home.new_group_chat_button.click() + if not device_1_home.element_by_text('Invite friends').is_element_displayed(): + self.errors.append("No placeholder is shown when there are no contacts") + device_1_home.get_back_to_home_view() + device_1_chat, device_2_chat = create_and_join_group_chat(device_1_home, device_2_home, chat_name) for chat in (device_1_chat, device_2_chat): diff --git a/test/appium/tests/atomic/transactions/test_wallet.py b/test/appium/tests/atomic/transactions/test_wallet.py index 2b6b969245..dee415a4f0 100644 --- a/test/appium/tests/atomic/transactions/test_wallet.py +++ b/test/appium/tests/atomic/transactions/test_wallet.py @@ -1,4 +1,5 @@ import random +import string from support.utilities import get_merged_txs_list from tests import marks, unique_password, common_password @@ -518,6 +519,38 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase): self.driver.fail('Total wallet balance %s != of Status account (%s) + SubAccount (%s)' % ( total_eth_from_two_accounts, balance_of_status_account, balance_of_sub_account)) + @marks.testrail_id(6235) + @marks.medium + def test_can_change_account_settings(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() + status_account_address = wallet_view.get_wallet_address() + wallet_view.account_options_button.click() + + wallet_view.just_fyi('open Account Settings screen and check that all elements are shown') + wallet_view.account_settings_button.click() + for text in 'On Status tree', status_account_address, "m/44'/60'/0'/0/0": + if not wallet_view.element_by_text(text).is_element_displayed(): + self.errors.append("'%s' text is not shown on Account Settings screen!" % text) + + wallet_view.just_fyi('change account name/color and verified applied changes') + 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.apply_settings_button.click() + wallet_view.element_by_text('This device').scroll_to_element() + wallet_view.back_button.click() + wallet_view.back_button.click() + account_button = wallet_view.get_account_by_name(account_name) + if not account_button.is_element_displayed(): + self.driver.fail('Account name was not changed') + if not account_button.color_matches('multi_account_color.png'): + self.driver.fail('Account color does not match expected') + + self.verify_no_errors() + @marks.transaction class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase): diff --git a/test/appium/views/wallet_view.py b/test/appium/views/wallet_view.py index 99e91a54a4..23154a1e1f 100644 --- a/test/appium/views/wallet_view.py +++ b/test/appium/views/wallet_view.py @@ -69,6 +69,11 @@ class OptionsButton(BaseButton): super(OptionsButton, self).__init__(driver) self.locator = self.Locator.accessibility_id('options-menu-button') +class AccountOptionsButton(BaseButton): + def __init__(self, driver, account_name): + super(AccountOptionsButton, self).__init__(driver) + self.locator = self.Locator.xpath_selector('(//*[@text="%s"]/..//*[@content-desc="icon"])[2]' % account_name) + class ManageAssetsButton(BaseButton): def __init__(self, driver): @@ -305,7 +310,7 @@ class AccountColorButton(BaseButton): def __init__(self, driver): super(AccountColorButton, self).__init__(driver) self.locator = self.Locator.xpath_selector("//android.widget.TextView[@text='Account color']" - "/following-sibling::android.view.ViewGroup") + "/following-sibling::android.view.ViewGroup[1]") def select_color_by_position(self, position: int): self.click() @@ -318,6 +323,15 @@ class FinishButton(BaseButton): super(FinishButton, self).__init__(driver) self.locator = self.Locator.text_selector('Finish') +class AccountSettingsButton(BaseButton): + def __init__(self, driver): + super(AccountSettingsButton, self).__init__(driver) + self.locator = self.Locator.text_selector('Account settings') + +class ApplySettingsButton(BaseButton): + def __init__(self, driver): + super(ApplySettingsButton, self).__init__(driver) + self.locator = self.Locator.text_selector('Apply') class WalletView(BaseView): def __init__(self, driver): @@ -368,6 +382,11 @@ class WalletView(BaseView): self.account_color_button = AccountColorButton(self.driver) self.finish_button = FinishButton(self.driver) + # individual account settings + self.account_settings_button = AccountSettingsButton(self.driver) + self.apply_settings_button = ApplySettingsButton(self.driver) + self.account_options_button = AccountOptionsButton(self.driver, account_name='Status account') + def get_usd_total_value(self): import re return float(re.sub('[~,]', '', self.usd_total_value.text)) @@ -429,6 +448,9 @@ class WalletView(BaseView): def asset_checkbox_by_name(self, asset_name): return AssetCheckBox(self.driver, asset_name) + def account_options_by_name(self, account_name): + return AccountOptionsButton(self.driver, account_name) + def select_asset(self, *args): self.multiaccount_more_options.click() self.manage_assets_button.click()