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) token = self.get_sauce_token(job_id)
return 'https://saucelabs.com/jobs/%s?auth=%s' % (job_id, token) 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/' \ 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) '?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 support.base_test_report import BaseTestReport
from sys import argv from sys import argv
class TestrailReport(BaseTestReport): class TestrailReport(BaseTestReport):
def __init__(self): def __init__(self):
@ -45,7 +46,8 @@ class TestrailReport(BaseTestReport):
def add_attachment(self, method, path): def add_attachment(self, method, path):
files = {'attachment': (open(path, 'rb'))} 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() files['attachment'].close()
return result.json() return result.json()
@ -84,7 +86,9 @@ class TestrailReport(BaseTestReport):
def get_cases(self, section_ids): def get_cases(self, section_ids):
test_cases = list() test_cases = list()
for section_id in section_ids: 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) return itertools.chain.from_iterable(test_cases)
def get_regression_cases(self): def get_regression_cases(self):
@ -123,12 +127,14 @@ class TestrailReport(BaseTestReport):
for i, device in enumerate(last_testrun.jobs): for i, device in enumerate(last_testrun.jobs):
devices += "# [Device %d](%s) \n" % (i + 1, self.get_sauce_job_url(device)) 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'], 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} else devices + test_steps}
result_id =self.post(method, data=data)['id'] result_id = self.post(method, data=data)['id']
if last_testrun.error: if last_testrun.error:
for geth in test.geth_paths.keys(): 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() self.change_test_run_description()
def change_test_run_description(self): def change_test_run_description(self):
@ -153,9 +159,9 @@ class TestrailReport(BaseTestReport):
case_title = '\n' case_title = '\n'
case_title += '-------\n' case_title += '-------\n'
case_title += "## %s) ID %s: [%s](%s) \n" % (i + 1, test.testrail_case_id, test.name, test_rail_link) case_title += "## %s) ID %s: [%s](%s) \n" % (i + 1, test.testrail_case_id, test.name, test_rail_link)
error ="```%s```\n" % last_testrun.error[:255] error = "```%s```\n" % last_testrun.error[:255]
for job_id, f in last_testrun.jobs.items(): for job_id, f in last_testrun.jobs.items():
case_info = "Logs for device %d: [steps](%s), [failure screenshot](%s)"\ case_info = "Logs for device %d: [steps](%s), [failure screenshot](%s)" \
% (f, % (f,
self.get_sauce_job_url(job_id), self.get_sauce_job_url(job_id),
self.get_sauce_final_screenshot_url(job_id)) self.get_sauce_final_screenshot_url(job_id))
@ -167,7 +173,6 @@ class TestrailReport(BaseTestReport):
request_body = {'description': final_description} request_body = {'description': final_description}
return self.post('update_run/%s' % self.run_id, request_body) return self.post('update_run/%s' % self.run_id, request_body)
def get_run_results(self): def get_run_results(self):
return self.get('get_results_for_run/%s' % self.run_id)['results'] return self.get('get_results_for_run/%s' % self.run_id)['results']

View File

@ -15,7 +15,7 @@ class TestCreateAccount(SingleDeviceTestCase):
sign_in = SignInView(self.driver) sign_in = SignInView(self.driver)
sign_in.just_fyi("Creating multiaccount with special char password") sign_in.just_fyi("Creating multiaccount with special char password")
password=basic_user['special_chars_password'] password = basic_user['special_chars_password']
home = sign_in.create_user(password=password) home = sign_in.create_user(password=password)
public_key, default_username = home.get_public_key_and_username(return_username=True) public_key, default_username = home.get_public_key_and_username(return_username=True)
profile = home.get_profile_view() profile = home.get_profile_view()
@ -66,7 +66,8 @@ class TestCreateAccount(SingleDeviceTestCase):
passphrase = fill_string_with_char(passphrase.upper(), ' ', 3, True, True) passphrase = fill_string_with_char(passphrase.upper(), ' ', 3, True, True)
sign_in = SignInView(self.driver) 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) sign_in.recover_access(passphrase, password=password)
profile = sign_in.profile_button.click() profile = sign_in.profile_button.click()
username = profile.default_username_text.text 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.get_started_button.click_until_presence_of_element(sign_in.generate_key_button)
sign_in.generate_key_button.click() sign_in.generate_key_button.click()
from views.sign_in_view import MultiAccountButton 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 username = account_button.username.text
account_button.click() account_button.click()
sign_in.next_button.click() sign_in.next_button.click()
@ -130,7 +132,8 @@ class TestCreateAccount(SingleDeviceTestCase):
if home.element_by_text(texts[0]).is_element_displayed(): 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]) 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(): 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() self.errors.verify_no_errors()
@ -154,7 +157,7 @@ class TestCreateAccount(SingleDeviceTestCase):
'phrase': 'a', 'phrase': 'a',
'validation message': '', 'validation message': '',
'words count': 1, 'words count': 1,
'popup' : False 'popup': False
}, },
{ {
'case': 'mnemonic but checksum validation fails', 'case': 'mnemonic but checksum validation fails',
@ -174,7 +177,7 @@ class TestCreateAccount(SingleDeviceTestCase):
sign_in.just_fyi("Checking %s" % validation.get('case')) sign_in.just_fyi("Checking %s" % validation.get('case'))
phrase, msg, words_count, popup = validation.get('phrase'), \ phrase, msg, words_count, popup = validation.get('phrase'), \
validation.get('validation message'), \ validation.get('validation message'), \
validation.get('words count'),\ validation.get('words count'), \
validation.get('popup') validation.get('popup')
if sign_in.access_key_button.is_element_displayed(): if sign_in.access_key_button.is_element_displayed():
sign_in.access_key_button.click() sign_in.access_key_button.click()
@ -230,7 +233,7 @@ class TestCreateAccount(SingleDeviceTestCase):
if sign_in.maybe_later_button.is_element_displayed(10): if sign_in.maybe_later_button.is_element_displayed(10):
self.driver.fail('%s %s' % (error, cases[0])) self.driver.fail('%s %s' % (error, cases[0]))
sign_in.just_fyi('Checking case when %s'% cases[1]) sign_in.just_fyi('Checking case when %s' % cases[1])
sign_in.create_password_input.send_keys('123456') sign_in.create_password_input.send_keys('123456')
[field.send_keys('123456') for field in (sign_in.create_password_input, sign_in.confirm_your_password_input)] [field.send_keys('123456') for field in (sign_in.create_password_input, sign_in.confirm_your_password_input)]
sign_in.confirm_your_password_input.delete_last_symbols(1) sign_in.confirm_your_password_input.delete_last_symbols(1)
@ -267,6 +270,3 @@ class TestCreateAccount(SingleDeviceTestCase):
profile.delete_profile_button.click() profile.delete_profile_button.click()
profile.ok_button.click() profile.ok_button.click()
self.errors.verify_no_errors() 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.lets_go_button.wait_and_click(30)
sign_in.just_fyi('Check that after migrating account with assets is restored') 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']: 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) self.errors.append('Asset %s was not restored' % asset)
sign_in.just_fyi('Check that after migration wallet address matches expected') 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']: if address != '0x%s' % basic_user['address']:
self.errors.append('Restored address %s does not match expected' % 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) self.errors.append('Default username %s does not match expected' % default_username)
profile.logout() 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() sign_in.get_multiaccount_by_position(1).click()
if sign_in.get_keycard_banner.is_element_displayed(): if sign_in.get_keycard_banner.is_element_displayed():
self.errors.append("Get a keycard banner is shown on migrated keycard multiaccount") 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') sign_in.just_fyi('Check that can add another wallet account and send transaction')
home.wallet_button.click() home.wallet_button.click()
wallet_view.add_account(account_name="another_keycard_account", keycard=True) wallet.add_account(account_name="another_keycard_account", keycard=True)
wallet_view.accounts_status_account.click() transaction_amount_added = wallet.get_unique_amount()
transaction_amount_added = wallet_view.get_unique_amount() wallet.send_transaction(amount=transaction_amount_added, recipient=transaction_senders['A']['address'],
wallet_view.send_transaction(amount=transaction_amount_added, recipient=transaction_senders['A']['address'], keycard=True, sign_transaction=True) keycard=True, sign_transaction=True)
self.driver.reset() self.driver.reset()
home = sign_in.recover_access(passphrase=seed) home = sign_in.recover_access(passphrase=seed)
contact, nickname, message = transaction_senders['A'], 'my_friend', 'some message' contact, nickname, message = transaction_senders['A'], 'my_friend', 'some message'
@ -380,7 +381,6 @@ class TestCreateAccount(SingleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(6311) @marks.testrail_id(6311)
@marks.medium @marks.medium
def test_same_seed_added_inside_multiaccount_and_keycard(self): 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.lets_go_button.click()
sign_in.just_fyi('Add to wallet seed phrase for restored multiaccount') sign_in.just_fyi('Add to wallet seed phrase for restored multiaccount')
wallet_view = sign_in.wallet_button.click() wallet = sign_in.wallet_button.click()
wallet_view.add_account_button.click() wallet.add_account_button.click()
wallet_view.enter_a_seed_phrase_button.click() wallet.enter_a_seed_phrase_button.click()
wallet_view.enter_your_password_input.send_keys(common_password) wallet.enter_your_password_input.send_keys(common_password)
account_name = 'subacc' account_name = 'subacc'
wallet_view.account_name_input.send_keys(account_name) wallet.account_name_input.send_keys(account_name)
wallet_view.enter_seed_phrase_input.set_value(basic_user['passphrase']) wallet.enter_seed_phrase_input.set_value(basic_user['passphrase'])
wallet_view.add_account_generate_account_button.click() wallet.add_account_generate_account_button.click()
wallet_view.get_account_by_name(account_name).click() wallet.get_account_by_name(account_name).click()
sign_in.just_fyi('Send transaction from added account and log out') sign_in.just_fyi('Send transaction from added account and log out')
transaction_amount_added = wallet_view.get_unique_amount() transaction_amount_added = wallet.get_unique_amount()
wallet_view.send_transaction(amount=transaction_amount_added, recipient=recipient, sign_transaction=True) wallet.send_transaction(from_main_wallet=False, amount=transaction_amount_added, recipient=recipient,
wallet_view.profile_button.click() sign_transaction=True)
wallet.profile_button.click()
profile_view.logout() profile_view.logout()
sign_in.just_fyi('Login to keycard account and send another transaction') sign_in.just_fyi('Login to keycard account and send another transaction')
sign_in.back_button.click() sign_in.back_button.click()
sign_in.sign_in(position=2, keycard=True) sign_in.sign_in(position=2, keycard=True)
sign_in.wallet_button.click() sign_in.wallet_button.click()
wallet_view.wait_balance_is_changed('ETH') wallet.wait_balance_is_changed('ETH')
wallet_view.accounts_status_account.click() transaction_amount_keycard = wallet.get_unique_amount()
transaction_amount_keycard = wallet_view.get_unique_amount() wallet.send_transaction(amount=transaction_amount_keycard, recipient=recipient, keycard=True,
wallet_view.send_transaction(amount=transaction_amount_keycard, recipient=recipient, keycard=True, sign_transaction=True) sign_transaction=True)
sign_in.just_fyi('Check both transactions from keycard multiaccount and from added account in network') 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]: for amount in [transaction_amount_keycard, transaction_amount_added]:
@ -475,7 +476,7 @@ class TestCreateAccount(SingleDeviceTestCase):
profile.change_pairing_code_button.click() profile.change_pairing_code_button.click()
keycard.enter_another_pin() keycard.enter_another_pin()
sign_in.create_password_input.set_value(common_password) sign_in.create_password_input.set_value(common_password)
sign_in.confirm_your_password_input.set_value(common_password+"1") sign_in.confirm_your_password_input.set_value(common_password + "1")
if not keycard.element_by_translation_id("pairing-code_error1").is_element_displayed(): if not keycard.element_by_translation_id("pairing-code_error1").is_element_displayed():
self.errors.append("No error is shown when pairing codes don't match") self.errors.append("No error is shown when pairing codes don't match")
sign_in.confirm_your_password_input.delete_last_symbols(1) sign_in.confirm_your_password_input.delete_last_symbols(1)
@ -507,7 +508,7 @@ class TestCreateAccount(SingleDeviceTestCase):
home.just_fyi('Set new PUK') home.just_fyi('Set new PUK')
keycard = profile.change_puk_button.click() keycard = profile.change_puk_button.click()
keycard.enter_default_pin() keycard.enter_default_pin()
[keycard.enter_default_puk() for _ in range (2)] [keycard.enter_default_puk() for _ in range(2)]
keycard.ok_button.click() keycard.ok_button.click()
home.just_fyi("Checking reset with PUK when logged in") home.just_fyi("Checking reset with PUK when logged in")
@ -629,10 +630,10 @@ class TestCreateAccount(SingleDeviceTestCase):
keycard.enter_another_pin() keycard.enter_another_pin()
home.element_by_translation_id("enter-puk-code").click() home.element_by_translation_id("enter-puk-code").click()
for i in range(1,4): for i in range(1, 4):
keycard.enter_default_puk() keycard.enter_default_puk()
sign_in.wait_for_element_starts_with_text('%s attempts left' % str(5-i)) sign_in.wait_for_element_starts_with_text('%s attempts left' % str(5 - i))
i+=1 i += 1
keycard.enter_default_puk() keycard.enter_default_puk()
sign_in.element_by_text_part('one attempt').wait_for_element(30) sign_in.element_by_text_part('one attempt').wait_for_element(30)
keycard.enter_default_puk() keycard.enter_default_puk()
@ -726,7 +727,7 @@ class TestKeycardCreateMultiaccountMultipleDevice(MultipleDeviceTestCase):
device_1.seedphrase_input.click() device_1.seedphrase_input.click()
device_1.seedphrase_input.set_value(seed_phrase) device_1.seedphrase_input.set_value(seed_phrase)
device_1.next_button.click() 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() keycard_flow.enter_default_pin()
device_1_home = device_1.home_button.click() device_1_home = device_1.home_button.click()
device_1_home.plus_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, \ from tests import marks, bootnode_address, mailserver_address, test_dapp_url, test_dapp_name, mailserver_ams, \
mailserver_gc, mailserver_hk, used_fleet, common_password mailserver_gc, mailserver_hk, used_fleet, common_password
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase 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 views.sign_in_view import SignInView
from time import time from time import time
@ -43,7 +43,8 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
if profile.element_by_translation_id("profile-deleted-title").is_element_displayed(): if profile.element_by_translation_id("profile-deleted-title").is_element_displayed():
self.driver.fail('Profile is deleted without confirmation with password') self.driver.fail('Profile is deleted without confirmation with password')
profile.delete_my_profile_password_input.set_value(common_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() profile.ok_button.click()
sign_in.just_fyi('Delete last multiaccount') 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.append('No redirected to carousel view after deleting last multiaccount')
self.errors.verify_no_errors() 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.testrail_id(5323)
@marks.critical @marks.critical
def test_share_copy_contact_code_and_wallet_address(self): def test_share_copy_contact_code_and_wallet_address(self):
@ -162,7 +212,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
profile.current_password_edit_box.clear() profile.current_password_edit_box.clear()
profile.current_password_edit_box.set_value(common_password) profile.current_password_edit_box.set_value(common_password)
profile.new_password_edit_box.set_value(new_password) profile.new_password_edit_box.set_value(new_password)
profile.confirm_new_password_edit_box.set_value(new_password+'1') profile.confirm_new_password_edit_box.set_value(new_password + '1')
profile.next_button.click() profile.next_button.click()
profile.just_fyi("Delete last symbol and check that can reset password") profile.just_fyi("Delete last symbol and check that can reset password")
@ -272,7 +322,8 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append('In %s case username not found in contact view after scanning' % key) self.errors.append('In %s case username not found in contact view after scanning' % key)
if 'nickname' in users[key]: if 'nickname' in users[key]:
if not profile.element_by_text(users[key]['nickname']).is_element_displayed(): 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') home.just_fyi('Remove contact and check that it disappeared')
user_to_remove = '@%s' % ens_user['ens_another'] 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(): if profile.element_by_text(user_to_remove).is_element_displayed():
self.errors.append('Removed user is still shown in contact view') 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.profile_button.click()
profile.relogin() profile.relogin()
one_to_one_chat = home.add_contact(public_key=ens_user['ens_another'], add_in_contacts=False) 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) self.driver.fail(values_in_logcat)
profile.profile_button.double_click() 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() profile.logout()
sign_in.back_button.click() sign_in.back_button.click()
sign_in.access_key_button.click() sign_in.access_key_button.click()
@ -349,7 +402,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
sign_in.seedphrase_input.click() sign_in.seedphrase_input.click()
sign_in.seedphrase_input.set_value(' '.join(recovery_phrase.values())) sign_in.seedphrase_input.set_value(' '.join(recovery_phrase.values()))
sign_in.next_button.click() 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) sign_in.password_input.set_value(common_password)
chat = sign_in.sign_in_button.click() chat = sign_in.sign_in_button.click()
chat.plus_button.click() chat.plus_button.click()
@ -383,7 +436,7 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
profile.terms_of_use_button.click() profile.terms_of_use_button.click()
web_page.wait_for_d_aap_to_load() web_page.wait_for_d_aap_to_load()
web_page.swipe_by_custom_coordinates(0.5,0.8,0.5,0.4) web_page.swipe_by_custom_coordinates(0.5, 0.8, 0.5, 0.4)
if not web_page.terms_of_use_summary.is_element_displayed(30): if not web_page.terms_of_use_summary.is_element_displayed(30):
self.errors.append('%s Profile about view!' % no_link_tos_error_msg) self.errors.append('%s Profile about view!' % no_link_tos_error_msg)
web_page.click_system_back_button() web_page.click_system_back_button()
@ -391,9 +444,9 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
signin.just_fyi("Checking that version match expected format and can be copied") signin.just_fyi("Checking that version match expected format and can be copied")
app_version = profile.app_version_text.text app_version = profile.app_version_text.text
node_version = profile.node_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) 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) self.errors.append("Node version %s didn't match expected format" % node_version)
profile.app_version_text.click() profile.app_version_text.click()
profile.back_button.click() profile.back_button.click()
@ -414,9 +467,21 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.append("FAQ is not shown") self.errors.append("FAQ is not shown")
profile.click_system_back_button() profile.click_system_back_button()
profile.submit_bug_button.click() 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): 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") 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() profile.request_a_feature_button.click()
if not profile.element_by_text("#support").is_element_displayed(30): if not profile.element_by_text("#support").is_element_displayed(30):
self.errors.append("Support channel is not suggested for requesting a feature") 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') home.just_fyi('Set another fleet and check that changes are applied')
profile.fleet_setting_button.click() 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.element_by_text(changed_fleet).click_until_presence_of_element(profile.confirm_button)
profile.confirm_button.click() profile.confirm_button.click()
SignInView(self.driver).sign_in() SignInView(self.driver).sign_in()
@ -509,7 +574,8 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
profile.just_fyi('pin history node') profile.just_fyi('pin history node')
profile.sync_settings_button.click() 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 h_node = node_ams
profile.mail_server_button.click() profile.mail_server_button.click()
profile.mail_server_auto_selection_button.click() profile.mail_server_auto_selection_button.click()
@ -566,7 +632,6 @@ class TestProfileSingleDevice(SingleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
class TestProfileMultipleDevice(MultipleDeviceTestCase): class TestProfileMultipleDevice(MultipleDeviceTestCase):
@marks.testrail_id(6646) @marks.testrail_id(6646)
@marks.high @marks.high
@ -599,7 +664,8 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
public_chat_1 = home_1.join_public_chat(public_chat_name) public_chat_1 = home_1.join_public_chat(public_chat_name)
public_chat_1.chat_message_input.send_keys(message) public_chat_1.chat_message_input.send_keys(message)
public_chat_1.send_message_button.click() 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') self.drivers[0].fail('Profile picture was not updated in chat')
profile_1.just_fyi("Set user Profile image by taking Photo") 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.chat_message_input.send_keys(message)
public_chat_1.send_message_button.click() 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') self.drivers[0].fail('Profile picture was not updated in chat after making photo')
@marks.testrail_id(6636) @marks.testrail_id(6636)
@ -617,11 +684,12 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
@marks.flaky @marks.flaky
def test_show_profile_picture_of_setting(self): def test_show_profile_picture_of_setting(self):
self.create_drivers(2) 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() 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_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) public_key_2, default_username_2 = profile_2.get_public_key_and_username(return_username=True)
logo_online, logo_default, logo_chats, logo_group= 'logo_new.png', 'sauce_logo.png', 'logo_chats_view.png', 'group_logo.png' logo_online, logo_default, logo_chats, logo_group = 'logo_new.png', 'sauce_logo.png', 'logo_chats_view.png', 'group_logo.png'
[profile.home_button.click() for profile in (profile_1, profile_2)] [profile.home_button.click() for profile in (profile_1, profile_2)]
home_1.add_contact(public_key_2) home_1.add_contact(public_key_2)
@ -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 = 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.set_value('@' + default_username_1)
one_to_one_chat_2.chat_message_input.click() 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') 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') 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.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.set_value('@' + default_username_1)
one_to_one_chat_2.chat_message_input.click() 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') self.errors.append('Profile picture was not updated in 1-1 chat mentions list')
one_to_one_chat_2.get_back_to_home_view() 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 = home_1.get_chat(group_chat_name).click()
group_chat_1.join_chat_button.click() group_chat_1.join_chat_button.click()
group_chat_1.send_message(group_chat_message) 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') self.errors.append('User profile picture was not updated in message Group chat view')
home_2.put_app_to_background() home_2.put_app_to_background()
profile_1.just_fyi('Check profile image updated in group chat invite') profile_1.just_fyi('Check profile image updated in group chat invite')
home_1.get_back_to_home_view() home_1.get_back_to_home_view()
new_group_chat = 'new_gr' 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.click_system_back_button()
home_2.open_notification_bar() home_2.open_notification_bar()
@ -694,10 +765,12 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
home_1.profile_button.click() home_1.profile_button.click()
profile_1.logout() profile_1.logout()
sign_in_1 = home_1.get_sign_in_view() 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') 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() 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') 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.password_input.set_value(common_password)
sign_in_1.sign_in_button.click() sign_in_1.sign_in_button.click()
@ -865,7 +938,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
@marks.flaky @marks.flaky
def test_can_not_connect_to_mailserver(self): def test_can_not_connect_to_mailserver(self):
self.create_drivers(2) self.create_drivers(2)
home_1, home_2= SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user() home_1, home_2 = SignInView(self.drivers[0]).create_user(), SignInView(self.drivers[1]).create_user()
profile_1 = home_1.profile_button.click() profile_1 = home_1.profile_button.click()
profile_1.just_fyi('add non-working mailserver and connect to it') profile_1.just_fyi('add non-working mailserver and connect to it')
@ -875,14 +948,14 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
profile_1.plus_button.click() profile_1.plus_button.click()
server_name = 'test' server_name = 'test'
profile_1.specify_name_input.set_value(server_name) profile_1.specify_name_input.set_value(server_name)
profile_1.mail_server_address_input.set_value(mailserver_address.replace('4','5')) profile_1.mail_server_address_input.set_value(mailserver_address.replace('4', '5'))
profile_1.save_button.click() profile_1.save_button.click()
profile_1.mail_server_by_name(server_name).click() profile_1.mail_server_by_name(server_name).click()
profile_1.mail_server_connect_button.click() profile_1.mail_server_connect_button.click()
profile_1.confirm_button.click() profile_1.confirm_button.click()
profile_1.just_fyi('check that popup "Error connecting" will not reappear if tap on "Cancel"') 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.cancel_button.click()
profile_1.home_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 = home_2.join_public_chat(public_chat_name)
public_chat_2.send_message(message) 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.sync_settings_button.click()
profile_1.mail_server_button.click() profile_1.mail_server_button.click()
profile_1.use_history_node_button.click() profile_1.use_history_node_button.click()
@ -949,7 +1023,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
self.errors.append('Message sent when use_history_node is disabled was not received') self.errors.append('Message sent when use_history_node is disabled was not received')
public_chat_1.profile_button.click() public_chat_1.profile_button.click()
profile_1.relogin() profile_1.relogin()
home_1.get_chat('#%s'%public_chat_name).click() home_1.get_chat('#%s' % public_chat_name).click()
if public_chat_1.chat_element_by_text(message).is_element_displayed(30): if public_chat_1.chat_element_by_text(message).is_element_displayed(30):
self.drivers[0].fail('History was fetched after relogin when use_history_node is disabled') self.drivers[0].fail('History was fetched after relogin when use_history_node is disabled')
@ -979,7 +1053,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
home_1.just_fyi('check ENS name wallet address and public key') home_1.just_fyi('check ENS name wallet address and public key')
profile_1.element_by_text(user_1['ens']).click() profile_1.element_by_text(user_1['ens']).click()
for text in (user_1['address'].lower(), user_1['public_key'] ): for text in (user_1['address'].lower(), user_1['public_key']):
if not profile_1.element_by_text_part(text).is_element_displayed(40): if not profile_1.element_by_text_part(text).is_element_displayed(40):
self.errors.append('%s text is not shown' % text) self.errors.append('%s text is not shown' % text)
profile_1.home_button.click() profile_1.home_button.click()
@ -1005,14 +1079,16 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
home_2.just_fyi('check that can mention user with ENS name') home_2.just_fyi('check that can mention user with ENS name')
public_2.select_mention_from_suggestion_list(user_1['ens']) public_2.select_mention_from_suggestion_list(user_1['ens'])
if public_2.chat_message_input.text != ens_name + ' ': 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.send_message_button.click()
public_2.element_starts_with_text(ens_name,'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): for element in (public_2.element_by_text(user_1['username']), public_2.profile_add_to_contacts):
if not element.is_element_displayed(): if not element.is_element_displayed():
self.errors.append('Was not redirected to user profile after tapping on mention!') 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.open_notification_bar()
home_1.element_by_text_part(username_2).click() 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): 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 # Close Device1 driver session since it's not needed anymore
self.drivers[0].quit() 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() one_to_one_2 = public_2.profile_send_message.click()
if one_to_one_2.user_name_text.text != ens_name: if one_to_one_2.user_name_text.text != ens_name:
self.errors.append('ENS username is not shown in 1-1 chat header') self.errors.append('ENS username is not shown in 1-1 chat header')
@ -1104,7 +1181,7 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
home_2.mobile_connection_on_icon.wait_for_visibility_of_element(10) home_2.mobile_connection_on_icon.wait_for_visibility_of_element(10)
if not home_2.mobile_connection_on_icon.is_element_displayed(): if not home_2.mobile_connection_on_icon.is_element_displayed():
self.errors.append('No mobile connection ON icon is shown') self.errors.append('No mobile connection ON icon is shown')
home_2.get_chat('#%s'% public_chat_name).click() home_2.get_chat('#%s' % public_chat_name).click()
if not public_2.chat_element_by_text(public_chat_message).is_element_displayed(180): if not public_2.chat_element_by_text(public_chat_message).is_element_displayed(180):
self.errors.append("Chat history was not fetched with mobile data fetching ON") self.errors.append("Chat history was not fetched with mobile data fetching ON")
@ -1113,7 +1190,8 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
home_2.mobile_connection_on_icon.click() home_2.mobile_connection_on_icon.click()
home_2.connection_settings_button.click() home_2.connection_settings_button.click()
if not home_2.element_by_translation_id("mobile-network-use-mobile").is_element_displayed(): 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") home_1.just_fyi("Check default preferences in Sync settings")
profile_1 = home_1.profile_button.click() profile_1 = home_1.profile_button.click()
@ -1139,7 +1217,6 @@ class TestProfileMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(5680) @marks.testrail_id(5680)
@marks.high @marks.high
@marks.skip @marks.skip

View File

@ -21,7 +21,7 @@ class TestWalletManagement(SingleDeviceTestCase):
send_transaction_view = wallet.send_transaction_button.click() send_transaction_view = wallet.send_transaction_button.click()
send_transaction_view.amount_edit_box.click() send_transaction_view.amount_edit_box.click()
send_transaction_view.amount_edit_box.set_value("0") send_transaction_view.amount_edit_box.set_value("0")
send_transaction_view.set_recipient_address("0x"+transaction_senders['A']['address']) send_transaction_view.set_recipient_address("0x" + transaction_senders['A']['address'])
send_transaction_view.sign_transaction_button.click() send_transaction_view.sign_transaction_button.click()
texts = list(map(sign_in.get_translation_by_key, texts = list(map(sign_in.get_translation_by_key,
@ -135,7 +135,7 @@ class TestWalletManagement(SingleDeviceTestCase):
wallet.close_send_transaction_view_button.double_click() wallet.close_send_transaction_view_button.double_click()
wallet.just_fyi('Check "Open in OpenSea" (that user is signed in)') 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) web_view.wait_for_d_aap_to_load(10)
wallet.element_by_text('e2ecryptokitty').wait_for_element(60) wallet.element_by_text('e2ecryptokitty').wait_for_element(60)
@ -208,7 +208,8 @@ class TestWalletManagement(SingleDeviceTestCase):
for asset in user['collectibles']: for asset in user['collectibles']:
wallet.get_collectibles_amount(asset).scroll_to_element() wallet.get_collectibles_amount(asset).scroll_to_element()
if wallet.get_collectibles_amount(asset).text != user['collectibles'][asset]: 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.testrail_id(6224)
@marks.critical @marks.critical
@ -271,7 +272,8 @@ class TestWalletManagement(SingleDeviceTestCase):
self.errors.append('No "Watch-only" label is shown on watch-only wallet') 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) wallet.receive_transaction_button.click_until_presence_of_element(wallet.address_text)
if wallet.address_text.text[2:] != basic_user['address']: 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.close_share_popup()
wallet.get_account_options_by_name(account_name).click() wallet.get_account_options_by_name(account_name).click()
wallet.account_settings_button.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') wallet.just_fyi('Check that overall balance is changed after adding account from private key')
for asset in ('ETH', 'ADI', 'LXS', 'STT'): for asset in ('ETH', 'ADI', 'LXS', 'STT'):
wallet.wait_balance_is_changed(asset) 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.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") 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') self.driver.fail('Account was not added')
wallet.just_fyi('Check that overall balance is changed after adding account from seed phrase') 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.wait_balance_is_changed('MDS')
wallet.just_fyi('Check account view and send option (imported from seed phrase)') 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.show_account_by_name_button(account_name_seed).click()
wallet.wallet_button.double_click() wallet.wallet_button.double_click()
if wallet.get_account_by_name(account_name_seed).is_element_displayed(): 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.multiaccount_more_options.click()
wallet.manage_accounts_button.click() wallet.manage_accounts_button.click()
wallet.hidden_account_by_name_button(account_name_seed).click() wallet.hidden_account_by_name_button(account_name_seed).click()
wallet.wallet_button.double_click() wallet.wallet_button.double_click()
if not wallet.get_account_by_name(account_name_seed).is_element_displayed(): 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.just_fyi("Delete unhidden account in wallet")
wallet.get_account_by_name(account_name_seed).click() wallet.get_account_by_name(account_name_seed).click()

View File

@ -3,7 +3,7 @@ import random
import emoji import emoji
from tests import marks, background_service_message 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 tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
from views.chat_view import ChatView from views.chat_view import ChatView
@ -32,7 +32,7 @@ class TestChatManagement(SingleDeviceTestCase):
chat.send_message(messages[i]) chat.send_message(messages[i])
chat.get_back_to_home_view() chat.get_back_to_home_view()
home.leave_chat_long_press(chat_name) if chat_name == group else home.delete_chat_long_press(chat_name) home.leave_chat_long_press(chat_name) if chat_name == group else home.delete_chat_long_press(chat_name)
i+=1 i += 1
home.relogin() home.relogin()
for chat_name in one_to_one, public, group: for chat_name in one_to_one, public, group:
if home.get_chat_from_home_view(chat_name).is_element_displayed(): if home.get_chat_from_home_view(chat_name).is_element_displayed():
@ -56,7 +56,6 @@ class TestChatManagement(SingleDeviceTestCase):
home.join_public_chat(public[1:]) home.join_public_chat(public[1:])
chat.get_back_to_home_view() chat.get_back_to_home_view()
home.just_fyi("Deleting 3 chats via delete button and check they will not reappear after relaunching app") home.just_fyi("Deleting 3 chats via delete button and check they will not reappear after relaunching app")
i = 0 i = 0
for chat_name in one_to_one, public, group: for chat_name in one_to_one, public, group:
@ -64,7 +63,7 @@ class TestChatManagement(SingleDeviceTestCase):
chat = home.get_chat(chat_name).click() chat = home.get_chat(chat_name).click()
chat.send_message(message) chat.send_message(message)
chat.leave_chat() if chat_name == group else chat.delete_chat() chat.leave_chat() if chat_name == group else chat.delete_chat()
i+=1 i += 1
chat.get_back_to_home_view() chat.get_back_to_home_view()
for chat_name in one_to_one, public, group: for chat_name in one_to_one, public, group:
if home.get_chat_from_home_view(chat_name).is_element_displayed(): if home.get_chat_from_home_view(chat_name).is_element_displayed():
@ -147,7 +146,8 @@ class TestChatManagement(SingleDeviceTestCase):
chat = home.get_chat(public_options).click() chat = home.get_chat(public_options).click()
chat.clear_history() chat.clear_history()
if chat.element_by_text(message).is_element_displayed(): 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.just_fyi("Recheck that history won't reappear after relogin")
home.relogin() home.relogin()
@ -689,7 +689,6 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
chat_public_2 = home_2.get_chat_view() chat_public_2 = home_2.get_chat_view()
[chat_public_2.send_message(message_after_block_2) for _ in range(2)] [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.just_fyi("check that new messages and push notifications don't arrive from blocked user")
device_1.open_notification_bar() device_1.open_notification_bar()
if device_1.element_by_text_part(message_after_block_2).is_element_displayed(): 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') 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) message_sender = chat_public_1.chat_element_by_text(message_from_sender)
emojis_from_sender = ['thumbs-down', 'love', 'laugh'] 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'] 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) message_receiver = chat_public_2.chat_element_by_text(message_from_sender)
for emoji in emojis_from_sender: for reaction in emojis_from_sender:
if message_sender.emojis_below_message(emoji) != 1: if message_sender.emojis_below_message(reaction) != 1:
self.errors.append( self.errors.append(
'Counter is not updated on own message after tapping %s for sender in pub chat' % emoji) 'Counter is not updated on own message after tapping %s for sender in pub chat' % reaction)
if message_receiver.emojis_below_message(emoji, own=False) != 1: if message_receiver.emojis_below_message(reaction, own=False) != 1:
self.errors.append( self.errors.append(
'Counter is not updated on received message after tapping %s for receiver in pub chat' % emoji) 'Counter is not updated on received message after tapping %s for receiver in pub chat' % reaction)
for emoji in emojis_from_receiver: for reaction in emojis_from_receiver:
if message_sender.emojis_below_message(emoji, own=False) != 1: if message_sender.emojis_below_message(reaction, own=False) != 1:
self.errors.append( self.errors.append(
'Counter is not updated on own message after tapping %s for receiver in pub chat' % emoji) '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( self.errors.append(
'Counter is not updated on received message after tapping %s for sender in pub chat' % emoji) '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) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_from_sender = "Message sender" message_from_sender = "Message sender"
GroupChat1Name = "GroupChat1" group_chat_name_1 = "GroupChat1"
GroupChat2Name = "GroupChat2" group_chat_name_2 = "GroupChat2"
home_1, home_2 = device_1.create_user(), device_2.create_user() 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') 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 = home_2.add_contact(public_key_user_1)
one_to_one_device_2.send_message(message_from_sender) one_to_one_device_2.send_message(message_from_sender)
one_to_one_device_2.home_button.click() 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') device_1.just_fyi('Device1 check there are no any chats in Activity Center nor Chats view')
home_1.home_button.click() 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") self.errors.append("Chats are present on Chats view despite they created by non-contact")
home_1.notifications_button.click() 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") 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') 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() 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.send_message(message_from_sender)
one_to_one_device_2.home_button.click() 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') device_1.just_fyi('Device1 verifies 1-1 chat Group chats are visible')
home_1.home_button.click() 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.append("Chats are not present on Chats view while they have to!")
self.errors.verify_no_errors() self.errors.verify_no_errors()
@ -1084,8 +1086,8 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
self.create_drivers(2) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
message_from_sender = "Message sender" message_from_sender = "Message sender"
GroupChat1Name = "GroupChat1" group_chat_name_1 = "GroupChat1"
GroupChat2Name = "GroupChat2" group_chat_name_2 = "GroupChat2"
home_1, home_2 = device_1.create_user(), device_2.create_user() 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') 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.send_message(message_from_sender)
device_1_one_to_one_chat.home_button.click() 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_1.home_button.click()
home_2.home_button.click() home_2.home_button.click()
@ -1104,29 +1106,29 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
home_2.notifications_button.click() home_2.notifications_button.click()
home_2.notifications_select_button.click() home_2.notifications_select_button.click()
home_2.element_by_text_part(username_1[:10]).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() home_2.notifications_reject_and_delete_button.click()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): 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") 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") self.errors.append("Group chat is on Activity Center view after action made on it")
home_2.home_button.click() home_2.home_button.click()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): 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") 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") 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.just_fyi("Verify there are still no chats after relogin")
home_2.relogin() home_2.relogin()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): 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") 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") self.errors.append("Group chat appears on Chats view after relogin")
home_2.notifications_button.click() home_2.notifications_button.click()
if home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): 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") 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") self.errors.append("Group chat request reappears back in Activity Center view after relogin")
home_2.home_button.click() home_2.home_button.click()
@ -1134,7 +1136,7 @@ class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
home_1.get_chat_from_home_view(username_2).click() 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.send_message('Some text here')
device_1_one_to_one_chat.home_button.click() 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 ' 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') '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): 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") 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") self.errors.append("Group chat request stays on Activity Center view after it was accepted")
home_2.home_button.click() home_2.home_button.click()
if not home_2.element_by_text_part(username_1[:20]).is_element_displayed(2): 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") 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.append("Group chat is not added on home after accepted from Activity Center")
self.errors.verify_no_errors() 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") self.drivers[0].fail("Required options accept or share are not shown")
select_account_bottom_sheet = receiver_message.accept_and_share_address.click() 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') self.errors.append('Not expected value in "From" in "Select account": "Status" is expected')
select_account_bottom_sheet.select_button.click() select_account_bottom_sheet.select_button.click()
receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account) receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account)
@ -91,7 +92,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
[message.transaction_status.wait_for_element_text(message.confirmed, 60) for message in [message.transaction_status.wait_for_element_text(message.confirmed, 60) for message in
(sender_message, receiver_message)] (sender_message, receiver_message)]
#TODO: should be added PNs for receiver after getting more stable feature # TODO: should be added PNs for receiver after getting more stable feature
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(6263) @marks.testrail_id(6263)
@ -112,7 +113,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
wallet_1.home_button.click() wallet_1.home_button.click()
home_2 = device_2.recover_access(passphrase=sender['passphrase']) home_2 = device_2.recover_access(passphrase=sender['passphrase'])
wallet_2 = home_2.wallet_button.click() 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() wallet_2.home_button.click()
device_2.just_fyi('Add recipient to contact and send 1 message') 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_1.just_fyi('Check that can find tx in history and balance is updated after offline')
home_2.wallet_button.click() 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') wallet_2.find_transaction_in_history(amount=amount, asset='STT')
self.errors.verify_no_errors() self.errors.verify_no_errors()
@ -202,7 +203,6 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
[message.transaction_status.wait_for_element_text(message.declined) for message in [message.transaction_status.wait_for_element_text(message.declined) for message in
(chat_1_sender_message, chat_2_receiver_message)] (chat_1_sender_message, chat_2_receiver_message)]
home_1.just_fyi('Decline transaction request and check that state is changed') home_1.just_fyi('Decline transaction request and check that state is changed')
request_amount = chat_1.get_unique_amount() request_amount = chat_1.get_unique_amount()
chat_1.commands_button.click() chat_1.commands_button.click()
@ -274,7 +274,8 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.create_drivers(2) self.create_drivers(2)
sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) sign_in_1, sign_in_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
sender, reciever = transaction_senders['E'], ens_user 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") home_2.just_fyi("Start chat with sender")
profile_2 = home_2.profile_button.click() 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.sign_in_view import SignInView
from views.chat_view import CommunityView from views.chat_view import CommunityView
class TestCommunitiesMultipleDevices(MultipleDeviceTestCase): class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(695842) @marks.testrail_id(695842)
@ -16,7 +17,8 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
message, message_member = "message", "from member" message, message_member = "message", "from member"
userkey_2, username_2 = home_2.get_public_key_and_username(return_username=True) userkey_2, username_2 = home_2.get_public_key_and_username(return_username=True)
home_2.home_button.click() 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 = community_1.add_channel(channel_name)
channel_1.send_message(message) channel_1.send_message(message)
home_1.home_button.double_click() home_1.home_button.double_click()
@ -35,9 +37,11 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
pub_2.element_by_text(community_name).wait_for_element(330) 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) community_message_2 = pub_2.get_community_link_preview_by_text(community_link_text)
if community_message_2.community_description != community_description: 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: 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_message_2.view()
community_2 = CommunityView(self.drivers[1]) community_2 = CommunityView(self.drivers[1])
community_2.request_access_button.click() community_2.request_access_button.click()
@ -50,7 +54,8 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
community_1.community_info_button.click() community_1.community_info_button.click()
community_1.community_membership_request_value.wait_for_element(60) community_1.community_membership_request_value.wait_for_element(60)
if community_1.community_membership_request_value.text != '1': 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") home_1.just_fyi("Approve membership")
community_1.handle_membership_request(username_2, approve=True) community_1.handle_membership_request(username_2, approve=True)
@ -73,7 +78,6 @@ class TestCommunitiesMultipleDevices(MultipleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(695845) @marks.testrail_id(695845)
@marks.medium @marks.medium
def test_notification_in_activity_center_for_mention_in_community_and_group_chat(self): 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.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from tests.users import transaction_senders, ens_user from tests.users import transaction_senders, ens_user
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
import random, emoji import random
import emoji
class TestGroupChatMultipleDevice(MultipleDeviceTestCase): 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.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() 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: for pn in pns:
if not home_2.get_pn(pn).is_element_displayed(30): if not home_2.get_pn(pn).is_element_displayed(30):
self.errors.append('%s is not shown after invite to group chat' % pn) 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): if not chat_2.chat_element_by_text(message):
self.errors.append('%s system message is not shown' % 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() chat_2.join_chat_button.click()
for chat in (chat_1, chat_2): for chat in (chat_1, chat_2):
if not chat.chat_element_by_text(join_system_message).is_element_displayed(30): 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 message_1 = "Message from device: %s" % chat_1.driver.number
chat_1.send_message(message_1) chat_1.send_message(message_1)
if chat_1.chat_element_by_text(message_1).status != 'delivered': 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() home_2.put_app_to_background()
@ -147,7 +151,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
chat_2.decline_invitation_button.click() chat_2.decline_invitation_button.click()
left_system_message = chat_2.leave_system_message(username_2) left_system_message = chat_2.leave_system_message(username_2)
if chat_1.chat_element_by_text(left_system_message).is_element_displayed(): 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(): 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) 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() new_chat_name = device_1_chat.get_random_chat_name()
device_1_chat.rename_chat_via_group_info(new_chat_name) device_1_chat.rename_chat_via_group_info(new_chat_name)
for chat in (device_1_chat, device_2_chat): 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!') 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') self.errors.append('Message about changing chat name is not shown')
device_2.just_fyi('Check that you can navigate to renamed chat') 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.element_by_text('Done').click()
chat_1.close_button.click() chat_1.close_button.click()
if chat_1.user_name_text.text != full_ens: 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') home_1.just_fyi('Adding ENS user to contacts and start group chat with him')
group_name = 'ens_group' group_name = 'ens_group'
@ -315,18 +323,20 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
if not chat_1.chat_element_by_text(message_text).is_element_displayed(): if not chat_1.chat_element_by_text(message_text).is_element_displayed():
self.errors.append("ENS name was not replaced with nickname on sent message") self.errors.append("ENS name was not replaced with nickname on sent message")
chat_1.chat_message_input.send_keys('@') chat_1.chat_message_input.send_keys('@')
if not chat_1.element_by_text('%s %s' %(nickname, full_ens)).is_element_displayed(): if not chat_1.element_by_text('%s %s' % (nickname, full_ens)).is_element_displayed():
self.errors.append("ENS name with nickname is not shown in mention input after set") self.errors.append("ENS name with nickname is not shown in mention input after set")
if not chat_1.element_by_text(username_2).is_element_displayed(): if not chat_1.element_by_text(username_2).is_element_displayed():
self.errors.append("3-random name is not shown in mention input after set from group info") self.errors.append("3-random name is not shown in mention input after set from group info")
chat_1.chat_message_input.clear() chat_1.chat_message_input.clear()
chat_1.select_mention_from_suggestion_list('%s %s' %(nickname, full_ens), typed_search_pattern=username_2[:2]) 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 + ' ': 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.chat_message_input.clear()
chat_1.select_mention_from_suggestion_list('%s %s' % (nickname, full_ens), typed_search_pattern=nickname[:2]) 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 + ' ': 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() chat_1.chat_message_input.clear()
home_1.just_fyi('Can delete nickname via group info and recheck received messages') 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() self.errors.verify_no_errors()
class TestCommandsSingleDevices(SingleDeviceTestCase): class TestCommandsSingleDevices(SingleDeviceTestCase):
@marks.testrail_id(5721) @marks.testrail_id(5721)

View File

@ -1,10 +1,11 @@
import time import time
from tests import marks 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 tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
class TestCommandsMultipleDevices(MultipleDeviceTestCase): class TestCommandsMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(6293) @marks.testrail_id(6293)
@ -50,7 +51,8 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.drivers[0].fail("Required options accept or share are not shown") self.drivers[0].fail("Required options accept or share are not shown")
select_account_bottom_sheet = receiver_message.accept_and_share_address.click() 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') self.errors.append('Not expected value in "From" in "Select account": "Status" is expected')
select_account_bottom_sheet.select_button.click() select_account_bottom_sheet.select_button.click()
receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account) 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) home_2 = device_2.recover_access(passphrase=sender['passphrase'], keycard=True, enable_notifications=True)
wallet_2 = home_2.wallet_button.click() 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() wallet_2.home_button.click()
device_2.just_fyi('Add recipient to contact and send 1 message') 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_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)] [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_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)] [wallet.find_transaction_in_history(amount=amount, asset='STT') for wallet in (wallet_1, wallet_2)]
self.errors.verify_no_errors() self.errors.verify_no_errors()
class TestCommandsSingleDevices(SingleDeviceTestCase): class TestCommandsSingleDevices(SingleDeviceTestCase):
@marks.testrail_id(6295) @marks.testrail_id(6295)

View File

@ -1,9 +1,6 @@
import time
import emoji import emoji
import random import random
import string import string
from selenium.common.exceptions import TimeoutException
from tests import marks from tests import marks
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
@ -216,9 +213,10 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
if not public_chat_1.element_by_text_part("⌫ Edited").is_element_displayed(): 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') 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) 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" 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) chat_private_2.send_message(message_before_edit_1_1)
home_1.home_button.click() home_1.home_button.click()
@ -261,7 +259,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
chat_private_2.just_fyi("Check for that edited message is shown for Device 2 and delete message in public chat") chat_private_2.just_fyi("Check for that edited message is shown for Device 2 and delete message in public chat")
[home.home_button.double_click() for home in (home_1, home_2)] [home.home_button.double_click() for home in (home_1, home_2)]
public_chat_1, public_chat_2 = home_1.get_chat('#%s' %chat_name).click(), home_2.join_public_chat(chat_name) public_chat_1, public_chat_2 = home_1.get_chat('#%s' % chat_name).click(), home_2.join_public_chat(chat_name)
if not public_chat_2.element_by_text_part("⌫ Edited").is_element_displayed(): if not public_chat_2.element_by_text_part("⌫ Edited").is_element_displayed():
self.errors.append('No mark in message bubble about this message was edited') self.errors.append('No mark in message bubble about this message was edited')
if not public_chat_2.element_by_text_part(message_after_edit).is_element_displayed(): if not public_chat_2.element_by_text_part(message_after_edit).is_element_displayed():
@ -484,7 +482,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
chat_1 = home_1.add_contact(public_key_2) chat_1 = home_1.add_contact(public_key_2)
home_1.just_fyi("Check that Device1 can pin own message in 1-1 chat") home_1.just_fyi("Check that Device1 can pin own message in 1-1 chat")
message_1, message_2, message_3 ,message_4 = "Message1", "Message2", "Message3", "Message4", message_1, message_2, message_3, message_4 = "Message1", "Message2", "Message3", "Message4",
chat_1.send_message(message_1) chat_1.send_message(message_1)
chat_1.send_message(message_2) chat_1.send_message(message_2)
chat_1.pin_message(message_1) chat_1.pin_message(message_1)
@ -629,7 +627,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
'url': 'https://www.youtube.com/watch?v=XN-SVmuJH2g&list=PLbrz7IuP1hrgNtYe9g6YHwHO6F3OqNMao', 'url': 'https://www.youtube.com/watch?v=XN-SVmuJH2g&list=PLbrz7IuP1hrgNtYe9g6YHwHO6F3OqNMao',
'txt': 'Status & Keycard Hardware-Enforced Security', 'txt': 'Status & Keycard Hardware-Enforced Security',
'subtitle': 'YouTube'}, 'subtitle': 'YouTube'},
'twitter':{ 'twitter': {
'url': 'https://twitter.com/ethdotorg/status/1445161651771162627?s=20', 'url': 'https://twitter.com/ethdotorg/status/1445161651771162627?s=20',
'txt': "We've rethought how we translate content, allowing us to translate", 'txt': "We've rethought how we translate content, allowing us to translate",
'subtitle': 'Twitter' 'subtitle': 'Twitter'
@ -741,7 +739,6 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
"audio": device_2_sends_audio, "audio": device_2_sends_audio,
} }
for key, value in sending_list.items(): for key, value in sending_list.items():
navigate_to_start_state_of_both_devices() navigate_to_start_state_of_both_devices()
sending_list[key]() 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) 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") 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() navigate_to_start_state_of_both_devices()
emoji_name = random.choice(list(emoji.EMOJI_UNICODE)) emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
@ -1165,7 +1162,8 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
wallet.home_button.click() wallet.home_button.click()
if 'dapp' in key: if 'dapp' in key:
home.open_in_status_button.click() 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!') self.errors.append('No allow button is shown in case of navigating to Status dapp!')
chat.dapp_tab_button.click() chat.dapp_tab_button.click()
chat.home_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) chat.verify_message_is_under_today_text(message, self.errors)
timestamp = chat.chat_element_by_text(message).timestamp_message.text timestamp = chat.chat_element_by_text(message).timestamp_message.text
if timestamp not in sent_time_variants: 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: 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) 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' message, message_2 = 'test message', 'test message2'
chat_2.send_message(message) 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(): 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') self.errors.append('New messages public chat badge is not shown on Home button')
chat_element = home_1.get_chat('#' + chat_name) chat_element = home_1.get_chat('#' + chat_name)
@ -97,7 +99,7 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
self.errors.append('New messages public chat badge is shown on Home button') self.errors.append('New messages public chat badge is shown on Home button')
if chat_element.new_messages_public_chat.is_element_displayed(): if chat_element.new_messages_public_chat.is_element_displayed():
self.errors.append('Unread messages badge is shown in public chat while there are no unread messages') self.errors.append('Unread messages badge is shown in public chat while there are no unread messages')
[home.get_chat('#' + chat_name).click() for home in (home_1,home_2)] [home.get_chat('#' + chat_name).click() for home in (home_1, home_2)]
chat_1.send_message(message_2) chat_1.send_message(message_2)
chat_2.chat_element_by_text(message_2).wait_for_element(20) chat_2.chat_element_by_text(message_2).wait_for_element(20)
@ -139,7 +141,6 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(6275) @marks.testrail_id(6275)
@marks.medium @marks.medium
def test_receive_message_while_in_different_tab_and_emoji_messages_long_press(self): def test_receive_message_while_in_different_tab_and_emoji_messages_long_press(self):
@ -192,9 +193,9 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
home_1.just_fyi('Set status in profile') home_1.just_fyi('Set status in profile')
statuses = { statuses = {
'*formatted text*':'formatted text', '*formatted text*': 'formatted text',
'https://www.youtube.com/watch?v=JjPWmEh2KhA' : 'Status Town Hall', 'https://www.youtube.com/watch?v=JjPWmEh2KhA': 'Status Town Hall',
emoji.emojize(emoji_message) : emoji_unicode, emoji.emojize(emoji_message): emoji_unicode,
} }
timeline_1 = device_1.status_button.click() timeline_1 = device_1.status_button.click()
@ -228,7 +229,8 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
chat_2.element_by_text_part(statuses['*formatted text*']).scroll_to_element() chat_2.element_by_text_part(statuses['*formatted text*']).scroll_to_element()
expected_value = statuses[status] expected_value = statuses[status]
if not chat_2.element_by_text_part(expected_value).is_element_displayed(): 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') 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') chat_2.close_button.scroll_and_click(direction='up')
@ -237,10 +239,11 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
for status in statuses: for status in statuses:
expected_value = statuses[status] expected_value = statuses[status]
if not timeline_2.element_by_text_part(expected_value).is_element_displayed(): 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') profile_1.just_fyi('Checking message tag and reactions on statuses')
#TODO: no way to tap into tag message from timeline_1 # TODO: no way to tap into tag message from timeline_1
# tag_status = '#public-chat-to-redirect-long-name' # tag_status = '#public-chat-to-redirect-long-name'
# timeline_1.set_new_status(tag_status) # timeline_1.set_new_status(tag_status)
# #timeline_2 = profile_1.get_chat_view() # #timeline_2 = profile_1.get_chat_view()
@ -267,10 +270,12 @@ class TestPublicChatMultipleDevice(MultipleDeviceTestCase):
timeline_1.set_reaction(text_status) timeline_1.set_reaction(text_status)
status_with_reaction_1 = timeline_1.chat_element_by_text(text_status) status_with_reaction_1 = timeline_1.chat_element_by_text(text_status)
if status_with_reaction_1.emojis_below_message() != 0: 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) status_with_reaction_2 = chat_2.chat_element_by_text(text_status)
if status_with_reaction_2.emojis_below_message(own=False) != 0: 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") 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() chat_2.remove_from_contacts.click()
@ -320,9 +325,9 @@ class TestPublicChatSingleDevice(SingleDeviceTestCase):
if not home_view.element_by_text(tag_message).is_element_displayed(): if not home_view.element_by_text(tag_message).is_element_displayed():
self.errors.append('Could not find the public chat in user chat list.') self.errors.append('Could not find the public chat in user chat list.')
times = { times = {
"three-days" : '5 days', "three-days": '5 days',
"one-week" : '12 days', "one-week": '12 days',
"one-month" : ['43 days', '42 days', '41 days', '40 days'], "one-month": ['43 days', '42 days', '41 days', '40 days'],
} }
signin.just_fyi("Check that can fetch more history") signin.just_fyi("Check that can fetch more history")
@ -343,7 +348,7 @@ class TestPublicChatSingleDevice(SingleDeviceTestCase):
chat.element_by_text_part(fetch_more).wait_for_invisibility_of_element(120) chat.element_by_text_part(fetch_more).wait_for_invisibility_of_element(120)
res = any(profile.element_by_text_part(variant).is_element_displayed(30) for variant in variants) res = any(profile.element_by_text_part(variant).is_element_displayed(30) for variant in variants)
if not res: if not res:
self.errors.append("History is not fetched for one month!" ) self.errors.append("History is not fetched for one month!")
home_view.profile_button.click(desired_element_text=profile.get_translation_by_key("default-sync-period")) home_view.profile_button.click(desired_element_text=profile.get_translation_by_key("default-sync-period"))
self.errors.verify_no_errors() self.errors.verify_no_errors()

View File

@ -48,7 +48,6 @@ class TestBrowsing(SingleDeviceTestCase):
if not element_on_start_page.is_element_displayed(30): if not element_on_start_page.is_element_displayed(30):
self.driver.fail("Page failed to be refreshed") self.driver.fail("Page failed to be refreshed")
@marks.testrail_id(6210) @marks.testrail_id(6210)
@marks.high @marks.high
def test_open_blocked_secure_not_secure_inlalid_offline_urls(self): 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') dapp.just_fyi('Checking connection is not secure warning')
web_page = dapp.open_url('http://www.dvwa.co.uk') 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.open_tabs_button.click()
dapp_detail.empty_tab_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) dapp.just_fyi('Checking connection is secure for %s' % url)
web_page = dapp.open_url(url) web_page = dapp.open_url(url)
web_page.wait_for_d_aap_to_load() 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.open_tabs_button.click()
dapp_detail.empty_tab_button.click() dapp_detail.empty_tab_button.click()
@ -111,7 +112,7 @@ class TestBrowsing(SingleDeviceTestCase):
urls = { urls = {
'google.com': 'Google', 'google.com': 'Google',
'status.im': 'Status - Private', 'status.im': 'Status - Private',
'bbc.com' : 'bbc.com' 'bbc.com': 'bbc.com'
} }
for url in urls: for url in urls:
browsing_view = dapp_view.open_url(url) browsing_view = dapp_view.open_url(url)
@ -207,7 +208,7 @@ class TestBrowsing(SingleDeviceTestCase):
profile.dapp_permissions_button.click() profile.dapp_permissions_button.click()
if not profile.element_by_text('wikipedia.org').is_element_displayed(): if not profile.element_by_text('wikipedia.org').is_element_displayed():
self.errors.append("Permissions are not granted") self.errors.append("Permissions are not granted")
profile.dapp_tab_button.click(desired_element_text = wiki_texts[0]) profile.dapp_tab_button.click(desired_element_text=wiki_texts[0])
browsing.options_button.click() browsing.options_button.click()
browsing.connected_account_button.click() browsing.connected_account_button.click()
browsing.element_by_translation_id("revoke-access").click() browsing.element_by_translation_id("revoke-access").click()
@ -215,12 +216,12 @@ class TestBrowsing(SingleDeviceTestCase):
if not browsing.connect_account_button.is_element_displayed(): if not browsing.connect_account_button.is_element_displayed():
self.errors.append("Permission for account is not removed if using 'Revoke access' from dapp view") self.errors.append("Permission for account is not removed if using 'Revoke access' from dapp view")
browsing.click_system_back_button() browsing.click_system_back_button()
browsing.profile_button.click(desired_element_text = 'DApp permissions') browsing.profile_button.click(desired_element_text='DApp permissions')
if profile.element_by_text('wikipedia.org').is_element_displayed(): if profile.element_by_text('wikipedia.org').is_element_displayed():
self.errors.append("Permissions are not revoked") self.errors.append("Permissions are not revoked")
web_view.just_fyi("Check that can open chat view and send some message") web_view.just_fyi("Check that can open chat view and send some message")
profile.dapp_tab_button.click(desired_element_text = wiki_texts[0]) profile.dapp_tab_button.click(desired_element_text=wiki_texts[0])
browsing.options_button.click() browsing.options_button.click()
browsing.open_chat_from_dapp_button.click() browsing.open_chat_from_dapp_button.click()
public_chat = browsing.get_chat_view() public_chat = browsing.get_chat_view()
@ -228,7 +229,7 @@ class TestBrowsing(SingleDeviceTestCase):
self.driver.fail("No redirect to public chat") self.driver.fail("No redirect to public chat")
message = public_chat.get_random_message() message = public_chat.get_random_message()
public_chat.send_message(message) public_chat.send_message(message)
public_chat.dapp_tab_button.click(desired_element_text = wiki_texts[0]) public_chat.dapp_tab_button.click(desired_element_text=wiki_texts[0])
browsing.options_button.click() browsing.options_button.click()
browsing.open_chat_from_dapp_button.click() browsing.open_chat_from_dapp_button.click()
if not public_chat.chat_element_by_text(message).is_element_displayed(): if not public_chat.chat_element_by_text(message).is_element_displayed():
@ -243,7 +244,7 @@ class TestBrowsing(SingleDeviceTestCase):
self.errors.verify_no_errors() self.errors.verify_no_errors()
#TODO: waiting mode # TODO: waiting mode
@marks.testrail_id(6300) @marks.testrail_id(6300)
@marks.skip @marks.skip
@marks.medium @marks.medium

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.base_test_case import SingleDeviceTestCase
from tests.users import basic_user from tests.users import basic_user
from views.sign_in_view import SignInView 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(): if not profile.element_by_text(account_name).is_element_displayed():
self.errors.append("Subaccount is not selected after relogin in Dapps!") self.errors.append("Subaccount is not selected after relogin in Dapps!")
self.errors.verify_no_errors() self.errors.verify_no_errors()

View File

@ -28,7 +28,7 @@ class TestDeepLinks(SingleDeviceTestCase):
def test_open_user_profile_using_deep_link(self): def test_open_user_profile_using_deep_link(self):
sign_in = SignInView(self.driver) sign_in = SignInView(self.driver)
sign_in.create_user() 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() self.driver.close_app()
deep_link = 'status-im://u/%s' % user_ident deep_link = 'status-im://u/%s' % user_ident
sign_in.open_weblink_and_login(deep_link) sign_in.open_weblink_and_login(deep_link)
@ -53,7 +53,6 @@ class TestDeepLinks(SingleDeviceTestCase):
except NoSuchElementException: except NoSuchElementException:
self.driver.fail("DApp '%s' is not opened!" % dapp_name) self.driver.fail("DApp '%s' is not opened!" % dapp_name)
@marks.testrail_id(5781) @marks.testrail_id(5781)
@marks.medium @marks.medium
def test_deep_link_with_invalid_user_public_key_own_profile_key(self): 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 = sign_in_view.get_home_view()
home_view.plus_button.click_until_presence_of_element(home_view.start_new_chat_button) 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(): 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() self.driver.close_app()
sign_in_view.just_fyi('Check that no error when opening invalid deep link') 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.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
from tests.users import upgrade_users, transaction_recipients, basic_user, ens_user from tests.users import upgrade_users, transaction_recipients, basic_user, ens_user
from views.sign_in_view import SignInView 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.pairing.data as sync_data
import views.upgrade_dbs.group.data as group import views.upgrade_dbs.group.data as group
@marks.upgrade @marks.upgrade
class TestUpgradeApplication(SingleDeviceTestCase): class TestUpgradeApplication(SingleDeviceTestCase):
@ -80,7 +82,8 @@ class TestUpgradeApplication(SingleDeviceTestCase):
self.errors.append('Preview message is not shown for %s' % key) self.errors.append('Preview message is not shown for %s' % key)
if 'title' in data: if 'title' in data:
if message.preview_title.text != data['title']: 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']: if message.preview_subtitle.text != data['subtitle']:
self.errors.append("Subtitle '%s' does not match expected '%s'" % (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() home.home_button.click()
@ -174,7 +177,7 @@ class TestUpgradeApplication(SingleDeviceTestCase):
profile = dapps.profile_button.click() profile = dapps.profile_button.click()
profile.privacy_and_security_button.click() profile.privacy_and_security_button.click()
profile.dapp_permissions_button.click() profile.dapp_permissions_button.click()
if profile.element_by_text_part( dapp_data.dapps['permissions']['deleted']).is_element_displayed(): if profile.element_by_text_part(dapp_data.dapps['permissions']['deleted']).is_element_displayed():
self.errors.append('Deleted permissions reappear after upgrade!') self.errors.append('Deleted permissions reappear after upgrade!')
profile.element_by_text(test_dapp_name).click() profile.element_by_text(test_dapp_name).click()
permissions = dapp_data.dapps['permissions']['added'][test_dapp_name] permissions = dapp_data.dapps['permissions']['added'][test_dapp_name]
@ -220,11 +223,8 @@ class TestUpgradeApplication(SingleDeviceTestCase):
self.errors.append('Asset %s was not restored' % asset) self.errors.append('Asset %s was not restored' % asset)
home.just_fyi('Check that can sign transaction in STT from wallet') home.just_fyi('Check that can sign transaction in STT from wallet')
wallet.accounts_status_account.click()
transaction_amount = wallet.get_unique_amount() transaction_amount = wallet.get_unique_amount()
wallet.send_transaction(amount=transaction_amount, asset_name='STT', wallet.send_transaction(amount=transaction_amount, asset_name='STT', sign_transaction=True, keycard=True,
sign_transaction=True,
keycard=True,
recipient=transaction_recipients['I']['address']) recipient=transaction_recipients['I']['address'])
self.network_api.find_transaction_by_unique_amount(user['address'], transaction_amount, token=True) 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) send_transaction.sign_transaction(keycard=True)
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.upgrade @marks.upgrade
class TestUpgradeMultipleApplication(MultipleDeviceTestCase): 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) 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") 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' message = 'Device pairing check'
device_1.home_button.click() device_1.home_button.click()
chat_1 = home_1.get_chat(main_1_1).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() home_2.get_chat(secondary_1_1).wait_for_visibility_of_element()
chat_2 = home_2.get_chat(secondary_1_1).click() chat_2 = home_2.get_chat(secondary_1_1).click()
if not chat_2.chat_element_by_text(message).is_element_displayed(): 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.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) chat_1.send_message(message)
home_2.get_chat(group).wait_for_visibility_of_element() home_2.get_chat(group_name).wait_for_visibility_of_element()
chat_2 = home_2.get_chat(group).click() chat_2 = home_2.get_chat(group_name).click()
if not chat_2.chat_element_by_text(message).is_element_displayed(): 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)] [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") 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") "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") 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 = chat_2.profile_button.click()
profile_2.contacts_button.click() profile_2.contacts_button.click()
for username in synced_secondary: for username in synced_secondary:
@ -399,7 +403,8 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
device.sign_in() device.sign_in()
home_1.just_fyi("Check that all group chats are preserved after upgrade") 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 home in home_1, home_2:
for name in names: for name in names:
if not home.get_chat(name).is_element_displayed(): if not home.get_chat(name).is_element_displayed():
@ -409,7 +414,7 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
home_1.just_fyi("Check messages in main group chat and resolved ENS") home_1.just_fyi("Check messages in main group chat and resolved ENS")
chat_name, messages = group.main["name"], group.main["messages"] chat_name, messages = group.main["name"], group.main["messages"]
[chat_1, chat_2]= [home.get_chat(chat_name).click() for home in (home_1, home_2)] [chat_1, chat_2] = [home.get_chat(chat_name).click() for home in (home_1, home_2)]
for chat in [chat_1, chat_2]: for chat in [chat_1, chat_2]:
if not chat.chat_element_by_text(messages["text"]).is_element_displayed(): if not chat.chat_element_by_text(messages["text"]).is_element_displayed():
self.errors.append("Text message in group chat is not shown after upgrade") self.errors.append("Text message in group chat is not shown after upgrade")
@ -457,7 +462,7 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
admins = chat_1.element_by_text('Admin').find_elements() admins = chat_1.element_by_text('Admin').find_elements()
if len(admins) != 2: if len(admins) != 2:
self.errors.append('Not 2 admins in group chat') self.errors.append('Not 2 admins in group chat')
[chat.home_button.double_click()for chat in [chat_1, chat_2]] [chat.home_button.double_click() for chat in [chat_1, chat_2]]
home_1.just_fyi("Check that can see invite and pending membership request after upgrade") home_1.just_fyi("Check that can see invite and pending membership request after upgrade")
chat_name = group.empty_invite['name'] chat_name = group.empty_invite['name']
@ -483,7 +488,6 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
profile_2 = home_2.profile_button.click() profile_2 = home_2.profile_button.click()
public_key_2, username_2 = profile_2.get_public_key_and_username(return_username=True) 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") 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) chat_1 = home_1.add_contact(public_key_2, add_in_contacts=False)
message = home_1.get_random_message() message = home_1.get_random_message()
@ -499,7 +503,8 @@ class TestUpgradeMultipleApplication(MultipleDeviceTestCase):
device_1.just_fyi("Check status") device_1.just_fyi("Check status")
timeline = home_1.status_button.click() timeline = home_1.status_button.click()
statuses = group.timeline 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(): if not element.is_element_displayed():
self.errors.append("Status is not shown after upgrade!") self.errors.append("Status is not shown after upgrade!")
timeline.element_by_text(statuses['link']).click() 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 from views.sign_in_view import SignInView
class TestTransactionDApp(SingleDeviceTestCase): class TestTransactionDApp(SingleDeviceTestCase):
@marks.testrail_id(5309) @marks.testrail_id(5309)
@marks.critical @marks.critical
@marks.transaction @marks.transaction
def test_request_stt_from_daap(self): def test_request_stt_from_dapp(self):
sender = transaction_senders['K'] sender = transaction_senders['K']
home = SignInView(self.driver).recover_access(sender['passphrase'], unique_password) home = SignInView(self.driver).recover_access(sender['passphrase'], unique_password)
wallet = home.wallet_button.click() wallet = home.wallet_button.click()
wallet.scan_tokens() 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 = home.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load() status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.assets_button.click() status_test_dapp.assets_button.click()
@ -29,7 +28,7 @@ class TestTransactionDApp(SingleDeviceTestCase):
status_test_dapp.wallet_button.click() status_test_dapp.wallet_button.click()
send_transaction.just_fyi('Verify that wallet balance is updated') 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') send_transaction.just_fyi('Check logcat for sensitive data')
values_in_logcat = send_transaction.find_values_in_logcat(password=unique_password) 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.driver.fail("'Test filters' button produced an error")
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(5784) @marks.testrail_id(5784)
@marks.medium @marks.medium
@marks.transaction @marks.transaction
@ -106,7 +104,7 @@ class TestTransactionDApp(SingleDeviceTestCase):
if not status_test_dapp.element_by_text(user['public_key']).is_element_displayed(): if not status_test_dapp.element_by_text(user['public_key']).is_element_displayed():
self.errors.append('Public key is not returned') self.errors.append('Public key is not returned')
status_test_dapp.get_empty_dapp_tab() status_test_dapp.get_empty_dapp_tab()
wallet = home.wallet_button.click() home.wallet_button.click()
home.just_fyi("Checking sign typed message") home.just_fyi("Checking sign typed message")
home.open_status_test_dapp(allow_all=True) 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) home_view = sign_in_view.recover_access(sender['passphrase'], keycard=True)
wallet_view = home_view.wallet_button.click() wallet_view = home_view.wallet_button.click()
wallet_view.scan_tokens() 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 = home_view.open_status_test_dapp()
status_test_dapp.wait_for_d_aap_to_load() status_test_dapp.wait_for_d_aap_to_load()
status_test_dapp.assets_button.click() status_test_dapp.assets_button.click()
@ -24,7 +24,7 @@ class TestTransactionDApp(SingleDeviceTestCase):
status_test_dapp.wallet_button.click() status_test_dapp.wallet_button.click()
send_transaction_view.just_fyi('Verify that wallet balance is updated') 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') send_transaction_view.just_fyi('Check logcat for sensitive data')
values_in_logcat = send_transaction_view.find_values_in_logcat(mnemonic=sender['passphrase'], 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() self.errors.verify_no_errors()
@marks.testrail_id(6310) @marks.testrail_id(6310)
@marks.medium @marks.medium
@marks.transaction @marks.transaction
@ -106,6 +105,3 @@ class TestTransactionDApp(SingleDeviceTestCase):
'Call contract set function', 'Call function 2 times in a row']: 'Call contract set function', 'Call function 2 times in a row']:
status_test_dapp.element_by_text(text).scroll_to_element() status_test_dapp.element_by_text(text).scroll_to_element()
self.errors.verify_no_errors() self.errors.verify_no_errors()

View File

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

View File

@ -4,7 +4,8 @@ import string
from support.utilities import get_merged_txs_list from support.utilities import get_merged_txs_list
from tests import marks, unique_password from tests import marks, unique_password
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase 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.send_transaction_view import SendTransactionView
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
@ -103,15 +104,11 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
home = SignInView(self.driver).recover_access(sender['passphrase']) home = SignInView(self.driver).recover_access(sender['passphrase'])
wallet = home.wallet_button.click() wallet = home.wallet_button.click()
wallet.wait_balance_is_changed(asset='ADI', scan_tokens=True) 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' amount = '0.000%s' % str(random.randint(100, 999)) + '1'
wallet.send_transaction(amount=amount, wallet.send_transaction(amount=amount, recipient='0x%s' % recipient['address'], asset_name='ADI')
recipient='0x%s' % recipient['address'],
asset_name='ADI')
transaction = wallet.find_transaction_in_history(amount=amount, asset='ADI', return_hash=True) transaction = wallet.find_transaction_in_history(amount=amount, asset='ADI', return_hash=True)
self.network_api.find_transaction_by_hash(transaction) self.network_api.find_transaction_by_hash(transaction)
@marks.testrail_id(5412) @marks.testrail_id(5412)
@marks.high @marks.high
@marks.transaction @marks.transaction
@ -215,7 +212,6 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
home.home_button.wait_for_visibility_of_element() home.home_button.wait_for_visibility_of_element()
home.connection_offline_icon.wait_for_visibility_of_element(20) home.connection_offline_icon.wait_for_visibility_of_element(20)
@marks.testrail_id(6225) @marks.testrail_id(6225)
@marks.transaction @marks.transaction
@marks.medium @marks.medium
@ -231,17 +227,14 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
wallet.add_account(account_name) wallet.add_account(account_name)
wallet.just_fyi("Send transaction to new account") wallet.just_fyi("Send transaction to new account")
wallet.accounts_status_account.click()
initial_balance = self.network_api.get_balance(status_account_address) initial_balance = self.network_api.get_balance(status_account_address)
transaction_amount = '0.003%s' % str(random.randint(10000, 99999)) + '1' transaction_amount = '0.003%s' % str(random.randint(10000, 99999)) + '1'
wallet.send_transaction(account_name=account_name, wallet.send_transaction(account_name=account_name, amount=transaction_amount)
amount=transaction_amount)
self.network_api.wait_for_confirmation_of_transaction(status_account_address, 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) self.network_api.verify_balance_is_updated(str(initial_balance), status_account_address)
wallet.just_fyi("Verifying previously sent transaction in new account") wallet.just_fyi("Verifying previously sent transaction in new account")
wallet.close_button.click()
wallet.get_account_by_name(account_name).click() wallet.get_account_by_name(account_name).click()
wallet.send_transaction_button.click() wallet.send_transaction_button.click()
wallet.close_send_transaction_view_button.click() wallet.close_send_transaction_view_button.click()
@ -254,14 +247,14 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
wallet.just_fyi("Sending eth from new account to main account") wallet.just_fyi("Sending eth from new account to main account")
updated_balance = self.network_api.get_balance(status_account_address) updated_balance = self.network_api.get_balance(status_account_address)
transaction_amount_1 = round(float(transaction_amount) * 0.2, 12) 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) amount=transaction_amount_1)
wallet.close_button.click() wallet.close_button.click()
sub_account_address = wallet.get_wallet_address(account_name)[2:] sub_account_address = wallet.get_wallet_address(account_name)[2:]
self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount) self.network_api.wait_for_confirmation_of_transaction(status_account_address, transaction_amount)
self.network_api.verify_balance_is_updated(updated_balance, status_account_address) self.network_api.verify_balance_is_updated(updated_balance, status_account_address)
wallet.find_transaction_in_history(amount=transaction_amount) wallet.find_transaction_in_history(amount=transaction_amount)
wallet.find_transaction_in_history(amount=format(float(transaction_amount_1),'.11f').rstrip('0')) wallet.find_transaction_in_history(amount=format(float(transaction_amount_1), '.11f').rstrip('0'))
wallet.just_fyi("Check transactions on subaccount") wallet.just_fyi("Check transactions on subaccount")
self.network_api.verify_balance_is_updated(updated_balance, status_account_address) self.network_api.verify_balance_is_updated(updated_balance, status_account_address)
@ -338,7 +331,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
url_data = { url_data = {
'ens_for_receiver': { 'ens_for_receiver': {
'url': 'ethereum:0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=nastya.stateofus.eth&uint256=1e-1', 'url': 'ethereum:0xc55cf4b03948d7ebc8b9e8bad92643703811d162@3/transfer?address=nastya.stateofus.eth&uint256=1e-1',
'data':{ 'data': {
'asset': 'STT', 'asset': 'STT',
'amount': '0.1', 'amount': '0.1',
'address': '0x58d8…F2ff', 'address': '0x58d8…F2ff',
@ -447,8 +440,6 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
wallet.asset_by_name(symbol).scroll_to_element() wallet.asset_by_name(symbol).scroll_to_element()
if not wallet.asset_by_name(symbol).is_element_displayed(): if not wallet.asset_by_name(symbol).is_element_displayed():
self.errors.append('Custom token is not shown on Wallet view') 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'] recipient = "0x" + basic_user['address']
amount = '0.000%s' % str(random.randint(10000, 99999)) + '1' amount = '0.000%s' % str(random.randint(10000, 99999)) + '1'
wallet.send_transaction(asset_name=symbol, amount=amount, recipient=recipient) 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(): 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) 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() 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.append('QR scanned address that was added to favourites was not resolved correctly')
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(5437) @marks.testrail_id(5437)
@marks.medium @marks.medium
def test_validation_amount_errors(self): def test_validation_amount_errors(self):
@ -577,21 +568,24 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
screen = 'send transaction screen from wallet' screen = 'send transaction screen from wallet'
sign_in.just_fyi('Checking %s on %s' % (errors['send_transaction_screen']['too_precise'], screen)) 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() send_transaction = wallet.send_transaction_button.click()
adi_button = send_transaction.asset_by_name('ADI') 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() adi_button.click()
send_transaction.amount_edit_box.click() send_transaction.amount_edit_box.click()
amount = '0.000%s' % str(random.randint(100000, 999999)) + '1' amount = '0.000%s' % str(random.randint(100000, 999999)) + '1'
send_transaction.amount_edit_box.set_value(amount) 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)) 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)) 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.clear()
send_transaction.amount_edit_box.set_value(str(initial_amount_ADI) + '1') 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(): 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)) self.errors.append(warning % (errors['send_transaction_screen']['insufficient_funds'], screen))
wallet.close_send_transaction_view_button.click() wallet.close_send_transaction_view_button.click()
wallet.close_button.click() wallet.close_button.click()
@ -607,7 +601,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.next_button.click() send_transaction.next_button.click()
wallet.ok_got_it_button.wait_and_click(30) wallet.ok_got_it_button.wait_and_click(30)
if not send_transaction.validation_error_element.is_element_displayed(10): if not send_transaction.validation_error_element.is_element_displayed(10):
self.errors.append('Validation icon is not shown when testing %s on %s' % (errors['sending_screen']['Network fee'],screen)) self.errors.append('Validation icon is not shown when testing %s on %s' % (errors['sending_screen']['Network fee'], screen))
if not wallet.element_by_translation_id("tx-fail-description2").is_element_displayed(): if not wallet.element_by_translation_id("tx-fail-description2").is_element_displayed():
self.errors.append("No warning about failing tx is shown!") self.errors.append("No warning about failing tx is shown!")
send_transaction.cancel_button.click() send_transaction.cancel_button.click()
@ -625,7 +619,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
status_test_dapp.send_two_tx_in_batch_button) status_test_dapp.send_two_tx_in_batch_button)
status_test_dapp.send_two_tx_in_batch_button.click() status_test_dapp.send_two_tx_in_batch_button.click()
if not send_transaction.validation_error_element.is_element_displayed(10): if not send_transaction.validation_error_element.is_element_displayed(10):
self.errors.append(warning % (errors['sending_screen']['Network fee'],screen)) self.errors.append(warning % (errors['sending_screen']['Network fee'], screen))
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(695855) @marks.testrail_id(695855)
@ -648,31 +642,29 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.network_fee_button.click() send_transaction.network_fee_button.click()
send_transaction = wallet.get_send_transaction_view() send_transaction = wallet.get_send_transaction_view()
fee_fields = (send_transaction.per_gas_tip_limit_input, send_transaction.per_gas_price_limit_input) 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' default_limit = '21000'
wallet.just_fyi("Check basic validation") wallet.just_fyi("Check basic validation")
values = { values = {
send_transaction.gas_limit_input : send_transaction.gas_limit_input:
{ {
'default': default_limit, 'default': default_limit,
'value' : '22000', 'value': '22000',
'20999' : 'wallet-send-min-units', '20999': 'wallet-send-min-units',
'@!': 'invalid-number', '@!': 'invalid-number',
}, },
send_transaction.per_gas_tip_limit_input: send_transaction.per_gas_tip_limit_input:
{ {
'default': default_tip, 'default': default_tip,
'value': '2.5', 'value': '2.5',
'aaaa' : 'invalid-number', 'aaaa': 'invalid-number',
}, },
send_transaction.per_gas_price_limit_input: send_transaction.per_gas_price_limit_input:
{ {
'default': default_price, 'default': default_price,
'value': '4,000000001', 'value': '4,000000001',
'-2' : 'invalid-number', '-2': 'invalid-number',
} }
} }
for field in values: for field in values:
@ -685,18 +677,18 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
field.clear() field.clear()
field.set_value(values[field]['value']) field.set_value(values[field]['value'])
wallet.just_fyi("Set custom fee and check that it will be applied") wallet.just_fyi("Set custom fee and check that it will be applied")
send_transaction.save_fee_button.scroll_and_click() send_transaction.save_fee_button.scroll_and_click()
if send_transaction.get_network_fee_from_bottom_sheet() != '0.000088': 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() send_transaction.sign_transaction()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=3) self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=3)
transaction = wallet.find_transaction_in_history(amount=amount, return_hash=True) transaction = wallet.find_transaction_in_history(amount=amount, return_hash=True)
expected_params = { expected_params = {
'fee_cap' : '4.000000001', 'fee_cap': '4.000000001',
'tip_cap': '2.5', 'tip_cap': '2.5',
'gas_limit' : '22000' 'gas_limit': '22000'
} }
actual_params = self.network_api.get_custom_fee_tx_params(transaction) actual_params = self.network_api.get_custom_fee_tx_params(transaction)
if actual_params != expected_params: if actual_params != expected_params:
@ -747,10 +739,7 @@ class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase):
receiver = transaction_recipients['K'] receiver = transaction_recipients['K']
self.create_drivers(2) self.create_drivers(2)
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1]) 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_sender = home_1.wallet_button.click()
wallet_receiver = home_2.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") device_1.just_fyi("Sending token amount to device who will use Set Max option for token")
amount = '0.012345678912345678' amount = '0.012345678912345678'
wallet_sender.accounts_status_account.click()
wallet_sender.send_transaction(asset_name='STT', amount=amount, recipient=receiver['address']) 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.wait_balance_is_changed(asset='STT', initial_balance=initial_balance, scan_tokens=True)
wallet_receiver.accounts_status_account.click() wallet_receiver.accounts_status_account.click()

View File

@ -67,7 +67,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@marks.high @marks.high
def test_pair_devices_sync_one_to_one_contacts_nicknames_public_chat(self): def test_pair_devices_sync_one_to_one_contacts_nicknames_public_chat(self):
self.create_drivers(3) 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' no_contact_nickname = 'no_contact_nickname'
name_1, name_2 = 'device_%s' % device_1.driver.number, 'device_%s' % device_2.driver.number 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) self.errors.append('"%s" is not found in Contacts after initial sync' % name)
profile_2.blocked_users_button.click() profile_2.blocked_users_button.click()
if not profile_2.element_by_text(no_contact_nickname).is_element_displayed(): 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() profile_2.profile_button.double_click()
device_1.just_fyi("Contacts(main device): unblock user, send message from unblocked user") 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() self.errors.verify_no_errors()
@marks.testrail_id(6324) @marks.testrail_id(6324)
@marks.medium @marks.medium
def test_invite_to_group_chat_handling(self): def test_invite_to_group_chat_handling(self):
@ -241,7 +242,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
chats[0].just_fyi('Member_1, member_2: both users send requests to join group chat') chats[0].just_fyi('Member_1, member_2: both users send requests to join group chat')
[sign_in.open_weblink_and_login(link) for sign_in in (sign_ins[1], sign_ins[2])] [sign_in.open_weblink_and_login(link) for sign_in in (sign_ins[1], sign_ins[2])]
introduction_messages = ['message for retrying'] introduction_messages = ['message for retrying']
for i in range(1,3): for i in range(1, 3):
homes[i].element_by_text_part(chat_name).click() homes[i].element_by_text_part(chat_name).click()
chats[i] = ChatView(self.drivers[i]) chats[i] = ChatView(self.drivers[i])
introduction_messages.append('Please add me, member_%s to your gorgeous group chat' % str(i)) introduction_messages.append('Please add me, member_%s to your gorgeous group chat' % str(i))
@ -275,12 +276,13 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
chats[2].just_fyi('Double check after relogin') chats[2].just_fyi('Double check after relogin')
if chats[0].group_membership_request_button.is_element_displayed(): if chats[0].group_membership_request_button.is_element_displayed():
self.errors.append('Group membership request is still shown when there are no pending requests anymore') self.errors.append('Group membership request is still shown when there are no pending requests anymore')
[homes[i].relogin() for i in range(0,3)] [homes[i].relogin() for i in range(0, 3)]
if homes[2].element_by_text_part(chat_name).is_element_displayed(): if homes[2].element_by_text_part(chat_name).is_element_displayed():
self.errors.append('Group chat was not removed when removing after declining group invite') 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])] [home.get_chat(chat_name).click() for home in (homes[0], homes[1])]
if chats[0].group_membership_request_button.is_element_displayed(): 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]) join_system_message = chats[0].join_system_message(usernames[1])
for chat in (chats[1], chats[0]): for chat in (chats[1], chats[0]):
if not chat.chat_element_by_text(join_system_message).is_element_displayed(): if not chat.chat_element_by_text(join_system_message).is_element_displayed():
@ -298,13 +300,13 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
public_keys[key], usernames[key] = sign_in_view.get_public_key_and_username(True) public_keys[key], usernames[key] = sign_in_view.get_public_key_and_username(True)
sign_in_view.home_button.click() sign_in_view.home_button.click()
chat_name = homes[0].get_random_chat_name() chat_name = homes[0].get_random_chat_name()
for i in range(1,3): for i in range(1, 3):
homes[0].add_contact(public_keys[i]) homes[0].add_contact(public_keys[i])
homes[0].get_back_to_home_view() homes[0].get_back_to_home_view()
chats[0] = homes[0].create_group_chat([usernames[1], chats[0] = homes[0].create_group_chat([usernames[1],
usernames[2]], chat_name) usernames[2]], chat_name)
chats[0].just_fyi('Member_1, member_2: both users join to group chat') chats[0].just_fyi('Member_1, member_2: both users join to group chat')
for i in range(1,3): for i in range(1, 3):
chats[i] = homes[i].get_chat(chat_name).click() chats[i] = homes[i].get_chat(chat_name).click()
chats[i].join_chat_button.click() chats[i].join_chat_button.click()
chats[0].just_fyi("Admin: get options for device 2 in group chat and remove him") chats[0].just_fyi("Admin: get options for device 2 in group chat and remove him")
@ -332,7 +334,8 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
@marks.medium @marks.medium
def test_pair_devices_group_chat_different_messages_nicknames(self): def test_pair_devices_group_chat_different_messages_nicknames(self):
self.create_drivers(3) 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() home_1 = device_1.create_user()
profile_1 = home_1.profile_button.click() profile_1 = home_1.profile_button.click()
profile_1.privacy_and_security_button.click() profile_1.privacy_and_security_button.click()
@ -347,7 +350,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
device_1_name, device_2_name, group_chat_name = 'creator', 'paired', 'some group chat' device_1_name, device_2_name, group_chat_name = 'creator', 'paired', 'some group chat'
device_1.just_fyi('Add contact, start group chat') device_1.just_fyi('Add contact, start group chat')
nickname = 'my_tester' nickname = 'my_tester'
home_1.add_contact(public_key_3,nickname=nickname) home_1.add_contact(public_key_3, nickname=nickname)
home_1.get_back_to_home_view() home_1.get_back_to_home_view()
chat_1 = home_1.create_group_chat([username_3], group_chat_name) chat_1 = home_1.create_group_chat([username_3], group_chat_name)
chat_3 = home_3.get_chat(group_chat_name).click() chat_3 = home_3.get_chat(group_chat_name).click()
@ -409,4 +412,3 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
if not chat_1.sticker_message.is_element_displayed(30): if not chat_1.sticker_message.is_element_displayed(30):
self.errors.append('Sticker was not sent') self.errors.append('Sticker was not sent')
self.errors.verify_no_errors() 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 import base64
from re import findall from re import findall
class AbstractTestCase: class AbstractTestCase:
__metaclass__ = ABCMeta __metaclass__ = ABCMeta
@ -38,12 +39,14 @@ class AbstractTestCase:
def executor_local(self): def executor_local(self):
return 'http://localhost:4723/wd/hub' return 'http://localhost:4723/wd/hub'
def print_sauce_lab_info(self, driver): @staticmethod
def print_sauce_lab_info(driver):
sys.stdout = sys.stderr sys.stdout = sys.stderr
print("SauceOnDemandSessionID=%s job-name=%s" % (driver.session_id, print("SauceOnDemandSessionID=%s job-name=%s" % (driver.session_id,
pytest_config_global['build'])) pytest_config_global['build']))
def get_translation_by_key(self, key): @staticmethod
def get_translation_by_key(key):
return transl[key] return transl[key]
def add_local_devices_to_capabilities(self): def add_local_devices_to_capabilities(self):
@ -59,7 +62,9 @@ class AbstractTestCase:
@property @property
def app_path(self): 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 return app_path
@property @property
@ -132,13 +137,15 @@ class AbstractTestCase:
network_api = NetworkApi() network_api = NetworkApi()
github_report = GithubHtmlReport() github_report = GithubHtmlReport()
def is_alert_present(self, driver): @staticmethod
def is_alert_present(driver):
try: try:
return driver.find_element(MobileBy.ID, 'android:id/message') return driver.find_element(MobileBy.ID, 'android:id/message')
except NoSuchElementException: except NoSuchElementException:
return False return False
def get_alert_text(self, driver): @staticmethod
def get_alert_text(driver):
return driver.find_element(MobileBy.ID, 'android:id/message').text return driver.find_element(MobileBy.ID, 'android:id/message').text
def add_alert_text_to_report(self, driver): 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'" \ test_suite_data.current_test.testruns[-1].error += "; also Unexpected Alert is shown: '%s'" \
% self.get_alert_text(driver) % self.get_alert_text(driver)
def pull_geth(self, driver): def pull_geth(self, driver):
result = "" result = ""
try: try:
@ -168,7 +174,6 @@ class Driver(webdriver.Remote):
logging.info(text) logging.info(text)
test_suite_data.current_test.testruns[-1].steps.append(text) test_suite_data.current_test.testruns[-1].steps.append(text)
def fail(self, text: str): def fail(self, text: str):
pytest.fail('Device %s: %s' % (self.number, text)) pytest.fail('Device %s: %s' % (self.number, text))
@ -216,7 +221,8 @@ class SingleDeviceTestCase(AbstractTestCase):
except (WebDriverException, AttributeError): except (WebDriverException, AttributeError):
pass pass
finally: 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): class LocalMultipleDeviceTestCase(AbstractTestCase):
@ -270,7 +276,8 @@ class SauceMultipleDeviceTestCase(AbstractTestCase):
try: try:
self.print_sauce_lab_info(self.drivers[driver]) self.print_sauce_lab_info(self.drivers[driver])
self.add_alert_text_to_report(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])) geth_contents.append(self.pull_geth(self.drivers[driver]))
self.drivers[driver].quit() self.drivers[driver].quit()
except (WebDriverException, AttributeError): except (WebDriverException, AttributeError):
@ -278,7 +285,6 @@ class SauceMultipleDeviceTestCase(AbstractTestCase):
geth = {geth_names[i]: geth_contents[i] for i in range(len(geth_names))} 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) self.github_report.save_test(test_suite_data.current_test, geth)
@classmethod @classmethod
def teardown_class(cls): def teardown_class(cls):
cls.loop.close() cls.loop.close()

View File

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

View File

@ -4,6 +4,7 @@ from views.sign_in_view import SignInView
from datetime import datetime from datetime import datetime
import time import time
class TestPerformance(SingleDeviceTestCase): class TestPerformance(SingleDeviceTestCase):
def get_timestamps_by_event(self, *args): def get_timestamps_by_event(self, *args):
@ -42,9 +43,10 @@ class TestPerformance(SingleDeviceTestCase):
timestamps_by_event = self.get_timestamps_by_event(app_started, login_shown, password_submitted, login_success) 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: 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], 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 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) self.driver.info("Time to login is '%s'" % time_to_login)
time_to_start_app = (timestamps_by_event[login_shown] - timestamps_by_event[app_started]) / 1000 time_to_start_app = (timestamps_by_event[login_shown] - timestamps_by_event[app_started]) / 1000

View File

@ -16,6 +16,16 @@ ens_user['ens_upgrade'] = 'statuse2e'
ens_user['ens_another'] = 'status-another-ens-e2e.eth' ens_user['ens_another'] = 'status-another-ens-e2e.eth'
ens_user['address'] = '0x1eE3058Bd300246B4B20E687Efc9Eba81FF7814b' 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 = dict()
ens_user_ropsten['ens'] = 'nastya' ens_user_ropsten['ens'] = 'nastya'
ens_user_ropsten['username'] = 'Thoughtful Stupendous Graywolf' 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['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['passphrase'] = 'tribe life dune clog throw situate robust gospel panic blanket timber eagle'
ens_user_message_sender['address'] = '0x75fF623fe856012b0667876582038A63F4004184' ens_user_message_sender['address'] = '0x75fF623fe856012b0667876582038A63F4004184'
ens_user_message_sender['public_key'] = '0x0471e18b2a9867161383919d85741389a829299ae0833c23e003818c1222942f5dddcbb792daee7c88' \ ens_user_message_sender[
'public_key'] = '0x0471e18b2a9867161383919d85741389a829299ae0833c23e003818c1222942f5dddcbb792daee7c88' \
'e8a30ee44c00d03240a971d90d76ed8200b75572241da9ef' 'e8a30ee44c00d03240a971d90d76ed8200b75572241da9ef'
dummy_user = dict() dummy_user = dict()
@ -44,7 +55,7 @@ upgrade_users['chats'] = dict()
upgrade_users['chats']['passphrase'] = 'identify level pink lift choose winner hour onion style festival rather salmon' upgrade_users['chats']['passphrase'] = 'identify level pink lift choose winner hour onion style festival rather salmon'
upgrade_users['chats']['public_key'] = '0x045d8a344ffee0c5ce187d0248a9b8ffc4a12493c9d9e8b9a395f38' \ upgrade_users['chats']['public_key'] = '0x045d8a344ffee0c5ce187d0248a9b8ffc4a12493c9d9e8b9a395f38' \
'825ebe55ac2350d9e7090e39e6c8d7020aaa799aefe563f1db5b6151370eae246558772ad9e' '825ebe55ac2350d9e7090e39e6c8d7020aaa799aefe563f1db5b6151370eae246558772ad9e'
upgrade_users['chats']['username']= 'Rapid Gleeful Cheetah' upgrade_users['chats']['username'] = 'Rapid Gleeful Cheetah'
wallet_users = dict() wallet_users = dict()
@ -62,7 +73,6 @@ wallet_users['B']['address'] = "0F3EFF5CacEe63045be97281316457fb78dd659E"
wallet_users['B']['public_key'] = "0x04f3c372522a087bd6895a67b669601e6b6825b2ee7add5942d10efd1c3c836a1d9a677d94d33" \ wallet_users['B']['public_key'] = "0x04f3c372522a087bd6895a67b669601e6b6825b2ee7add5942d10efd1c3c836a1d9a677d94d33" \
"895833b6ebe523f0fe5965f73558da58520a3f9c7a00e73f75d61" "895833b6ebe523f0fe5965f73558da58520a3f9c7a00e73f75d61"
wallet_users['C'] = dict() wallet_users['C'] = dict()
wallet_users['C']['passphrase'] = "purchase ensure mistake crystal person similar shaft family shield clog risk market" wallet_users['C']['passphrase'] = "purchase ensure mistake crystal person similar shaft family shield clog risk market"
wallet_users['C']['username'] = "Mellow Virtual Nubiangoat" wallet_users['C']['username'] = "Mellow Virtual Nubiangoat"
@ -85,10 +95,10 @@ wallet_users['E']['address'] = "0x3e2e4077753d3c229a9ae332b9ca46958945e2f6"
wallet_users['E']['public_key'] = "0x044cf0620ec3ea0aba9fb0e19cb42a6fbd6b4e74f234f0da82580564817b238cc6434745d31" \ wallet_users['E']['public_key'] = "0x044cf0620ec3ea0aba9fb0e19cb42a6fbd6b4e74f234f0da82580564817b238cc6434745d31" \
"fa1649927ba48adfa7c95991fd51940bc00a71e80b095db5b107f1b" "fa1649927ba48adfa7c95991fd51940bc00a71e80b095db5b107f1b"
wallet_users['E']['collectibles'] = { wallet_users['E']['collectibles'] = {
'Coins & Steel Exclusive Item Skin V2' : '1', 'Coins & Steel Exclusive Item Skin V2': '1',
'Coins & Steel Founder Aura' : '2', 'Coins & Steel Founder Aura': '2',
'CryptoKittiesRinkeby' : '2', 'CryptoKittiesRinkeby': '2',
'KudosToken V7' : '1', 'KudosToken V7': '1',
} }
wallet_users['F'] = dict() wallet_users['F'] = dict()
wallet_users['F']['passphrase'] = "jazz human replace save wreck merry evolve oval black expose clutch sword" wallet_users['F']['passphrase'] = "jazz human replace save wreck merry evolve oval black expose clutch sword"
@ -97,7 +107,6 @@ wallet_users['F']['address'] = "0x8A4339aE98df2B2e51E37631C8B4F853048D4556"
wallet_users['F']['public_key'] = "0x049d0b39d95b20114fac79c3173a36c60a126c060dce52bba4128ab9a3885f0f058f2af9c92099" \ wallet_users['F']['public_key'] = "0x049d0b39d95b20114fac79c3173a36c60a126c060dce52bba4128ab9a3885f0f058f2af9c92099" \
"315eb564412b718d8bfe697a4425e4bc603063abd4f5c45f8e57" "315eb564412b718d8bfe697a4425e4bc603063abd4f5c45f8e57"
# Users used in chats. E.g. as members of a group chat # Users used in chats. E.g. as members of a group chat
chat_users = dict() chat_users = dict()
@ -148,7 +157,8 @@ transaction_senders['D']['public_key'] = "0x044764a9ba22bb4ae355619ca3824ee66b9f
"d0dd570471986c229c077c8053ee47784416eb6604d52e41f8f9d566ef8" "d0dd570471986c229c077c8053ee47784416eb6604d52e41f8f9d566ef8"
transaction_senders['E'] = dict() 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']['username'] = "Fatal Metallic Imperialeagle"
transaction_senders['E']['address'] = "f7cb60839c0de25e37be0391c33bb34a8f0f8414" transaction_senders['E']['address'] = "f7cb60839c0de25e37be0391c33bb34a8f0f8414"
transaction_senders['E']['public_key'] = "0x04db6128352e5c2d05ee5a6556848453cf3a7af34e94b3e20a302de684e9906461e38adf" \ transaction_senders['E']['public_key'] = "0x04db6128352e5c2d05ee5a6556848453cf3a7af34e94b3e20a302de684e9906461e38adf" \
@ -367,13 +377,13 @@ transaction_recipients['J']['public_key'] = "0x04e7e481932714c1a13ffb29fc79446ee
"7a80804ff59a750693492a65be9682d0b850b4080d976cf9e43ff37ec841" "7a80804ff59a750693492a65be9682d0b850b4080d976cf9e43ff37ec841"
transaction_recipients['K'] = dict() 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']['username'] = "Upright Authorized Waterstrider"
transaction_recipients['K']['address'] = "0x6a1aC3a7a5A064FF6E0f169E0d384703245556b4" transaction_recipients['K']['address'] = "0x6a1aC3a7a5A064FF6E0f169E0d384703245556b4"
transaction_recipients['K']['public_key'] = "0x04d1c98a6e25a7ea0241349a41709c5dc51c7c1d59224076d13d1ebe16671eedc8f" \ transaction_recipients['K']['public_key'] = "0x04d1c98a6e25a7ea0241349a41709c5dc51c7c1d59224076d13d1ebe16671eedc8f" \
"3b23ab95db679a9124752ed77339424034fd9a12f0184894c0d7a25710d2f3c" "3b23ab95db679a9124752ed77339424034fd9a12f0184894c0d7a25710d2f3c"
recovery_users = { recovery_users = {
"radar blur cabbage chef fix engine embark joy scheme fiction master release": "radar blur cabbage chef fix engine embark joy scheme fiction master release":
"0xaC39b311DCEb2A4b2f5d8461c1cdaF756F4F7Ae9", "0xaC39b311DCEb2A4b2f5d8461c1cdaF756F4F7Ae9",

View File

@ -25,7 +25,7 @@ class BaseElement(object):
self.accessibility_id = None self.accessibility_id = None
self.translation_id = None self.translation_id = None
self.uppercase = None self.uppercase = None
self.prefix='' self.prefix = ''
self.suffix = None self.suffix = None
self.id = None self.id = None
self.class_name = None self.class_name = None
@ -77,7 +77,8 @@ class BaseElement(object):
return self.driver.find_element(self.by, self.locator) return self.driver.find_element(self.by, self.locator)
except NoSuchElementException: except NoSuchElementException:
raise 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: except Exception as exception:
if 'Internal Server Error' in str(exception): if 'Internal Server Error' in str(exception):
continue continue
@ -100,7 +101,8 @@ class BaseElement(object):
.until(expected_conditions.presence_of_element_located((self.by, self.locator))) .until(expected_conditions.presence_of_element_located((self.by, self.locator)))
except TimeoutException: except TimeoutException:
raise 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): def wait_for_elements(self, seconds=10):
try: try:
@ -108,7 +110,8 @@ class BaseElement(object):
.until(expected_conditions.presence_of_all_elements_located((self.by, self.locator))) .until(expected_conditions.presence_of_all_elements_located((self.by, self.locator)))
except TimeoutException: except TimeoutException:
raise 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): def wait_for_visibility_of_element(self, seconds=10, ignored_exceptions=None):
try: try:
@ -116,7 +119,8 @@ class BaseElement(object):
.until(expected_conditions.visibility_of_element_located((self.by, self.locator))) .until(expected_conditions.visibility_of_element_located((self.by, self.locator)))
except TimeoutException: except TimeoutException:
raise 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): def wait_for_invisibility_of_element(self, seconds=10):
try: try:
@ -148,12 +152,13 @@ class BaseElement(object):
except NoSuchElementException: except NoSuchElementException:
size = self.driver.get_window_size() size = self.driver.get_window_size()
if direction == 'down': if direction == 'down':
self.driver.swipe(500, size["height"]*0.4, 500, size["height"]*0.05) self.driver.swipe(500, size["height"] * 0.4, 500, size["height"] * 0.05)
else: else:
self.driver.swipe(500, size["height"]*0.25, 500, size["height"]*0.8) self.driver.swipe(500, size["height"] * 0.25, 500, size["height"] * 0.8)
else: else:
raise 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
def scroll_and_click(self, direction='down'): def scroll_and_click(self, direction='down'):
self.scroll_to_element(direction=direction) 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 = Image.open(BytesIO(base64.b64decode(self.find_element().screenshot_as_base64)))
screen.save(full_path_to_file) 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: if file_name:
self.template = file_name self.template = file_name
return not ImageChops.difference(self.image, self.template).getbbox() return not ImageChops.difference(self.image, self.template).getbbox()
@ -224,8 +229,8 @@ class BaseElement(object):
difference = ImageChops.difference(self.image, self.template) difference = ImageChops.difference(self.image, self.template)
stat = ImageStat.Stat(difference) stat = ImageStat.Stat(difference)
diff_ratio = sum(stat.mean) / (len(stat.mean) * 255) diff_ratio = sum(stat.mean) / (len(stat.mean) * 255)
if diff_ratio*100 > diff: if diff_ratio * 100 > diff:
self.driver.info('Image differs from template to %s percents' % str(diff_ratio*100)) self.driver.info('Image differs from template to %s percents' % str(diff_ratio * 100))
result = True result = True
return result return result
@ -233,7 +238,7 @@ class BaseElement(object):
image_template = os.sep.join(__file__.split(os.sep)[:-1]) + '/elements_templates/%s' % template_path image_template = os.sep.join(__file__.split(os.sep)[:-1]) + '/elements_templates/%s' % template_path
template = imagehash.average_hash(Image.open(image_template)) template = imagehash.average_hash(Image.open(image_template))
element_image = imagehash.average_hash(self.image) element_image = imagehash.average_hash(self.image)
return not bool(template-element_image) return not bool(template - element_image)
def swipe_left_on_element(self): def swipe_left_on_element(self):
element = self.find_element() element = self.find_element()
@ -337,20 +342,20 @@ class Text(BaseElement):
return text return text
class Button(BaseElement): class Button(BaseElement):
def __init__(self, driver, **kwargs): def __init__(self, driver, **kwargs):
super(Button, self).__init__(driver, **kwargs) super(Button, self).__init__(driver, **kwargs)
def wait_and_click(self, time=30): 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, time)) 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(time) self.wait_for_visibility_of_element(sec)
self.click() self.click()
def click_until_presence_of_element(self, desired_element, attempts=4): def click_until_presence_of_element(self, desired_element, attempts=4):
counter = 0 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: while not desired_element.is_element_present(1) and counter <= attempts:
try: try:
self.find_element().click() self.find_element().click()
@ -363,7 +368,8 @@ class Button(BaseElement):
def click_until_absense_of_element(self, desired_element, attempts=3): def click_until_absense_of_element(self, desired_element, attempts=3):
counter = 0 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: while desired_element.is_element_present(1) and counter <= attempts:
try: try:
self.find_element().click() self.find_element().click()
@ -371,6 +377,7 @@ class Button(BaseElement):
except (NoSuchElementException, TimeoutException): except (NoSuchElementException, TimeoutException):
return self.navigate() return self.navigate()
class SilentButton(Button): class SilentButton(Button):
def find_element(self): def find_element(self):
for _ in range(3): for _ in range(3):
@ -378,7 +385,8 @@ class SilentButton(Button):
return self.driver.find_element(self.by, self.locator) return self.driver.find_element(self.by, self.locator)
except NoSuchElementException: except NoSuchElementException:
raise 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: except Exception as exception:
if 'Internal Server Error' in str(exception): if 'Internal Server Error' in str(exception):
continue continue

View File

@ -46,6 +46,7 @@ class TabButton(Button):
def __init__(self, driver, parent_locator): def __init__(self, driver, parent_locator):
super().__init__(driver, super().__init__(driver,
xpath="%s/android.widget.TextView" % parent_locator) xpath="%s/android.widget.TextView" % parent_locator)
return Counter(self.driver, self.locator) return Counter(self.driver, self.locator)
@property @property
@ -53,6 +54,7 @@ class TabButton(Button):
class PublicChatUnreadMessages(BaseElement): class PublicChatUnreadMessages(BaseElement):
def __init__(self, driver, parent_locator): def __init__(self, driver, parent_locator):
super().__init__(driver, xpath="%s/android.widget.TextView" % parent_locator) super().__init__(driver, xpath="%s/android.widget.TextView" % parent_locator)
return PublicChatUnreadMessages(self.driver, self.locator) return PublicChatUnreadMessages(self.driver, self.locator)
@ -122,7 +124,7 @@ class ProfileButton(TabButton):
from views.profile_view import ProfileView from views.profile_view import ProfileView
return ProfileView(self.driver) return ProfileView(self.driver)
def click(self, desired_element_text = 'privacy'): def click(self, desired_element_text='privacy'):
from views.profile_view import ProfileView from views.profile_view import ProfileView
if desired_element_text == 'privacy': if desired_element_text == 'privacy':
self.click_until_presence_of_element(ProfileView(self.driver).privacy_and_security_button) self.click_until_presence_of_element(ProfileView(self.driver).privacy_and_security_button)
@ -158,6 +160,7 @@ class AssetButton(Button):
def click(self): def click(self):
self.wait_for_element().click() self.wait_for_element().click()
class OpenInStatusButton(Button): class OpenInStatusButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, translation_id="browsing-open-in-status") super().__init__(driver, translation_id="browsing-open-in-status")
@ -194,9 +197,11 @@ class AirplaneModeButton(Button):
super(AirplaneModeButton, self).click() super(AirplaneModeButton, self).click()
self.driver.press_keycode(4) self.driver.press_keycode(4)
class SignInPhraseText(Text): class SignInPhraseText(Text):
def __init__(self, driver): 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 @property
def list(self): def list(self):
@ -247,8 +252,6 @@ class BaseView(object):
self.qr_code_image = Button(self.driver, accessibility_id="qr-code-image") self.qr_code_image = Button(self.driver, accessibility_id="qr-code-image")
self.sign_in_phrase = SignInPhraseText(self.driver) self.sign_in_phrase = SignInPhraseText(self.driver)
# external browser # external browser
self.open_in_status_button = OpenInStatusButton(self.driver) self.open_in_status_button = OpenInStatusButton(self.driver)
@ -283,8 +286,8 @@ class BaseView(object):
iterations += 1 iterations += 1
@staticmethod @staticmethod
def get_translation_by_key(id): def get_translation_by_key(translation_id):
return transl[id] return transl[translation_id]
def rooted_device_continue(self): def rooted_device_continue(self):
try: try:
@ -321,8 +324,8 @@ class BaseView(object):
except TimeoutException: except TimeoutException:
counter += 1 counter += 1
def just_fyi(self, string): def just_fyi(self, some_str):
self.driver.info('# STEP: %s' % string, device=False) self.driver.info('# STEP: %s' % some_str, device=False)
def click_system_back_button(self, times=1): def click_system_back_button(self, times=1):
self.driver.info('Click system back button') self.driver.info('Click system back button')
@ -360,8 +363,8 @@ class BaseView(object):
self.driver.info('Paste text') self.driver.info('Paste text')
self.driver.press_keycode(279) self.driver.press_keycode(279)
def send_as_keyevent(self, string): def send_as_keyevent(self, keyevent):
self.driver.info("Sending as keyevent `%s`" % string) 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, 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, ',': 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, '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} 'u': 49, 'v': 50, 'w': 51, 'x': 52, 'y': 53, 'z': 54}
time.sleep(3) time.sleep(3)
for i in string: for i in keyevent:
if i.isalpha() and i.isupper(): if i.isalpha() and i.isupper():
keycode, metastate = keys[i.lower()], 64 # META_SHIFT_LEFT_ON Constant Value: 64. Example: i='n' -> 'N' keycode, metastate = keys[i.lower()], 64 # META_SHIFT_LEFT_ON Constant Value: 64. Example: i='n' -> 'N'
elif type(keys[i]) is list: 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) element = self.element_types[element_type](self.driver, xpath="//*[starts-with(@text,'%s')]" % text)
return element return element
def element_by_translation_id(self, id, element_type='button', uppercase=False): def element_by_translation_id(self, translation_id, element_type='button', uppercase=False):
element = self.element_types[element_type](self.driver, translation_id=id, uppercase=uppercase) element = self.element_types[element_type](self.driver, translation_id=translation_id, uppercase=uppercase)
return element return element
def wait_for_element_starts_with_text(self, text, wait_time=60): def wait_for_element_starts_with_text(self, text, wait_time=60):
@ -406,27 +409,28 @@ class BaseView(object):
"""Uses percentage values based on device width/height""" """Uses percentage values based on device width/height"""
self.driver.info("Swiping based on custom coordinates relative to device height/width") self.driver.info("Swiping based on custom coordinates relative to device height/width")
size = self.driver.get_window_size() 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): def swipe_up(self):
self.driver.info("Swiping up") self.driver.info("Swiping up")
size = self.driver.get_window_size() size = self.driver.get_window_size()
self.driver.swipe(size["width"]*0.5, size["height"]*0.8, size["width"]*0.5, size["height"]*0.2) self.driver.swipe(size["width"] * 0.5, size["height"] * 0.8, size["width"] * 0.5, size["height"] * 0.2)
def swipe_down(self): def swipe_down(self):
self.driver.info("Swiping down") self.driver.info("Swiping down")
size = self.driver.get_window_size() size = self.driver.get_window_size()
self.driver.swipe(size["width"]*0.5, size["height"]*0.2, size["width"]*0.5, size["height"]*0.8) self.driver.swipe(size["width"] * 0.5, size["height"] * 0.2, size["width"] * 0.5, size["height"] * 0.8)
def swipe_left(self): def swipe_left(self):
self.driver.info("Swiping left") self.driver.info("Swiping left")
size = self.driver.get_window_size() size = self.driver.get_window_size()
self.driver.swipe(size["width"]*0.8, size["height"]*0.8, size["width"]*0.2, size["height"]*0.8) self.driver.swipe(size["width"] * 0.8, size["height"] * 0.8, size["width"] * 0.2, size["height"] * 0.8)
def swipe_right(self): def swipe_right(self):
self.driver.info("Swiping right") self.driver.info("Swiping right")
size = self.driver.get_window_size() size = self.driver.get_window_size()
self.driver.swipe(size["width"]*0.2, size["height"]*0.8, size["width"]*0.8, size["height"]*0.8) self.driver.swipe(size["width"] * 0.2, size["height"] * 0.8, size["width"] * 0.8, size["height"] * 0.8)
def switch_to_mobile(self, before_login=False, sync=False): def switch_to_mobile(self, before_login=False, sync=False):
self.driver.info("Turning on mobile data, syncing is %s" % str(sync)) self.driver.info("Turning on mobile data, syncing is %s" % str(sync))
@ -520,7 +524,6 @@ class BaseView(object):
continue continue
return self.get_home_view() return self.get_home_view()
def relogin(self, password=common_password): def relogin(self, password=common_password):
try: try:
profile_view = self.profile_button.click() profile_view = self.profile_button.click()
@ -536,7 +539,6 @@ class BaseView(object):
TouchAction(self.driver).tap(None, 255, 104, 1).perform() TouchAction(self.driver).tap(None, 255, 104, 1).perform()
time.sleep(3) time.sleep(3)
def get_public_key_and_username(self, return_username=False): def get_public_key_and_username(self, return_username=False):
self.driver.info("Get public key and username") self.driver.info("Get public key and username")
profile_view = self.profile_button.click() profile_view = self.profile_button.click()
@ -562,7 +564,6 @@ class BaseView(object):
element.click() element.click()
return self.get_chat_view() return self.get_chat_view()
def find_values_in_logcat(self, **kwargs): def find_values_in_logcat(self, **kwargs):
logcat = self.logcat logcat = self.logcat
items_in_logcat = list() items_in_logcat = list()
@ -610,7 +611,7 @@ class BaseView(object):
network_and_internet = self.element_by_text('Network & internet') network_and_internet = self.element_by_text('Network & internet')
network_and_internet.wait_for_visibility_of_element() network_and_internet.wait_for_visibility_of_element()
network_and_internet.click() network_and_internet.click()
toggle=Button(self.driver, accessibility_id='WiFi') toggle = Button(self.driver, accessibility_id='WiFi')
toggle.wait_for_visibility_of_element() toggle.wait_for_visibility_of_element()
toggle.click() toggle.click()
self.driver.back() self.driver.back()
@ -650,4 +651,3 @@ class BaseView(object):
string_source = self.driver.page_source string_source = self.driver.page_source
source = open(full_path_to_file, "a+") source = open(full_path_to_file, "a+")
source.write(string_source) source.write(string_source)

View File

@ -90,7 +90,6 @@ class ChatOptionsButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, xpath="//androidx.appcompat.widget.LinearLayoutCompat") super().__init__(driver, xpath="//androidx.appcompat.widget.LinearLayoutCompat")
def click(self): def click(self):
self.click_until_presence_of_element(HomeView(self.driver).mark_all_messages_as_read_button) 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): class ImageInReply(BaseElement):
def __init__(self, driver, parent_locator: str): def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="//android.widget.ImageView") super().__init__(driver, prefix=parent_locator, xpath="//android.widget.ImageView")
try: try:
return ImageInReply(self.driver, self.locator) return ImageInReply(self.driver, self.locator)
except NoSuchElementException: except NoSuchElementException:
@ -150,7 +150,6 @@ class ChatElementByText(Text):
return TimeStampText(self.driver, self.locator) return TimeStampText(self.driver, self.locator)
@property @property
def member_photo(self): def member_photo(self):
class MemberPhoto(Button): class MemberPhoto(Button):
@ -163,7 +162,7 @@ class ChatElementByText(Text):
def username(self): def username(self):
class Username(Text): class Username(Text):
def __init__(self, driver, parent_locator: str): def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/*[2]/android.widget.TextView" ) super().__init__(driver, prefix=parent_locator, xpath="/*[2]/android.widget.TextView")
return Username(self.driver, self.locator) return Username(self.driver, self.locator)
@ -176,7 +175,8 @@ class ChatElementByText(Text):
def uncollapse(self) -> bool: def uncollapse(self) -> bool:
class Collapse(Button): class Collapse(Button):
def __init__(self, driver, parent_locator: str): 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() return Collapse(self.driver, self.locator).is_element_displayed()
@ -195,7 +195,9 @@ class ChatElementByText(Text):
def replied_message_text(self): def replied_message_text(self):
class RepliedMessageText(Text): class RepliedMessageText(Text):
def __init__(self, driver, parent_locator: str): 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: try:
return RepliedMessageText(self.driver, self.message_locator).text return RepliedMessageText(self.driver, self.message_locator).text
except NoSuchElementException: except NoSuchElementException:
@ -207,6 +209,7 @@ class ChatElementByText(Text):
def __init__(self, driver, parent_locator: str): def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, super().__init__(driver, prefix=parent_locator,
xpath="/preceding-sibling::*[1]/android.widget.TextView[1]") xpath="/preceding-sibling::*[1]/android.widget.TextView[1]")
try: try:
return RepliedToUsernameText(self.driver, self.message_locator).text return RepliedToUsernameText(self.driver, self.message_locator).text
except NoSuchElementException: except NoSuchElementException:
@ -228,6 +231,7 @@ class ChatElementByText(Text):
return text return text
except NoSuchElementException: except NoSuchElementException:
return 0 return 0
return int(EmojisNumber(self.driver, self.locator).text) return int(EmojisNumber(self.driver, self.locator).text)
@property @property
@ -236,8 +240,10 @@ class ChatElementByText(Text):
def __init__(self, driver, parent_locator: str): def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, super().__init__(driver, prefix=parent_locator,
xpath="/../..//android.view.ViewGroup[@content-desc='pinned-by']") xpath="/../..//android.view.ViewGroup[@content-desc='pinned-by']")
return PinnedByLabelText(self.driver, self.locator) return PinnedByLabelText(self.driver, self.locator)
class UsernameOptions(Button): class UsernameOptions(Button):
def __init__(self, driver, username): def __init__(self, driver, username):
super().__init__(driver, xpath="//*[@text='%s']/..//*[@content-desc='menu-option']" % 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.request_access_button = Button(self.driver, translation_id="request-access")
self.membership_request_pending_text = Text(self.driver, translation_id="membership-request-pending") self.membership_request_pending_text = Text(self.driver, translation_id="membership-request-pending")
def add_channel(self, name: str, description="Some new channel"): def add_channel(self, name: str, description="Some new channel"):
self.driver.info("Adding channel") self.driver.info("Adding channel")
self.plus_button.click() self.plus_button.click()
@ -328,10 +333,10 @@ class CommunityView(HomeView):
self.element_starts_with_text('join.status.im/c/').click() self.element_starts_with_text('join.status.im/c/').click()
community_link_text = self.element_starts_with_text('join.status.im/c/').text community_link_text = self.element_starts_with_text('join.status.im/c/').text
self.home_button.double_click() self.home_button.double_click()
return 'https://%s'% community_link_text return 'https://%s' % community_link_text
def handle_membership_request(self, username: str, approve=True): def handle_membership_request(self, username: str, approve=True):
self.driver.info("Handling membership request of user '%s', approve='%s'" %(username, str(approve))) self.driver.info("Handling membership request of user '%s', approve='%s'" % (username, str(approve)))
self.members_button.click() self.members_button.click()
self.membership_requests_button.click() self.membership_requests_button.click()
approve_suffix, decline_suffix = '/following-sibling::android.view.ViewGroup[1]', '/following-sibling::android.view.ViewGroup[2]' approve_suffix, decline_suffix = '/following-sibling::android.view.ViewGroup[1]', '/following-sibling::android.view.ViewGroup[2]'
@ -343,7 +348,7 @@ class CommunityView(HomeView):
class PreviewMessage(ChatElementByText): class PreviewMessage(ChatElementByText):
def __init__(self, driver, text:str): def __init__(self, driver, text: str):
super().__init__(driver, text=text) super().__init__(driver, text=text)
self.locator += "/android.view.ViewGroup/android.view.ViewGroup" self.locator += "/android.view.ViewGroup/android.view.ViewGroup"
@ -359,6 +364,7 @@ class PreviewMessage(ChatElementByText):
class PreviewImage(SilentButton): class PreviewImage(SilentButton):
def __init__(self, driver, parent_locator: str): def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/android.widget.ImageView") super().__init__(driver, prefix=parent_locator, xpath="/android.widget.ImageView")
return PreviewMessage.return_element_or_empty(PreviewImage(self.driver, self.locator)) return PreviewMessage.return_element_or_empty(PreviewImage(self.driver, self.locator))
@property @property
@ -366,6 +372,7 @@ class PreviewMessage(ChatElementByText):
class PreviewTitle(SilentButton): class PreviewTitle(SilentButton):
def __init__(self, driver, parent_locator: str): def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/android.widget.TextView[1]") super().__init__(driver, prefix=parent_locator, xpath="/android.widget.TextView[1]")
return PreviewMessage.return_element_or_empty(PreviewTitle(self.driver, self.locator)) return PreviewMessage.return_element_or_empty(PreviewTitle(self.driver, self.locator))
@property @property
@ -373,13 +380,14 @@ class PreviewMessage(ChatElementByText):
class PreviewSubTitle(SilentButton): class PreviewSubTitle(SilentButton):
def __init__(self, driver, parent_locator: str): def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/android.widget.TextView[2]") super().__init__(driver, prefix=parent_locator, xpath="/android.widget.TextView[2]")
return PreviewMessage.return_element_or_empty(PreviewSubTitle(self.driver, self.locator)) return PreviewMessage.return_element_or_empty(PreviewSubTitle(self.driver, self.locator))
class CommunityLinkPreviewMessage(ChatElementByText): class CommunityLinkPreviewMessage(ChatElementByText):
def __init__(self, driver, text:str): def __init__(self, driver, text: str):
super().__init__(driver, text=text) super().__init__(driver, text=text)
self.locator+="//*[@text='%s']" % self.get_translation_by_key('community') self.locator += "//*[@text='%s']" % self.get_translation_by_key('community')
@property @property
def community_name(self) -> str: def community_name(self) -> str:
@ -402,6 +410,7 @@ class CommunityLinkPreviewMessage(ChatElementByText):
class CommunityMembers(SilentButton): class CommunityMembers(SilentButton):
def __init__(self, driver, parent_locator: str): def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/following-sibling::android.widget.TextView[3]") super().__init__(driver, prefix=parent_locator, xpath="/following-sibling::android.widget.TextView[3]")
members_string = CommunityMembers(self.driver, self.locator).text members_string = CommunityMembers(self.driver, self.locator).text
return int(re.search(r'\d+', members_string).group()) return int(re.search(r'\d+', members_string).group())
@ -409,18 +418,20 @@ class CommunityLinkPreviewMessage(ChatElementByText):
def view(self) -> object: def view(self) -> object:
class CommunityViewButton(SilentButton): class CommunityViewButton(SilentButton):
def __init__(self, driver, parent_locator: str): 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() CommunityViewButton(self.driver, self.locator).click()
CommunityView(self.driver).request_access_button.wait_for_element(20) CommunityView(self.driver).request_access_button.wait_for_element(20)
return CommunityView(self.driver) return CommunityView(self.driver)
class TransactionMessage(ChatElementByText): class TransactionMessage(ChatElementByText):
def __init__(self, driver, text:str, transaction_value): def __init__(self, driver, text: str, transaction_value):
super().__init__(driver, text=text) super().__init__(driver, text=text)
if transaction_value: 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 # Common statuses for incoming and outgoing transactions
self.address_requested = self.get_translation_by_key("address-requested") self.address_requested = self.get_translation_by_key("address-requested")
self.confirmed = self.get_translation_by_key("status-confirmed") self.confirmed = self.get_translation_by_key("status-confirmed")
@ -510,13 +521,15 @@ class PinnedMessagesOnProfileButton(Button):
class UnpinMessagePopUp(BaseElement): class UnpinMessagePopUp(BaseElement):
def __init__(self, driver): def __init__(self, driver):
#self.message_text = message_text # self.message_text = message_text
super().__init__(driver, translation_id="pin-limit-reached", suffix='/..') super().__init__(driver, translation_id="pin-limit-reached", suffix='/..')
def click_unpin_message_button(self): def click_unpin_message_button(self):
class UnpinMessageButton(Button): class UnpinMessageButton(Button):
def __init__(self, driver, parent_locator: str): 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() return UnpinMessageButton(self.driver, self.locator).click()
def message_text(self, text): 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.view_profile_by_avatar_button = Button(self.driver, accessibility_id="member-photo")
self.user_options = Button(self.driver, accessibility_id="options") self.user_options = Button(self.driver, accessibility_id="options")
self.open_in_status_button = OpenInStatusButton(self.driver) 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 # Chat input
self.chat_message_input = EditBox(self.driver, accessibility_id="chat-message-input") self.chat_message_input = EditBox(self.driver, accessibility_id="chat-message-input")
@ -564,7 +578,7 @@ class ChatView(BaseView):
self.history_start_icon = Button(self.driver, accessibility_id="history-chat") self.history_start_icon = Button(self.driver, accessibility_id="history-chat")
self.unpin_message_popup = UnpinMessagePopUp(self.driver) self.unpin_message_popup = UnpinMessagePopUp(self.driver)
#Stickers # Stickers
self.show_stickers_button = Button(self.driver, accessibility_id="show-stickers-icon") self.show_stickers_button = Button(self.driver, accessibility_id="show-stickers-icon")
self.get_stickers = Button(self.driver, translation_id="get-stickers") self.get_stickers = Button(self.driver, translation_id="get-stickers")
self.sticker_icon = Button(self.driver, accessibility_id="sticker-icon") self.sticker_icon = Button(self.driver, accessibility_id="sticker-icon")
@ -589,7 +603,7 @@ class ChatView(BaseView):
self.save_image_icon_button = Button(self.driver, accessibility_id="save-button") self.save_image_icon_button = Button(self.driver, accessibility_id="save-button")
self.image_in_android_messenger = Button(self.driver, accessibility_id="Image") self.image_in_android_messenger = Button(self.driver, accessibility_id="Image")
#Audio # Audio
self.audio_message_in_chat = Button(self.driver, accessibility_id="audio-message") self.audio_message_in_chat = Button(self.driver, accessibility_id="audio-message")
self.audio_message_button = Button(self.driver, accessibility_id="show-audio-message-icon") self.audio_message_button = Button(self.driver, accessibility_id="show-audio-message-icon")
self.record_audio_button = Button(self.driver, accessibility_id="start-stop-audio-recording-button") self.record_audio_button = Button(self.driver, accessibility_id="start-stop-audio-recording-button")
@ -650,13 +664,12 @@ class ChatView(BaseView):
self.create_community_button = Button(self.driver, translation_id="create-community") 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_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.community_description_edit_box = EditBox(self.driver, xpath='//android.widget.EditText[@text="%s"]' %
self.get_translation_by_key("give-a-short-description-community")) self.get_translation_by_key(
self.set_community_image_button = Button(self.driver, translation_id='community-thumbnail-image',suffix='/following-sibling::android.view.ViewGroup') "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") self.confirm_create_in_community_button = Button(self.driver, translation_id="create")
def get_outgoing_transaction(self, account=None, transaction_value=None) -> object: def get_outgoing_transaction(self, account=None, transaction_value=None) -> object:
if account is None: if account is None:
account = self.status_account_name account = self.status_account_name
@ -693,7 +706,6 @@ class ChatView(BaseView):
self.clear_history_button.click() self.clear_history_button.click()
self.clear_button.click() self.clear_button.click()
def leave_chat_via_group_info(self): def leave_chat_via_group_info(self):
self.driver.info("Leave group chat via group info") self.driver.info("Leave group chat via group info")
self.chat_options.click() self.chat_options.click()
@ -795,7 +807,7 @@ class ChatView(BaseView):
self.element_by_text_part(message_text).long_press_element() self.element_by_text_part(message_text).long_press_element()
self.element_by_translation_id("copy-to-clipboard").click() self.element_by_translation_id("copy-to-clipboard").click()
def quote_message(self, message = str): def quote_message(self, message=str):
self.driver.info("Quoting '%s' message" % message) self.driver.info("Quoting '%s' message" % message)
self.element_by_text_part(message).long_press_element() self.element_by_text_part(message).long_press_element()
self.reply_message_button.click() self.reply_message_button.click()
@ -812,16 +824,16 @@ class ChatView(BaseView):
self.chat_element_by_text(message).long_press_element() self.chat_element_by_text(message).long_press_element()
else: else:
self.element_by_text_part(message).long_press_element() self.element_by_text_part(message).long_press_element()
element = Button(self.driver, accessibility_id ='pick-emoji-%s' % key) element = Button(self.driver, accessibility_id='pick-emoji-%s' % key)
element.click() element.click()
element.wait_for_invisibility_of_element() element.wait_for_invisibility_of_element()
def view_profile_long_press(self, message = str): def view_profile_long_press(self, message=str):
self.chat_element_by_text(message).long_press_element() self.chat_element_by_text(message).long_press_element()
self.view_profile_by_avatar_button.click() self.view_profile_by_avatar_button.click()
self.profile_block_contact.wait_for_visibility_of_element(5) self.profile_block_contact.wait_for_visibility_of_element(5)
def wait_ens_name_resolved_in_chat(self, message = str, username_value = str): def wait_ens_name_resolved_in_chat(self, message=str, username_value=str):
self.driver.info("Waiting ENS name '%s' is resolved in chat" % username_value) self.driver.info("Waiting ENS name '%s' is resolved in chat" % username_value)
counter = 0 counter = 0
while True: while True:
@ -869,7 +881,7 @@ class ChatView(BaseView):
def search_user_in_mention_suggestion_list(self, username): def search_user_in_mention_suggestion_list(self, username):
return Button(self.driver, xpath="//*[@content-desc='suggestions-list']//*[@text='%s']" % username) return Button(self.driver, xpath="//*[@content-desc='suggestions-list']//*[@text='%s']" % username)
def select_mention_from_suggestion_list(self, username_in_list, typed_search_pattern = ''): def select_mention_from_suggestion_list(self, username_in_list, typed_search_pattern=''):
self.driver.info("Selecting '%s' from suggestion list by '%s'" % (username_in_list, typed_search_pattern)) self.driver.info("Selecting '%s' from suggestion list by '%s'" % (username_in_list, typed_search_pattern))
self.chat_message_input.set_value('@' + typed_search_pattern) self.chat_message_input.set_value('@' + typed_search_pattern)
self.chat_message_input.click() self.chat_message_input.click()
@ -898,7 +910,6 @@ class ChatView(BaseView):
chat_element.find_element() chat_element.find_element()
chat_element.member_photo.click() chat_element.member_photo.click()
def set_nickname(self, nickname, close_profile=True): def set_nickname(self, nickname, close_profile=True):
self.driver.info("Setting nickname:%s" % nickname) self.driver.info("Setting nickname:%s" % nickname)
self.profile_nickname_button.click() self.profile_nickname_button.click()
@ -909,16 +920,18 @@ class ChatView(BaseView):
def convert_device_time_to_chat_timestamp(self) -> list: def convert_device_time_to_chat_timestamp(self) -> list:
sent_time_object = dateutil.parser.parse(self.driver.device_time) 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') 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,
timestamps = list(map(lambda x : x.strftime("%I:%M %p"), possible_timestamps_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] final_timestamps = [t[1:] if t[0] == '0' else t for t in timestamps]
return final_timestamps return final_timestamps
def set_new_status(self, status='something is happening', image=False): 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_add_new_status_button.click_until_presence_of_element(self.timeline_my_status_editbox)
self.timeline_my_status_editbox.set_value(status) self.timeline_my_status_editbox.set_value(status)
@ -938,11 +951,11 @@ class ChatView(BaseView):
return transaction_message return transaction_message
def get_community_by_name(self, community_name: str): 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() community_button.click()
return CommunityView(self.driver) return CommunityView(self.driver)
@staticmethod @staticmethod
def get_resolved_chat_key(username, chat_key): def get_resolved_chat_key(username, chat_key):
return '%s%s%s' % (username, chat_key[:6], chat_key[-4:]) 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.base_view import BaseView
from views.home_view import ChatElement from views.home_view import ChatElement
class DiscoverDappsButton(Button): class DiscoverDappsButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, translation_id="open-dapp-store") 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) self.click_until_presence_of_element(BaseWebView(self.driver).browser_refresh_page_button)
return self.navigate() return self.navigate()
class EditUrlEditbox(EditBox): class EditUrlEditbox(EditBox):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, xpath="(//android.widget.TextView)[1]") super().__init__(driver, xpath="(//android.widget.TextView)[1]")

View File

@ -13,11 +13,13 @@ class ChatButton(Button):
from views.chat_view import ChatView from views.chat_view import ChatView
return ChatView(self.driver) return ChatView(self.driver)
class ChatElement(SilentButton): class ChatElement(SilentButton):
def __init__(self, driver, username_part, community=False): def __init__(self, driver, username_part, community=False):
self.username = username_part self.username = username_part
self.community = community 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): def navigate(self):
if self.community: if self.community:
@ -81,10 +83,12 @@ class ChatElement(SilentButton):
return ChatImage(self.driver) return ChatImage(self.driver)
class ActivityCenterChatElement(SilentButton): class ActivityCenterChatElement(SilentButton):
def __init__(self, driver, chat_name): def __init__(self, driver, chat_name):
self.chat_name = 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): def navigate(self):
from views.chat_view import ChatView from views.chat_view import ChatView
@ -117,12 +121,15 @@ class ActivityCenterChatElement(SilentButton):
def chat_name_indicator_text(self): def chat_name_indicator_text(self):
class ChatNameIndicatorText(BaseElement): class ChatNameIndicatorText(BaseElement):
def __init__(self, driver, parent_locator: str): 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: try:
return ChatNameIndicatorText(self.driver, self.locator).text return ChatNameIndicatorText(self.driver, self.locator).text
except NoSuchElementException: except NoSuchElementException:
return '' return ''
class PushNotificationElement(SilentButton): class PushNotificationElement(SilentButton):
def __init__(self, driver, pn_text): def __init__(self, driver, pn_text):
self.pn_text = pn_text self.pn_text = pn_text
@ -150,12 +157,12 @@ class PushNotificationElement(SilentButton):
def group_chat_icon(self): def group_chat_icon(self):
class GroupChatIconElement(BaseElement): class GroupChatIconElement(BaseElement):
def __init__(self, driver, parent_locator): 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) return GroupChatIconElement(self.driver, self.locator)
class HomeView(BaseView): class HomeView(BaseView):
def __init__(self, driver): def __init__(self, driver):
super().__init__(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.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.invite_friends_button = Button(self.driver, accessibility_id="invite-friends-button")
self.stop_status_service_button = Button(self.driver, accessibility_id="STOP") 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") self.communities_button = ChatButton(self.driver, accessibility_id="communities-button")
# Notification centre # Notification centre
@ -177,7 +185,8 @@ class HomeView(BaseView):
self.notifications_select_button = Button(self.driver, translation_id="select") self.notifications_select_button = Button(self.driver, translation_id="select")
self.notifications_reject_and_delete_button = Button(self.driver, accessibility_id="reject-and-delete" self.notifications_reject_and_delete_button = Button(self.driver, accessibility_id="reject-and-delete"
"-activity-center") "-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[" self.notifications_select_all = Button(self.driver, xpath="(//android.widget.CheckBox["
"@content-desc='checkbox'])[1]") "@content-desc='checkbox'])[1]")
@ -238,7 +247,8 @@ class HomeView(BaseView):
return chat_element return chat_element
def get_username_below_start_new_chat_button(self, username_part): 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=''): 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) self.driver.info("## Starting 1-1 chat, add in contacts:%s" % str(add_in_contacts), device=False)

View File

@ -48,9 +48,9 @@ class KeycardView(BaseView):
def get_seed_phrase(self): def get_seed_phrase(self):
recovery_phrase = dict() recovery_phrase = dict()
for i in range(0,12): for i in range(0, 12):
word = self.get_recovery_word(i) word = self.get_recovery_word(i)
recovery_phrase[str(i+1)] = word recovery_phrase[str(i + 1)] = word
return recovery_phrase return recovery_phrase
def backup_seed_phrase(self): def backup_seed_phrase(self):

View File

@ -8,6 +8,7 @@ class OptionsButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, xpath="(//android.view.ViewGroup[@content-desc='icon'])[2]") super().__init__(driver, xpath="(//android.view.ViewGroup[@content-desc='icon'])[2]")
class AddNewContactButton(Button): class AddNewContactButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, accessibility_id="add-new-contact-button") super().__init__(driver, accessibility_id="add-new-contact-button")
@ -39,6 +40,7 @@ class LogoutDialog(BaseView):
from views.sign_in_view import SignInView from views.sign_in_view import SignInView
return SignInView(self.driver) return SignInView(self.driver)
class ENSusernames(Button): class ENSusernames(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, translation_id="ens-usernames") super().__init__(driver, translation_id="ens-usernames")
@ -51,6 +53,7 @@ class ENSusernames(Button):
self.scroll_to_element().click() self.scroll_to_element().click()
return self.navigate() return self.navigate()
class AdvancedButton(Button): class AdvancedButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, accessibility_id="advanced-button") super().__init__(driver, accessibility_id="advanced-button")
@ -74,6 +77,7 @@ class RecoveryPhraseTable(Text):
super().__init__(driver, translation_id="your-recovery-phrase", super().__init__(driver, translation_id="your-recovery-phrase",
suffix="/following-sibling::android.view.ViewGroup[1]/android.widget.TextView") suffix="/following-sibling::android.view.ViewGroup[1]/android.widget.TextView")
class RecoveryPhraseWordNumberText(Text): class RecoveryPhraseWordNumberText(Text):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, xpath="//*[contains(@text,'#')]") super().__init__(driver, xpath="//*[contains(@text,'#')]")
@ -113,7 +117,7 @@ class MailServerElement(Button):
def click(self): def click(self):
size = self.driver.get_window_size() size = self.driver.get_window_size()
self.driver.swipe(500, size["height"]*0.8, 500, size["height"]*0.05) self.driver.swipe(500, size["height"] * 0.8, 500, size["height"] * 0.05)
self.find_element().click() self.find_element().click()
@ -164,6 +168,7 @@ class ProfilePictureElement(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, accessibility_id="chat-icon") super().__init__(driver, accessibility_id="chat-icon")
class KeycardButton(Button): class KeycardButton(Button):
def navigate(self): def navigate(self):
@ -175,7 +180,6 @@ class KeycardButton(Button):
return self.navigate() return self.navigate()
class ProfileView(BaseView): class ProfileView(BaseView):
def __init__(self, driver): def __init__(self, driver):
@ -249,7 +253,7 @@ class ProfileView(BaseView):
suffix="/following-sibling::android.widget.Switch[1]") suffix="/following-sibling::android.widget.Switch[1]")
self.ask_me_when_on_mobile_network = Button(self.driver, translation_id="mobile-network-ask-me", self.ask_me_when_on_mobile_network = Button(self.driver, translation_id="mobile-network-ask-me",
suffix="/following-sibling::android.widget.Switch[1]") suffix="/following-sibling::android.widget.Switch[1]")
##Sync history data ## Sync history data
self.sync_history_for_button = Button(self.driver, accessibility_id="default-sync-period-button") self.sync_history_for_button = Button(self.driver, accessibility_id="default-sync-period-button")
## History nodes ## History nodes
self.mail_server_button = Button(self.driver, accessibility_id="offline-messages-settings-button") self.mail_server_button = Button(self.driver, accessibility_id="offline-messages-settings-button")
@ -261,7 +265,9 @@ class ProfileView(BaseView):
self.use_history_node_button = Button(self.driver, translation_id="offline-messaging-use-history-nodes", self.use_history_node_button = Button(self.driver, translation_id="offline-messaging-use-history-nodes",
suffix="/following-sibling::*[1]") suffix="/following-sibling::*[1]")
self.mail_server_delete_button = Button(self.driver, accessibility_id="mailserver-delete-button") 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 ## Device syncing
self.devices_button = Button(self.driver, accessibility_id="pairing-settings-button") self.devices_button = Button(self.driver, accessibility_id="pairing-settings-button")
self.device_name_input = EditBox(self.driver, accessibility_id="device-name") self.device_name_input = EditBox(self.driver, accessibility_id="device-name")
@ -270,26 +276,32 @@ class ProfileView(BaseView):
self.advertise_device_button = Button(self.driver, accessibility_id="advertise-device") self.advertise_device_button = Button(self.driver, accessibility_id="advertise-device")
self.sync_all_button = Button(self.driver, translation_id="sync-all-devices") self.sync_all_button = Button(self.driver, translation_id="sync-all-devices")
#Keycard # Keycard
self.keycard_button = Button(self.driver, accessibility_id="keycard-button") self.keycard_button = Button(self.driver, accessibility_id="keycard-button")
self.change_pin_button = KeycardButton(self.driver, translation_id="change-pin") self.change_pin_button = KeycardButton(self.driver, translation_id="change-pin")
self.change_puk_button = KeycardButton(self.driver, translation_id="change-puk") self.change_puk_button = KeycardButton(self.driver, translation_id="change-puk")
self.change_pairing_code_button = KeycardButton(self.driver, translation_id="change-pairing") self.change_pairing_code_button = KeycardButton(self.driver, translation_id="change-pairing")
self.create_keycard_backup_button = KeycardButton(self.driver, translation_id="keycard-backup") self.create_keycard_backup_button = KeycardButton(self.driver, translation_id="keycard-backup")
# Advanced # Advanced
self.advanced_button = AdvancedButton(self.driver) self.advanced_button = AdvancedButton(self.driver)
## Network ## Network
self.network_settings_button = Button(self.driver, accessibility_id="network-button") 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.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.ropsten_chain_button = Button(self.driver, translation_id="ropsten-network")
self.custom_network_url_input = EditBox(self.driver, translation_id="rpc-url", self.custom_network_url_input = EditBox(self.driver, translation_id="rpc-url",
suffix="/following-sibling::*[1]/android.widget.EditText") 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", self.specify_name_input = EditBox(self.driver, translation_id="name",
suffix="/following-sibling::*[1]/android.widget.EditText") suffix="/following-sibling::*[1]/android.widget.EditText")
self.connect_button = Button(self.driver, accessibility_id="network-connect-button") 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 ## Log level
self.log_level_setting_button = Button(self.driver, accessibility_id="log-level-settings-button") self.log_level_setting_button = Button(self.driver, accessibility_id="log-level-settings-button")
## Fleet ## Fleet
@ -300,13 +312,16 @@ class ProfileView(BaseView):
self.enable_bootnodes = Button(self.driver, xpath="//android.widget.Switch") self.enable_bootnodes = Button(self.driver, xpath="//android.widget.Switch")
self.add_bootnode_button = Button(self.driver, accessibility_id="add-bootnode") self.add_bootnode_button = Button(self.driver, accessibility_id="add-bootnode")
#Need help # Need help
self.help_button = HelpButton(self.driver) self.help_button = HelpButton(self.driver)
self.submit_bug_button = Button(self.driver, accessibility_id="submit-bug-button") 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.request_a_feature_button = Button(self.driver, accessibility_id="request-a-feature-button")
self.faq_button = FaqButton(self.driver) self.faq_button = FaqButton(self.driver)
#About # About
self.about_button = AboutButton(self.driver) self.about_button = AboutButton(self.driver)
self.privacy_policy_button = PrivacyPolicyButton(self.driver) self.privacy_policy_button = PrivacyPolicyButton(self.driver)
self.terms_of_use_button = TermsOfUseButton(self.driver) self.terms_of_use_button = TermsOfUseButton(self.driver)
@ -314,7 +329,7 @@ class ProfileView(BaseView):
self.node_version_text = Text(self.driver, self.node_version_text = Text(self.driver,
xpath="//*[@content-desc='node-version']//android.widget.TextView[2]") xpath="//*[@content-desc='node-version']//android.widget.TextView[2]")
#Logout # Logout
self.logout_button = LogoutButton(self.driver) self.logout_button = LogoutButton(self.driver)
self.logout_dialog = LogoutDialog(self.driver) self.logout_dialog = LogoutDialog(self.driver)
self.confirm_logout_button = Button(self.driver, translation_id="logout", uppercase=True) self.confirm_logout_button = Button(self.driver, translation_id="logout", uppercase=True)
@ -338,8 +353,8 @@ class ProfileView(BaseView):
from views.chat_view import ChatView from views.chat_view import ChatView
return ChatView(self.driver) return ChatView(self.driver)
def add_custom_network(self, rpc_url ='https://ropsten.infura.io/v3/f315575765b14720b32382a61a89341a', 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.driver.info("## Add predefined custom network", device=False)
self.advanced_button.click() self.advanced_button.click()
self.network_settings_button.scroll_to_element() 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.plus_button.click_until_presence_of_element(self.ropsten_chain_button)
self.custom_network_url_input.send_keys(rpc_url) self.custom_network_url_input.send_keys(rpc_url)
self.specify_name_input.send_keys(name) 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.scroll_to_element()
self.ropsten_chain_button.click() self.ropsten_chain_button.click()
self.ropsten_chain_button.click() self.ropsten_chain_button.click()
@ -378,7 +394,7 @@ class ProfileView(BaseView):
self.driver.info("## Seed phrase is backed up!", device=False) self.driver.info("## Seed phrase is backed up!", device=False)
return recovery_phrase return recovery_phrase
def edit_profile_picture(self, file_name: str, update_by = "Gallery"): def edit_profile_picture(self, file_name: str, update_by="Gallery"):
self.driver.info("## Setting custom profile image", device=False) self.driver.info("## Setting custom profile image", device=False)
if not AbstractTestCase().environment == 'sauce': if not AbstractTestCase().environment == 'sauce':
raise NotImplementedError('Test case is implemented to run on SauceLabs only') raise NotImplementedError('Test case is implemented to run on SauceLabs only')
@ -397,7 +413,6 @@ class ProfileView(BaseView):
self.crop_photo_button.click() self.crop_photo_button.click()
self.driver.info("## Custom profile image has been set", device=False) self.driver.info("## Custom profile image has been set", device=False)
def take_photo(self): def take_photo(self):
self.take_photo_button.click() self.take_photo_button.click()
if self.allow_button.is_element_displayed(sec=5): if self.allow_button.is_element_displayed(sec=5):
@ -418,7 +433,6 @@ class ProfileView(BaseView):
self.element_by_text(element_text).click() self.element_by_text(element_text).click()
image_full_content.click() image_full_content.click()
def logout(self): def logout(self):
self.driver.info("Logging out") self.driver.info("Logging out")
self.logout_button.click() self.logout_button.click()
@ -433,7 +447,8 @@ class ProfileView(BaseView):
def get_toggle_device_by_name(self, device_name): def get_toggle_device_by_name(self, device_name):
self.driver.info("Selecting device '%s' for sync" % 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): def discover_and_advertise_device(self, device_name):
self.driver.info("Discovering and advertising '%s'" % 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_element import Button, EditBox
from views.base_view import BaseView from views.base_view import BaseView
class AmountEditBox(EditBox, Button): class AmountEditBox(EditBox, Button):
def __init__(self, driver): def __init__(self, driver):
super(AmountEditBox, self).__init__(driver, accessibility_id="amount-input") super(AmountEditBox, self).__init__(driver, accessibility_id="amount-input")
@ -21,7 +22,6 @@ class ChooseRecipientButton(Button):
return self.navigate() return self.navigate()
class UpdateFeeButton(Button): class UpdateFeeButton(Button):
def __init__(self, driver): def __init__(self, driver):
super(UpdateFeeButton, self).__init__(driver, translation_id="update") super(UpdateFeeButton, self).__init__(driver, translation_id="update")
@ -35,7 +35,8 @@ class UpdateFeeButton(Button):
class ValidationErrorOnSendTransaction(Button): class ValidationErrorOnSendTransaction(Button):
def __init__(self, driver, field): 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): class NotEnoughEthForGas(Text):
@ -50,7 +51,9 @@ class ValidationWarnings(object):
class SignWithKeycardButton(Button): class SignWithKeycardButton(Button):
def __init__(self, driver): 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): def navigate(self):
from views.keycard_view import KeycardView 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.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.enter_recipient_address_input = EditBox(self.driver, accessibility_id="recipient-address-input")
self.first_recipient_button = Button(self.driver, accessibility_id="chat-icon") 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.recent_recipients_button = Button(self.driver, translation_id="recent-recipients")
self.amount_edit_box = AmountEditBox(self.driver) self.amount_edit_box = AmountEditBox(self.driver)
self.set_max_button = Button(self.driver, translation_id="set-max") 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 # Network fee elements
self.network_fee_button = Button(self.driver, accessibility_id="custom-gas-fee") 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.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_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.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.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_transaction_button = Button(self.driver, accessibility_id="send-transaction-bottom-sheet")
self.sign_with_keycard_button = SignWithKeycardButton(self.driver) self.sign_with_keycard_button = SignWithKeycardButton(self.driver)
self.sign_with_password = Button(self.driver, translation_id="sign-with-password") 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.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.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") 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_name_input = EditBox(self.driver, accessibility_id="fav-name")
self.new_favorite_add_favorite = Button(self.driver, accessibility_id="add-fav") 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): def set_recipient_address(self, address):
self.driver.info("Setting recipient address to '%s'" % 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.driver.info("## Transaction is signed!", device=False)
self.ok_button.click() self.ok_button.click()
@staticmethod @staticmethod
def get_formatted_recipient_address(address): def get_formatted_recipient_address(address):
return address[:6] + '' + address[-4:] return address[:6] + '' + address[-4:]
def get_username_in_transaction_bottom_sheet_button(self, username_part): 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) 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): 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) 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'): def get_validation_icon(self, field='Network fee'):
return ValidationErrorOnSendTransaction(self.driver, field) return ValidationErrorOnSendTransaction(self.driver, field)
@ -170,7 +181,6 @@ class SendTransactionView(BaseView):
self.driver.info("Getting network fee from send transaction bottom sheet") 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] return Text(self.driver, xpath="//*[@content-desc='custom-gas-fee']/android.widget.TextView[1]").text[0:-9]
def add_to_favorites(self, name): def add_to_favorites(self, name):
self.driver.info("Adding '%s' to favorite recipients" % name) self.driver.info("Adding '%s' to favorite recipients" % name)
self.recipient_add_to_favorites.click() 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_element import Button, EditBox, Text
from views.base_view import BaseView from views.base_view import BaseView
class MultiAccountButton(Button): class MultiAccountButton(Button):
class Username(Text): class Username(Text):
def __init__(self, driver, locator_value): def __init__(self, driver, locator_value):
super(MultiAccountButton.Username, self).__init__(driver, super(MultiAccountButton.Username, self).__init__(driver,
xpath="%s//android.widget.TextView[@content-desc='username']" % locator_value) xpath="%s//android.widget.TextView[@content-desc='username']" % locator_value)
def __init__(self, driver, position=1): def __init__(self, driver, position=1):
super(MultiAccountButton, self).__init__(driver, super(MultiAccountButton, self).__init__(driver,
xpath="//*[@content-desc='select-account-button-%s']" % position) xpath="//*[@content-desc='select-account-button-%s']" % position)
@ -106,7 +108,7 @@ class TermsOfUseLink(Button):
try: try:
self.click_inside_element_by_coordinate(times_to_click=2) self.click_inside_element_by_coordinate(times_to_click=2)
counter += 1 counter += 1
except (NoSuchElementException): except NoSuchElementException:
return self.navigate() return self.navigate()
self.driver.info('Click on link %s' % self.name) self.driver.info('Click on link %s' % self.name)
return self.navigate() return self.navigate()
@ -144,7 +146,7 @@ class SignInView(BaseView):
self.get_keycard_banner = Button(self.driver, translation_id="get-a-keycard") self.get_keycard_banner = Button(self.driver, translation_id="get-a-keycard")
self.accept_tos_checkbox = Button(self.driver, xpath="//android.widget.CheckBox[@content-desc='checkbox']") self.accept_tos_checkbox = Button(self.driver, xpath="//android.widget.CheckBox[@content-desc='checkbox']")
#keycard recovery # keycard recovery
self.recover_with_keycard_button = Button(self.driver, accessibility_id="recover-with-keycard-button") self.recover_with_keycard_button = Button(self.driver, accessibility_id="recover-with-keycard-button")
self.begin_recovery_button = BeginRecoveryButton(self.driver) self.begin_recovery_button = BeginRecoveryButton(self.driver)
self.pair_to_this_device_button = Button(self.driver, translation_id="pair-card") self.pair_to_this_device_button = Button(self.driver, translation_id="pair-card")
@ -171,7 +173,8 @@ class SignInView(BaseView):
self.cancel_custom_seed_phrase_button = Button(self.driver, accessibility_id="cancel-custom-seed-phrase") 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): 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: if not second_user:
self.accept_tos_checkbox.click() self.accept_tos_checkbox.click()
self.get_started_button.click_until_presence_of_element(self.generate_key_button) 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) self.driver.info("## New multiaccount is created successfully!", device=False)
return self.get_home_view() 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) self.driver.info("## Recover access(password:%s, keycard:%s)" % (password, str(keycard)), device=False)
if not second_user: if not second_user:
self.accept_tos_checkbox.click() self.accept_tos_checkbox.click()
@ -250,7 +254,6 @@ class SignInView(BaseView):
self.driver.info("## Signed in successfully!", device=False) self.driver.info("## Signed in successfully!", device=False)
return self.get_home_view() return self.get_home_view()
def get_multiaccount_by_position(self, position: int, element_class=MultiAccountOnLoginButton): def get_multiaccount_by_position(self, position: int, element_class=MultiAccountOnLoginButton):
account_button = element_class(self.driver, position) account_button = element_class(self.driver, position)
if account_button.is_element_displayed(): 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.multi_account_on_login_button.wait_for_visibility_of_element(30)
self.get_multiaccount_by_position(1).click() self.get_multiaccount_by_position(1).click()
self.password_input.set_value(common_password) 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.options_button.click()
self.element_by_text('Import unencrypted').click() self.element_by_text('Import unencrypted').click()
self.element_by_text('Import unencrypted').wait_for_invisibility_of_element(40) 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): class OptionsButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, xpath="(//android.widget.ImageView[@content-desc='icon'])[2]") super().__init__(driver, xpath="(//android.widget.ImageView[@content-desc='icon'])[2]")
def click(self): def click(self):
self.click_until_presence_of_element(OptionsButton.CopyTransactionHashButton(self.driver)) self.click_until_presence_of_element(OptionsButton.CopyTransactionHashButton(self.driver))
@ -17,6 +18,7 @@ class OptionsButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, translation_id="open-on-etherscan") super().__init__(driver, translation_id="open-on-etherscan")
class TransactionTable(BaseElement): class TransactionTable(BaseElement):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, xpath="//android.widget.ScrollView") super().__init__(driver, xpath="//android.widget.ScrollView")
@ -78,7 +80,6 @@ class TransactionTable(BaseElement):
self.driver.info('Finding transaction by index %s' % index) self.driver.info('Finding transaction by index %s' % index)
return self.TransactionElement.by_index(self.driver, index=index) return self.TransactionElement.by_index(self.driver, index=index)
def transaction_by_amount(self, amount: str, asset): def transaction_by_amount(self, amount: str, asset):
self.driver.info('Finding transaction by amount %s' % amount) self.driver.info('Finding transaction by amount %s' % amount)
return self.TransactionElement.by_amount(self.driver, amount=amount.replace(',', '.'), asset=asset) return self.TransactionElement.by_amount(self.driver, amount=amount.replace(',', '.'), asset=asset)
@ -92,13 +93,14 @@ class TransactionTable(BaseElement):
except NoSuchElementException: except NoSuchElementException:
from views.base_view import BaseView from views.base_view import BaseView
BaseView(self.driver).pull_to_refresh() BaseView(self.driver).pull_to_refresh()
self.driver.fail('Transaction %s %s was not found on Wallet/Transaction screen' %(amount, asset)) self.driver.fail('Transaction %s %s was not found on Wallet/Transaction screen' % (amount, asset))
def get_transactions_number(self): def get_transactions_number(self):
element = self.TransactionElement(self.driver) element = self.TransactionElement(self.driver)
element.locator = '//android.view.ViewGroup[@content-desc="transaction-item"]' element.locator = '//android.view.ViewGroup[@content-desc="transaction-item"]'
return len(element.wait_for_elements()) return len(element.wait_for_elements())
class TransactionsView(BaseView): class TransactionsView(BaseView):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver) super().__init__(driver)

View File

@ -21,6 +21,7 @@ class AssetCheckBox(SilentButton):
def click(self): def click(self):
self.scroll_to_element(12).click() self.scroll_to_element(12).click()
class BackupRecoveryPhrase(Button): class BackupRecoveryPhrase(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, translation_id="wallet-backup-recovery-title") super().__init__(driver, translation_id="wallet-backup-recovery-title")
@ -29,6 +30,7 @@ class BackupRecoveryPhrase(Button):
from views.profile_view import ProfileView from views.profile_view import ProfileView
return ProfileView(self.driver) return ProfileView(self.driver)
class AccountElementButton(SilentButton): class AccountElementButton(SilentButton):
def __init__(self, driver, account_name): def __init__(self, driver, account_name):
super().__init__(driver, xpath="//*[@content-desc='accountcard%s']" % account_name) super().__init__(driver, xpath="//*[@content-desc='accountcard%s']" % account_name)
@ -48,6 +50,15 @@ class SendTransactionButton(Button):
return SendTransactionView(self.driver) 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): class ReceiveTransactionButton(Button):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver, translation_id="receive") super().__init__(driver, translation_id="receive")
@ -73,7 +84,7 @@ class AccountColorButton(Button):
def select_color_by_position(self, position: int): def select_color_by_position(self, position: int):
self.click() self.click()
self.driver.find_element_by_xpath( self.driver.find_element_by_xpath(
"((//android.widget.ScrollView)[1]/*/*)[%s]" % str(position+1)).click() "((//android.widget.ScrollView)[1]/*/*)[%s]" % str(position + 1)).click()
class WalletView(BaseView): class WalletView(BaseView):
@ -81,6 +92,7 @@ class WalletView(BaseView):
super().__init__(driver) super().__init__(driver)
self.send_transaction_button = SendTransactionButton(self.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.transaction_history_button = TransactionHistoryButton(self.driver)
self.usd_total_value = Text(self.driver, accessibility_id="total-amount-value-text") 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_assets_button = Button(self.driver, accessibility_id="wallet-manage-assets")
self.manage_accounts_button = Button(self.driver, accessibility_id="wallet-manage-accounts") 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.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.stt_check_box = Button(self.driver,
self.all_assets_full_names = Text(self.driver, xpath="//*[@content-desc='checkbox']/../android.widget.TextView[1]") xpath="//*[@text='STT']/../android.view.ViewGroup[@content-desc='checkbox']")
self.all_assets_symbols = Button(self.driver, xpath="//*[@content-desc='checkbox']/../android.widget.TextView[2]") 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.currency_item_text = Text(self.driver, xpath="//*[@content-desc='currency-item']//android.widget.TextView")
self.address_text = Text(self.driver, accessibility_id="address-text") 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.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.currency_text = Text(self.driver, accessibility_id="total-amount-currency-text")
self.backup_recovery_phrase = BackupRecoveryPhrase(self.driver) 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) self.add_custom_token_button = AddCustomTokenButton(self.driver)
@ -121,13 +137,15 @@ class WalletView(BaseView):
self.enter_your_password_input = EditBox(self.driver, accessibility_id="add-account-enter-password") 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_name_input = EditBox(self.driver, accessibility_id="enter-account-name")
self.account_color_button = AccountColorButton(self.driver) 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.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.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") self.hide_account_button = Button(self.driver, accessibility_id="hide-account-button")
#collectibles # collectibles
self.collectibles_button = Button(self.driver, translation_id="wallet-collectibles") self.collectibles_button = Button(self.driver, translation_id="wallet-collectibles")
self.nft_asset_button = Button(self.driver, accessibility_id="nft-asset") self.nft_asset_button = Button(self.driver, accessibility_id="nft-asset")
self.set_collectible_as_profile_photo_button = Button(self.driver, accessibility_id="set-nft-as-pfp") self.set_collectible_as_profile_photo_button = Button(self.driver, accessibility_id="set-nft-as-pfp")
@ -136,10 +154,11 @@ class WalletView(BaseView):
# individual account settings # individual account settings
self.account_settings_button = Button(self.driver, translation_id="account-settings") self.account_settings_button = Button(self.driver, translation_id="account-settings")
self.apply_settings_button = Button(self.driver, translation_id="apply") 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") 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): def wait_balance_is_equal_expected_amount(self, asset='ETH', expected_balance=0.1, wait_time=300):
counter = 0 counter = 0
while True: while True:
if counter >= wait_time: if counter >= wait_time:
@ -148,35 +167,38 @@ class WalletView(BaseView):
counter += 10 counter += 10
time.sleep(10) time.sleep(10)
self.swipe_down() 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: else:
self.driver.info('**Balance for %s is equal to %s**' % (asset, expected_balance)) self.driver.info('**Balance for %s is equal to %s**' % (asset, expected_balance))
return return
def wait_balance_is_changed(self, asset ='ETH', initial_balance=0, wait_time=400, scan_tokens=False): 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 counter = 0
while True: while True:
if counter >= wait_time: if counter >= wait_time:
self.driver.fail('Balance %s %s is not changed during %s seconds!' % (asset, initial_balance,wait_time)) self.driver.fail(
elif self.asset_by_name(asset).is_element_present() and self.get_asset_amount_by_name(asset) == initial_balance: '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: if scan_tokens:
self.scan_tokens() self.scan_tokens()
if (counter/60).is_integer(): if (counter / 60).is_integer():
self.pull_to_refresh() self.pull_to_refresh()
counter+=20 counter += 20
counter += 10 counter += 10
time.sleep(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): elif not self.asset_by_name(asset).is_element_present(10):
if scan_tokens: if scan_tokens:
self.scan_tokens() self.scan_tokens()
self.swipe_up() self.swipe_up()
counter += 10 counter += 10
time.sleep(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: else:
self.driver.info('**Balance is updated!**') self.driver.info('Balance is updated!')
self.wallet_button.double_click() self.wallet_button.double_click()
self.element_by_translation_id("wallet-total-value").scroll_to_element(direction='up') self.element_by_translation_id("wallet-total-value").scroll_to_element(direction='up')
return self return self
@ -184,7 +206,6 @@ class WalletView(BaseView):
def get_sign_in_phrase(self): def get_sign_in_phrase(self):
return ' '.join([element.text for element in self.sign_in_phrase.find_elements()]) return ' '.join([element.text for element in self.sign_in_phrase.find_elements()])
def set_up_wallet_when_sending_tx(self): def set_up_wallet_when_sending_tx(self):
self.driver.info("Setting up wallet") self.driver.info("Setting up wallet")
phrase = self.sign_in_phrase.text phrase = self.sign_in_phrase.text
@ -201,10 +222,9 @@ class WalletView(BaseView):
return address return address
def wallet_account_by_name(self, account_name): 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) return AccountElementButton(self.driver, account_name)
def get_asset_amount_by_name(self, asset: str): def get_asset_amount_by_name(self, asset: str):
self.driver.info("Getting %s amount" % asset) self.driver.info("Getting %s amount" % asset)
asset_value = SilentButton(self.driver, xpath="//android.view.ViewGroup[@content-desc=':%s-asset-value']" asset_value = SilentButton(self.driver, xpath="//android.view.ViewGroup[@content-desc=':%s-asset-value']"
@ -231,16 +251,16 @@ class WalletView(BaseView):
def get_account_options_from_main_screen(self, account_name=''): def get_account_options_from_main_screen(self, account_name=''):
account_name = self.status_account_name if not account_name else 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) 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=''): def hidden_account_by_name_button(self, account_name=''):
return SilentButton(self.driver, return SilentButton(self.driver,
xpath="//*[@text='%s']/following-sibling::*[@content-desc='hide-icon']"% account_name) xpath="//*[@text='%s']/following-sibling::*[@content-desc='hide-icon']" % account_name)
def show_account_by_name_button(self, account_name=''): def show_account_by_name_button(self, account_name=''):
return SilentButton(self.driver, return SilentButton(self.driver,
xpath="//*[@text='%s']/following-sibling::*[@content-desc='show-icon']"% account_name) xpath="//*[@text='%s']/following-sibling::*[@content-desc='show-icon']" % account_name)
def select_asset(self, *args): def select_asset(self, *args):
self.driver.info("Selecting asset(s)") self.driver.info("Selecting asset(s)")
@ -273,30 +293,32 @@ class WalletView(BaseView):
def send_transaction(self, **kwargs): def send_transaction(self, **kwargs):
self.driver.info("## Sending transaction", device=False) self.driver.info("## Sending transaction", device=False)
send_transaction_view = self.send_transaction_button.click() send_tx = self.send_transaction_from_main_screen.click() if kwargs.get('from_main_wallet',
send_transaction_view.select_asset_button.click() True) else self.send_transaction_button.click()
send_tx.select_asset_button.click()
asset_name = kwargs.get('asset_name', 'ETH').upper() asset_name = kwargs.get('asset_name', 'ETH').upper()
asset_button = send_transaction_view.asset_by_name(asset_name) asset_button = send_tx.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) send_tx.select_asset_button.click_until_presence_of_element(
send_tx.eth_asset_in_select_asset_bottom_sheet_button)
asset_button.click() 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'): if kwargs.get('account_name'):
send_transaction_view.chose_recipient_button.click() send_tx.chose_recipient_button.click()
send_transaction_view.accounts_button.click() send_tx.accounts_button.click()
send_transaction_view.element_by_text(kwargs.get('account_name')).click() send_tx.element_by_text(kwargs.get('account_name')).click()
else: else:
send_transaction_view.set_recipient_address(kwargs.get('recipient')) send_tx.set_recipient_address(kwargs.get('recipient'))
if kwargs.get('sign_transaction', True): 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(): if self.sign_in_phrase.is_element_displayed():
self.set_up_wallet_when_sending_tx() 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)) 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): def find_transaction_in_history(self, amount, asset='ETH', account_name=None, return_hash=False):
if account_name is None: if account_name is None:
@ -314,7 +336,6 @@ class WalletView(BaseView):
result = TransactionTable.TransactionElement.TransactionDetailsView(self.driver).get_transaction_hash() result = TransactionTable.TransactionElement.TransactionDetailsView(self.driver).get_transaction_hash()
return result return result
def set_currency(self, desired_currency='EUR'): def set_currency(self, desired_currency='EUR'):
self.driver.info("Setting '%s' currency" % desired_currency) self.driver.info("Setting '%s' currency" % desired_currency)
self.multiaccount_more_options.click_until_presence_of_element(self.set_currency_button) self.multiaccount_more_options.click_until_presence_of_element(self.set_currency_button)
@ -344,4 +365,4 @@ class WalletView(BaseView):
def get_collectibles_amount(self, collectibles='CryptoKitties'): def get_collectibles_amount(self, collectibles='CryptoKitties'):
self.driver.info("Getting '%s' Collectibles amount" % collectibles) self.driver.info("Getting '%s' Collectibles amount" % collectibles)
return Text(self.driver,xpath="//*[@text='%s']//following-sibling::android.widget.TextView" % collectibles) return Text(self.driver, xpath="//*[@text='%s']//following-sibling::android.widget.TextView" % collectibles)

View File

@ -3,6 +3,7 @@ import time
from views.base_element import EditBox, Button, BaseElement from views.base_element import EditBox, Button, BaseElement
from views.base_view import BaseView from views.base_view import BaseView
class BaseWebView(BaseView): class BaseWebView(BaseView):
def __init__(self, driver): def __init__(self, driver):
@ -10,7 +11,8 @@ class BaseWebView(BaseView):
self.progress_bar_icon = Button(self.driver, xpath="//android.widget.ProgressBar") 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.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.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") 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() self.close_all_button.click()
else: else:
self.driver.info("**Removing '%s' from recent websites**") 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.scroll_to_element()
close_button.click() close_button.click()
@ -82,4 +85,3 @@ class BaseWebView(BaseView):
bookmark_name = self.bookmark_name_input.text bookmark_name = self.bookmark_name_input.text
self.save_bookmark_button.click() self.save_bookmark_button.click()
return bookmark_name return bookmark_name

View File

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