e2e: new checks, formatting

This commit is contained in:
Churikova Tetiana 2021-11-18 16:16:48 +01:00
parent b919df6d6b
commit ebf2ad206e
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
40 changed files with 775 additions and 583 deletions

View File

@ -89,7 +89,8 @@ class BaseTestReport:
token = self.get_sauce_token(job_id)
return 'https://saucelabs.com/jobs/%s?auth=%s' % (job_id, token)
def get_jenkins_link_to_rerun_e2e(self, branch_name="develop", pr_id="", apk_name="", tr_case_ids=""):
@staticmethod
def get_jenkins_link_to_rerun_e2e(branch_name="develop", pr_id="", apk_name="", tr_case_ids=""):
return 'https://ci.status.im/job/end-to-end-tests/job/status-app-prs-rerun/parambuild/' \
'?BRANCH_NAME=%s&APK_NAME=%s&PR_ID=%s&TR_CASE_IDS=%s' % (branch_name, apk_name, pr_id, tr_case_ids)

View File

@ -8,6 +8,7 @@ from os import environ
from support.base_test_report import BaseTestReport
from sys import argv
class TestrailReport(BaseTestReport):
def __init__(self):
@ -45,7 +46,8 @@ class TestrailReport(BaseTestReport):
def add_attachment(self, method, path):
files = {'attachment': (open(path, 'rb'))}
result = requests.post(self.api_url + method, headers={'Authorization': self.headers['Authorization']}, files=files)
result = requests.post(self.api_url + method, headers={'Authorization': self.headers['Authorization']},
files=files)
files['attachment'].close()
return result.json()
@ -84,7 +86,9 @@ class TestrailReport(BaseTestReport):
def get_cases(self, section_ids):
test_cases = list()
for section_id in section_ids:
test_cases.append(self.get('get_cases/%s&suite_id=%s&section_id=%s' % (self.project_id, self.suite_id, section_id))['cases'])
test_cases.append(
self.get('get_cases/%s&suite_id=%s&section_id=%s' % (self.project_id, self.suite_id, section_id))[
'cases'])
return itertools.chain.from_iterable(test_cases)
def get_regression_cases(self):
@ -123,12 +127,14 @@ class TestrailReport(BaseTestReport):
for i, device in enumerate(last_testrun.jobs):
devices += "# [Device %d](%s) \n" % (i + 1, self.get_sauce_job_url(device))
data = {'status_id': self.outcomes['undefined_fail'] if last_testrun.error else self.outcomes['passed'],
'comment': '%s' % ('# Error: \n %s \n' % emoji.demojize(last_testrun.error)) + devices + test_steps if last_testrun.error
'comment': '%s' % ('# Error: \n %s \n' % emoji.demojize(
last_testrun.error)) + devices + test_steps if last_testrun.error
else devices + test_steps}
result_id = self.post(method, data=data)['id']
if last_testrun.error:
for geth in test.geth_paths.keys():
self.add_attachment(method='add_attachment_to_result/%s' % str(result_id), path=test.geth_paths[geth])
self.add_attachment(method='add_attachment_to_result/%s' % str(result_id),
path=test.geth_paths[geth])
self.change_test_run_description()
def change_test_run_description(self):
@ -167,7 +173,6 @@ class TestrailReport(BaseTestReport):
request_body = {'description': final_description}
return self.post('update_run/%s' % self.run_id, request_body)
def get_run_results(self):
return self.get('get_results_for_run/%s' % self.run_id)['results']

View File

@ -66,7 +66,8 @@ class TestCreateAccount(SingleDeviceTestCase):
passphrase = fill_string_with_char(passphrase.upper(), ' ', 3, True, True)
sign_in = SignInView(self.driver)
sign_in.just_fyi("Restore multiaccount from uppercase seed phrase with whitespaces and set password with special chars")
sign_in.just_fyi(
"Restore multiaccount from uppercase seed phrase with whitespaces and set password with special chars")
sign_in.recover_access(passphrase, password=password)
profile = sign_in.profile_button.click()
username = profile.default_username_text.text
@ -99,7 +100,8 @@ class TestCreateAccount(SingleDeviceTestCase):
sign_in.get_started_button.click_until_presence_of_element(sign_in.generate_key_button)
sign_in.generate_key_button.click()
from views.sign_in_view import MultiAccountButton
account_button = sign_in.get_multiaccount_by_position(position=random.randint(1, 4), element_class=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()
@ -130,7 +132,8 @@ class TestCreateAccount(SingleDeviceTestCase):
if home.element_by_text(texts[0]).is_element_displayed():
self.errors.append("'%s' text is shown after relogin, but welcome view was closed" % texts[0])
if not home.element_by_translation_id("welcome-blank-message").is_element_displayed():
self.errors.append("'%s' text is not shown after welcome view was closed" % home.get_translation_by_key("welcome-blank-message"))
self.errors.append("'%s' text is not shown after welcome view was closed" % home.get_translation_by_key(
"welcome-blank-message"))
self.errors.verify_no_errors()
@ -267,6 +270,3 @@ class TestCreateAccount(SingleDeviceTestCase):
profile.delete_profile_button.click()
profile.ok_button.click()
self.errors.verify_no_errors()

View File

@ -71,13 +71,13 @@ class TestCreateAccount(SingleDeviceTestCase):
sign_in.lets_go_button.wait_and_click(30)
sign_in.just_fyi('Check that after migrating account with assets is restored')
wallet_view = sign_in.wallet_button.click()
wallet = sign_in.wallet_button.click()
for asset in ['ETH', 'ADI', 'STT']:
if wallet_view.get_asset_amount_by_name(asset) == 0:
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_view.get_wallet_address()
address = wallet.get_wallet_address()
if address != '0x%s' % basic_user['address']:
self.errors.append('Restored address %s does not match expected' % address)
@ -90,7 +90,8 @@ class TestCreateAccount(SingleDeviceTestCase):
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.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")
@ -101,10 +102,10 @@ class TestCreateAccount(SingleDeviceTestCase):
sign_in.just_fyi('Check that can add another wallet account and send transaction')
home.wallet_button.click()
wallet_view.add_account(account_name="another_keycard_account", keycard=True)
wallet_view.accounts_status_account.click()
transaction_amount_added = wallet_view.get_unique_amount()
wallet_view.send_transaction(amount=transaction_amount_added, recipient=transaction_senders['A']['address'], keycard=True, sign_transaction=True)
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['A']['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'
@ -380,7 +381,6 @@ class TestCreateAccount(SingleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6311)
@marks.medium
def test_same_seed_added_inside_multiaccount_and_keycard(self):
@ -406,30 +406,31 @@ class TestCreateAccount(SingleDeviceTestCase):
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.add_account_button.click()
wallet_view.enter_a_seed_phrase_button.click()
wallet_view.enter_your_password_input.send_keys(common_password)
wallet = sign_in.wallet_button.click()
wallet.add_account_button.click()
wallet.enter_a_seed_phrase_button.click()
wallet.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()
wallet.account_name_input.send_keys(account_name)
wallet.enter_seed_phrase_input.set_value(basic_user['passphrase'])
wallet.add_account_generate_account_button.click()
wallet.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()
transaction_amount_added = wallet.get_unique_amount()
wallet.send_transaction(from_main_wallet=False, amount=transaction_amount_added, recipient=recipient,
sign_transaction=True)
wallet.profile_button.click()
profile_view.logout()
sign_in.just_fyi('Login to keycard account and send another transaction')
sign_in.back_button.click()
sign_in.sign_in(position=2, keycard=True)
sign_in.wallet_button.click()
wallet_view.wait_balance_is_changed('ETH')
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)
wallet.wait_balance_is_changed('ETH')
transaction_amount_keycard = wallet.get_unique_amount()
wallet.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]:
@ -726,7 +727,7 @@ class TestKeycardCreateMultiaccountMultipleDevice(MultipleDeviceTestCase):
device_1.seedphrase_input.click()
device_1.seedphrase_input.set_value(seed_phrase)
device_1.next_button.click()
device_1.element_by_translation_id(id="unlock", uppercase=True).click()
device_1.element_by_translation_id("unlock", uppercase=True).click()
keycard_flow.enter_default_pin()
device_1_home = device_1.home_button.click()
device_1_home.plus_button.click()

View File

@ -3,7 +3,7 @@ import re
from tests import marks, bootnode_address, mailserver_address, test_dapp_url, test_dapp_name, mailserver_ams, \
mailserver_gc, mailserver_hk, used_fleet, common_password
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from tests.users import transaction_senders, basic_user, ens_user, ens_user_ropsten
from tests.users import transaction_senders, basic_user, ens_user, ens_user_ropsten, user_mainnet
from views.sign_in_view import SignInView
from time import time
@ -43,7 +43,8 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
if profile.element_by_translation_id("profile-deleted-title").is_element_displayed():
self.driver.fail('Profile is deleted without confirmation with password')
profile.delete_my_profile_password_input.set_value(common_password)
profile.delete_profile_button.click_until_presence_of_element(profile.element_by_translation_id("profile-deleted-title"))
profile.delete_profile_button.click_until_presence_of_element(
profile.element_by_translation_id("profile-deleted-title"))
profile.ok_button.click()
sign_in.just_fyi('Delete last multiaccount')
@ -58,6 +59,55 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append('No redirected to carousel view after deleting last multiaccount')
self.errors.verify_no_errors()
@marks.testrail_id(695890)
@marks.medium
def test_can_use_another_fleets_and_networks_advanced(self):
user = user_mainnet
sign_in = SignInView(self.driver)
home = sign_in.recover_access(user['passphrase'])
home.just_fyi("Check that can enable all toggles and still login successfully")
profile = home.profile_button.click()
profile.advanced_button.click()
profile.transaction_management_enabled_toggle.click()
profile.webview_debug_toggle.click()
profile.waku_bloom_toggle.click()
sign_in.sign_in()
# home.just_fyi("Check tx management")
# TODO: blocked due to 12827
# wallet = home.wallet_button.click()
# send_tx = wallet.send_transaction_from_main_screen.click()
# from views.send_transaction_view import SendTransactionView
# send_tx = SendTransactionView(self.driver)
# send_tx.amount_edit_box.set_value('0')
# send_tx.set_recipient_address(ens_user['address'])
# send_tx.next_button.click()
# send_tx.advanced_button.click()
# send_tx.nonce_input.set_value('4')
# send_tx.nonce_save_button.click()
home.just_fyi("Check balance on mainnet")
profile = home.profile_button.click()
profile.switch_network()
wallet = home.wallet_button.click()
wallet.scan_tokens()
[wallet.wait_balance_is_equal_expected_amount(asset, value) for asset, value in user['mainnet'].items()]
home.just_fyi("Check balance on xDai and default network fee")
profile = home.profile_button.click()
profile.switch_network('xDai Chain')
home.wallet_button.click()
wallet.element_by_text(user['xdai']).wait_for_element(30)
home.just_fyi("Check balance on BSC and default network fee")
profile = home.profile_button.click()
profile.switch_network('BSC Network')
home.wallet_button.click()
wallet.element_by_text(user['bsc']).wait_for_element(30)
self.errors.verify_no_errors()
@marks.testrail_id(5323)
@marks.critical
def test_share_copy_contact_code_and_wallet_address(self):
@ -272,7 +322,8 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append('In %s case username not found in contact view after scanning' % key)
if 'nickname' in users[key]:
if not profile.element_by_text(users[key]['nickname']).is_element_displayed():
self.errors.append('In %s case nickname %s not found in contact view after scanning' % (key, users[key]['nickname']))
self.errors.append('In %s case nickname %s not found in contact view after scanning' % (key,
users[key]['nickname']))
home.just_fyi('Remove contact and check that it disappeared')
user_to_remove = '@%s' % ens_user['ens_another']
@ -282,7 +333,8 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
if profile.element_by_text(user_to_remove).is_element_displayed():
self.errors.append('Removed user is still shown in contact view')
home.just_fyi('Relogin and open profile view of the contact removed from Contact list to ensure there is no crash')
home.just_fyi(
'Relogin and open profile view of the contact removed from Contact list to ensure there is no crash')
profile.profile_button.click()
profile.relogin()
one_to_one_chat = home.add_contact(public_key=ens_user['ens_another'], add_in_contacts=False)
@ -341,7 +393,8 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.driver.fail(values_in_logcat)
profile.profile_button.double_click()
home.just_fyi("Try to restore same account from seed phrase (should be possible only to unlock existing account)")
home.just_fyi(
"Try to restore same account from seed phrase (should be possible only to unlock existing account)")
profile.logout()
sign_in.back_button.click()
sign_in.access_key_button.click()
@ -349,7 +402,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
sign_in.seedphrase_input.click()
sign_in.seedphrase_input.set_value(' '.join(recovery_phrase.values()))
sign_in.next_button.click()
sign_in.element_by_translation_id(id="unlock", uppercase=True).click()
sign_in.element_by_translation_id(translation_id="unlock", uppercase=True).click()
sign_in.password_input.set_value(common_password)
chat = sign_in.sign_in_button.click()
chat.plus_button.click()
@ -391,9 +444,9 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
signin.just_fyi("Checking that version match expected format and can be copied")
app_version = profile.app_version_text.text
node_version = profile.node_version_text.text
if not re.search(r'\d{1}[.]\d{1,2}[.]\d{1,2}\s[(]\d*[)]', app_version):
if not re.search(r'\d[.]\d{1,2}[.]\d{1,2}\s[(]\d*[)]', app_version):
self.errors.append("App version %s didn't match expected format" % app_version)
if not re.search(r'StatusIM\/v.*\/android-\d{3}\/go\d{1}[.]\d{1,}', node_version):
if not re.search(r'StatusIM/v.*/android-\d{3}/go\d[.]\d+', node_version):
self.errors.append("Node version %s didn't match expected format" % node_version)
profile.app_version_text.click()
profile.back_button.click()
@ -414,9 +467,21 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append("FAQ is not shown")
profile.click_system_back_button()
profile.submit_bug_button.click()
signin.just_fyi("Checking bug submitting form")
profile.bug_description_edit_box.set_value('1234')
profile.bug_submit_button.click()
if not profile.element_by_translation_id("bug-report-too-short-description").is_element_displayed():
self.errors.append("Can submit big with too short description!")
profile.bug_description_edit_box.clear()
[field.set_value("Something wrong happened!!") for field in
(profile.bug_description_edit_box, profile.bug_steps_edit_box)]
profile.bug_submit_button.click()
if not profile.element_by_text_part("Welcome to Gmail").is_element_displayed(30):
self.errors.append("Mail client is not opened when submitting bug")
profile.click_system_back_button()
profile.click_system_back_button(2)
signin.just_fyi("Checking request feature")
profile.request_a_feature_button.click()
if not profile.element_by_text("#support").is_element_displayed(30):
self.errors.append("Support channel is not suggested for requesting a feature")
@ -487,7 +552,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
home.just_fyi('Set another fleet and check that changes are applied')
profile.fleet_setting_button.click()
changed_fleet = 'eth.prod'
changed_fleet = 'wakuv2.prod'
profile.element_by_text(changed_fleet).click_until_presence_of_element(profile.confirm_button)
profile.confirm_button.click()
SignInView(self.driver).sign_in()
@ -509,7 +574,8 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
profile.just_fyi('pin history node')
profile.sync_settings_button.click()
node_gc, node_ams, node_hk = [profile.return_mailserver_name(history_node_name, used_fleet) for history_node_name in (mailserver_gc, mailserver_ams, mailserver_hk)]
node_gc, node_ams, node_hk = [profile.return_mailserver_name(history_node_name, used_fleet) for
history_node_name in (mailserver_gc, mailserver_ams, mailserver_hk)]
h_node = node_ams
profile.mail_server_button.click()
profile.mail_server_auto_selection_button.click()
@ -566,7 +632,6 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.verify_no_errors()
class TestProfileMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(6646)
@marks.high
@ -599,7 +664,8 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
public_chat_1 = home_1.join_public_chat(public_chat_name)
public_chat_1.chat_message_input.send_keys(message)
public_chat_1.send_message_button.click()
if not public_chat_2.chat_element_by_text(message).member_photo.is_element_image_similar_to_template('sauce_logo.png'):
if not public_chat_2.chat_element_by_text(message).member_photo.is_element_image_similar_to_template(
'sauce_logo.png'):
self.drivers[0].fail('Profile picture was not updated in chat')
profile_1.just_fyi("Set user Profile image by taking Photo")
@ -609,7 +675,8 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
public_chat_1.chat_message_input.send_keys(message)
public_chat_1.send_message_button.click()
if public_chat_2.chat_element_by_text(message).member_photo.is_element_image_similar_to_template('sauce_logo.png'):
if public_chat_2.chat_element_by_text(message).member_photo.is_element_image_similar_to_template(
'sauce_logo.png'):
self.drivers[0].fail('Profile picture was not updated in chat after making photo')
@marks.testrail_id(6636)
@ -617,7 +684,8 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
@marks.flaky
def test_show_profile_picture_of_setting(self):
self.create_drivers(2)
home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user(enable_notifications=True)
home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user(
enable_notifications=True)
profile_1, profile_2 = home_1.profile_button.click(), home_2.profile_button.click()
public_key_1, default_username_1 = profile_1.get_public_key_and_username(return_username=True)
public_key_2, default_username_2 = profile_2.get_public_key_and_username(return_username=True)
@ -643,14 +711,16 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
one_to_one_chat_2 = home_2.add_contact(public_key_1, add_in_contacts=False)
one_to_one_chat_2.chat_message_input.set_value('@' + default_username_1)
one_to_one_chat_2.chat_message_input.click()
if one_to_one_chat_2.user_profile_image_in_mentions_list(default_username_1).is_element_image_similar_to_template(logo_default):
if one_to_one_chat_2.user_profile_image_in_mentions_list(
default_username_1).is_element_image_similar_to_template(logo_default):
self.errors.append('Profile picture is updated in 1-1 chat mentions list of contact not in Contacts list')
profile_1.just_fyi('Check profile image is in mentions because now user was added in contacts')
one_to_one_chat_2.add_to_contacts.click()
one_to_one_chat_2.chat_message_input.set_value('@' + default_username_1)
one_to_one_chat_2.chat_message_input.click()
if not one_to_one_chat_2.user_profile_image_in_mentions_list(default_username_1).is_element_image_similar_to_template(logo_default):
if not one_to_one_chat_2.user_profile_image_in_mentions_list(
default_username_1).is_element_image_similar_to_template(logo_default):
self.errors.append('Profile picture was not updated in 1-1 chat mentions list')
one_to_one_chat_2.get_back_to_home_view()
@ -673,14 +743,15 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
group_chat_1 = home_1.get_chat(group_chat_name).click()
group_chat_1.join_chat_button.click()
group_chat_1.send_message(group_chat_message)
if not group_chat_2.chat_element_by_text(group_chat_message).member_photo.is_element_image_similar_to_template(logo_default):
if not group_chat_2.chat_element_by_text(group_chat_message).member_photo.is_element_image_similar_to_template(
logo_default):
self.errors.append('User profile picture was not updated in message Group chat view')
home_2.put_app_to_background()
profile_1.just_fyi('Check profile image updated in group chat invite')
home_1.get_back_to_home_view()
new_group_chat = 'new_gr'
group_chat_1 = home_1.create_group_chat(user_names_to_add=[default_username_2], group_chat_name=new_group_chat)
home_1.create_group_chat(user_names_to_add=[default_username_2], group_chat_name=new_group_chat)
home_2.click_system_back_button()
home_2.open_notification_bar()
@ -694,10 +765,12 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
home_1.profile_button.click()
profile_1.logout()
sign_in_1 = home_1.get_sign_in_view()
if not sign_in_1.get_multiaccount_by_position(1).account_logo.is_element_image_similar_to_template(logo_default):
if not sign_in_1.get_multiaccount_by_position(1).account_logo.is_element_image_similar_to_template(
logo_default):
self.errors.append('User profile picture was not updated on Multiaccounts list select login view')
sign_in_1.element_by_text(default_username_1).click()
if not sign_in_1.get_multiaccount_by_position(1).account_logo.is_element_image_similar_to_template(logo_default):
if not sign_in_1.get_multiaccount_by_position(1).account_logo.is_element_image_similar_to_template(
logo_default):
self.errors.append('User profile picture was not updated on account login view')
sign_in_1.password_input.set_value(common_password)
sign_in_1.sign_in_button.click()
@ -882,7 +955,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
profile_1.confirm_button.click()
profile_1.just_fyi('check that popup "Error connecting" will not reappear if tap on "Cancel"')
profile_1.element_by_translation_id(id='mailserver-error-title').wait_for_element(120)
profile_1.element_by_translation_id('mailserver-error-title').wait_for_element(120)
profile_1.cancel_button.click()
profile_1.home_button.click()
@ -936,7 +1009,8 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
public_chat_2 = home_2.join_public_chat(public_chat_name)
public_chat_2.send_message(message)
profile_1.just_fyi('disable use_history_node and check that no history is fetched but you can still send messages')
profile_1.just_fyi(
'disable use_history_node and check that no history is fetched but you can still send messages')
profile_1.sync_settings_button.click()
profile_1.mail_server_button.click()
profile_1.use_history_node_button.click()
@ -1005,14 +1079,16 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
home_2.just_fyi('check that can mention user with ENS name')
public_2.select_mention_from_suggestion_list(user_1['ens'])
if public_2.chat_message_input.text != ens_name + ' ':
self.errors.append('ENS username is not resolved in chat input after selecting it in mention suggestions list!')
self.errors.append(
'ENS username is not resolved in chat input after selecting it in mention suggestions list!')
public_2.send_message_button.click()
public_2.element_starts_with_text(ens_name, 'button').click()
for element in (public_2.element_by_text(user_1['username']), public_2.profile_add_to_contacts):
if not element.is_element_displayed():
self.errors.append('Was not redirected to user profile after tapping on mention!')
home_1.just_fyi('check that PN is received and after tap you are redirected to public chat, mention is highligted')
home_1.just_fyi(
'check that PN is received and after tap you are redirected to public chat, mention is highligted')
home_1.open_notification_bar()
home_1.element_by_text_part(username_2).click()
if home_1.element_starts_with_text(user_1['ens']).is_element_differs_from_template('mentioned.png', 2):
@ -1021,7 +1097,8 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
# Close Device1 driver session since it's not needed anymore
self.drivers[0].quit()
home_2.just_fyi('check that ENS name is shown in 1-1 chat without adding user as contact in header, profile, options')
home_2.just_fyi(
'check that ENS name is shown in 1-1 chat without adding user as contact in header, profile, options')
one_to_one_2 = public_2.profile_send_message.click()
if one_to_one_2.user_name_text.text != ens_name:
self.errors.append('ENS username is not shown in 1-1 chat header')
@ -1113,7 +1190,8 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
home_2.mobile_connection_on_icon.click()
home_2.connection_settings_button.click()
if not home_2.element_by_translation_id("mobile-network-use-mobile").is_element_displayed():
self.errors.append("Was not redirected to sync settings after tapping on Settings in connection bottom sheet")
self.errors.append(
"Was not redirected to sync settings after tapping on Settings in connection bottom sheet")
home_1.just_fyi("Check default preferences in Sync settings")
profile_1 = home_1.profile_button.click()
@ -1139,7 +1217,6 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(5680)
@marks.high
@marks.skip

View File

@ -135,7 +135,7 @@ class TestWalletManagement(SingleDeviceTestCase):
wallet.close_send_transaction_view_button.double_click()
wallet.just_fyi('Check "Open in OpenSea" (that user is signed in)')
wallet.element_by_translation_id("check-on-opensea").click_until_presence_of_element((web_view.browser_previous_page_button))
wallet.element_by_translation_id("check-on-opensea").click_until_presence_of_element(web_view.browser_previous_page_button)
web_view.wait_for_d_aap_to_load(10)
wallet.element_by_text('e2ecryptokitty').wait_for_element(60)
@ -208,7 +208,8 @@ class TestWalletManagement(SingleDeviceTestCase):
for asset in user['collectibles']:
wallet.get_collectibles_amount(asset).scroll_to_element()
if wallet.get_collectibles_amount(asset).text != user['collectibles'][asset]:
self.errors.append('%s %s is not shown in Collectibles for Rinkeby!' % (user['collectibles'][asset], asset))
self.errors.append(
'%s %s is not shown in Collectibles for Rinkeby!' % (user['collectibles'][asset], asset))
@marks.testrail_id(6224)
@marks.critical
@ -271,7 +272,8 @@ class TestWalletManagement(SingleDeviceTestCase):
self.errors.append('No "Watch-only" label is shown on watch-only wallet')
wallet.receive_transaction_button.click_until_presence_of_element(wallet.address_text)
if wallet.address_text.text[2:] != basic_user['address']:
self.errors.append('Wrong address %s is shown in "Receive" popup for watch-only account ' % wallet.address_text.text)
self.errors.append(
'Wrong address %s is shown in "Receive" popup for watch-only account ' % wallet.address_text.text)
wallet.close_share_popup()
wallet.get_account_options_by_name(account_name).click()
wallet.account_settings_button.click()
@ -314,7 +316,7 @@ class TestWalletManagement(SingleDeviceTestCase):
wallet.just_fyi('Check that overall balance is changed after adding account from private key')
for asset in ('ETH', 'ADI', 'LXS', 'STT'):
wallet.wait_balance_is_changed(asset)
initial_STT = wallet.get_asset_amount_by_name('STT')
initial_stt = wallet.get_asset_amount_by_name('STT')
wallet.just_fyi('Check individual account view (imported from private key), receive option')
wallet.get_account_by_name(account_name_private).scroll_and_click(direction="up")
@ -347,7 +349,7 @@ class TestWalletManagement(SingleDeviceTestCase):
self.driver.fail('Account was not added')
wallet.just_fyi('Check that overall balance is changed after adding account from seed phrase')
wallet.wait_balance_is_changed('STT', initial_balance=initial_STT)
wallet.wait_balance_is_changed('STT', initial_balance=initial_stt)
wallet.wait_balance_is_changed('MDS')
wallet.just_fyi('Check account view and send option (imported from seed phrase)')
@ -373,13 +375,15 @@ class TestWalletManagement(SingleDeviceTestCase):
wallet.show_account_by_name_button(account_name_seed).click()
wallet.wallet_button.double_click()
if wallet.get_account_by_name(account_name_seed).is_element_displayed():
self.errors.append("Hidden %s is shown on main wallet view after hiding via 'Show icon'" % account_name_seed)
self.errors.append(
"Hidden %s is shown on main wallet view after hiding via 'Show icon'" % account_name_seed)
wallet.multiaccount_more_options.click()
wallet.manage_accounts_button.click()
wallet.hidden_account_by_name_button(account_name_seed).click()
wallet.wallet_button.double_click()
if not wallet.get_account_by_name(account_name_seed).is_element_displayed():
self.errors.append("Unhidden %s is shown on main wallet view after hiding via 'Show icon'" % account_name_seed)
self.errors.append(
"Unhidden %s is shown on main wallet view after hiding via 'Show icon'" % account_name_seed)
wallet.just_fyi("Delete unhidden account in wallet")
wallet.get_account_by_name(account_name_seed).click()

View File

@ -3,7 +3,7 @@ import random
import emoji
from tests import marks, background_service_message
from tests.users import basic_user, dummy_user, ens_user_ropsten, ens_user, ens_user_message_sender
from tests.users import basic_user, dummy_user, ens_user_ropsten, ens_user
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from views.sign_in_view import SignInView
from views.chat_view import ChatView
@ -56,7 +56,6 @@ class TestChatManagement(SingleDeviceTestCase):
home.join_public_chat(public[1:])
chat.get_back_to_home_view()
home.just_fyi("Deleting 3 chats via delete button and check they will not reappear after relaunching app")
i = 0
for chat_name in one_to_one, public, group:
@ -147,7 +146,8 @@ class TestChatManagement(SingleDeviceTestCase):
chat = home.get_chat(public_options).click()
chat.clear_history()
if chat.element_by_text(message).is_element_displayed():
self.errors.append('Messages in %s chat are still shown after clearing history via options' % public_options)
self.errors.append(
'Messages in %s chat are still shown after clearing history via options' % public_options)
home.just_fyi("Recheck that history won't reappear after relogin")
home.relogin()
@ -689,7 +689,6 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
chat_public_2 = home_2.get_chat_view()
[chat_public_2.send_message(message_after_block_2) for _ in range(2)]
device_1.just_fyi("check that new messages and push notifications don't arrive from blocked user")
device_1.open_notification_bar()
if device_1.element_by_text_part(message_after_block_2).is_element_displayed():
@ -872,22 +871,22 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
device_1_chat.just_fyi('Set several emojis as sender and receiver and check counters in public chat')
message_sender = chat_public_1.chat_element_by_text(message_from_sender)
emojis_from_sender = ['thumbs-down', 'love', 'laugh']
[chat_public_1.set_reaction(message_from_sender, emoji) for emoji in emojis_from_sender]
[chat_public_1.set_reaction(message_from_sender, reaction) for reaction in emojis_from_sender]
emojis_from_receiver = ['angry', 'sad']
[chat_public_2.set_reaction(message_from_sender, emoji) for emoji in emojis_from_receiver]
[chat_public_2.set_reaction(message_from_sender, reaction) for reaction in emojis_from_receiver]
message_receiver = chat_public_2.chat_element_by_text(message_from_sender)
for emoji in emojis_from_sender:
if message_sender.emojis_below_message(emoji) != 1:
for reaction in emojis_from_sender:
if message_sender.emojis_below_message(reaction) != 1:
self.errors.append(
'Counter is not updated on own message after tapping %s for sender in pub chat' % emoji)
if message_receiver.emojis_below_message(emoji, own=False) != 1:
'Counter is not updated on own message after tapping %s for sender in pub chat' % reaction)
if message_receiver.emojis_below_message(reaction, own=False) != 1:
self.errors.append(
'Counter is not updated on received message after tapping %s for receiver in pub chat' % emoji)
for emoji in emojis_from_receiver:
if message_sender.emojis_below_message(emoji, own=False) != 1:
'Counter is not updated on received message after tapping %s for receiver in pub chat' % reaction)
for reaction in emojis_from_receiver:
if message_sender.emojis_below_message(reaction, own=False) != 1:
self.errors.append(
'Counter is not updated on own message after tapping %s for receiver in pub chat' % emoji)
if message_receiver.emojis_below_message(emoji) != 1:
if message_receiver.emojis_below_message(reaction) != 1:
self.errors.append(
'Counter is not updated on received message after tapping %s for sender in pub chat' % emoji)
@ -1030,8 +1029,8 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_from_sender = "Message sender"
GroupChat1Name = "GroupChat1"
GroupChat2Name = "GroupChat2"
group_chat_name_1 = "GroupChat1"
group_chat_name_2 = "GroupChat2"
home_1, home_2 = device_1.create_user(), device_2.create_user()
device_1.just_fyi('Device1 sets permissions to accept chat requests only from trusted contacts')
@ -1048,15 +1047,17 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
one_to_one_device_2 = home_2.add_contact(public_key_user_1)
one_to_one_device_2.send_message(message_from_sender)
one_to_one_device_2.home_button.click()
home_2.create_group_chat([username_1], group_chat_name=GroupChat1Name)
home_2.create_group_chat([username_1], group_chat_name=group_chat_name_1)
device_1.just_fyi('Device1 check there are no any chats in Activity Center nor Chats view')
home_1.home_button.click()
if home_1.element_by_text_part(username_2).is_element_displayed() or home_1.element_by_text_part(GroupChat1Name).is_element_displayed():
if home_1.element_by_text_part(username_2).is_element_displayed() or home_1.element_by_text_part(
group_chat_name_1).is_element_displayed():
self.errors.append("Chats are present on Chats view despite they created by non-contact")
home_1.notifications_button.click()
if home_1.element_by_text_part(username_2).is_element_displayed() or home_1.element_by_text_part(GroupChat1Name).is_element_displayed():
if home_1.element_by_text_part(username_2).is_element_displayed() or home_1.element_by_text_part(
group_chat_name_1).is_element_displayed():
self.errors.append("Chats are present in Activity Center view despite they created by non-contact")
device_1.just_fyi('Device1 adds Device2 in Contacts so chat requests should be visible now')
@ -1068,12 +1069,13 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
home_2.get_chat_from_home_view(username_1).click()
one_to_one_device_2.send_message(message_from_sender)
one_to_one_device_2.home_button.click()
home_2.create_group_chat([username_1], group_chat_name=GroupChat2Name)
home_2.create_group_chat([username_1], group_chat_name=group_chat_name_2)
device_1.just_fyi('Device1 verifies 1-1 chat Group chats are visible')
home_1.home_button.click()
if not home_1.element_by_text_part(username_2).is_element_displayed() or not home_1.element_by_text_part(GroupChat2Name).is_element_displayed():
if not home_1.element_by_text_part(username_2).is_element_displayed() or not home_1.element_by_text_part(
group_chat_name_2).is_element_displayed():
self.errors.append("Chats are not present on Chats view while they have to!")
self.errors.verify_no_errors()
@ -1084,8 +1086,8 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_from_sender = "Message sender"
GroupChat1Name = "GroupChat1"
GroupChat2Name = "GroupChat2"
group_chat_name_1 = "GroupChat1"
group_chat_name_2 = "GroupChat2"
home_1, home_2 = device_1.create_user(), device_2.create_user()
device_1.just_fyi('Device1 adds Devices and creates 1-1 and Group chat with it')
@ -1096,7 +1098,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
device_1_one_to_one_chat.send_message(message_from_sender)
device_1_one_to_one_chat.home_button.click()
home_1.create_group_chat([username_2], group_chat_name=GroupChat1Name)
home_1.create_group_chat([username_2], group_chat_name=group_chat_name_1)
home_1.home_button.click()
home_2.home_button.click()
@ -1104,29 +1106,29 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
home_2.notifications_button.click()
home_2.notifications_select_button.click()
home_2.element_by_text_part(username_1[:10]).click()
home_2.element_by_text_part(GroupChat1Name).click()
home_2.element_by_text_part(group_chat_name_1).click()
home_2.notifications_reject_and_delete_button.click()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat is on Activity Center view after action made on it")
if home_2.element_by_text_part(GroupChat1Name).is_element_displayed(2):
if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2):
self.errors.append("Group chat is on Activity Center view after action made on it")
home_2.home_button.click()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat is added on home after rejection")
if home_2.element_by_text_part(GroupChat1Name).is_element_displayed(2):
if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2):
self.errors.append("Group chat is added on home after rejection")
home_2.just_fyi("Verify there are still no chats after relogin")
home_2.relogin()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat appears on Chats view after relogin")
if home_2.element_by_text_part(GroupChat1Name).is_element_displayed(2):
if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2):
self.errors.append("Group chat appears on Chats view after relogin")
home_2.notifications_button.click()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat request reappears back in Activity Center view after relogin")
if home_2.element_by_text_part(GroupChat1Name).is_element_displayed(2):
if home_2.element_by_text_part(group_chat_name_1).is_element_displayed(2):
self.errors.append("Group chat request reappears back in Activity Center view after relogin")
home_2.home_button.click()
@ -1134,7 +1136,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
home_1.get_chat_from_home_view(username_2).click()
device_1_one_to_one_chat.send_message('Some text here')
device_1_one_to_one_chat.home_button.click()
home_1.create_group_chat([username_2], group_chat_name=GroupChat2Name)
home_1.create_group_chat([username_2], group_chat_name=group_chat_name_2)
device_1.just_fyi('Device2 accepts both chats (via Select All button) and verifies they disappeared '
'from activity center view but present on Chats view')
@ -1145,13 +1147,13 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat request stays on Activity Center view after it was accepted")
if home_2.element_by_text_part(GroupChat2Name).is_element_displayed(2):
if home_2.element_by_text_part(group_chat_name_2).is_element_displayed(2):
self.errors.append("Group chat request stays on Activity Center view after it was accepted")
home_2.home_button.click()
if not home_2.element_by_text_part(username_1[:20]).is_element_displayed(2):
self.errors.append("1-1 chat is not added on home after accepted from Activity Center")
if not home_2.element_by_text_part(GroupChat2Name).is_element_displayed(2):
if not home_2.element_by_text_part(group_chat_name_2).is_element_displayed(2):
self.errors.append("Group chat is not added on home after accepted from Activity Center")
self.errors.verify_no_errors()

View File

@ -56,7 +56,8 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.drivers[0].fail("Required options accept or share are not shown")
select_account_bottom_sheet = receiver_message.accept_and_share_address.click()
if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(account_name).is_element_displayed():
if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(
account_name).is_element_displayed():
self.errors.append('Not expected value in "From" in "Select account": "Status" is expected')
select_account_bottom_sheet.select_button.click()
receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account)
@ -112,7 +113,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
wallet_1.home_button.click()
home_2 = device_2.recover_access(passphrase=sender['passphrase'])
wallet_2 = home_2.wallet_button.click()
initial_amount_STT = wallet_2.get_asset_amount_by_name('STT')
initial_amount_stt = wallet_2.get_asset_amount_by_name('STT')
wallet_2.home_button.click()
device_2.just_fyi('Add recipient to contact and send 1 message')
@ -161,7 +162,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
home_1.just_fyi('Check that can find tx in history and balance is updated after offline')
home_2.wallet_button.click()
wallet_2.wait_balance_is_changed('STT', initial_amount_STT)
wallet_2.wait_balance_is_changed('STT', initial_amount_stt)
wallet_2.find_transaction_in_history(amount=amount, asset='STT')
self.errors.verify_no_errors()
@ -202,7 +203,6 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
[message.transaction_status.wait_for_element_text(message.declined) for message in
(chat_1_sender_message, chat_2_receiver_message)]
home_1.just_fyi('Decline transaction request and check that state is changed')
request_amount = chat_1.get_unique_amount()
chat_1.commands_button.click()
@ -274,7 +274,8 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.create_drivers(2)
sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
sender, reciever = transaction_senders['E'], ens_user
home_1, home_2 = sign_in_1.recover_access(sender['passphrase']), sign_in_2.recover_access(reciever['passphrase'])
home_1, home_2 = sign_in_1.recover_access(sender['passphrase']), sign_in_2.recover_access(
reciever['passphrase'])
home_2.just_fyi("Start chat with sender")
profile_2 = home_2.profile_button.click()

View File

@ -3,6 +3,7 @@ from tests.base_test_case import MultipleDeviceTestCase
from views.sign_in_view import SignInView
from views.chat_view import CommunityView
class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(695842)
@ -16,7 +17,8 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
message, message_member = "message", "from member"
userkey_2, username_2 = home_2.get_public_key_and_username(return_username=True)
home_2.home_button.click()
community_1 = home_1.create_community(community_name, community_description, set_image=True, file_name=community_pic)
community_1 = home_1.create_community(community_name, community_description, set_image=True,
file_name=community_pic)
channel_1 = community_1.add_channel(channel_name)
channel_1.send_message(message)
home_1.home_button.double_click()
@ -35,9 +37,11 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
pub_2.element_by_text(community_name).wait_for_element(330)
community_message_2 = pub_2.get_community_link_preview_by_text(community_link_text)
if community_message_2.community_description != community_description:
self.errors.append("Community description '%s' does not match expected" % community_message_2.community_description)
self.errors.append(
"Community description '%s' does not match expected" % community_message_2.community_description)
if community_message_2.community_members_amount != 1:
self.errors.append("Members amount in resolved message '%s' does not match expected" % str(community_message_2.community_members_amount))
self.errors.append("Members amount in resolved message '%s' does not match expected" % str(
community_message_2.community_members_amount))
community_message_2.view()
community_2 = CommunityView(self.drivers[1])
community_2.request_access_button.click()
@ -50,7 +54,8 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
community_1.community_info_button.click()
community_1.community_membership_request_value.wait_for_element(60)
if community_1.community_membership_request_value.text != '1':
self.drivers[0].fail("Membership request value '%s' is not equal expected" % community_1.community_membership_request_value)
self.drivers[0].fail(
"Membership request value '%s' is not equal expected" % community_1.community_membership_request_value)
home_1.just_fyi("Approve membership")
community_1.handle_membership_request(username_2, approve=True)
@ -73,7 +78,6 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(695845)
@marks.medium
def test_notification_in_activity_center_for_mention_in_community_and_group_chat(self):

View File

@ -2,7 +2,8 @@ from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from tests.users import transaction_senders, ens_user
from views.sign_in_view import SignInView
import random, emoji
import random
import emoji
class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@ -39,7 +40,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
home_2.just_fyi('check that PN invite to group chat is received and after tap you are redirected to group chat')
home_2.open_notification_bar()
pns = [chat_1.pn_invited_to_group_chat(username_1, chat_name), chat_1.pn_wants_you_to_join_to_group_chat(username_1, chat_name)]
pns = [chat_1.pn_invited_to_group_chat(username_1, chat_name),
chat_1.pn_wants_you_to_join_to_group_chat(username_1, chat_name)]
for pn in pns:
if not home_2.get_pn(pn).is_element_displayed(30):
self.errors.append('%s is not shown after invite to group chat' % pn)
@ -68,7 +70,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
if not chat_2.chat_element_by_text(message):
self.errors.append('%s system message is not shown' % message)
device_2.just_fyi('Join to group chat, check system messages and send messages to group chat, check message status is delivered')
device_2.just_fyi(
'Join to group chat, check system messages and send messages to group chat, check message status is delivered')
chat_2.join_chat_button.click()
for chat in (chat_1, chat_2):
if not chat.chat_element_by_text(join_system_message).is_element_displayed(30):
@ -77,7 +80,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
message_1 = "Message from device: %s" % chat_1.driver.number
chat_1.send_message(message_1)
if chat_1.chat_element_by_text(message_1).status != 'delivered':
self.errors.append('Message status is not delivered, it is %s!' % chat_1.chat_element_by_text(message_1).status)
self.errors.append(
'Message status is not delivered, it is %s!' % chat_1.chat_element_by_text(message_1).status)
home_2.put_app_to_background()
@ -147,7 +151,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
chat_2.decline_invitation_button.click()
left_system_message = chat_2.leave_system_message(username_2)
if chat_1.chat_element_by_text(left_system_message).is_element_displayed():
self.errors.append('System message after user left the group chat is shown if declined before accepting in Activity Centre')
self.errors.append(
'System message after user left the group chat is shown if declined before accepting in Activity Centre')
if home_2.element_by_text(chat_name).is_element_displayed():
self.errors.append("Group chat '%s' is shown, but user has left" % chat_name)
@ -233,9 +238,11 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
new_chat_name = device_1_chat.get_random_chat_name()
device_1_chat.rename_chat_via_group_info(new_chat_name)
for chat in (device_1_chat, device_2_chat):
if not chat.element_by_text(chat.create_system_message(device_1_username, initial_chat_name)).is_element_displayed():
if not chat.element_by_text(
chat.create_system_message(device_1_username, initial_chat_name)).is_element_displayed():
self.errors.append('Initial system message about creating chta was changed!')
if not chat.element_by_text(chat.changed_group_name_system_message(device_1_username, new_chat_name)).is_element_displayed():
if not chat.element_by_text(
chat.changed_group_name_system_message(device_1_username, new_chat_name)).is_element_displayed():
self.errors.append('Message about changing chat name is not shown')
device_2.just_fyi('Check that you can navigate to renamed chat')
@ -274,7 +281,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
chat_1.element_by_text('Done').click()
chat_1.close_button.click()
if chat_1.user_name_text.text != full_ens:
self.errors.append('Nickname was not removed! real chat name is %s instead of %s' % (chat_1.user_name_text.text, full_ens))
self.errors.append(
'Nickname was not removed! real chat name is %s instead of %s' % (chat_1.user_name_text.text, full_ens))
home_1.just_fyi('Adding ENS user to contacts and start group chat with him')
group_name = 'ens_group'
@ -322,11 +330,13 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
chat_1.chat_message_input.clear()
chat_1.select_mention_from_suggestion_list('%s %s' % (nickname, full_ens), typed_search_pattern=username_2[:2])
if chat_1.chat_message_input.text != '@' + ens + ' ':
self.errors.append('ENS is not resolved in chat input after setting nickname in mention suggestions list (search by 3-random name)!')
self.errors.append(
'ENS is not resolved in chat input after setting nickname in mention suggestions list (search by 3-random name)!')
chat_1.chat_message_input.clear()
chat_1.select_mention_from_suggestion_list('%s %s' % (nickname, full_ens), typed_search_pattern=nickname[:2])
if chat_1.chat_message_input.text != '@' + ens + ' ':
self.errors.append('ENS is not resolved in chat input after setting nickname in mention suggestions list (search by nickname)!')
self.errors.append(
'ENS is not resolved in chat input after setting nickname in mention suggestions list (search by nickname)!')
chat_1.chat_message_input.clear()
home_1.just_fyi('Can delete nickname via group info and recheck received messages')
@ -389,6 +399,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
class TestCommandsSingleDevices(SingleDeviceTestCase):
@marks.testrail_id(5721)

View File

@ -1,10 +1,11 @@
import time
from tests import marks
from tests.users import transaction_senders, transaction_recipients, ens_user_ropsten
from tests.users import transaction_senders, ens_user_ropsten
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from views.sign_in_view import SignInView
class TestCommandsMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(6293)
@ -50,7 +51,8 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.drivers[0].fail("Required options accept or share are not shown")
select_account_bottom_sheet = receiver_message.accept_and_share_address.click()
if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(account_name).is_element_displayed():
if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(
account_name).is_element_displayed():
self.errors.append('Not expected value in "From" in "Select account": "Status" is expected')
select_account_bottom_sheet.select_button.click()
receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account)
@ -95,7 +97,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
home_2 = device_2.recover_access(passphrase=sender['passphrase'], keycard=True, enable_notifications=True)
wallet_2 = home_2.wallet_button.click()
initial_amount_STT = wallet_2.get_asset_amount_by_name('STT')
initial_amount_stt = wallet_2.get_asset_amount_by_name('STT')
wallet_2.home_button.click()
device_2.just_fyi('Add recipient to contact and send 1 message')
@ -151,13 +153,12 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
home_1.just_fyi('Check that can find tx in history and balance is updated after offline')
[home.wallet_button.click() for home in (home_1, home_2)]
wallet_2.wait_balance_is_changed('STT', initial_amount_STT)
wallet_2.wait_balance_is_changed('STT', initial_amount_stt)
wallet_1.wait_balance_is_changed('STT', scan_tokens=True)
[wallet.find_transaction_in_history(amount=amount, asset='STT') for wallet in (wallet_1, wallet_2)]
self.errors.verify_no_errors()
class TestCommandsSingleDevices(SingleDeviceTestCase):
@marks.testrail_id(6295)

View File

@ -1,9 +1,6 @@
import time
import emoji
import random
import string
from selenium.common.exceptions import TimeoutException
from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
@ -216,7 +213,8 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
if not public_chat_1.element_by_text_part("⌫ Edited").is_element_displayed():
self.errors.append('No mark in message bubble about this message was edited')
device_2.just_fyi("Device 1 sends text message and edits it in 1-1 chat. Device2 checks edited message is shown")
device_2.just_fyi(
"Device 1 sends text message and edits it in 1-1 chat. Device2 checks edited message is shown")
chat_private_2 = home_2.add_contact(public_key_1)
message_before_edit_1_1, message_after_edit_1_1 = "Message before edit 1-1", "AFTER"
chat_private_2.send_message(message_before_edit_1_1)
@ -741,7 +739,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
"audio": device_2_sends_audio,
}
for key, value in sending_list.items():
navigate_to_start_state_of_both_devices()
sending_list[key]()
@ -760,7 +757,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
self.errors.append("Counter of reaction is not re-set on %s for message receiver!" % key)
chat_2.just_fyi("Sending Emoji/Tag/Links in chat")
## TODO: add link and tag messages after #11168 is fixed
# TODO: add link and tag messages after #11168 is fixed
navigate_to_start_state_of_both_devices()
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
@ -1165,7 +1162,8 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
wallet.home_button.click()
if 'dapp' in key:
home.open_in_status_button.click()
if not (chat.allow_button.is_element_displayed() or chat.element_by_text("Can't find web3 library").is_element_displayed()):
if not (chat.allow_button.is_element_displayed() or chat.element_by_text(
"Can't find web3 library").is_element_displayed()):
self.errors.append('No allow button is shown in case of navigating to Status dapp!')
chat.dapp_tab_button.click()
chat.home_button.click()

View File

@ -48,7 +48,8 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
chat.verify_message_is_under_today_text(message, self.errors)
timestamp = chat.chat_element_by_text(message).timestamp_message.text
if timestamp not in sent_time_variants:
self.errors.append("Timestamp is not shown, expected '%s', in fact '%s'" % (sent_time_variants.join(','), timestamp))
self.errors.append(
"Timestamp is not shown, expected '%s', in fact '%s'" % (sent_time_variants.join(','), timestamp))
if chat_2.chat_element_by_text(message).username.text != default_username_1:
self.errors.append("Default username '%s' is not shown next to the received message" % default_username_1)
@ -76,7 +77,8 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
message, message_2 = 'test message', 'test message2'
chat_2.send_message(message)
home_1.just_fyi("Check unread message indicator on home, on chat element and that it is not shown after reading messages")
home_1.just_fyi(
"Check unread message indicator on home, on chat element and that it is not shown after reading messages")
if not home_1.home_button.public_unread_messages.is_element_displayed():
self.errors.append('New messages public chat badge is not shown on Home button')
chat_element = home_1.get_chat('#' + chat_name)
@ -139,7 +141,6 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6275)
@marks.medium
def test_receive_message_while_in_different_tab_and_emoji_messages_long_press(self):
@ -228,7 +229,8 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
chat_2.element_by_text_part(statuses['*formatted text*']).scroll_to_element()
expected_value = statuses[status]
if not chat_2.element_by_text_part(expected_value).is_element_displayed():
self.errors.append("Expected value %s is not shown in other user profile without adding to contacts" % expected_value)
self.errors.append(
"Expected value %s is not shown in other user profile without adding to contacts" % expected_value)
home_2.just_fyi('Add device1 to contacts and check that status will be shown in timeline_1')
chat_2.close_button.scroll_and_click(direction='up')
@ -237,7 +239,8 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
for status in statuses:
expected_value = statuses[status]
if not timeline_2.element_by_text_part(expected_value).is_element_displayed():
self.errors.append("Expected value %s is not shown in timeline_1 after adding user to contacts" % expected_value)
self.errors.append(
"Expected value %s is not shown in timeline_1 after adding user to contacts" % expected_value)
profile_1.just_fyi('Checking message tag and reactions on statuses')
# TODO: no way to tap into tag message from timeline_1
@ -267,10 +270,12 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
timeline_1.set_reaction(text_status)
status_with_reaction_1 = timeline_1.chat_element_by_text(text_status)
if status_with_reaction_1.emojis_below_message() != 0:
self.errors.append("Counter of reaction is not updated after removing reaction on your own status in timeline_1!")
self.errors.append(
"Counter of reaction is not updated after removing reaction on your own status in timeline_1!")
status_with_reaction_2 = chat_2.chat_element_by_text(text_status)
if status_with_reaction_2.emojis_below_message(own=False) != 0:
self.errors.append("Counter of reaction is not updated after removing on status of another user in profile!")
self.errors.append(
"Counter of reaction is not updated after removing on status of another user in profile!")
profile_1.just_fyi("Remove user from contacts and check there is no his status in timeline_1 anymore")
chat_2.remove_from_contacts.click()

View File

@ -48,7 +48,6 @@ class TestBrowsing(SingleDeviceTestCase):
if not element_on_start_page.is_element_displayed(30):
self.driver.fail("Page failed to be refreshed")
@marks.testrail_id(6210)
@marks.high
def test_open_blocked_secure_not_secure_inlalid_offline_urls(self):
@ -71,7 +70,8 @@ class TestBrowsing(SingleDeviceTestCase):
dapp.just_fyi('Checking connection is not secure warning')
web_page = dapp.open_url('http://www.dvwa.co.uk')
web_page.url_edit_box_lock_icon.click_until_presence_of_element(web_page.element_by_translation_id("browser-not-secure"))
web_page.url_edit_box_lock_icon.click_until_presence_of_element(
web_page.element_by_translation_id("browser-not-secure"))
dapp_detail.open_tabs_button.click()
dapp_detail.empty_tab_button.click()
@ -79,7 +79,8 @@ class TestBrowsing(SingleDeviceTestCase):
dapp.just_fyi('Checking connection is secure for %s' % url)
web_page = dapp.open_url(url)
web_page.wait_for_d_aap_to_load()
web_page.url_edit_box_lock_icon.click_until_presence_of_element(web_page.element_by_translation_id("browser-secure"))
web_page.url_edit_box_lock_icon.click_until_presence_of_element(
web_page.element_by_translation_id("browser-secure"))
dapp_detail.open_tabs_button.click()
dapp_detail.empty_tab_button.click()

View File

@ -1,4 +1,4 @@
from tests import marks, test_dapp_name, test_dapp_url
from tests import marks, test_dapp_name
from tests.base_test_case import SingleDeviceTestCase
from tests.users import basic_user
from views.sign_in_view import SignInView
@ -141,4 +141,3 @@ class TestDApps(SingleDeviceTestCase):
if not profile.element_by_text(account_name).is_element_displayed():
self.errors.append("Subaccount is not selected after relogin in Dapps!")
self.errors.verify_no_errors()

View File

@ -28,7 +28,7 @@ class TestDeepLinks(SingleDeviceTestCase):
def test_open_user_profile_using_deep_link(self):
sign_in = SignInView(self.driver)
sign_in.create_user()
for user_ident in ens_user['ens'], ens_user['ens_another'], ens_user['public_key'],:
for user_ident in ens_user['ens'], ens_user['ens_another'], ens_user['public_key']:
self.driver.close_app()
deep_link = 'status-im://u/%s' % user_ident
sign_in.open_weblink_and_login(deep_link)
@ -53,7 +53,6 @@ class TestDeepLinks(SingleDeviceTestCase):
except NoSuchElementException:
self.driver.fail("DApp '%s' is not opened!" % dapp_name)
@marks.testrail_id(5781)
@marks.medium
def test_deep_link_with_invalid_user_public_key_own_profile_key(self):
@ -67,7 +66,8 @@ class TestDeepLinks(SingleDeviceTestCase):
home_view = sign_in_view.get_home_view()
home_view.plus_button.click_until_presence_of_element(home_view.start_new_chat_button)
if not home_view.start_new_chat_button.is_element_present():
self.errors.append("Can't navigate to start new chat after app opened from deep link with invalid public key")
self.errors.append(
"Can't navigate to start new chat after app opened from deep link with invalid public key")
self.driver.close_app()
sign_in_view.just_fyi('Check that no error when opening invalid deep link')

View File

@ -1,4 +1,5 @@
from tests import marks, pytest_config_global, test_dapp_name, staging_fleet, mailserver_hk, mailserver_ams, mailserver_gc
from tests import marks, pytest_config_global, test_dapp_name, staging_fleet, mailserver_hk, mailserver_ams, \
mailserver_gc
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from tests.users import upgrade_users, transaction_recipients, basic_user, ens_user
from views.sign_in_view import SignInView
@ -7,6 +8,7 @@ import views.upgrade_dbs.dapps.data as dapp_data
import views.upgrade_dbs.pairing.data as sync_data
import views.upgrade_dbs.group.data as group
@marks.upgrade
class TestUpgradeApplication(SingleDeviceTestCase):
@ -80,7 +82,8 @@ class TestUpgradeApplication(SingleDeviceTestCase):
self.errors.append('Preview message is not shown for %s' % key)
if 'title' in data:
if message.preview_title.text != data['title']:
self.errors.append("Title '%s' does not match expected '%s'" % (message.preview_title.text, data['title']))
self.errors.append(
"Title '%s' does not match expected '%s'" % (message.preview_title.text, data['title']))
if message.preview_subtitle.text != data['subtitle']:
self.errors.append("Subtitle '%s' does not match expected '%s'" % (message.preview_subtitle.text, data['subtitle']))
home.home_button.click()
@ -220,11 +223,8 @@ class TestUpgradeApplication(SingleDeviceTestCase):
self.errors.append('Asset %s was not restored' % asset)
home.just_fyi('Check that can sign transaction in STT from wallet')
wallet.accounts_status_account.click()
transaction_amount = wallet.get_unique_amount()
wallet.send_transaction(amount=transaction_amount, asset_name='STT',
sign_transaction=True,
keycard=True,
wallet.send_transaction(amount=transaction_amount, asset_name='STT', sign_transaction=True, keycard=True,
recipient=transaction_recipients['I']['address'])
self.network_api.find_transaction_by_unique_amount(user['address'], transaction_amount, token=True)
@ -241,6 +241,7 @@ class TestUpgradeApplication(SingleDeviceTestCase):
send_transaction.sign_transaction(keycard=True)
self.errors.verify_no_errors()
@marks.upgrade
class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
@ -335,7 +336,7 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
self.error.append("Synced public chat '%s' is not shown on secondary device after upgrade!" % chat)
device_1.just_fyi("Pairing: check that can send messages to chats and they will appear on secondary device")
main_1_1, secondary_1_1, group = synced['ens'], synced['username_ens'], sync_data.chats['group']
main_1_1, secondary_1_1, group_name = synced['ens'], synced['username_ens'], sync_data.chats['group']
message = 'Device pairing check'
device_1.home_button.click()
chat_1 = home_1.get_chat(main_1_1).click()
@ -343,14 +344,16 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
home_2.get_chat(secondary_1_1).wait_for_visibility_of_element()
chat_2 = home_2.get_chat(secondary_1_1).click()
if not chat_2.chat_element_by_text(message).is_element_displayed():
self.error.append("Message in 1-1 chat does not appear on device 2 after sending from main device after upgrade")
self.error.append(
"Message in 1-1 chat does not appear on device 2 after sending from main device after upgrade")
[chat.home_button.click() for chat in (chat_1, chat_2)]
chat_1 = home_1.get_chat(group).click()
chat_1 = home_1.get_chat(group_name).click()
chat_1.send_message(message)
home_2.get_chat(group).wait_for_visibility_of_element()
chat_2 = home_2.get_chat(group).click()
home_2.get_chat(group_name).wait_for_visibility_of_element()
chat_2 = home_2.get_chat(group_name).click()
if not chat_2.chat_element_by_text(message).is_element_displayed():
self.error.append("Message in group chat does not appear on device 2 after sending from main device after upgrade")
self.error.append(
"Message in group chat does not appear on device 2 after sending from main device after upgrade")
[chat.home_button.click() for chat in (chat_1, chat_2)]
device_1.just_fyi("Pairing: add public chat and check it will appear on secondary device")
@ -375,7 +378,8 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
"Message in new 1-1 chat does not appear on device 2 after sending from main device after upgrade")
device_2.just_fyi("Pairing: check that contacts/nicknames are synced")
synced_secondary = {synced['nickname'], synced['username_nickname'], synced['username_ens'], added['name'], added['username']}
synced_secondary = {synced['nickname'], synced['username_nickname'], synced['username_ens'], added['name'],
added['username']}
profile_2 = chat_2.profile_button.click()
profile_2.contacts_button.click()
for username in synced_secondary:
@ -399,7 +403,8 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
device.sign_in()
home_1.just_fyi("Check that all group chats are preserved after upgrade")
names = [sub["name"] for sub in (group.main, group.empty_invite, group.make_admin, group.to_join, group.to_remove)]
names = [sub["name"] for sub in
(group.main, group.empty_invite, group.make_admin, group.to_join, group.to_remove)]
for home in home_1, home_2:
for name in names:
if not home.get_chat(name).is_element_displayed():
@ -483,7 +488,6 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
profile_2 = home_2.profile_button.click()
public_key_2, username_2 = profile_2.get_public_key_and_username(return_username=True)
device_1.just_fyi("Activity centre: send message to 1-1 and invite member to group chat")
chat_1 = home_1.add_contact(public_key_2, add_in_contacts=False)
message = home_1.get_random_message()
@ -499,7 +503,8 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
device_1.just_fyi("Check status")
timeline = home_1.status_button.click()
statuses = group.timeline
for element in timeline.element_by_text(statuses['text']), timeline.image_message_in_chat, timeline.element_by_text(statuses['link']):
for element in timeline.element_by_text(
statuses['text']), timeline.image_message_in_chat, timeline.element_by_text(statuses['link']):
if not element.is_element_displayed():
self.errors.append("Status is not shown after upgrade!")
timeline.element_by_text(statuses['link']).click()

View File

@ -4,18 +4,17 @@ from tests.users import transaction_senders
from views.sign_in_view import SignInView
class TestTransactionDApp(SingleDeviceTestCase):
@marks.testrail_id(5309)
@marks.critical
@marks.transaction
def test_request_stt_from_daap(self):
def test_request_stt_from_dapp(self):
sender = transaction_senders['K']
home = SignInView(self.driver).recover_access(sender['passphrase'], unique_password)
wallet = home.wallet_button.click()
wallet.scan_tokens()
initial_amount_STT = wallet.get_asset_amount_by_name('STT')
initial_amount_stt = wallet.get_asset_amount_by_name('STT')
status_test_dapp = home.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.assets_button.click()
@ -29,7 +28,7 @@ class TestTransactionDApp(SingleDeviceTestCase):
status_test_dapp.wallet_button.click()
send_transaction.just_fyi('Verify that wallet balance is updated')
wallet.wait_balance_is_changed('STT', initial_amount_STT, scan_tokens=True)
wallet.wait_balance_is_changed('STT', initial_amount_stt, scan_tokens=True)
send_transaction.just_fyi('Check logcat for sensitive data')
values_in_logcat = send_transaction.find_values_in_logcat(password=unique_password)
@ -86,7 +85,6 @@ class TestTransactionDApp(SingleDeviceTestCase):
self.driver.fail("'Test filters' button produced an error")
self.errors.verify_no_errors()
@marks.testrail_id(5784)
@marks.medium
@marks.transaction
@ -106,7 +104,7 @@ class TestTransactionDApp(SingleDeviceTestCase):
if not status_test_dapp.element_by_text(user['public_key']).is_element_displayed():
self.errors.append('Public key is not returned')
status_test_dapp.get_empty_dapp_tab()
wallet = home.wallet_button.click()
home.wallet_button.click()
home.just_fyi("Checking sign typed message")
home.open_status_test_dapp(allow_all=True)

View File

@ -15,7 +15,7 @@ class TestTransactionDApp(SingleDeviceTestCase):
home_view = sign_in_view.recover_access(sender['passphrase'], keycard=True)
wallet_view = home_view.wallet_button.click()
wallet_view.scan_tokens()
initial_amount_STT = wallet_view.get_asset_amount_by_name('STT')
initial_amount_stt = wallet_view.get_asset_amount_by_name('STT')
status_test_dapp = home_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.assets_button.click()
@ -24,7 +24,7 @@ class TestTransactionDApp(SingleDeviceTestCase):
status_test_dapp.wallet_button.click()
send_transaction_view.just_fyi('Verify that wallet balance is updated')
wallet_view.wait_balance_is_changed('STT', initial_amount_STT, scan_tokens=True)
wallet_view.wait_balance_is_changed('STT', initial_amount_stt, scan_tokens=True)
send_transaction_view.just_fyi('Check logcat for sensitive data')
values_in_logcat = send_transaction_view.find_values_in_logcat(mnemonic=sender['passphrase'],
@ -77,7 +77,6 @@ class TestTransactionDApp(SingleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6310)
@marks.medium
@marks.transaction
@ -106,6 +105,3 @@ class TestTransactionDApp(SingleDeviceTestCase):
'Call contract set function', 'Call function 2 times in a row']:
status_test_dapp.element_by_text(text).scroll_to_element()
self.errors.verify_no_errors()

View File

@ -1,5 +1,5 @@
from support.utilities import get_merged_txs_list
from tests import marks, pin, puk, pair_code
from tests import marks
from tests.base_test_case import SingleDeviceTestCase
from tests.users import transaction_senders, basic_user, wallet_users
from views.sign_in_view import SignInView
@ -13,22 +13,17 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
def test_keycard_send_eth_from_wallet_to_address(self):
recipient = basic_user
sender = transaction_senders['P']
sign_in_view = SignInView(self.driver)
home_view = sign_in_view.recover_access(sender['passphrase'], keycard=True)
wallet_view = home_view.wallet_button.click()
wallet_view.wait_balance_is_changed()
wallet_view.accounts_status_account.click()
transaction_amount = wallet_view.get_unique_amount()
wallet_view.send_transaction(amount=transaction_amount,
sign_transaction=True,
keycard=True,
recipient='0x%s'%recipient['address'])
sign_in = SignInView(self.driver)
home = sign_in.recover_access(sender['passphrase'], keycard=True)
wallet = home.wallet_button.click()
wallet.wait_balance_is_changed()
transaction_amount = wallet.get_unique_amount()
wallet.send_transaction(amount=transaction_amount, sign_transaction=True, keycard=True, recipient='0x%s' % recipient['address'])
wallet_view.just_fyi('Check that transaction is appeared in transaction history')
transaction = wallet_view.find_transaction_in_history(amount=transaction_amount, return_hash=True)
wallet.just_fyi('Check that transaction is appeared in transaction history')
transaction = wallet.find_transaction_in_history(amount=transaction_amount, return_hash=True)
self.network_api.find_transaction_by_hash(transaction)
@marks.testrail_id(6291)
@marks.critical
@marks.transaction
@ -88,17 +83,13 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
wallet.click_system_back_button()
wallet.just_fyi("Send transaction to new account")
wallet.accounts_status_account.wait_and_click()
transaction_amount = '0.004'
initial_balance = self.network_api.get_balance(status_account_address)
wallet.send_transaction(account_name=account_name,
amount=transaction_amount,
keycard=True)
wallet.send_transaction(account_name=account_name, amount=transaction_amount, keycard=True)
self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount)
self.network_api.verify_balance_is_updated(str(initial_balance), status_account_address)
wallet.just_fyi("Verifying previously sent transaction in new account")
wallet.close_button.click()
wallet.get_account_by_name(account_name).click()
wallet.send_transaction_button.click()
wallet.close_send_transaction_view_button.click()
@ -113,9 +104,8 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
transaction_amount_1 = round(float(transaction_amount) * 0.2, 11)
wallet.wait_balance_is_changed()
wallet.get_account_by_name(account_name).click()
send_transaction = wallet.send_transaction(account_name=wallet.status_account_name,
amount=transaction_amount_1,
keycard=True)
send_transaction = wallet.send_transaction(from_main_wallet=False, account_name=wallet.status_account_name,
amount=transaction_amount_1, keycard=True)
wallet.close_button.click()
sub_account_address = wallet.get_wallet_address(account_name)[2:]
self.network_api.wait_for_confirmation_of_transaction(sub_account_address, transaction_amount_1)

View File

@ -4,7 +4,8 @@ import string
from support.utilities import get_merged_txs_list
from tests import marks, unique_password
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from tests.users import transaction_senders, basic_user, wallet_users, ens_user_ropsten, transaction_recipients, ens_user
from tests.users import transaction_senders, basic_user, wallet_users, ens_user_ropsten, transaction_recipients, \
ens_user
from views.send_transaction_view import SendTransactionView
from views.sign_in_view import SignInView
@ -103,15 +104,11 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
home = SignInView(self.driver).recover_access(sender['passphrase'])
wallet = home.wallet_button.click()
wallet.wait_balance_is_changed(asset='ADI', scan_tokens=True)
wallet.accounts_status_account.click()
amount = '0.000%s' % str(random.randint(100, 999)) + '1'
wallet.send_transaction(amount=amount,
recipient='0x%s' % recipient['address'],
asset_name='ADI')
wallet.send_transaction(amount=amount, recipient='0x%s' % recipient['address'], asset_name='ADI')
transaction = wallet.find_transaction_in_history(amount=amount, asset='ADI', return_hash=True)
self.network_api.find_transaction_by_hash(transaction)
@marks.testrail_id(5412)
@marks.high
@marks.transaction
@ -215,7 +212,6 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
home.home_button.wait_for_visibility_of_element()
home.connection_offline_icon.wait_for_visibility_of_element(20)
@marks.testrail_id(6225)
@marks.transaction
@marks.medium
@ -231,17 +227,14 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
wallet.add_account(account_name)
wallet.just_fyi("Send transaction to new account")
wallet.accounts_status_account.click()
initial_balance = self.network_api.get_balance(status_account_address)
transaction_amount = '0.003%s' % str(random.randint(10000, 99999)) + '1'
wallet.send_transaction(account_name=account_name,
amount=transaction_amount)
wallet.send_transaction(account_name=account_name, amount=transaction_amount)
self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount)
self.network_api.verify_balance_is_updated(str(initial_balance), status_account_address)
wallet.just_fyi("Verifying previously sent transaction in new account")
wallet.close_button.click()
wallet.get_account_by_name(account_name).click()
wallet.send_transaction_button.click()
wallet.close_send_transaction_view_button.click()
@ -254,7 +247,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
wallet.just_fyi("Sending eth from new account to main account")
updated_balance = self.network_api.get_balance(status_account_address)
transaction_amount_1 = round(float(transaction_amount) * 0.2, 12)
wallet.send_transaction(account_name=wallet.status_account_name,
wallet.send_transaction(from_main_wallet=False, account_name=wallet.status_account_name,
amount=transaction_amount_1)
wallet.close_button.click()
sub_account_address = wallet.get_wallet_address(account_name)[2:]
@ -447,8 +440,6 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
wallet.asset_by_name(symbol).scroll_to_element()
if not wallet.asset_by_name(symbol).is_element_displayed():
self.errors.append('Custom token is not shown on Wallet view')
wallet.accounts_status_account.scroll_to_element(direction='up')
wallet.accounts_status_account.click()
recipient = "0x" + basic_user['address']
amount = '0.000%s' % str(random.randint(10000, 99999)) + '1'
wallet.send_transaction(asset_name=symbol, amount=amount, recipient=recipient)
@ -547,12 +538,12 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
if not send_tr.element_by_text(name).is_element_displayed():
self.errors.append('%s is not shown in search when searching by namepart' % name)
send_tr.element_by_text(basic_add_to_fav_name).click()
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address('0x' + basic_user['address']):
if send_tr.enter_recipient_address_text.text != send_tr.get_formatted_recipient_address(
'0x' + basic_user['address']):
self.errors.append('QR scanned address that was added to favourites was not resolved correctly')
self.errors.verify_no_errors()
@marks.testrail_id(5437)
@marks.medium
def test_validation_amount_errors(self):
@ -577,21 +568,24 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
screen = 'send transaction screen from wallet'
sign_in.just_fyi('Checking %s on %s' % (errors['send_transaction_screen']['too_precise'], screen))
initial_amount_ADI = wallet.get_asset_amount_by_name('ADI')
initial_amount_adi = wallet.get_asset_amount_by_name('ADI')
send_transaction = wallet.send_transaction_button.click()
adi_button = send_transaction.asset_by_name('ADI')
send_transaction.select_asset_button.click_until_presence_of_element(send_transaction.eth_asset_in_select_asset_bottom_sheet_button)
send_transaction.select_asset_button.click_until_presence_of_element(
send_transaction.eth_asset_in_select_asset_bottom_sheet_button)
adi_button.click()
send_transaction.amount_edit_box.click()
amount = '0.000%s' % str(random.randint(100000, 999999)) + '1'
send_transaction.amount_edit_box.set_value(amount)
if not send_transaction.element_by_text(errors['send_transaction_screen']['too_precise']).is_element_displayed():
if not send_transaction.element_by_text(
errors['send_transaction_screen']['too_precise']).is_element_displayed():
self.errors.append(warning % (errors['send_transaction_screen']['too_precise'], screen))
sign_in.just_fyi('Checking %s on %s' % (errors['send_transaction_screen']['insufficient_funds'], screen))
send_transaction.amount_edit_box.clear()
send_transaction.amount_edit_box.set_value(str(initial_amount_ADI) + '1')
if not send_transaction.element_by_text(errors['send_transaction_screen']['insufficient_funds']).is_element_displayed():
send_transaction.amount_edit_box.set_value(str(initial_amount_adi) + '1')
if not send_transaction.element_by_text(
errors['send_transaction_screen']['insufficient_funds']).is_element_displayed():
self.errors.append(warning % (errors['send_transaction_screen']['insufficient_funds'], screen))
wallet.close_send_transaction_view_button.click()
wallet.close_button.click()
@ -648,11 +642,9 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.network_fee_button.click()
send_transaction = wallet.get_send_transaction_view()
fee_fields = (send_transaction.per_gas_tip_limit_input, send_transaction.per_gas_price_limit_input)
[default_tip, default_price] = [input.text for input in fee_fields]
[default_tip, default_price] = [field.text for field in fee_fields]
default_limit = '21000'
wallet.just_fyi("Check basic validation")
values = {
send_transaction.gas_limit_input:
@ -685,11 +677,11 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
field.clear()
field.set_value(values[field]['value'])
wallet.just_fyi("Set custom fee and check that it will be applied")
send_transaction.save_fee_button.scroll_and_click()
if send_transaction.get_network_fee_from_bottom_sheet() != '0.000088':
self.driver.fail("Custom fee is not applied, in fact it is %s " % send_transaction.get_network_fee_from_bottom_sheet())
self.driver.fail(
"Custom fee is not applied, in fact it is %s " % send_transaction.get_network_fee_from_bottom_sheet())
send_transaction.sign_transaction()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=3)
transaction = wallet.find_transaction_in_history(amount=amount, return_hash=True)
@ -747,10 +739,7 @@ class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase):
receiver = transaction_recipients['K']
self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
home_1, home_2 = device_1.recover_access(sender['passphrase']), \
device_2.recover_access(receiver['passphrase'])
home_1, home_2 = device_1.recover_access(sender['passphrase']), device_2.recover_access(receiver['passphrase'])
wallet_sender = home_1.wallet_button.click()
wallet_receiver = home_2.wallet_button.click()
@ -761,7 +750,6 @@ class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase):
device_1.just_fyi("Sending token amount to device who will use Set Max option for token")
amount = '0.012345678912345678'
wallet_sender.accounts_status_account.click()
wallet_sender.send_transaction(asset_name='STT', amount=amount, recipient=receiver['address'])
wallet_receiver.wait_balance_is_changed(asset='STT', initial_balance=initial_balance, scan_tokens=True)
wallet_receiver.accounts_status_account.click()

View File

@ -67,7 +67,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@marks.high
def test_pair_devices_sync_one_to_one_contacts_nicknames_public_chat(self):
self.create_drivers(3)
device_1, device_2, device_3 = SignInView(self.drivers[0]), SignInView(self.drivers[1]), SignInView(self.drivers[2])
device_1, device_2, device_3 = SignInView(self.drivers[0]), SignInView(self.drivers[1]), SignInView(
self.drivers[2])
no_contact_nickname = 'no_contact_nickname'
name_1, name_2 = 'device_%s' % device_1.driver.number, 'device_%s' % device_2.driver.number
@ -132,7 +133,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
self.errors.append('"%s" is not found in Contacts after initial sync' % name)
profile_2.blocked_users_button.click()
if not profile_2.element_by_text(no_contact_nickname).is_element_displayed():
self.errors.append("'%s' nickname without addeing to contacts is not synced after initial sync" % no_contact_nickname)
self.errors.append(
"'%s' nickname without addeing to contacts is not synced after initial sync" % no_contact_nickname)
profile_2.profile_button.double_click()
device_1.just_fyi("Contacts(main device): unblock user, send message from unblocked user")
@ -220,7 +222,6 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors()
@marks.testrail_id(6324)
@marks.medium
def test_invite_to_group_chat_handling(self):
@ -280,7 +281,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
self.errors.append('Group chat was not removed when removing after declining group invite')
[home.get_chat(chat_name).click() for home in (homes[0], homes[1])]
if chats[0].group_membership_request_button.is_element_displayed():
self.errors.append('Group membership request is shown after relogin when there are no pending requests anymore')
self.errors.append(
'Group membership request is shown after relogin when there are no pending requests anymore')
join_system_message = chats[0].join_system_message(usernames[1])
for chat in (chats[1], chats[0]):
if not chat.chat_element_by_text(join_system_message).is_element_displayed():
@ -332,7 +334,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@marks.medium
def test_pair_devices_group_chat_different_messages_nicknames(self):
self.create_drivers(3)
device_1, device_2, device_3 = SignInView(self.drivers[0]), SignInView(self.drivers[1]), SignInView(self.drivers[2])
device_1, device_2, device_3 = SignInView(self.drivers[0]), SignInView(self.drivers[1]), SignInView(
self.drivers[2])
home_1 = device_1.create_user()
profile_1 = home_1.profile_button.click()
profile_1.privacy_and_security_button.click()
@ -409,4 +412,3 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
if not chat_1.sticker_message.is_element_displayed(30):
self.errors.append('Sticker was not sent')
self.errors.verify_no_errors()

View File

@ -19,6 +19,7 @@ from tests import test_suite_data, start_threads, appium_container, pytest_confi
import base64
from re import findall
class AbstractTestCase:
__metaclass__ = ABCMeta
@ -38,12 +39,14 @@ class AbstractTestCase:
def executor_local(self):
return 'http://localhost:4723/wd/hub'
def print_sauce_lab_info(self, driver):
@staticmethod
def print_sauce_lab_info(driver):
sys.stdout = sys.stderr
print("SauceOnDemandSessionID=%s job-name=%s" % (driver.session_id,
pytest_config_global['build']))
def get_translation_by_key(self, key):
@staticmethod
def get_translation_by_key(key):
return transl[key]
def add_local_devices_to_capabilities(self):
@ -59,7 +62,9 @@ class AbstractTestCase:
@property
def app_path(self):
app_path='/storage/emulated/0/Android/data/im.status.ethereum.pr/files/Download/' if findall(r'pr\d\d\d\d\d', pytest_config_global['apk']) else '/storage/emulated/0/Android/data/im.status.ethereum/files/Download/'
app_path = '/storage/emulated/0/Android/data/im.status.ethereum.pr/files/Download/' if findall(r'pr\d\d\d\d\d',
pytest_config_global[
'apk']) else '/storage/emulated/0/Android/data/im.status.ethereum/files/Download/'
return app_path
@property
@ -132,13 +137,15 @@ class AbstractTestCase:
network_api = NetworkApi()
github_report = GithubHtmlReport()
def is_alert_present(self, driver):
@staticmethod
def is_alert_present(driver):
try:
return driver.find_element(MobileBy.ID, 'android:id/message')
except NoSuchElementException:
return False
def get_alert_text(self, driver):
@staticmethod
def get_alert_text(driver):
return driver.find_element(MobileBy.ID, 'android:id/message').text
def add_alert_text_to_report(self, driver):
@ -146,7 +153,6 @@ class AbstractTestCase:
test_suite_data.current_test.testruns[-1].error += "; also Unexpected Alert is shown: '%s'" \
% self.get_alert_text(driver)
def pull_geth(self, driver):
result = ""
try:
@ -168,7 +174,6 @@ class Driver(webdriver.Remote):
logging.info(text)
test_suite_data.current_test.testruns[-1].steps.append(text)
def fail(self, text: str):
pytest.fail('Device %s: %s' % (self.number, text))
@ -216,7 +221,8 @@ class SingleDeviceTestCase(AbstractTestCase):
except (WebDriverException, AttributeError):
pass
finally:
self.github_report.save_test(test_suite_data.current_test, {'%s_geth.log' % test_suite_data.current_test.name: geth_content})
self.github_report.save_test(test_suite_data.current_test,
{'%s_geth.log' % test_suite_data.current_test.name: geth_content})
class LocalMultipleDeviceTestCase(AbstractTestCase):
@ -270,7 +276,8 @@ class SauceMultipleDeviceTestCase(AbstractTestCase):
try:
self.print_sauce_lab_info(self.drivers[driver])
self.add_alert_text_to_report(self.drivers[driver])
geth_names.append('%s_geth%s.log' % (test_suite_data.current_test.name, str(self.drivers[driver].number)))
geth_names.append(
'%s_geth%s.log' % (test_suite_data.current_test.name, str(self.drivers[driver].number)))
geth_contents.append(self.pull_geth(self.drivers[driver]))
self.drivers[driver].quit()
except (WebDriverException, AttributeError):
@ -278,7 +285,6 @@ class SauceMultipleDeviceTestCase(AbstractTestCase):
geth = {geth_names[i]: geth_contents[i] for i in range(len(geth_names))}
self.github_report.save_test(test_suite_data.current_test, geth)
@classmethod
def teardown_class(cls):
cls.loop.close()

View File

@ -2,11 +2,8 @@ import os
import pytest
import re
import time
from os import path
from support.api.third_parties_api import get_token_info
from tests import marks
def get_parameters():

View File

@ -4,6 +4,7 @@ from views.sign_in_view import SignInView
from datetime import datetime
import time
class TestPerformance(SingleDeviceTestCase):
def get_timestamps_by_event(self, *args):
@ -42,7 +43,8 @@ class TestPerformance(SingleDeviceTestCase):
timestamps_by_event = self.get_timestamps_by_event(app_started, login_shown, password_submitted, login_success)
for event in app_started, login_shown, password_submitted, login_success:
self.driver.info("event: '%s' | timestamp: '%s' | time: '%s'" % (event, timestamps_by_event[event],
datetime.utcfromtimestamp(timestamps_by_event[event] / 1000)))
datetime.utcfromtimestamp(
timestamps_by_event[event] / 1000)))
time_to_login = (timestamps_by_event[login_success] - timestamps_by_event[password_submitted]) / 1000
self.driver.info("Time to login is '%s'" % time_to_login)

View File

@ -16,6 +16,16 @@ ens_user['ens_upgrade'] = 'statuse2e'
ens_user['ens_another'] = 'status-another-ens-e2e.eth'
ens_user['address'] = '0x1eE3058Bd300246B4B20E687Efc9Eba81FF7814b'
user_mainnet = dict()
user_mainnet['passphrase'] = "gallery zoo inspire work used slush deliver surface adjust struggle lazy virtual"
user_mainnet['mainnet'] = {
'ETH': 0.000372125264,
'SNT': 60,
'DGD': 0.00001
}
user_mainnet['xdai'] = '0.0002 xDAI'
user_mainnet['bsc'] = '0.00001 BNB'
ens_user_ropsten = dict()
ens_user_ropsten['ens'] = 'nastya'
ens_user_ropsten['username'] = 'Thoughtful Stupendous Graywolf'
@ -28,7 +38,8 @@ ens_user_message_sender['ens'] = 'ensmessenger'
ens_user_message_sender['username'] = 'Glaring Plush Arkshell'
ens_user_message_sender['passphrase'] = 'tribe life dune clog throw situate robust gospel panic blanket timber eagle'
ens_user_message_sender['address'] = '0x75fF623fe856012b0667876582038A63F4004184'
ens_user_message_sender['public_key'] = '0x0471e18b2a9867161383919d85741389a829299ae0833c23e003818c1222942f5dddcbb792daee7c88' \
ens_user_message_sender[
'public_key'] = '0x0471e18b2a9867161383919d85741389a829299ae0833c23e003818c1222942f5dddcbb792daee7c88' \
'e8a30ee44c00d03240a971d90d76ed8200b75572241da9ef'
dummy_user = dict()
@ -62,7 +73,6 @@ wallet_users['B']['address'] = "0F3EFF5CacEe63045be97281316457fb78dd659E"
wallet_users['B']['public_key'] = "0x04f3c372522a087bd6895a67b669601e6b6825b2ee7add5942d10efd1c3c836a1d9a677d94d33" \
"895833b6ebe523f0fe5965f73558da58520a3f9c7a00e73f75d61"
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"
@ -97,7 +107,6 @@ wallet_users['F']['address'] = "0x8A4339aE98df2B2e51E37631C8B4F853048D4556"
wallet_users['F']['public_key'] = "0x049d0b39d95b20114fac79c3173a36c60a126c060dce52bba4128ab9a3885f0f058f2af9c92099" \
"315eb564412b718d8bfe697a4425e4bc603063abd4f5c45f8e57"
# Users used in chats. E.g. as members of a group chat
chat_users = dict()
@ -148,7 +157,8 @@ transaction_senders['D']['public_key'] = "0x044764a9ba22bb4ae355619ca3824ee66b9f
"d0dd570471986c229c077c8053ee47784416eb6604d52e41f8f9d566ef8"
transaction_senders['E'] = dict()
transaction_senders['E']['passphrase'] = "sea ill guard bounce gesture tomato walnut fitness plastic affair oven transfer"
transaction_senders['E'][
'passphrase'] = "sea ill guard bounce gesture tomato walnut fitness plastic affair oven transfer"
transaction_senders['E']['username'] = "Fatal Metallic Imperialeagle"
transaction_senders['E']['address'] = "f7cb60839c0de25e37be0391c33bb34a8f0f8414"
transaction_senders['E']['public_key'] = "0x04db6128352e5c2d05ee5a6556848453cf3a7af34e94b3e20a302de684e9906461e38adf" \
@ -367,13 +377,13 @@ transaction_recipients['J']['public_key'] = "0x04e7e481932714c1a13ffb29fc79446ee
"7a80804ff59a750693492a65be9682d0b850b4080d976cf9e43ff37ec841"
transaction_recipients['K'] = dict()
transaction_recipients['K']['passphrase'] = "core orphan clerk involve trade admit exhibit valid short canvas disorder world"
transaction_recipients['K'][
'passphrase'] = "core orphan clerk involve trade admit exhibit valid short canvas disorder world"
transaction_recipients['K']['username'] = "Upright Authorized Waterstrider"
transaction_recipients['K']['address'] = "0x6a1aC3a7a5A064FF6E0f169E0d384703245556b4"
transaction_recipients['K']['public_key'] = "0x04d1c98a6e25a7ea0241349a41709c5dc51c7c1d59224076d13d1ebe16671eedc8f" \
"3b23ab95db679a9124752ed77339424034fd9a12f0184894c0d7a25710d2f3c"
recovery_users = {
"radar blur cabbage chef fix engine embark joy scheme fiction master release":
"0xaC39b311DCEb2A4b2f5d8461c1cdaF756F4F7Ae9",

View File

@ -77,7 +77,8 @@ class BaseElement(object):
return self.driver.find_element(self.by, self.locator)
except NoSuchElementException:
raise NoSuchElementException(
"Device %s: %s by %s: `%s` is not found on the screen" % (self.driver.number, self.name, self.by, self.locator)) from None
"Device %s: %s by %s: `%s` is not found on the screen" % (
self.driver.number, self.name, self.by, self.locator)) from None
except Exception as exception:
if 'Internal Server Error' in str(exception):
continue
@ -100,7 +101,8 @@ class BaseElement(object):
.until(expected_conditions.presence_of_element_located((self.by, self.locator)))
except TimeoutException:
raise TimeoutException(
"Device %s: %s by %s: `%s` is not found on the screen" % (self.driver.number, self.name, self.by, self.locator)) from None
"Device %s: %s by %s: `%s` is not found on the screen" % (
self.driver.number, self.name, self.by, self.locator)) from None
def wait_for_elements(self, seconds=10):
try:
@ -108,7 +110,8 @@ class BaseElement(object):
.until(expected_conditions.presence_of_all_elements_located((self.by, self.locator)))
except TimeoutException:
raise TimeoutException(
"Device %s: %s by %s:`%s` is not found on the screen" % (self.driver.number, self.name, self.by, self.locator)) from None
"Device %s: %s by %s:`%s` is not found on the screen" % (
self.driver.number, self.name, self.by, self.locator)) from None
def wait_for_visibility_of_element(self, seconds=10, ignored_exceptions=None):
try:
@ -116,7 +119,8 @@ class BaseElement(object):
.until(expected_conditions.visibility_of_element_located((self.by, self.locator)))
except TimeoutException:
raise TimeoutException(
"Device %s: %s by %s:`%s` is not found on the screen" % (self.driver.number, self.name, self.by, self.locator)) from None
"Device %s: %s by %s:`%s` is not found on the screen" % (
self.driver.number, self.name, self.by, self.locator)) from None
def wait_for_invisibility_of_element(self, seconds=10):
try:
@ -153,7 +157,8 @@ class BaseElement(object):
self.driver.swipe(500, size["height"] * 0.25, 500, size["height"] * 0.8)
else:
raise NoSuchElementException(
"Device %s: %s by %s: `%s` is not found on the screen" % (self.driver.number, self.name, self.by, self.locator)) from None
"Device %s: %s by %s: `%s` is not found on the screen" % (
self.driver.number, self.name, self.by, self.locator)) from None
def scroll_and_click(self, direction='down'):
self.scroll_to_element(direction=direction)
@ -212,7 +217,7 @@ class BaseElement(object):
screen = Image.open(BytesIO(base64.b64decode(self.find_element().screenshot_as_base64)))
screen.save(full_path_to_file)
def is_element_image_equals_template(self, file_name: str = '', diff: int = 0):
def is_element_image_equals_template(self, file_name: str = ''):
if file_name:
self.template = file_name
return not ImageChops.difference(self.image, self.template).getbbox()
@ -337,20 +342,20 @@ class Text(BaseElement):
return text
class Button(BaseElement):
def __init__(self, driver, **kwargs):
super(Button, self).__init__(driver, **kwargs)
def wait_and_click(self, time=30):
self.driver.info("Wait for element '%s' for max %ss and click when it is available" % (self.name, time))
self.wait_for_visibility_of_element(time)
def wait_and_click(self, sec=30):
self.driver.info("Wait for element '%s' for max %ss and click when it is available" % (self.name, sec))
self.wait_for_visibility_of_element(sec)
self.click()
def click_until_presence_of_element(self, desired_element, attempts=4):
counter = 0
self.driver.info("Click until '%s' by '%s': `%s` will be presented" % (desired_element.name, desired_element.by, desired_element.locator))
self.driver.info("Click until '%s' by '%s': `%s` will be presented" % (
desired_element.name, desired_element.by, desired_element.locator))
while not desired_element.is_element_present(1) and counter <= attempts:
try:
self.find_element().click()
@ -363,7 +368,8 @@ class Button(BaseElement):
def click_until_absense_of_element(self, desired_element, attempts=3):
counter = 0
self.driver.info("Click until '%s' by '%s': `%s` is NOT presented" % (desired_element.name, desired_element.by, desired_element.locator))
self.driver.info("Click until '%s' by '%s': `%s` is NOT presented" % (
desired_element.name, desired_element.by, desired_element.locator))
while desired_element.is_element_present(1) and counter <= attempts:
try:
self.find_element().click()
@ -371,6 +377,7 @@ class Button(BaseElement):
except (NoSuchElementException, TimeoutException):
return self.navigate()
class SilentButton(Button):
def find_element(self):
for _ in range(3):
@ -378,7 +385,8 @@ class SilentButton(Button):
return self.driver.find_element(self.by, self.locator)
except NoSuchElementException:
raise NoSuchElementException(
"Device %s: '%s' by %s:'%s' not found on the screen" % (self.driver.number, self.name, self.by, self.locator)) from None
"Device %s: '%s' by %s:'%s' not found on the screen" % (
self.driver.number, self.name, self.by, self.locator)) from None
except Exception as exception:
if 'Internal Server Error' in str(exception):
continue

View File

@ -46,6 +46,7 @@ class TabButton(Button):
def __init__(self, driver, parent_locator):
super().__init__(driver,
xpath="%s/android.widget.TextView" % parent_locator)
return Counter(self.driver, self.locator)
@property
@ -53,6 +54,7 @@ class TabButton(Button):
class PublicChatUnreadMessages(BaseElement):
def __init__(self, driver, parent_locator):
super().__init__(driver, xpath="%s/android.widget.TextView" % parent_locator)
return PublicChatUnreadMessages(self.driver, self.locator)
@ -158,6 +160,7 @@ class AssetButton(Button):
def click(self):
self.wait_for_element().click()
class OpenInStatusButton(Button):
def __init__(self, driver):
super().__init__(driver, translation_id="browsing-open-in-status")
@ -194,9 +197,11 @@ class AirplaneModeButton(Button):
super(AirplaneModeButton, self).click()
self.driver.press_keycode(4)
class SignInPhraseText(Text):
def __init__(self, driver):
super().__init__(driver, translation_id="this-is-you-signing", suffix="//following-sibling::*[2]/android.widget.TextView")
super().__init__(driver, translation_id="this-is-you-signing",
suffix="//following-sibling::*[2]/android.widget.TextView")
@property
def list(self):
@ -247,8 +252,6 @@ class BaseView(object):
self.qr_code_image = Button(self.driver, accessibility_id="qr-code-image")
self.sign_in_phrase = SignInPhraseText(self.driver)
# external browser
self.open_in_status_button = OpenInStatusButton(self.driver)
@ -283,8 +286,8 @@ class BaseView(object):
iterations += 1
@staticmethod
def get_translation_by_key(id):
return transl[id]
def get_translation_by_key(translation_id):
return transl[translation_id]
def rooted_device_continue(self):
try:
@ -321,8 +324,8 @@ class BaseView(object):
except TimeoutException:
counter += 1
def just_fyi(self, string):
self.driver.info('# STEP: %s' % string, device=False)
def just_fyi(self, some_str):
self.driver.info('# STEP: %s' % some_str, device=False)
def click_system_back_button(self, times=1):
self.driver.info('Click system back button')
@ -360,8 +363,8 @@ class BaseView(object):
self.driver.info('Paste text')
self.driver.press_keycode(279)
def send_as_keyevent(self, string):
self.driver.info("Sending as keyevent `%s`" % string)
def send_as_keyevent(self, keyevent):
self.driver.info("Sending as keyevent `%s`" % keyevent)
keys = {'0': 7, '1': 8, '2': 9, '3': 10, '4': 11, '5': 12, '6': 13, '7': 14, '8': 15, '9': 16,
',': 55, '-': 69, '+': 81, '.': 56, '/': 76, '\\': 73, ';': 74, ' ': 62,
@ -371,7 +374,7 @@ class BaseView(object):
'k': 39, 'l': 40, 'm': 41, 'n': 42, 'o': 43, 'p': 44, 'q': 45, 'r': 46, 's': 47, 't': 48,
'u': 49, 'v': 50, 'w': 51, 'x': 52, 'y': 53, 'z': 54}
time.sleep(3)
for i in string:
for i in keyevent:
if i.isalpha() and i.isupper():
keycode, metastate = keys[i.lower()], 64 # META_SHIFT_LEFT_ON Constant Value: 64. Example: i='n' -> 'N'
elif type(keys[i]) is list:
@ -394,8 +397,8 @@ class BaseView(object):
element = self.element_types[element_type](self.driver, xpath="//*[starts-with(@text,'%s')]" % text)
return element
def element_by_translation_id(self, id, element_type='button', uppercase=False):
element = self.element_types[element_type](self.driver, translation_id=id, uppercase=uppercase)
def element_by_translation_id(self, translation_id, element_type='button', uppercase=False):
element = self.element_types[element_type](self.driver, translation_id=translation_id, uppercase=uppercase)
return element
def wait_for_element_starts_with_text(self, text, wait_time=60):
@ -406,7 +409,8 @@ class BaseView(object):
"""Uses percentage values based on device width/height"""
self.driver.info("Swiping based on custom coordinates relative to device height/width")
size = self.driver.get_window_size()
self.driver.swipe(size["width"] * x_start, size["height"] * y_start, size["width"] * x_end, size["height"] * y_end)
self.driver.swipe(size["width"] * x_start, size["height"] * y_start, size["width"] * x_end,
size["height"] * y_end)
def swipe_up(self):
self.driver.info("Swiping up")
@ -520,7 +524,6 @@ class BaseView(object):
continue
return self.get_home_view()
def relogin(self, password=common_password):
try:
profile_view = self.profile_button.click()
@ -536,7 +539,6 @@ class BaseView(object):
TouchAction(self.driver).tap(None, 255, 104, 1).perform()
time.sleep(3)
def get_public_key_and_username(self, return_username=False):
self.driver.info("Get public key and username")
profile_view = self.profile_button.click()
@ -562,7 +564,6 @@ class BaseView(object):
element.click()
return self.get_chat_view()
def find_values_in_logcat(self, **kwargs):
logcat = self.logcat
items_in_logcat = list()
@ -650,4 +651,3 @@ class BaseView(object):
string_source = self.driver.page_source
source = open(full_path_to_file, "a+")
source.write(string_source)

View File

@ -90,7 +90,6 @@ class ChatOptionsButton(Button):
def __init__(self, driver):
super().__init__(driver, xpath="//androidx.appcompat.widget.LinearLayoutCompat")
def click(self):
self.click_until_presence_of_element(HomeView(self.driver).mark_all_messages_as_read_button)
@ -137,6 +136,7 @@ class ChatElementByText(Text):
class ImageInReply(BaseElement):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="//android.widget.ImageView")
try:
return ImageInReply(self.driver, self.locator)
except NoSuchElementException:
@ -150,7 +150,6 @@ class ChatElementByText(Text):
return TimeStampText(self.driver, self.locator)
@property
def member_photo(self):
class MemberPhoto(Button):
@ -176,7 +175,8 @@ class ChatElementByText(Text):
def uncollapse(self) -> bool:
class Collapse(Button):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/../../..//android.widget.ImageView[@content-desc='icon']")
super().__init__(driver, prefix=parent_locator,
xpath="/../../..//android.widget.ImageView[@content-desc='icon']")
return Collapse(self.driver, self.locator).is_element_displayed()
@ -195,7 +195,9 @@ class ChatElementByText(Text):
def replied_message_text(self):
class RepliedMessageText(Text):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/preceding-sibling::*[1]/android.widget.TextView[2]")
super().__init__(driver, prefix=parent_locator,
xpath="/preceding-sibling::*[1]/android.widget.TextView[2]")
try:
return RepliedMessageText(self.driver, self.message_locator).text
except NoSuchElementException:
@ -207,6 +209,7 @@ class ChatElementByText(Text):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator,
xpath="/preceding-sibling::*[1]/android.widget.TextView[1]")
try:
return RepliedToUsernameText(self.driver, self.message_locator).text
except NoSuchElementException:
@ -228,6 +231,7 @@ class ChatElementByText(Text):
return text
except NoSuchElementException:
return 0
return int(EmojisNumber(self.driver, self.locator).text)
@property
@ -236,8 +240,10 @@ class ChatElementByText(Text):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator,
xpath="/../..//android.view.ViewGroup[@content-desc='pinned-by']")
return PinnedByLabelText(self.driver, self.locator)
class UsernameOptions(Button):
def __init__(self, driver, username):
super().__init__(driver, xpath="//*[@text='%s']/..//*[@content-desc='menu-option']" % username)
@ -309,7 +315,6 @@ class CommunityView(HomeView):
self.request_access_button = Button(self.driver, translation_id="request-access")
self.membership_request_pending_text = Text(self.driver, translation_id="membership-request-pending")
def add_channel(self, name: str, description="Some new channel"):
self.driver.info("Adding channel")
self.plus_button.click()
@ -359,6 +364,7 @@ class PreviewMessage(ChatElementByText):
class PreviewImage(SilentButton):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/android.widget.ImageView")
return PreviewMessage.return_element_or_empty(PreviewImage(self.driver, self.locator))
@property
@ -366,6 +372,7 @@ class PreviewMessage(ChatElementByText):
class PreviewTitle(SilentButton):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/android.widget.TextView[1]")
return PreviewMessage.return_element_or_empty(PreviewTitle(self.driver, self.locator))
@property
@ -373,6 +380,7 @@ class PreviewMessage(ChatElementByText):
class PreviewSubTitle(SilentButton):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/android.widget.TextView[2]")
return PreviewMessage.return_element_or_empty(PreviewSubTitle(self.driver, self.locator))
@ -402,6 +410,7 @@ class CommunityLinkPreviewMessage(ChatElementByText):
class CommunityMembers(SilentButton):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/following-sibling::android.widget.TextView[3]")
members_string = CommunityMembers(self.driver, self.locator).text
return int(re.search(r'\d+', members_string).group())
@ -409,18 +418,20 @@ class CommunityLinkPreviewMessage(ChatElementByText):
def view(self) -> object:
class CommunityViewButton(SilentButton):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/..//*[@text='%s']" % self.get_translation_by_key("view"))
super().__init__(driver, prefix=parent_locator,
xpath="/..//*[@text='%s']" % self.get_translation_by_key("view"))
CommunityViewButton(self.driver, self.locator).click()
CommunityView(self.driver).request_access_button.wait_for_element(20)
return CommunityView(self.driver)
class TransactionMessage(ChatElementByText):
def __init__(self, driver, text: str, transaction_value):
super().__init__(driver, text=text)
if transaction_value:
self.xpath = "//*[starts-with(@text,'%s')]/../*[@text='%s']/ancestor::android.view.ViewGroup[@content-desc='chat-item']" % (text, transaction_value)
self.xpath = "//*[starts-with(@text,'%s')]/../*[@text='%s']/ancestor::android.view.ViewGroup[@content-desc='chat-item']" % (
text, transaction_value)
# Common statuses for incoming and outgoing transactions
self.address_requested = self.get_translation_by_key("address-requested")
self.confirmed = self.get_translation_by_key("status-confirmed")
@ -516,7 +527,9 @@ class UnpinMessagePopUp(BaseElement):
def click_unpin_message_button(self):
class UnpinMessageButton(Button):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="//android.widget.TextView[starts-with(@text,'Unpin')]")
super().__init__(driver, prefix=parent_locator,
xpath="//android.widget.TextView[starts-with(@text,'Unpin')]")
return UnpinMessageButton(self.driver, self.locator).click()
def message_text(self, text):
@ -547,7 +560,8 @@ class ChatView(BaseView):
self.view_profile_by_avatar_button = Button(self.driver, accessibility_id="member-photo")
self.user_options = Button(self.driver, accessibility_id="options")
self.open_in_status_button = OpenInStatusButton(self.driver)
self.close_modal_view_from_chat_button = Button(self.driver, xpath="//androidx.appcompat.widget.LinearLayoutCompat")
self.close_modal_view_from_chat_button = Button(self.driver,
xpath="//androidx.appcompat.widget.LinearLayoutCompat")
# Chat input
self.chat_message_input = EditBox(self.driver, accessibility_id="chat-message-input")
@ -650,13 +664,12 @@ class ChatView(BaseView):
self.create_community_button = Button(self.driver, translation_id="create-community")
self.community_name_edit_box = EditBox(self.driver, translation_id="name-your-community-placeholder")
self.community_description_edit_box = EditBox(self.driver, xpath='//android.widget.EditText[@text="%s"]' %
self.get_translation_by_key("give-a-short-description-community"))
self.set_community_image_button = Button(self.driver, translation_id='community-thumbnail-image',suffix='/following-sibling::android.view.ViewGroup')
self.get_translation_by_key(
"give-a-short-description-community"))
self.set_community_image_button = Button(self.driver, translation_id='community-thumbnail-image',
suffix='/following-sibling::android.view.ViewGroup')
self.confirm_create_in_community_button = Button(self.driver, translation_id="create")
def get_outgoing_transaction(self, account=None, transaction_value=None) -> object:
if account is None:
account = self.status_account_name
@ -693,7 +706,6 @@ class ChatView(BaseView):
self.clear_history_button.click()
self.clear_button.click()
def leave_chat_via_group_info(self):
self.driver.info("Leave group chat via group info")
self.chat_options.click()
@ -898,7 +910,6 @@ class ChatView(BaseView):
chat_element.find_element()
chat_element.member_photo.click()
def set_nickname(self, nickname, close_profile=True):
self.driver.info("Setting nickname:%s" % nickname)
self.profile_nickname_button.click()
@ -909,16 +920,18 @@ class ChatView(BaseView):
def convert_device_time_to_chat_timestamp(self) -> list:
sent_time_object = dateutil.parser.parse(self.driver.device_time)
timestamp = datetime.strptime("%s:%s" % (sent_time_object.hour, sent_time_object.minute), '%H:%M').strftime("%I:%M %p")
timestamp = datetime.strptime("%s:%s" % (sent_time_object.hour, sent_time_object.minute), '%H:%M').strftime(
"%I:%M %p")
timestamp_obj = datetime.strptime(timestamp, '%I:%M %p')
possible_timestamps_obj = [timestamp_obj + timedelta(0,0,0,0,1), timestamp_obj, timestamp_obj - timedelta(0,0,0,0,1)]
possible_timestamps_obj = [timestamp_obj + timedelta(0, 0, 0, 0, 1), timestamp_obj,
timestamp_obj - timedelta(0, 0, 0, 0, 1)]
timestamps = list(map(lambda x: x.strftime("%I:%M %p"), possible_timestamps_obj))
final_timestamps = [t[1:] if t[0] == '0' else t for t in timestamps]
return final_timestamps
def set_new_status(self, status='something is happening', image=False):
self.driver.info("## Setting new status:'%s', image set is: '%s'" % (BaseElement(self.driver).exclude_emoji(status), str(image)), device=False)
self.driver.info("## Setting new status:'%s', image set is: '%s'" %
(BaseElement(self.driver).exclude_emoji(status), str(image)), device=False)
self.timeline_add_new_status_button.click_until_presence_of_element(self.timeline_my_status_editbox)
self.timeline_my_status_editbox.set_value(status)
@ -938,11 +951,11 @@ class ChatView(BaseView):
return transaction_message
def get_community_by_name(self, community_name: str):
community_button = Button(self.driver, xpath = "//*[@content-desc='community-name-text'][starts-with(@text,'%s')]/.." % community_name)
community_button = Button(self.driver,
xpath="//*[@content-desc='community-name-text'][starts-with(@text,'%s')]/.." % community_name)
community_button.click()
return CommunityView(self.driver)
@staticmethod
def get_resolved_chat_key(username, chat_key):
return '%s%s%s' % (username, chat_key[:6], chat_key[-4:])

View File

@ -2,6 +2,7 @@ from views.base_element import Button, EditBox, BaseElement
from views.base_view import BaseView
from views.home_view import ChatElement
class DiscoverDappsButton(Button):
def __init__(self, driver):
super().__init__(driver, translation_id="open-dapp-store")
@ -15,6 +16,7 @@ class DiscoverDappsButton(Button):
self.click_until_presence_of_element(BaseWebView(self.driver).browser_refresh_page_button)
return self.navigate()
class EditUrlEditbox(EditBox):
def __init__(self, driver):
super().__init__(driver, xpath="(//android.widget.TextView)[1]")

View File

@ -13,11 +13,13 @@ class ChatButton(Button):
from views.chat_view import ChatView
return ChatView(self.driver)
class ChatElement(SilentButton):
def __init__(self, driver, username_part, community=False):
self.username = username_part
self.community = community
super().__init__(driver, xpath="//*[@content-desc='chat-name-text'][starts-with(@text,'%s')]/.." % username_part)
super().__init__(driver,
xpath="//*[@content-desc='chat-name-text'][starts-with(@text,'%s')]/.." % username_part)
def navigate(self):
if self.community:
@ -81,10 +83,12 @@ class ChatElement(SilentButton):
return ChatImage(self.driver)
class ActivityCenterChatElement(SilentButton):
def __init__(self, driver, chat_name):
self.chat_name = chat_name
super().__init__(driver, xpath="//*[@content-desc='chat-name-or-sender-text'][starts-with(@text,'%s')]/../.." % chat_name)
super().__init__(driver,
xpath="//*[@content-desc='chat-name-or-sender-text'][starts-with(@text,'%s')]/../.." % chat_name)
def navigate(self):
from views.chat_view import ChatView
@ -117,12 +121,15 @@ class ActivityCenterChatElement(SilentButton):
def chat_name_indicator_text(self):
class ChatNameIndicatorText(BaseElement):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, xpath="(%s//*[@content-desc='chat-name-container']//android.widget.TextView)[last()]" % parent_locator)
super().__init__(driver,
xpath="(%s//*[@content-desc='chat-name-container']//android.widget.TextView)[last()]" % parent_locator)
try:
return ChatNameIndicatorText(self.driver, self.locator).text
except NoSuchElementException:
return ''
class PushNotificationElement(SilentButton):
def __init__(self, driver, pn_text):
self.pn_text = pn_text
@ -150,12 +157,12 @@ class PushNotificationElement(SilentButton):
def group_chat_icon(self):
class GroupChatIconElement(BaseElement):
def __init__(self, driver, parent_locator):
super().__init__(driver, xpath="%s/../../../*[@resource-id='android:id/right_icon_container']" % parent_locator)
super().__init__(driver,
xpath="%s/../../../*[@resource-id='android:id/right_icon_container']" % parent_locator)
return GroupChatIconElement(self.driver, self.locator)
class HomeView(BaseView):
def __init__(self, driver):
super().__init__(driver)
@ -168,7 +175,8 @@ class HomeView(BaseView):
self.universal_qr_scanner_button = Button(self.driver, accessibility_id="universal-qr-scanner")
self.invite_friends_button = Button(self.driver, accessibility_id="invite-friends-button")
self.stop_status_service_button = Button(self.driver, accessibility_id="STOP")
self.my_profile_on_start_new_chat_button = Button(self.driver, xpath="//*[@content-desc='current-account-photo']")
self.my_profile_on_start_new_chat_button = Button(self.driver,
xpath="//*[@content-desc='current-account-photo']")
self.communities_button = ChatButton(self.driver, accessibility_id="communities-button")
# Notification centre
@ -177,7 +185,8 @@ class HomeView(BaseView):
self.notifications_select_button = Button(self.driver, translation_id="select")
self.notifications_reject_and_delete_button = Button(self.driver, accessibility_id="reject-and-delete"
"-activity-center")
self.notifications_accept_and_add_button = Button(self.driver, accessibility_id="accept-and-add-activity-center")
self.notifications_accept_and_add_button = Button(self.driver,
accessibility_id="accept-and-add-activity-center")
self.notifications_select_all = Button(self.driver, xpath="(//android.widget.CheckBox["
"@content-desc='checkbox'])[1]")
@ -238,7 +247,8 @@ class HomeView(BaseView):
return chat_element
def get_username_below_start_new_chat_button(self, username_part):
return Text(self.driver, xpath="//*[@content-desc='enter-contact-code-input']/../..//*[starts-with(@text,'%s')]" % username_part)
return Text(self.driver,
xpath="//*[@content-desc='enter-contact-code-input']/../..//*[starts-with(@text,'%s')]" % username_part)
def add_contact(self, public_key, add_in_contacts=True, nickname=''):
self.driver.info("## Starting 1-1 chat, add in contacts:%s" % str(add_in_contacts), device=False)

View File

@ -8,6 +8,7 @@ class OptionsButton(Button):
def __init__(self, driver):
super().__init__(driver, xpath="(//android.view.ViewGroup[@content-desc='icon'])[2]")
class AddNewContactButton(Button):
def __init__(self, driver):
super().__init__(driver, accessibility_id="add-new-contact-button")
@ -39,6 +40,7 @@ class LogoutDialog(BaseView):
from views.sign_in_view import SignInView
return SignInView(self.driver)
class ENSusernames(Button):
def __init__(self, driver):
super().__init__(driver, translation_id="ens-usernames")
@ -51,6 +53,7 @@ class ENSusernames(Button):
self.scroll_to_element().click()
return self.navigate()
class AdvancedButton(Button):
def __init__(self, driver):
super().__init__(driver, accessibility_id="advanced-button")
@ -74,6 +77,7 @@ class RecoveryPhraseTable(Text):
super().__init__(driver, translation_id="your-recovery-phrase",
suffix="/following-sibling::android.view.ViewGroup[1]/android.widget.TextView")
class RecoveryPhraseWordNumberText(Text):
def __init__(self, driver):
super().__init__(driver, xpath="//*[contains(@text,'#')]")
@ -164,6 +168,7 @@ class ProfilePictureElement(Button):
def __init__(self, driver):
super().__init__(driver, accessibility_id="chat-icon")
class KeycardButton(Button):
def navigate(self):
@ -175,7 +180,6 @@ class KeycardButton(Button):
return self.navigate()
class ProfileView(BaseView):
def __init__(self, driver):
@ -261,7 +265,9 @@ class ProfileView(BaseView):
self.use_history_node_button = Button(self.driver, translation_id="offline-messaging-use-history-nodes",
suffix="/following-sibling::*[1]")
self.mail_server_delete_button = Button(self.driver, accessibility_id="mailserver-delete-button")
self.mail_server_confirm_delete_button = Button(self.driver, xpath='//*[@text="%s"]' % self.get_translation_by_key("delete-mailserver").upper())
self.mail_server_confirm_delete_button = Button(self.driver,
xpath='//*[@text="%s"]' % self.get_translation_by_key(
"delete-mailserver").upper())
## Device syncing
self.devices_button = Button(self.driver, accessibility_id="pairing-settings-button")
self.device_name_input = EditBox(self.driver, accessibility_id="device-name")
@ -277,19 +283,25 @@ class ProfileView(BaseView):
self.change_pairing_code_button = KeycardButton(self.driver, translation_id="change-pairing")
self.create_keycard_backup_button = KeycardButton(self.driver, translation_id="keycard-backup")
# Advanced
self.advanced_button = AdvancedButton(self.driver)
## Network
self.network_settings_button = Button(self.driver, accessibility_id="network-button")
self.active_network_name = Text(self.driver, xpath="//android.widget.TextView[contains(@text,'with upstream RPC')]")
self.active_network_name = Text(self.driver,
xpath="//android.widget.TextView[contains(@text,'with upstream RPC')]")
self.plus_button = Button(self.driver, xpath="(//android.widget.ImageView[@content-desc='icon'])[2]")
self.ropsten_chain_button = Button(self.driver, translation_id="ropsten-network")
self.custom_network_url_input = EditBox(self.driver, translation_id="rpc-url",
suffix="/following-sibling::*[1]/android.widget.EditText")
self.custom_network_symbol_input = EditBox(self.driver, translation_id="specify-symbol")
self.specify_name_input = EditBox(self.driver, translation_id="name",
suffix="/following-sibling::*[1]/android.widget.EditText")
self.connect_button = Button(self.driver, accessibility_id="network-connect-button")
## Toggles
self.transaction_management_enabled_toggle = Button(self.driver,
accessibility_id="transactions-management-enabled")
self.webview_debug_toggle = Button(self.driver, accessibility_id="webview-debug-switch")
self.waku_bloom_toggle = Button(self.driver, accessibility_id="waku-bloom-filter-mode-settings-switch")
## Log level
self.log_level_setting_button = Button(self.driver, accessibility_id="log-level-settings-button")
## Fleet
@ -303,6 +315,9 @@ class ProfileView(BaseView):
# Need help
self.help_button = HelpButton(self.driver)
self.submit_bug_button = Button(self.driver, accessibility_id="submit-bug-button")
self.bug_description_edit_box = EditBox(self.driver, accessibility_id="bug-report-description")
self.bug_steps_edit_box = EditBox(self.driver, accessibility_id="bug-report-steps")
self.bug_submit_button = Button(self.driver, accessibility_id="bug-report-submit")
self.request_a_feature_button = Button(self.driver, accessibility_id="request-a-feature-button")
self.faq_button = FaqButton(self.driver)
@ -339,7 +354,7 @@ class ProfileView(BaseView):
return ChatView(self.driver)
def add_custom_network(self, rpc_url='https://ropsten.infura.io/v3/f315575765b14720b32382a61a89341a',
name='custom_ropsten'):
name='custom_ropsten', symbol='ETHro'):
self.driver.info("## Add predefined custom network", device=False)
self.advanced_button.click()
self.network_settings_button.scroll_to_element()
@ -347,6 +362,7 @@ class ProfileView(BaseView):
self.plus_button.click_until_presence_of_element(self.ropsten_chain_button)
self.custom_network_url_input.send_keys(rpc_url)
self.specify_name_input.send_keys(name)
self.custom_network_symbol_input.set_value(symbol)
self.ropsten_chain_button.scroll_to_element()
self.ropsten_chain_button.click()
self.ropsten_chain_button.click()
@ -397,7 +413,6 @@ class ProfileView(BaseView):
self.crop_photo_button.click()
self.driver.info("## Custom profile image has been set", device=False)
def take_photo(self):
self.take_photo_button.click()
if self.allow_button.is_element_displayed(sec=5):
@ -418,7 +433,6 @@ class ProfileView(BaseView):
self.element_by_text(element_text).click()
image_full_content.click()
def logout(self):
self.driver.info("Logging out")
self.logout_button.click()
@ -433,7 +447,8 @@ class ProfileView(BaseView):
def get_toggle_device_by_name(self, device_name):
self.driver.info("Selecting device '%s' for sync" % device_name)
return SilentButton(self.driver, xpath="//android.widget.TextView[contains(@text,'%s')]/..//android.widget.CheckBox" % device_name)
return SilentButton(self.driver,
xpath="//android.widget.TextView[contains(@text,'%s')]/..//android.widget.CheckBox" % device_name)
def discover_and_advertise_device(self, device_name):
self.driver.info("Discovering and advertising '%s'" % device_name)

View File

@ -3,6 +3,7 @@ from views.base_element import Text, SilentButton
from views.base_element import Button, EditBox
from views.base_view import BaseView
class AmountEditBox(EditBox, Button):
def __init__(self, driver):
super(AmountEditBox, self).__init__(driver, accessibility_id="amount-input")
@ -21,7 +22,6 @@ class ChooseRecipientButton(Button):
return self.navigate()
class UpdateFeeButton(Button):
def __init__(self, driver):
super(UpdateFeeButton, self).__init__(driver, translation_id="update")
@ -35,7 +35,8 @@ class UpdateFeeButton(Button):
class ValidationErrorOnSendTransaction(Button):
def __init__(self, driver, field):
super(ValidationErrorOnSendTransaction, self).__init__(driver, xpath="//*[@text='%s']/../*[@content-desc='icon']" % field)
super(ValidationErrorOnSendTransaction, self).__init__(driver,
xpath="//*[@text='%s']/../*[@content-desc='icon']" % field)
class NotEnoughEthForGas(Text):
@ -50,7 +51,9 @@ class ValidationWarnings(object):
class SignWithKeycardButton(Button):
def __init__(self, driver):
super(SignWithKeycardButton, self).__init__(driver, xpath="//*[contains(@text,'%s')]" % self.get_translation_by_key("sign-with"))
super(SignWithKeycardButton, self).__init__(driver,
xpath="//*[contains(@text,'%s')]" % self.get_translation_by_key(
"sign-with"))
def navigate(self):
from views.keycard_view import KeycardView
@ -72,22 +75,24 @@ class SendTransactionView(BaseView):
self.scan_qr_code_button = Button(self.driver, accessibility_id="scan-contact-code-button")
self.enter_recipient_address_input = EditBox(self.driver, accessibility_id="recipient-address-input")
self.first_recipient_button = Button(self.driver, accessibility_id="chat-icon")
self.enter_recipient_address_text = Text(self.driver, xpath="//*[@content-desc='choose-recipient-button']//android.widget.TextView")
self.enter_recipient_address_text = Text(self.driver,
xpath="//*[@content-desc='choose-recipient-button']//android.widget.TextView")
self.recent_recipients_button = Button(self.driver, translation_id="recent-recipients")
self.amount_edit_box = AmountEditBox(self.driver)
self.set_max_button = Button(self.driver, translation_id="set-max")
self.validation_error_element = Text(self.driver, xpath="//*[@content-desc='custom-gas-fee']/../android.view.ViewGroup//*[@content-desc='icon']")
self.validation_error_element = Text(self.driver,
xpath="//*[@content-desc='custom-gas-fee']/../android.view.ViewGroup//*[@content-desc='icon']")
# Network fee elements
self.network_fee_button = Button(self.driver, accessibility_id="custom-gas-fee")
self.gas_limit_input = EditBox(self.driver, accessibility_id="gas-amount-limit")
self.per_gas_tip_limit_input = EditBox(self.driver, accessibility_id="per-gas-tip-limit")
self.per_gas_price_limit_input = EditBox(self.driver, accessibility_id="per-gas-price-limit")
self.max_fee_text = Text(self.driver, xpath='//*[@text="Maximum fee:"]/following-sibling::android.widget.TextView[1]')
self.max_fee_text = Text(self.driver,
xpath='//*[@text="Maximum fee:"]/following-sibling::android.widget.TextView[1]')
self.save_fee_button = Button(self.driver, accessibility_id="save-fees")
self.sign_transaction_button = Button(self.driver, accessibility_id="send-transaction-bottom-sheet")
self.sign_with_keycard_button = SignWithKeycardButton(self.driver)
self.sign_with_password = Button(self.driver, translation_id="sign-with-password")
@ -98,7 +103,8 @@ class SendTransactionView(BaseView):
self.select_asset_button = Button(self.driver, accessibility_id="choose-asset-button")
self.asset_text = Text(self.driver, xpath="//*[@content-desc='choose-asset-button']//android.widget.TextView")
self.recipient_text = Text(self.driver, xpath="//*[@content-desc='choose-recipient-button']//android.widget.TextView")
self.recipient_text = Text(self.driver,
xpath="//*[@content-desc='choose-recipient-button']//android.widget.TextView")
self.share_button = Button(self.driver, accessibility_id="share-address-button")
@ -116,6 +122,10 @@ class SendTransactionView(BaseView):
self.new_favorite_name_input = EditBox(self.driver, accessibility_id="fav-name")
self.new_favorite_add_favorite = Button(self.driver, accessibility_id="add-fav")
# Transaction management
self.advanced_button = Button(self.driver, translation_id="advanced")
self.nonce_input = EditBox(self.driver, accessibility_id="nonce")
self.nonce_save_button = Button(self.driver, accessibility_id="save-nonce")
def set_recipient_address(self, address):
self.driver.info("Setting recipient address to '%s'" % address)
@ -141,18 +151,19 @@ class SendTransactionView(BaseView):
self.driver.info("## Transaction is signed!", device=False)
self.ok_button.click()
@staticmethod
def get_formatted_recipient_address(address):
return address[:6] + '' + address[-4:]
def get_username_in_transaction_bottom_sheet_button(self, username_part):
self.driver.info("Getting username by '%s' in transaction fee bottom sheet" % username_part)
return SilentButton(self.driver, xpath="//*[@content-desc='amount-input']/..//*[starts-with(@text,'%s')]" % username_part)
return SilentButton(self.driver,
xpath="//*[@content-desc='amount-input']/..//*[starts-with(@text,'%s')]" % username_part)
def get_account_in_select_account_bottom_sheet_button(self, account_name):
self.driver.info("Getting account by '%s' in transaction fee bottom sheet" % account_name)
return SilentButton(self.driver, translation_id="select-account", suffix="/..//*[starts-with(@text,'%s')]" % account_name)
return SilentButton(self.driver, translation_id="select-account",
suffix="/..//*[starts-with(@text,'%s')]" % account_name)
def get_validation_icon(self, field='Network fee'):
return ValidationErrorOnSendTransaction(self.driver, field)
@ -170,7 +181,6 @@ class SendTransactionView(BaseView):
self.driver.info("Getting network fee from send transaction bottom sheet")
return Text(self.driver, xpath="//*[@content-desc='custom-gas-fee']/android.widget.TextView[1]").text[0:-9]
def add_to_favorites(self, name):
self.driver.info("Adding '%s' to favorite recipients" % name)
self.recipient_add_to_favorites.click()

View File

@ -4,11 +4,13 @@ from tests import common_password, appium_root_project_path
from views.base_element import Button, EditBox, Text
from views.base_view import BaseView
class MultiAccountButton(Button):
class Username(Text):
def __init__(self, driver, locator_value):
super(MultiAccountButton.Username, self).__init__(driver,
xpath="%s//android.widget.TextView[@content-desc='username']" % locator_value)
def __init__(self, driver, position=1):
super(MultiAccountButton, self).__init__(driver,
xpath="//*[@content-desc='select-account-button-%s']" % position)
@ -106,7 +108,7 @@ class TermsOfUseLink(Button):
try:
self.click_inside_element_by_coordinate(times_to_click=2)
counter += 1
except (NoSuchElementException):
except NoSuchElementException:
return self.navigate()
self.driver.info('Click on link %s' % self.name)
return self.navigate()
@ -171,7 +173,8 @@ class SignInView(BaseView):
self.cancel_custom_seed_phrase_button = Button(self.driver, accessibility_id="cancel-custom-seed-phrase")
def create_user(self, password=common_password, keycard=False, enable_notifications=False, second_user=False):
self.driver.info("## Creating new multiaccount (password:'%s', keycard:'%s')" % (password, str(keycard)), device=False)
self.driver.info("## Creating new multiaccount (password:'%s', keycard:'%s')" % (password, str(keycard)),
device=False)
if not second_user:
self.accept_tos_checkbox.click()
self.get_started_button.click_until_presence_of_element(self.generate_key_button)
@ -200,7 +203,8 @@ class SignInView(BaseView):
self.driver.info("## New multiaccount is created successfully!", device=False)
return self.get_home_view()
def recover_access(self, passphrase: str, password: str = common_password, keycard=False, enable_notifications=False, second_user=False):
def recover_access(self, passphrase: str, password: str = common_password, keycard=False,
enable_notifications=False, second_user=False):
self.driver.info("## Recover access(password:%s, keycard:%s)" % (password, str(keycard)), device=False)
if not second_user:
self.accept_tos_checkbox.click()
@ -250,7 +254,6 @@ class SignInView(BaseView):
self.driver.info("## Signed in successfully!", device=False)
return self.get_home_view()
def get_multiaccount_by_position(self, position: int, element_class=MultiAccountOnLoginButton):
account_button = element_class(self.driver, position)
if account_button.is_element_displayed():
@ -276,7 +279,8 @@ class SignInView(BaseView):
self.multi_account_on_login_button.wait_for_visibility_of_element(30)
self.get_multiaccount_by_position(1).click()
self.password_input.set_value(common_password)
self.driver.push_file(source_path=full_path_to_file, destination_path='%s%s'% (AbstractTestCase().app_path, import_file_name))
self.driver.push_file(source_path=full_path_to_file,
destination_path='%s%s' % (AbstractTestCase().app_path, import_file_name))
self.options_button.click()
self.element_by_text('Import unencrypted').click()
self.element_by_text('Import unencrypted').wait_for_invisibility_of_element(40)

View File

@ -6,6 +6,7 @@ from views.base_view import BaseView
class OptionsButton(Button):
def __init__(self, driver):
super().__init__(driver, xpath="(//android.widget.ImageView[@content-desc='icon'])[2]")
def click(self):
self.click_until_presence_of_element(OptionsButton.CopyTransactionHashButton(self.driver))
@ -17,6 +18,7 @@ class OptionsButton(Button):
def __init__(self, driver):
super().__init__(driver, translation_id="open-on-etherscan")
class TransactionTable(BaseElement):
def __init__(self, driver):
super().__init__(driver, xpath="//android.widget.ScrollView")
@ -78,7 +80,6 @@ class TransactionTable(BaseElement):
self.driver.info('Finding transaction by index %s' % index)
return self.TransactionElement.by_index(self.driver, index=index)
def transaction_by_amount(self, amount: str, asset):
self.driver.info('Finding transaction by amount %s' % amount)
return self.TransactionElement.by_amount(self.driver, amount=amount.replace(',', '.'), asset=asset)
@ -99,6 +100,7 @@ class TransactionTable(BaseElement):
element.locator = '//android.view.ViewGroup[@content-desc="transaction-item"]'
return len(element.wait_for_elements())
class TransactionsView(BaseView):
def __init__(self, driver):
super().__init__(driver)

View File

@ -21,6 +21,7 @@ class AssetCheckBox(SilentButton):
def click(self):
self.scroll_to_element(12).click()
class BackupRecoveryPhrase(Button):
def __init__(self, driver):
super().__init__(driver, translation_id="wallet-backup-recovery-title")
@ -29,6 +30,7 @@ class BackupRecoveryPhrase(Button):
from views.profile_view import ProfileView
return ProfileView(self.driver)
class AccountElementButton(SilentButton):
def __init__(self, driver, account_name):
super().__init__(driver, xpath="//*[@content-desc='accountcard%s']" % account_name)
@ -48,6 +50,15 @@ class SendTransactionButton(Button):
return SendTransactionView(self.driver)
class SendTransactionFromMainButton(Button):
def __init__(self, driver):
super().__init__(driver, accessibility_id="send-transaction-button")
def navigate(self):
from views.send_transaction_view import SendTransactionView
return SendTransactionView(self.driver)
class ReceiveTransactionButton(Button):
def __init__(self, driver):
super().__init__(driver, translation_id="receive")
@ -81,6 +92,7 @@ class WalletView(BaseView):
super().__init__(driver)
self.send_transaction_button = SendTransactionButton(self.driver)
self.send_transaction_from_main_screen = SendTransactionFromMainButton(self.driver)
self.transaction_history_button = TransactionHistoryButton(self.driver)
self.usd_total_value = Text(self.driver, accessibility_id="total-amount-value-text")
@ -89,9 +101,12 @@ class WalletView(BaseView):
self.manage_assets_button = Button(self.driver, accessibility_id="wallet-manage-assets")
self.manage_accounts_button = Button(self.driver, accessibility_id="wallet-manage-accounts")
self.scan_tokens_button = Button(self.driver, accessibility_id="wallet-scan-token")
self.stt_check_box = Button(self.driver, xpath="//*[@text='STT']/../android.view.ViewGroup[@content-desc='checkbox']")
self.all_assets_full_names = Text(self.driver, xpath="//*[@content-desc='checkbox']/../android.widget.TextView[1]")
self.all_assets_symbols = Button(self.driver, xpath="//*[@content-desc='checkbox']/../android.widget.TextView[2]")
self.stt_check_box = Button(self.driver,
xpath="//*[@text='STT']/../android.view.ViewGroup[@content-desc='checkbox']")
self.all_assets_full_names = Text(self.driver,
xpath="//*[@content-desc='checkbox']/../android.widget.TextView[1]")
self.all_assets_symbols = Button(self.driver,
xpath="//*[@content-desc='checkbox']/../android.widget.TextView[2]")
self.currency_item_text = Text(self.driver, xpath="//*[@content-desc='currency-item']//android.widget.TextView")
self.address_text = Text(self.driver, accessibility_id="address-text")
@ -101,7 +116,8 @@ class WalletView(BaseView):
self.total_amount_text = Text(self.driver, accessibility_id="total-amount-value-text")
self.currency_text = Text(self.driver, accessibility_id="total-amount-currency-text")
self.backup_recovery_phrase = BackupRecoveryPhrase(self.driver)
self.backup_recovery_phrase_warning_text = Text(self.driver, accessibility_id="back-up-your-seed-phrase-warning")
self.backup_recovery_phrase_warning_text = Text(self.driver,
accessibility_id="back-up-your-seed-phrase-warning")
self.add_custom_token_button = AddCustomTokenButton(self.driver)
@ -121,10 +137,12 @@ class WalletView(BaseView):
self.enter_your_password_input = EditBox(self.driver, accessibility_id="add-account-enter-password")
self.account_name_input = EditBox(self.driver, accessibility_id="enter-account-name")
self.account_color_button = AccountColorButton(self.driver)
self.add_account_generate_account_button = Button(self.driver, accessibility_id="add-account-add-account-button")
self.add_account_generate_account_button = Button(self.driver,
accessibility_id="add-account-add-account-button")
self.status_account_total_usd_value = Text(self.driver, accessibility_id="account-total-value")
self.scan_qr_button = Button(self.driver, accessibility_id="accounts-qr-code")
self.close_send_transaction_view_button = Button(self.driver, xpath="//androidx.appcompat.widget.LinearLayoutCompat")
self.close_send_transaction_view_button = Button(self.driver,
xpath="//androidx.appcompat.widget.LinearLayoutCompat")
self.hide_account_button = Button(self.driver, accessibility_id="hide-account-button")
# collectibles
@ -136,7 +154,8 @@ class WalletView(BaseView):
# individual account settings
self.account_settings_button = Button(self.driver, translation_id="account-settings")
self.apply_settings_button = Button(self.driver, translation_id="apply")
self.password_delete_account_input = EditBox(self.driver, xpath='//*[@text="Password"]/following-sibling::*/android.widget.EditText')
self.password_delete_account_input = EditBox(self.driver,
xpath='//*[@text="Password"]/following-sibling::*/android.widget.EditText')
self.delete_account_confirm_button = Button(self.driver, accessibility_id="delete-account-confirm")
def wait_balance_is_equal_expected_amount(self, asset='ETH', expected_balance=0.1, wait_time=300):
@ -148,18 +167,21 @@ class WalletView(BaseView):
counter += 10
time.sleep(10)
self.swipe_down()
self.driver.info('**Waiting %s seconds for %s balance update to be equal to %s**' % (counter,asset, expected_balance))
self.driver.info('Waiting %s seconds for %s balance update to be equal to %s' % (
counter, asset, expected_balance))
else:
self.driver.info('**Balance for %s is equal to %s**' % (asset, expected_balance))
return
def wait_balance_is_changed(self, asset='ETH', initial_balance=0, wait_time=400, scan_tokens=False):
self.driver.info('**Waiting %ss for %s updated balance**' % (wait_time, asset))
self.driver.info('Waiting %ss for %s updated balance' % (wait_time, asset))
counter = 0
while True:
if counter >= wait_time:
self.driver.fail('Balance %s %s is not changed during %s seconds!' % (asset, initial_balance,wait_time))
elif self.asset_by_name(asset).is_element_present() and self.get_asset_amount_by_name(asset) == initial_balance:
self.driver.fail(
'Balance %s %s is not changed during %s seconds!' % (asset, initial_balance, wait_time))
elif self.asset_by_name(asset).is_element_present() and self.get_asset_amount_by_name(
asset) == initial_balance:
if scan_tokens:
self.scan_tokens()
if (counter / 60).is_integer():
@ -167,16 +189,16 @@ class WalletView(BaseView):
counter += 20
counter += 10
time.sleep(10)
self.driver.info('*Waiting %ss for %s updated balance*' % (counter,asset))
self.driver.info('Waiting %ss for %s updated balance' % (counter, asset))
elif not self.asset_by_name(asset).is_element_present(10):
if scan_tokens:
self.scan_tokens()
self.swipe_up()
counter += 10
time.sleep(10)
self.driver.info('*Waiting %s seconds for %s to display asset*' % (counter, asset))
self.driver.info('Waiting %s seconds for %s to display asset' % (counter, asset))
else:
self.driver.info('**Balance is updated!**')
self.driver.info('Balance is updated!')
self.wallet_button.double_click()
self.element_by_translation_id("wallet-total-value").scroll_to_element(direction='up')
return self
@ -184,7 +206,6 @@ class WalletView(BaseView):
def get_sign_in_phrase(self):
return ' '.join([element.text for element in self.sign_in_phrase.find_elements()])
def set_up_wallet_when_sending_tx(self):
self.driver.info("Setting up wallet")
phrase = self.sign_in_phrase.text
@ -201,10 +222,9 @@ class WalletView(BaseView):
return address
def wallet_account_by_name(self, account_name):
self.driver.info("*Getting '%s' wallet account*" % account_name)
self.driver.info("Getting '%s' wallet account" % account_name)
return AccountElementButton(self.driver, account_name)
def get_asset_amount_by_name(self, asset: str):
self.driver.info("Getting %s amount" % asset)
asset_value = SilentButton(self.driver, xpath="//android.view.ViewGroup[@content-desc=':%s-asset-value']"
@ -231,7 +251,8 @@ class WalletView(BaseView):
def get_account_options_from_main_screen(self, account_name=''):
account_name = self.status_account_name if not account_name else account_name
self.driver.info("Getting '%s'account options from main wallet screen" % account_name)
return SilentButton(self.driver, xpath="//*[@content-desc='accountcard%s']//*[@content-desc='icon']" % account_name)
return SilentButton(self.driver,
xpath="//*[@content-desc='accountcard%s']//*[@content-desc='icon']" % account_name)
def hidden_account_by_name_button(self, account_name=''):
return SilentButton(self.driver,
@ -241,7 +262,6 @@ class WalletView(BaseView):
return SilentButton(self.driver,
xpath="//*[@text='%s']/following-sibling::*[@content-desc='show-icon']" % account_name)
def select_asset(self, *args):
self.driver.info("Selecting asset(s)")
self.multiaccount_more_options.click()
@ -273,30 +293,32 @@ class WalletView(BaseView):
def send_transaction(self, **kwargs):
self.driver.info("## Sending transaction", device=False)
send_transaction_view = self.send_transaction_button.click()
send_transaction_view.select_asset_button.click()
send_tx = self.send_transaction_from_main_screen.click() if kwargs.get('from_main_wallet',
True) else self.send_transaction_button.click()
send_tx.select_asset_button.click()
asset_name = kwargs.get('asset_name', 'ETH').upper()
asset_button = send_transaction_view.asset_by_name(asset_name)
send_transaction_view.select_asset_button.click_until_presence_of_element(send_transaction_view.eth_asset_in_select_asset_bottom_sheet_button)
asset_button = send_tx.asset_by_name(asset_name)
send_tx.select_asset_button.click_until_presence_of_element(
send_tx.eth_asset_in_select_asset_bottom_sheet_button)
asset_button.click()
send_transaction_view.amount_edit_box.click()
send_tx.amount_edit_box.click()
transaction_amount = str(kwargs.get('amount', send_transaction_view.get_unique_amount()))
transaction_amount = str(kwargs.get('amount', send_tx.get_unique_amount()))
send_transaction_view.amount_edit_box.set_value(transaction_amount)
send_tx.amount_edit_box.set_value(transaction_amount)
if kwargs.get('account_name'):
send_transaction_view.chose_recipient_button.click()
send_transaction_view.accounts_button.click()
send_transaction_view.element_by_text(kwargs.get('account_name')).click()
send_tx.chose_recipient_button.click()
send_tx.accounts_button.click()
send_tx.element_by_text(kwargs.get('account_name')).click()
else:
send_transaction_view.set_recipient_address(kwargs.get('recipient'))
send_tx.set_recipient_address(kwargs.get('recipient'))
if kwargs.get('sign_transaction', True):
send_transaction_view.sign_transaction_button.click()
send_tx.sign_transaction_button.click()
if self.sign_in_phrase.is_element_displayed():
self.set_up_wallet_when_sending_tx()
send_transaction_view.sign_transaction(keycard=kwargs.get('keycard', False),
send_tx.sign_transaction(keycard=kwargs.get('keycard', False),
sender_password=kwargs.get('sender_password', common_password))
return send_transaction_view
return send_tx
def find_transaction_in_history(self, amount, asset='ETH', account_name=None, return_hash=False):
if account_name is None:
@ -314,7 +336,6 @@ class WalletView(BaseView):
result = TransactionTable.TransactionElement.TransactionDetailsView(self.driver).get_transaction_hash()
return result
def set_currency(self, desired_currency='EUR'):
self.driver.info("Setting '%s' currency" % desired_currency)
self.multiaccount_more_options.click_until_presence_of_element(self.set_currency_button)

View File

@ -3,6 +3,7 @@ import time
from views.base_element import EditBox, Button, BaseElement
from views.base_view import BaseView
class BaseWebView(BaseView):
def __init__(self, driver):
@ -10,7 +11,8 @@ class BaseWebView(BaseView):
self.progress_bar_icon = Button(self.driver, xpath="//android.widget.ProgressBar")
self.url_edit_box_lock_icon = Button(self.driver, xpath="'(//android.view.ViewGroup[@content-desc='icon'])[2]")
self.policy_summary = Button(self.driver, xpath="//*[@content-desc='Status Privacy Policy'] | //*[@text='Status Privacy Policy']")
self.policy_summary = Button(self.driver,
xpath="//*[@content-desc='Status Privacy Policy'] | //*[@text='Status Privacy Policy']")
self.terms_of_use_summary = Button(self.driver, xpath="//*[@content-desc='Status App Terms of Use']")
self.browser_previous_page_button = Button(self.driver, accessibility_id="previous-page-button")
@ -61,7 +63,8 @@ class BaseWebView(BaseView):
self.close_all_button.click()
else:
self.driver.info("**Removing '%s' from recent websites**")
close_button = Button(self.driver, xpath="//*[contains(@text, '%s')]/../../../../*[@content-desc='empty-tab']"% name)
close_button = Button(self.driver,
xpath="//*[contains(@text, '%s')]/../../../../*[@content-desc='empty-tab']" % name)
close_button.scroll_to_element()
close_button.click()
@ -82,4 +85,3 @@ class BaseWebView(BaseView):
bookmark_name = self.bookmark_name_input.text
self.save_bookmark_button.click()
return bookmark_name

View File

@ -1,6 +1,7 @@
from views.web_views.base_web_view import BaseWebView, Button
import time
class RequestSTTButton(Button):
def __init__(self, driver):
super(RequestSTTButton, self).__init__(driver, webview="Request STT")