Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2020-11-03 17:15:14 +01:00
parent d8713fe3c7
commit c7b3efe6ad
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
7 changed files with 147 additions and 26 deletions

View File

@ -42,6 +42,7 @@ staging_fleet = 'eth.staging'
prod_fleet = 'eth.prod'
# This fleet is used in the tests
used_fleet = staging_fleet
geth_log_emulator_path = '/storage/emulated/0/Android/data/im.status.ethereum/files/Download/geth.log'
mailserver_ams = 'mail-01.do-ams3'
mailserver_hk = 'mail-01.ac-cn-hongkong-c'
@ -65,3 +66,4 @@ test_dapp_url = 'simpledapp.eth'
test_dapp_name = 'simpledapp.eth'
emojis = {'thumbs-up': 2, 'thumbs-down': 3, 'love': 1, 'laugh': 4, 'angry': 6, 'sad': 5}

View File

@ -200,7 +200,7 @@ class TestCreateAccount(SingleDeviceTestCase):
@marks.testrail_id(5758)
@marks.high
def test_can_recover_keycard_account_card_pairing(self):
def test_keycard_can_recover_keycard_account_card_pairing(self):
sign_in = SignInView(self.driver)
recovered_user = transaction_senders['A']
@ -243,6 +243,72 @@ class TestCreateAccount(SingleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6243)
@marks.medium
def test_keycard_can_recover_keycard_account_offline_and_add_watch_only_acc(self):
sign_in = SignInView(self.driver)
recovered_user = transaction_senders['A']
sign_in.toggle_airplane_mode()
sign_in.just_fyi('Recover multiaccount offline')
sign_in.get_started_button.click_until_presence_of_element(sign_in.access_key_button)
sign_in.access_key_button.click()
sign_in.recover_with_keycard_button.click()
keycard_view = sign_in.begin_recovery_button.click()
keycard_view.connect_pairing_card_button.click()
keycard_view.pair_code_input.set_value(pair_code)
sign_in.pair_to_this_device_button.click()
keycard_view.enter_default_pin()
sign_in.home_button.wait_for_visibility_of_element(30)
wallet_view = sign_in.wallet_button.click()
wallet_view.set_up_wallet()
sign_in.just_fyi('Relogin offline')
self.driver.close_app()
self.driver.launch_app()
sign_in.sign_in(keycard=True)
if not sign_in.home_button.is_element_displayed(10):
self.driver.fail('Keycard user is not logged in')
sign_in.just_fyi('Turn off airplane mode and turn on cellular network')
sign_in.toggle_airplane_mode()
sign_in.toggle_mobile_data()
sign_in.element_by_text_part('Stop syncing').wait_and_click(60)
sign_in.wallet_button.click()
if wallet_view.asset_by_name('LXS').is_element_displayed():
self.errors.append('Token balance is fetched while on cellular network!')
wallet_view.just_fyi('Add watch-only account when on cellular network')
wallet_view.add_account_button.click()
wallet_view.add_watch_only_address_button.click()
wallet_view.enter_address_input.send_keys(basic_user['address'])
account_name = 'watch-only'
wallet_view.account_name_input.send_keys(account_name)
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')
# TODO: not working in keycard - token balance is fetched. blecked due to issue
# if wallet_view.asset_by_name('ADI').is_element_displayed():
# self.errors.append('Tokens are visible after adding account on cellular network!')
wallet_view.just_fyi('Check that balance is changed after go back to WI-FI')
sign_in.toggle_mobile_data()
for asset in ('LXS', 'ADI', 'STT'):
wallet_view.wait_balance_is_changed(asset, wait_time=60)
wallet_view.just_fyi('Delete watch-only account')
wallet_view.get_account_by_name(account_name).click()
wallet_view.get_account_options_by_name(account_name).click()
wallet_view.account_settings_button.click()
wallet_view.delete_account_button.click()
wallet_view.yes_button.click()
if wallet_view.get_account_by_name(account_name).is_element_displayed(20):
self.errors.append('Account was not deleted')
self.errors.verify_no_errors()
@marks.testrail_id(6311)
@marks.medium
def test_same_seed_added_inside_multiaccount_and_keycard(self):

View File

@ -504,16 +504,49 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
profile_view.find_full_text('#status')
@marks.testrail_id(5368)
@marks.high
def test_log_level_and_fleet(self):
sign_in_view = SignInView(self.driver)
sign_in_view.create_user()
profile_view = sign_in_view.profile_button.click()
profile_view.settings_button.click()
profile_view.advanced_button.click()
for text in 'INFO', used_fleet:
if not profile_view.element_by_text(text).is_element_displayed():
@marks.medium
def test_change_log_level_and_fleet(self):
home = SignInView(self.driver).create_user()
profile = home.profile_button.click()
profile.settings_button.click()
profile.advanced_button.click()
default_log_level = 'INFO'
for text in default_log_level, used_fleet:
if not profile.element_by_text(text).is_element_displayed():
self.errors.append('%s is not selected by default' % text)
if home.find_values_in_geth('lvl=trce', 'lvl=dbug'):
self.errors.append('"%s" is set, but found another entries!' % default_log_level)
if not home.find_values_in_geth('lvl=info'):
self.errors.append('"%s" is set, but no entries are found!' % default_log_level)
home.just_fyi('Set another loglevel and check that changes are applied')
profile.log_level_setting_button.click()
changed_log_level = 'TRACE'
profile.element_by_text(changed_log_level).click_until_presence_of_element(profile.confirm_button)
profile.confirm_button.click()
SignInView(self.driver).sign_in()
home.profile_button.click()
profile.settings_button.click()
profile.advanced_button.click()
if not profile.element_by_text(changed_log_level).is_element_displayed():
self.errors.append('"%s" is not selected after change' % changed_log_level)
if not home.find_values_in_geth('lvl=trc'):
self.errors.append('"%s" is set, but no entries are found!' % changed_log_level)
home.just_fyi('Set another fleet and check that changes are applied')
profile.fleet_setting_button.click()
changed_fleet = 'eth.prod'
profile.element_by_text(changed_fleet).click_until_presence_of_element(profile.confirm_button)
profile.confirm_button.click()
SignInView(self.driver).sign_in()
home.profile_button.click()
profile.settings_button.click()
profile.advanced_button.click()
if not profile.element_by_text(changed_fleet).is_element_displayed():
self.errors.append('"%s" fleet is not selected after change' % changed_fleet)
if not home.find_values_in_geth(changed_fleet):
self.errors.append('"%s" is set, but no entry is found!' % changed_fleet)
self.errors.verify_no_errors()

View File

@ -253,9 +253,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
chat_name = devices_home[0].get_random_chat_name()
devices_home[0].add_contact(basic_user['public_key'])
devices_home[0].get_back_to_home_view()
devices_chat[0] = devices_home[0].create_group_chat([basic_user['username']], chat_name)
devices_chat[0].just_fyi('Create usernames without members')
devices_chat[0] = devices_home[0].create_group_chat([], chat_name)
link = devices_chat[0].get_group_invite_via_group_info()
devices_chat[0].get_back_to_home_view()

View File

@ -13,7 +13,7 @@ from io import BytesIO
from selenium.common.exceptions import NoSuchElementException, TimeoutException, StaleElementReferenceException
from support.device_apps import start_web_browser
from tests import common_password, pytest_config_global
from tests import common_password, pytest_config_global, geth_log_emulator_path
from views.base_element import BaseButton, BaseElement, BaseEditBox, BaseText
@ -556,7 +556,7 @@ class BaseView(object):
return element
def wait_for_element_starts_with_text(self, text, wait_time=60):
self.driver.info("Looking for full text: '%s'" % text)
self.driver.info("Looking for element, start with text: '%s'" % text)
element = BaseElement(self.driver)
element.locator = element.Locator.xpath_selector("//*[starts-with(@text,'%s')]" % text)
return element.wait_for_element(wait_time)
@ -713,6 +713,18 @@ class BaseView(object):
items_in_logcat.append('%s in logcat!!!' % key.capitalize())
return items_in_logcat
def find_values_in_geth(self, *args):
b64_log = self.driver.pull_file(geth_log_emulator_path)
file = base64.b64decode(b64_log)
result = False
for value in args:
self.driver.info('Checking for %s entry' % value)
if re.findall('%s*' % value, file.decode("utf-8")):
self.driver.info('%s was found in geth.log' % value)
result = True
return result
def asset_by_name(self, asset_name):
return AssetButton(self.driver, asset_name)

View File

@ -230,15 +230,16 @@ class HomeView(BaseView):
def create_group_chat(self, user_names_to_add: list, group_chat_name: str = 'new_group_chat'):
self.plus_button.click()
contacts_view = self.new_group_chat_button.click()
for user_name in user_names_to_add:
if len(user_names_to_add) > 5:
from views.chat_view import ChatView
contact_view_with_search = ChatView(self.driver)
contact_view_with_search.search_by_keyword(user_name[:4])
contacts_view.get_username_checkbox(user_name).click()
contact_view_with_search.search_input.clear()
else:
contacts_view.get_username_checkbox(user_name).click()
if user_names_to_add:
for user_name in user_names_to_add:
if len(user_names_to_add) > 5:
from views.chat_view import ChatView
contact_view_with_search = ChatView(self.driver)
contact_view_with_search.search_by_keyword(user_name[:4])
contacts_view.get_username_checkbox(user_name).click()
contact_view_with_search.search_input.clear()
else:
contacts_view.get_username_checkbox(user_name).click()
contacts_view.next_button.click()
contacts_view.chat_name_editbox.send_keys(group_chat_name)
contacts_view.create_button.click()

View File

@ -202,7 +202,14 @@ class LogLevelSetting(BaseButton):
def __init__(self, driver):
super(LogLevelSetting, self).__init__(driver)
self.locator = self.Locator.xpath_selector('//*[@content-desc="log-level-settings-button"]/android.widget.TextView[2]')
self.locator = self.Locator.accessibility_id('log-level-settings-button')
class FleetSettingButton(BaseButton):
def __init__(self, driver):
super(FleetSettingButton, self).__init__(driver)
self.locator = self.Locator.accessibility_id('fleet-settings-button')
class BackupRecoveryPhraseButton(BaseButton):
@ -653,7 +660,8 @@ class ProfileView(BaseView):
self.profile_notifications_button = PrifileNotificationsButton(self.driver)
self.profile_notifications_toggle_button = PrifileNotificationsToggleButton(self.driver)
self.advanced_button = AdvancedButton(self.driver)
self.log_level_setting = LogLevelSetting(self.driver)
self.log_level_setting_button = LogLevelSetting(self.driver)
self.fleet_setting_button = FleetSettingButton(self.driver)
self.debug_mode_toggle = DebugModeToggle(self.driver)
self.contacts_button = ContactsButton(self.driver)
self.blocked_users_button = BlockedUsersButton(self.driver)