e2e: refactoring commands, wait for balance, find trans

Signed-off-by: Churikova Tetiana <churikova.tm@gmail.com>
This commit is contained in:
Churikova Tetiana 2021-02-04 13:51:01 +01:00
parent 39b0a6bb44
commit 7e8a68ec67
No known key found for this signature in database
GPG Key ID: 0D4EA7B33B47E6D8
16 changed files with 309 additions and 266 deletions

4
.gitignore vendored
View File

@ -165,3 +165,7 @@ trace.edn
/app/ /app/
project.clj project.clj
##appium
test/appium/report/
result.xml

View File

@ -4,7 +4,7 @@ apipkg==1.5
Appium-Python-Client==1.0.2 Appium-Python-Client==1.0.2
async-timeout==3.0.1 async-timeout==3.0.1
certifi==2020.11.8 certifi==2020.11.8
chardet==3.0.4 chardet==4.0.0
cycler==0.10.0 cycler==0.10.0
cytoolz==0.11.0 cytoolz==0.11.0
emoji==0.5.0 emoji==0.5.0
@ -37,7 +37,7 @@ python-dateutil==2.8.1
pytz==2020.4 pytz==2020.4
PyYAML==5.4 PyYAML==5.4
repoze.lru==0.7 repoze.lru==0.7
requests==2.25.0 requests==2.25.1
rlp==1.2.0 rlp==1.2.0
sauceclient==1.0.0 sauceclient==1.0.0
scrypt==0.8.17 scrypt==0.8.17

View File

@ -17,8 +17,8 @@ class NetworkApi(object):
self.faucet_url = 'https://faucet-ropsten.status.im/donate' self.faucet_url = 'https://faucet-ropsten.status.im/donate'
self.faucet_backup_address = w3.account_address self.faucet_backup_address = w3.account_address
self.headers = { self.headers = {
'User-Agent':"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit\ 'User-Agent':"Mozilla\\5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit\\537.36 (KHTML, like Gecko) Chrome\\7"
/537.36 (KHTML, like Gecko) Chrome\/77.0.3865.90 Safari\/537.36", } "7.0.3865.90 Safari\\537.36", }
self.chat_bot_url = 'http://offsite.chat:8099' self.chat_bot_url = 'http://offsite.chat:8099'
self.api_key = environ.get('ETHERSCAN_API_KEY') self.api_key = environ.get('ETHERSCAN_API_KEY')

View File

@ -27,7 +27,7 @@ class Account(object):
return w3.eth.getBalance(self.account_address) return w3.eth.getBalance(self.account_address)
def send_eth(self, to_address, eth_value, gas_price_increment=0): def send_eth(self, to_address, eth_value, gas_price_increment=0):
signed_txn = w3.eth.account.signTransaction(dict( signed_txn = w3.eth.account.sign_transaction(dict(
nonce=self.nonce, nonce=self.nonce,
gasPrice=w3.eth.gasPrice + gas_price_increment * 1000000000, gasPrice=w3.eth.gasPrice + gas_price_increment * 1000000000,
gas=21000, gas=21000,

View File

@ -133,9 +133,9 @@ class TestCreateAccount(SingleDeviceTestCase):
@marks.testrail_id(5363) @marks.testrail_id(5363)
@marks.high @marks.high
def test_pass_phrase_validation(self): def test_pass_phrase_validation(self):
signin_view = SignInView(self.driver) sign_in = SignInView(self.driver)
signin_view.get_started_button.click_until_presence_of_element(signin_view.access_key_button) sign_in.get_started_button.click_until_presence_of_element(sign_in.access_key_button)
signin_view.access_key_button.click() sign_in.access_key_button.click()
validations = [ validations = [
{ {
'case': 'empty value', 'case': 'empty value',
@ -160,52 +160,52 @@ class TestCreateAccount(SingleDeviceTestCase):
}, },
] ]
signin_view.just_fyi("check that seed phrase is required (can't be empty)") sign_in.just_fyi("check that seed phrase is required (can't be empty)")
signin_view.enter_seed_phrase_button.click() sign_in.enter_seed_phrase_button.click()
signin_view.next_button.click() sign_in.next_button.click()
if signin_view.reencrypt_your_key_button.is_element_displayed(): if sign_in.reencrypt_your_key_button.is_element_displayed():
self.errors.append("Possible to create account with empty seed phrase") self.errors.append("Possible to create account with empty seed phrase")
signin_view = SignInView(self.driver, skip_popups=False) sign_in = SignInView(self.driver, skip_popups=False)
for validation in validations: for validation in validations:
signin_view.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 signin_view.access_key_button.is_element_displayed(): if sign_in.access_key_button.is_element_displayed():
signin_view.access_key_button.click() sign_in.access_key_button.click()
if signin_view.enter_seed_phrase_button.is_element_displayed(): if sign_in.enter_seed_phrase_button.is_element_displayed():
signin_view.enter_seed_phrase_button.click() sign_in.enter_seed_phrase_button.click()
signin_view.seedphrase_input.set_value(phrase) sign_in.seedphrase_input.set_value(phrase)
if msg: if msg:
if not signin_view.element_by_text(msg).is_element_displayed(): if not sign_in.element_by_text(msg).is_element_displayed():
self.errors.append('"{}" message is not shown'.format(msg)) self.errors.append('"{}" message is not shown'.format(msg))
signin_view.just_fyi('check that words count is shown') sign_in.just_fyi('check that words count is shown')
if words_count: if words_count:
if not signin_view.element_by_text('%s word' % words_count): if not sign_in.element_by_text('%s word' % words_count):
self.errors.append('"%s word" is not shown ' % words_count) self.errors.append('"%s word" is not shown ' % words_count)
else: else:
if not signin_view.element_by_text('%s words' % words_count): if not sign_in.element_by_text('%s words' % words_count):
self.errors.append('"%s words" is not shown ' % words_count) self.errors.append('"%s words" is not shown ' % words_count)
signin_view.just_fyi('check that "Next" is disabled unless we use allowed count of words') sign_in.just_fyi('check that "Next" is disabled unless we use allowed count of words')
if words_count != 12 or 15 or 18 or 21 or 24: if words_count != 12 or 15 or 18 or 21 or 24:
signin_view.next_button.click() sign_in.next_button.click()
if signin_view.reencrypt_your_key_button.is_element_displayed(): if sign_in.reencrypt_your_key_button.is_element_displayed():
self.errors.append("Possible to create account with wrong count (%s) of words" % words_count) self.errors.append("Possible to create account with wrong count (%s) of words" % words_count)
signin_view.just_fyi('check behavior for popup "Custom seed phrase"') sign_in.just_fyi('check behavior for popup "Custom seed phrase"')
if popup: if popup:
if not signin_view.element_by_translation_id("custom-seed-phrase").is_element_displayed(): if not sign_in.element_by_translation_id("custom-seed-phrase").is_element_displayed():
self.errors.append("Popup about custom seed phrase is not shown") self.errors.append("Popup about custom seed phrase is not shown")
signin_view.cancel_custom_seed_phrase_button.click() sign_in.cancel_custom_seed_phrase_button.click()
signin_view.click_system_back_button() sign_in.click_system_back_button()
self.errors.verify_no_errors() self.errors.verify_no_errors()

View File

@ -1,4 +1,3 @@
from _pytest.outcomes import Failed
import time import time
from tests import marks from tests import marks
@ -11,7 +10,7 @@ from views.sign_in_view import SignInView
class TestCommandsMultipleDevices(MultipleDeviceTestCase): class TestCommandsMultipleDevices(MultipleDeviceTestCase):
@marks.testrail_id(6253) @marks.testrail_id(6253)
@marks.critical @marks.critical
def test_send_eth_in_1_1_chat(self): def test_send_eth_in_1_1_chat_transaction_push(self):
sender = transaction_senders['A'] sender = transaction_senders['A']
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])
@ -30,69 +29,70 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
chat_1 = home_1.add_contact(recipient_public_key) chat_1 = home_1.add_contact(recipient_public_key)
amount = chat_1.get_unique_amount() amount = chat_1.get_unique_amount()
account_name = wallet_1.status_account_name
home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount) home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
chat_1.commands_button.click() chat_1.commands_button.click()
send_transaction = chat_1.send_command.click() send_transaction = chat_1.send_command.click()
if not send_transaction.get_username_in_transaction_bottom_sheet_button(recipient_username).is_element_displayed():
self.driver.fail('%s is not shown in "Send Transaction" bottom sheet' % recipient_username)
send_transaction.get_username_in_transaction_bottom_sheet_button(recipient_username).click() send_transaction.get_username_in_transaction_bottom_sheet_button(recipient_username).click()
if send_transaction.scan_qr_code_button.is_element_displayed(): if send_transaction.scan_qr_code_button.is_element_displayed():
self.driver.fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat') self.drivers[0].fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat')
send_transaction.amount_edit_box.set_value(amount) send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm() send_transaction.confirm()
send_transaction.sign_transaction_button.click() send_transaction.sign_transaction_button.click()
chat_1_sender_message = chat_1.chat_element_by_text('↑ Outgoing transaction') sender_message = chat_1.get_outgoing_transaction(account_name)
if not chat_1_sender_message.is_element_displayed(): if not sender_message.is_element_displayed():
self.driver.fail('No message is shown after sending ETH in 1-1 chat for sender') self.drivers[0].fail('No message is shown after sending ETH in 1-1 chat for sender')
chat_1_sender_message.transaction_status.wait_for_element_text('Address requested') sender_message.transaction_status.wait_for_element_text(sender_message.address_requested)
chat_2 = home_2.get_chat(sender['username']).click() chat_2 = home_2.get_chat(sender['username']).click()
chat_2_receiver_message = chat_2.chat_element_by_text('↓ Incoming transaction') receiver_message = chat_2.get_incoming_transaction(account_name)
timestamp_sender = chat_1_sender_message.timestamp_message.text timestamp_sender = sender_message.timestamp_message.text
if not chat_2_receiver_message.is_element_displayed(): if not receiver_message.is_element_displayed():
self.driver.fail('No message about incoming transaction in 1-1 chat is shown for receiver') self.drivers[0].fail('No message about incoming transaction in 1-1 chat is shown for receiver')
chat_2_receiver_message.transaction_status.wait_for_element_text('Address requested') receiver_message.transaction_status.wait_for_element_text(receiver_message.address_requested)
home_2.just_fyi('Accept and share address for sender and receiver') home_2.just_fyi('Accept and share address for sender and receiver')
for text in ('Accept and share address', 'Decline'): for option in (receiver_message.decline_transaction, receiver_message.accept_and_share_address):
if not chat_2_receiver_message.contains_text(text): if not option.is_element_displayed():
self.driver.fail("Transaction message doesn't contain required option %s" % text) self.drivers[0].fail("Required options accept or share are not shown")
select_account_bottom_sheet = chat_2_receiver_message.accept_and_share_address.click()
if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(wallet_1.status_account_name).is_element_displayed(): 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():
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()
chat_2_receiver_message.transaction_status.wait_for_element_text("Shared '%s'" % receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account)
home_1.status_account_name) sender_message.transaction_status.wait_for_element_text(sender_message.address_request_accepted)
chat_1_sender_message.transaction_status.wait_for_element_text('Address request accepted')
home_1.just_fyi("Sign and send transaction and check that timestamp on message is updated") home_1.just_fyi("Sign and send transaction and check that timestamp on message is updated")
time.sleep(40) time.sleep(20)
send_message = chat_1_sender_message.sign_and_send.click() send_bottom_sheet = sender_message.sign_and_send.click()
send_message.next_button.click() send_bottom_sheet.next_button.click()
send_message.sign_transaction(default_gas_price=False) send_bottom_sheet.sign_transaction(default_gas_price=False)
updated_timestamp_sender = chat_1_sender_message.timestamp_message.text updated_timestamp_sender = sender_message.timestamp_message.text
if updated_timestamp_sender == timestamp_sender: if updated_timestamp_sender == timestamp_sender:
self.errors.append("Timestamp of message is not updated after signing transaction") self.errors.append("Timestamp of message is not updated after signing transaction")
sender_message.transaction_status.wait_for_element_text(sender_message.pending)
chat_1.wallet_button.click() chat_1.wallet_button.click()
wallet_1.accounts_status_account.click() wallet_1.find_transaction_in_history(amount=amount)
transactions_view = wallet_1.transaction_history_button.click()
transactions_view.transactions_table.find_transaction(amount=amount)
for wallet in wallet_1, wallet_2: [wallet.put_app_to_background() for wallet in (wallet_1, wallet_2)]
wallet.put_app_to_background()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount) self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount)
device_1.open_notification_bar() device_1.open_notification_bar()
device_1.element_by_text_part('You sent %s ETH' % amount).click() device_1.element_by_text_part('You sent %s ETH' % amount).click()
if not wallet_1.transaction_history_button.is_element_displayed(): if not wallet_1.transaction_history_button.is_element_displayed():
self.errors.append('Was not redirected to transaction history after tapping on PN') self.errors.append('Was not redirected to transaction history after tapping on PN')
wallet_1.home_button.click(desired_view="chat") wallet_1.home_button.click(desired_view="chat")
home_1.just_fyi("Check 'Confirmed' state for sender and receiver")
wallet_2.status_in_background_button.click() home_1.just_fyi("Check 'Confirmed' state for sender and receiver(use pull-to-refresh to update history)")
[message.transaction_status.wait_for_element_text('Confirmed') for message in (chat_1_sender_message, chat_2_receiver_message)] chat_2.status_in_background_button.click()
# TODO: should be added PNs for receiver agter getting more stable feature chat_2.wallet_button.click()
wallet_2.find_transaction_in_history(amount=amount)
wallet_2.home_button.click(desired_view="chat")
[message.transaction_status.wait_for_element_text(message.confirmed, 60) for message in
(sender_message, receiver_message)]
#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)
@ -101,17 +101,16 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
sender = transaction_senders['C'] sender = transaction_senders['C']
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])
asset_name = 'STT'
amount = device_1.get_unique_amount()
device_1.just_fyi('Grab user data for transactions and public chat, set up wallets') device_1.just_fyi('Grab user data for transactions and public chat, set up wallets')
home_1 = device_1.create_user() home_1 = device_1.create_user()
recipient_public_key, recipient_username = home_1.get_public_key_and_username(return_username=True) recipient_public_key, recipient_username = home_1.get_public_key_and_username(return_username=True)
wallet_1 = home_1.wallet_button.click() wallet_1 = home_1.wallet_button.click()
wallet_1.set_up_wallet() wallet_1.set_up_wallet()
recipient_address = wallet_1.get_wallet_address() wallet_1.select_asset(asset_name)
wallet_1.back_button.click()
wallet_1.select_asset('STT')
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()
wallet_2.set_up_wallet() wallet_2.set_up_wallet()
@ -120,13 +119,9 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
device_2.just_fyi('Add recipient to contact and send 1 message') device_2.just_fyi('Add recipient to contact and send 1 message')
chat_2 = home_2.add_contact(recipient_public_key) chat_2 = home_2.add_contact(recipient_public_key)
chat_2.send_message("Hey there!") chat_2.send_message("Hey there!")
amount = chat_2.get_unique_amount()
asset_name = 'STT'
profile_2 = wallet_2.profile_button.click() profile_2 = wallet_2.profile_button.click()
profile_2.logout() profile_2.logout()
chat_element = home_1.get_chat(sender['username']) chat_1 = home_1.get_chat(sender['username']).click()
chat_element.wait_for_visibility_of_element(30)
chat_1 = chat_element.click()
home_1.just_fyi('Request %s STT in 1-1 chat and check it is visible for sender and receiver' % amount) home_1.just_fyi('Request %s STT in 1-1 chat and check it is visible for sender and receiver' % amount)
chat_1.commands_button.click() chat_1.commands_button.click()
@ -137,47 +132,50 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
request_transaction.select_asset_button.click_until_presence_of_element(asset_button) request_transaction.select_asset_button.click_until_presence_of_element(asset_button)
asset_button.click() asset_button.click()
request_transaction.request_transaction_button.click() request_transaction.request_transaction_button.click()
chat_1_request_message = chat_1.chat_element_by_text('↓ Incoming transaction') chat_1_request_message = chat_1.get_incoming_transaction()
if not chat_1_request_message.is_element_displayed(): if not chat_1_request_message.is_element_displayed():
self.driver.fail('No incoming transaction in 1-1 chat is shown for recipient after requesting STT') self.drivers[0].fail('No incoming transaction in 1-1 chat is shown for recipient after requesting STT')
home_2.just_fyi('Check that transaction message is fetched from offline and sign transaction') home_2.just_fyi('Check that transaction message is fetched from offline and sign transaction')
device_2.sign_in() device_2.sign_in()
home_2.connection_status.wait_for_invisibility_of_element(30) home_2.connection_status.wait_for_invisibility_of_element(30)
home_2.get_chat(recipient_username).click() home_2.get_chat(recipient_username).click()
chat_2_sender_message = chat_2.chat_element_by_text('↑ Outgoing transaction') chat_2_sender_message = chat_2.get_outgoing_transaction()
if not chat_2_sender_message.is_element_displayed(): if not chat_2_sender_message.is_element_displayed():
self.driver.fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT') self.drivers[0].fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT')
chat_2_sender_message.transaction_status.wait_for_element_text('Address received') chat_2_sender_message.transaction_status.wait_for_element_text(chat_2_sender_message.address_received)
send_message = chat_2_sender_message.sign_and_send.click() send_message = chat_2_sender_message.sign_and_send.click()
send_message.next_button.click() send_message.next_button.click()
send_message.sign_transaction(default_gas_price=False) send_message.sign_transaction(default_gas_price=False)
chat_2_sender_message.transaction_status.wait_for_element_text(chat_2_sender_message.pending)
home_2.just_fyi('Check that transaction message is updated with new status after offline') home_2.just_fyi('Check that transaction message is updated with new status after offline')
chat_2.toggle_airplane_mode() chat_2.toggle_airplane_mode()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15, token=True) self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15, token=True)
chat_2.toggle_airplane_mode() chat_2.toggle_airplane_mode()
chat_2.connection_status.wait_for_invisibility_of_element(30) chat_2.connection_status.wait_for_invisibility_of_element(30)
[message.transaction_status.wait_for_element_text('Confirmed') for message in [message.transaction_status.wait_for_element_text(message.confirmed) for message in
(chat_2_sender_message, chat_1_request_message)] (chat_2_sender_message, chat_1_request_message)]
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.testrail_id(6265) @marks.testrail_id(6265)
@marks.critical @marks.critical
def test_decline_transactions_in_1_1_chat_push_notification_changing_state(self): def test_decline_transactions_in_1_1_chat_push_notification_changing_state(self):
recipient = transaction_recipients['B']
sender = transaction_senders['B'] sender = transaction_senders['B']
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 = device_1.recover_access(passphrase=sender['passphrase'], enable_notifications=True) home_1 = device_1.recover_access(passphrase=sender['passphrase'], enable_notifications=True)
home_2 = device_2.recover_access(passphrase=recipient['passphrase']) home_2 = device_2.create_user()
profile_2 = home_2.profile_button.click()
recipient_chat_key = profile_2.get_public_key_and_username()
wallet_1, wallet_2 = home_1.wallet_button.click(), home_2.wallet_button.click() wallet_1, wallet_2 = home_1.wallet_button.click(), home_2.wallet_button.click()
for wallet in wallet_1, wallet_2: for wallet in wallet_1, wallet_2:
wallet.set_up_wallet() wallet.set_up_wallet()
wallet.home_button.click() wallet.home_button.click()
chat_1 = home_1.add_contact(recipient['public_key']) chat_1 = home_1.add_contact(recipient_chat_key)
amount = chat_1.get_unique_amount() amount = chat_1.get_unique_amount()
chat_1.send_message('To start conversation')
home_1.just_fyi('Decline transaction before sharing address and check that state is changed') home_1.just_fyi('Decline transaction before sharing address and check that state is changed')
chat_1.commands_button.click() chat_1.commands_button.click()
@ -185,20 +183,18 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
send_transaction.amount_edit_box.set_value(amount) send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm() send_transaction.confirm()
send_transaction.sign_transaction_button.click() send_transaction.sign_transaction_button.click()
chat_1_sender_message = chat_1.chat_element_by_text('↑ Outgoing transaction') chat_1_sender_message = chat_1.get_outgoing_transaction()
home_1.click_system_home_button() home_1.click_system_home_button()
from views.chat_view import ChatView chat_2 = home_2.get_chat(sender['username']).click()
chat = ChatView(self.drivers[1]) chat_2_receiver_message = chat_2.get_incoming_transaction()
chat_2 = home_2.get_chat(sender['username']).click_until_presence_of_element(chat.chat_message_input)
chat_2_receiver_message = chat_2.chat_element_by_text('↓ Incoming transaction')
chat_2_receiver_message.decline_transaction.click() chat_2_receiver_message.decline_transaction.click()
home_1.open_notification_bar() home_1.open_notification_bar()
home_1.element_by_text_part('Request address for transaction declined').wait_and_click() home_1.element_by_text_part('Request address for transaction declined').wait_and_click()
for message in chat_1_sender_message, chat_2_receiver_message:
if not message.contains_text('Transaction declined', 20): [message.transaction_status.wait_for_element_text(message.declined) for message in
self.errors.append('Message status is not updated to "Transaction declined" for transaction before ' (chat_1_sender_message, chat_2_receiver_message)]
'sharing address')
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()
@ -206,12 +202,11 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
request_transaction.amount_edit_box.set_value(request_amount) request_transaction.amount_edit_box.set_value(request_amount)
request_transaction.confirm() request_transaction.confirm()
request_transaction.request_transaction_button.click() request_transaction.request_transaction_button.click()
chat_1_request_message = chat_1.chat_element_by_text('↓ Incoming transaction') chat_1_request_message = chat_1.get_incoming_transaction()
chat_2_sender_message = chat_2.chat_element_by_text('↑ Outgoing transaction') chat_2_sender_message = chat_2.get_outgoing_transaction()
chat_2_sender_message.decline_transaction.click() chat_2_sender_message.decline_transaction.click()
for message in chat_2_sender_message, chat_1_request_message: [message.transaction_status.wait_for_element_text(message.declined) for message in
if not message.contains_text('Transaction declined', 20): (chat_2_sender_message, chat_1_request_message)]
self.errors.append('Message status is not updated to "Transaction declined" for transaction request')
self.errors.verify_no_errors() self.errors.verify_no_errors()
@ -237,14 +232,14 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
request_transaction.amount_edit_box.set_value(amount) request_transaction.amount_edit_box.set_value(amount)
request_transaction.confirm() request_transaction.confirm()
request_transaction.request_transaction_button.click() request_transaction.request_transaction_button.click()
chat_2_request_message = chat_2.chat_element_by_text('↓ Incoming transaction') chat_2_request_message = chat_2.get_incoming_transaction()
chat_2_request_message.long_press_element() chat_2_request_message.long_press_element()
if chat_2.reply_message_button.is_element_displayed(): if chat_2.reply_message_button.is_element_displayed():
self.errors.append('Reply is available on long-tap on Incoming transaction message!') self.errors.append('Reply is available on long-tap on Incoming transaction message!')
chat_1 = home_1.get_chat(device_2_username).click() chat_1 = home_1.get_chat(device_2_username).click()
chat_1_sender_message = chat_1.chat_element_by_text('↑ Outgoing transaction') chat_1_sender_message = chat_1.get_outgoing_transaction()
chat_1_sender_message.long_press_element() chat_1_sender_message.long_press_element()
if chat_1.reply_message_button.is_element_displayed(): if chat_1.reply_message_button.is_element_displayed():
self.errors.append('Reply is available on long-tap on Outgoing transaction message!') self.errors.append('Reply is available on long-tap on Outgoing transaction message!')
@ -252,7 +247,14 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
send_message.next_button.click() send_message.next_button.click()
send_message.sign_transaction() send_message.sign_transaction()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15) self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15)
chat_1_sender_message.transaction_status.wait_for_element_text('Confirmed') chat_1_sender_message.transaction_status.wait_for_element_text(chat_1_sender_message.confirmed)
wallet_2 = chat_2.wallet_button.click()
wallet_2.set_up_wallet()
wallet_2.accounts_status_account.click()
wallet_2.swipe_down()
wallet_2.home_button.click(desired_view="chat")
if chat_2_request_message.transaction_status == chat_1_sender_message.confirmed:
self.errors.append("Transaction is shown as confirmed on mainnet, but was sent on ropsten!")
self.errors.verify_no_errors() self.errors.verify_no_errors()
@marks.transaction @marks.transaction
@ -277,6 +279,6 @@ class TestCommandsSingleDevices(SingleDeviceTestCase):
send_transaction = SendTransactionView(self.driver) send_transaction = SendTransactionView(self.driver)
send_transaction.ok_got_it_button.click() send_transaction.ok_got_it_button.click()
send_transaction.sign_transaction(default_gas_price=False) send_transaction.sign_transaction(default_gas_price=False)
chat_sender_message = chat.chat_element_by_text('↑ Outgoing transaction') chat_sender_message = chat.get_outgoing_transaction()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15) self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15)
chat_sender_message.transaction_status.wait_for_element_text('Confirmed') chat_sender_message.transaction_status.wait_for_element_text(chat_sender_message.confirmed)

View File

@ -21,7 +21,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
device_1_home.just_fyi('Check default placeholder when trying to create group chat without contacts') device_1_home.just_fyi('Check default placeholder when trying to create group chat without contacts')
device_1_home.new_group_chat_button.click() device_1_home.new_group_chat_button.click()
if not device_1_home.element_by_text('Invite friends').is_element_displayed(): if not device_1_home.element_by_translation_id("invite-friends").is_element_displayed():
self.errors.append("No placeholder is shown when there are no contacts") self.errors.append("No placeholder is shown when there are no contacts")
device_1_home.get_back_to_home_view() device_1_home.get_back_to_home_view()
@ -35,6 +35,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
create_system_message = device_1_chat.create_system_message(device_1_username, chat_name) create_system_message = device_1_chat.create_system_message(device_1_username, chat_name)
invite_system_message = device_1_chat.invite_system_message(device_1_username, device_2_username) invite_system_message = device_1_chat.invite_system_message(device_1_username, device_2_username)
join_system_message = device_1_chat.join_system_message(device_2_username) join_system_message = device_1_chat.join_system_message(device_2_username)
invited_to_join = device_1_chat.invited_to_join_system_message(device_1_username, chat_name)
create_for_admin_system_message = device_1_chat.create_for_admin_system_message(chat_name) create_for_admin_system_message = device_1_chat.create_for_admin_system_message(chat_name)
for message in [create_for_admin_system_message, create_system_message, invite_system_message]: for message in [create_for_admin_system_message, create_system_message, invite_system_message]:
if not device_1_chat.chat_element_by_text(message): if not device_1_chat.chat_element_by_text(message):
@ -47,8 +48,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
for element in device_2_chat.join_chat_button, device_2_chat.decline_invitation_button: for element in device_2_chat.join_chat_button, device_2_chat.decline_invitation_button:
if not element.is_element_displayed(): if not element.is_element_displayed():
self.drivers[0].fail('"Join Chat" or "Decline" is not shown for member of group chat') self.drivers[0].fail('"Join Chat" or "Decline" is not shown for member of group chat')
for message in ['%s invited you to join the group %s' % (device_1_username, chat_name), for message in [invited_to_join, create_system_message, invite_system_message]:
create_system_message, invite_system_message]:
if not device_2_chat.chat_element_by_text(message): if not device_2_chat.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)
@ -100,7 +100,7 @@ class TestGroupChatMultipleDevice(MultipleDeviceTestCase):
devices_home[2].toggle_airplane_mode() devices_home[2].toggle_airplane_mode()
devices_home[2].connection_status.wait_for_invisibility_of_element(60) devices_home[2].connection_status.wait_for_invisibility_of_element(60)
if not devices_home[2].get_chat(chat_name).is_element_displayed(): if not devices_home[2].get_chat(chat_name).is_element_displayed():
self.driver[0].fail('Invite to group chat was not fetched from offline') self.drivers[0].fail('Invite to group chat was not fetched from offline')
devices_chat[2] = devices_home[2].get_chat(chat_name).click() devices_chat[2] = devices_home[2].get_chat(chat_name).click()
if not devices_chat[2].element_by_text(invite_system_message).is_element_displayed(): if not devices_chat[2].element_by_text(invite_system_message).is_element_displayed():
self.errors.append('Message about adding first chat member is not shown for new added member') self.errors.append('Message about adding first chat member is not shown for new added member')

View File

@ -24,61 +24,62 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
chat_1 = home_1.add_contact(recipient_public_key) chat_1 = home_1.add_contact(recipient_public_key)
amount = chat_1.get_unique_amount() amount = chat_1.get_unique_amount()
account_name = wallet_1.status_account_name
home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount) home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
chat_1.commands_button.click_until_presence_of_element(chat_1.send_command) chat_1.commands_button.click()
send_transaction = chat_1.send_command.click() send_transaction = chat_1.send_command.click()
if not send_transaction.get_username_in_transaction_bottom_sheet_button(recipient_username).is_element_displayed():
self.driver.fail('%s is not shown in "Send Transaction" bottom sheet' % recipient_username)
send_transaction.get_username_in_transaction_bottom_sheet_button(recipient_username).click() send_transaction.get_username_in_transaction_bottom_sheet_button(recipient_username).click()
if send_transaction.scan_qr_code_button.is_element_displayed(): if send_transaction.scan_qr_code_button.is_element_displayed():
self.driver.fail('Recipient is editable in bootom sheet when send ETH from 1-1 chat') self.drivers[0].fail('Recipient is editable in bottom sheet when send ETH from 1-1 chat')
send_transaction.amount_edit_box.set_value(amount) send_transaction.amount_edit_box.set_value(amount)
send_transaction.confirm() send_transaction.confirm()
send_transaction.sign_transaction_button.click() send_transaction.sign_transaction_button.click()
chat_1_sender_message = chat_1.chat_element_by_text('↑ Outgoing transaction') sender_message = chat_1.get_outgoing_transaction()
if not chat_1_sender_message.is_element_displayed(): if not sender_message.is_element_displayed():
self.driver.fail('No message is shown after sending ETH in 1-1 chat for sender') self.drivers[0].fail('No message is shown after sending ETH in 1-1 chat for sender')
chat_1_sender_message.transaction_status.wait_for_element_text('Address requested') sender_message.transaction_status.wait_for_element_text(sender_message.address_requested)
chat_2 = home_2.get_chat(sender['username']).click() chat_2 = home_2.get_chat(sender['username']).click()
chat_2_receiver_message = chat_2.chat_element_by_text('↓ Incoming transaction') receiver_message = chat_2.get_incoming_transaction()
timestamp_sender = chat_1_sender_message.timestamp_message.text timestamp_sender = sender_message.timestamp_message.text
if not chat_2_receiver_message.is_element_displayed(): if not receiver_message.is_element_displayed():
self.driver.fail('No message about incoming transaction in 1-1 chat is shown for receiver') self.drivers[0].fail('No message about incoming transaction in 1-1 chat is shown for receiver')
chat_2_receiver_message.transaction_status.wait_for_element_text('Address requested') receiver_message.transaction_status.wait_for_element_text(receiver_message.address_requested)
home_2.just_fyi('Accept and share address for sender and receiver') home_2.just_fyi('Accept and share address for sender and receiver')
for text in ('Accept and share address', 'Decline'): for option in (receiver_message.decline_transaction, receiver_message.accept_and_share_address):
if not chat_2_receiver_message.contains_text(text): if not option.is_element_displayed():
self.driver.fail("Transaction message doesn't contain required option %s" % text) self.drivers[0].fail("Required options accept or share are not shown")
select_account_bottom_sheet = chat_2_receiver_message.accept_and_share_address.click()
if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(wallet_1.status_account_name).is_element_displayed(): 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():
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()
chat_2_receiver_message.transaction_status.wait_for_element_text("Shared '%s'" % home_1.status_account_name) receiver_message.transaction_status.wait_for_element_text(receiver_message.shared_account)
chat_1_sender_message.transaction_status.wait_for_element_text('Address request accepted') sender_message.transaction_status.wait_for_element_text(sender_message.address_request_accepted)
home_1.just_fyi("Sign and send transaction and check that timestamp on message is updated") home_1.just_fyi("Sign and send transaction and check that timestamp on message is updated")
time.sleep(40) time.sleep(20)
send_message = chat_1_sender_message.sign_and_send.click() send_message = sender_message.sign_and_send.click()
send_message.next_button.click() send_message.next_button.click()
send_message.sign_transaction(keycard=True, default_gas_price=False) send_message.sign_transaction(keycard=True, default_gas_price=False)
chat_1_sender_message.transaction_status.wait_for_element_text('Pending') sender_message.transaction_status.wait_for_element_text(sender_message.pending)
updated_timestamp_sender = chat_1_sender_message.timestamp_message.text updated_timestamp_sender = sender_message.timestamp_message.text
if updated_timestamp_sender == timestamp_sender: if updated_timestamp_sender == timestamp_sender:
self.errors.append("Timestamp of message is not updated after signing transaction") self.errors.append("Timestamp of message is not updated after signing transaction")
chat_1.wallet_button.click() chat_1.wallet_button.click()
wallet_1.accounts_status_account.click() wallet_1.find_transaction_in_history(amount=amount)
transactions_view = wallet_1.transaction_history_button.click()
transactions_view.transactions_table.find_transaction(amount=amount)
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount) self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount)
wallet_1.home_button.click(desired_view='chat') wallet_1.home_button.click(desired_view='chat')
home_1.just_fyi("Check 'Confirmed' state for sender and receiver") home_1.just_fyi("Check 'Confirmed' state for sender and receiver(use pull-to-refresh to update history)")
[message.transaction_status.wait_for_element_text('Confirmed') for message in chat_2.wallet_button.click()
(chat_1_sender_message, chat_2_receiver_message)] wallet_2.find_transaction_in_history(amount=amount)
wallet_2.home_button.click(desired_view="chat")
[message.transaction_status.wait_for_element_text(message.confirmed, 60) for message in
(sender_message, receiver_message)]
self.errors.verify_no_errors() self.errors.verify_no_errors()
@ -92,11 +93,11 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
device_1.just_fyi('Grab user data for transactions and public chat, set up wallets') device_1.just_fyi('Grab user data for transactions and public chat, set up wallets')
home_1 = device_1.create_user(keycard=True) home_1 = device_1.create_user(keycard=True)
recipient_public_key, recipient_username = home_1.get_public_key_and_username(return_username=True) recipient_public_key, recipient_username = home_1.get_public_key_and_username(return_username=True)
amount = device_1.get_unique_amount()
asset_name = 'STT'
wallet_1 = home_1.wallet_button.click() wallet_1 = home_1.wallet_button.click()
wallet_1.set_up_wallet() wallet_1.set_up_wallet()
recipient_address = wallet_1.get_wallet_address() wallet_1.select_asset(asset_name)
wallet_1.back_button.click()
wallet_1.select_asset('STT')
wallet_1.home_button.click() wallet_1.home_button.click()
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)
@ -107,8 +108,7 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
device_2.just_fyi('Add recipient to contact and send 1 message') device_2.just_fyi('Add recipient to contact and send 1 message')
chat_2 = home_2.add_contact(recipient_public_key) chat_2 = home_2.add_contact(recipient_public_key)
chat_2.send_message("Hey there!") chat_2.send_message("Hey there!")
amount = chat_2.get_unique_amount()
asset_name = 'STT'
profile_2 = wallet_2.profile_button.click() profile_2 = wallet_2.profile_button.click()
profile_2.airplane_mode_button.click() profile_2.airplane_mode_button.click()
device_2.home_button.click() device_2.home_button.click()
@ -126,9 +126,9 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
request_transaction.select_asset_button.click_until_presence_of_element(asset_button) request_transaction.select_asset_button.click_until_presence_of_element(asset_button)
asset_button.click() asset_button.click()
request_transaction.request_transaction_button.click() request_transaction.request_transaction_button.click()
chat_1_request_message = chat_1.chat_element_by_text('↓ Incoming transaction') chat_1_request_message = chat_1.get_incoming_transaction()
if not chat_1_request_message.is_element_displayed(): if not chat_1_request_message.is_element_displayed():
self.driver.fail('No incoming transaction in 1-1 chat is shown for recipient after requesting STT') self.drivers[0].fail('No incoming transaction in 1-1 chat is shown for recipient after requesting STT')
home_2.just_fyi('Check that transaction message is fetched from offline and sign transaction') home_2.just_fyi('Check that transaction message is fetched from offline and sign transaction')
profile_2.airplane_mode_button.click() profile_2.airplane_mode_button.click()
@ -137,10 +137,10 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
if not device_2.element_by_text(transaction_request_pn).is_element_displayed(60): if not device_2.element_by_text(transaction_request_pn).is_element_displayed(60):
self.errors.append("Push notification is not received after going back from offline") self.errors.append("Push notification is not received after going back from offline")
device_2.element_by_text(transaction_request_pn).click() device_2.element_by_text(transaction_request_pn).click()
chat_2_sender_message = chat_2.chat_element_by_text('↑ Outgoing transaction') chat_2_sender_message = chat_2.get_outgoing_transaction()
if not chat_2_sender_message.is_element_displayed(): if not chat_2_sender_message.is_element_displayed():
self.driver.fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT') self.driver.fail('No outgoing transaction in 1-1 chat is shown for sender after requesting STT')
chat_2_sender_message.transaction_status.wait_for_element_text('Address received') chat_2_sender_message.transaction_status.wait_for_element_text(chat_2_sender_message.address_received)
send_message = chat_2_sender_message.sign_and_send.click() send_message = chat_2_sender_message.sign_and_send.click()
send_message.next_button.click() send_message.next_button.click()
send_message.sign_transaction(keycard=True, default_gas_price=False) send_message.sign_transaction(keycard=True, default_gas_price=False)
@ -150,7 +150,8 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True) self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True)
chat_2.toggle_airplane_mode() chat_2.toggle_airplane_mode()
chat_2.connection_status.wait_for_invisibility_of_element(60) chat_2.connection_status.wait_for_invisibility_of_element(60)
[message.transaction_status.wait_for_element_text('Confirmed') for message in (chat_2_sender_message, chat_1_request_message)] [message.transaction_status.wait_for_element_text(message.confirmed) for message in
(chat_2_sender_message, chat_1_request_message)]
self.errors.verify_no_errors() self.errors.verify_no_errors()
@ -175,6 +176,6 @@ class TestCommandsSingleDevices(SingleDeviceTestCase):
from views.send_transaction_view import SendTransactionView from views.send_transaction_view import SendTransactionView
send_transaction = SendTransactionView(self.driver) send_transaction = SendTransactionView(self.driver)
send_transaction.sign_transaction(keycard=True) send_transaction.sign_transaction(keycard=True)
chat_sender_message = chat.chat_element_by_text('↑ Outgoing transaction') chat_sender_message = chat.get_outgoing_transaction()
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15) self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15)
chat_sender_message.transaction_status.wait_for_element_text('Confirmed') chat_sender_message.transaction_status.wait_for_element_text(chat_sender_message.confirmed)

View File

@ -26,10 +26,9 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
self.network_api.find_transaction_by_unique_amount(sender['address'], transaction_amount) self.network_api.find_transaction_by_unique_amount(sender['address'], transaction_amount)
wallet_view.just_fyi('Check that transaction is appeared in transaction history') wallet_view.just_fyi('Check that transaction is appeared in transaction history')
transactions_view = wallet_view.transaction_history_button.click() wallet_view.find_transaction_in_history(amount=transaction_amount)
transactions_view.transactions_table.find_transaction(amount=transaction_amount)
transactions_view.just_fyi('Check logcat for sensitive data') wallet_view.just_fyi('Check logcat for sensitive data')
values_in_logcat = wallet_view.find_values_in_logcat(pin=pin, puk=puk, password=pair_code) values_in_logcat = wallet_view.find_values_in_logcat(pin=pin, puk=puk, password=pair_code)
if values_in_logcat: if values_in_logcat:
self.driver.fail(values_in_logcat) self.driver.fail(values_in_logcat)
@ -68,9 +67,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
sign_in_view.toggle_airplane_mode() sign_in_view.toggle_airplane_mode()
wallet_view.wait_balance_is_changed('STT', initial_amount_STT) wallet_view.wait_balance_is_changed('STT', initial_amount_STT)
wallet_view.accounts_status_account.click() wallet_view.find_transaction_in_history(amount=sending_amount, asset='STT')
transactions_view = wallet_view.transaction_history_button.click()
transactions_view.transactions_table.find_transaction(amount=sending_amount, asset='STT')
@marks.testrail_id(6291) @marks.testrail_id(6291)
@marks.critical @marks.critical
@ -143,6 +140,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
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.1, 11) transaction_amount_1 = round(float(transaction_amount) * 0.1, 11)
wallet_view.wait_balance_is_changed() wallet_view.wait_balance_is_changed()
wallet_view.get_account_by_name(account_name).click()
send_transaction = wallet_view.send_transaction(account_name=wallet_view.status_account_name, send_transaction = wallet_view.send_transaction(account_name=wallet_view.status_account_name,
amount=transaction_amount_1, amount=transaction_amount_1,
keycard=True, keycard=True,
@ -150,11 +148,13 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
send_transaction.back_button.click() send_transaction.back_button.click()
sub_account_address = wallet_view.get_wallet_address(account_name)[2:] sub_account_address = wallet_view.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)
transactions_view = wallet_view.transaction_history_button.click() wallet_view.find_transaction_in_history(amount=transaction_amount)
wallet_view.find_transaction_in_history(amount=format(float(transaction_amount_1),'.11f').rstrip('0'))
#transactions_view = wallet_view.transaction_history_button.click()
wallet_view.just_fyi("Check transactions on subaccount") wallet_view.just_fyi("Check transactions on subaccount")
transactions_view.transactions_table.find_transaction(amount=transaction_amount) #transactions_view.transactions_table.find_transaction(amount=transaction_amount)
transactions_view.transactions_table.find_transaction(amount=format(float(transaction_amount_1),'.11f').rstrip('0')) #transactions_view.transactions_table.find_transaction(amount=format(float(transaction_amount_1),'.11f').rstrip('0'))
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_view.just_fyi("Verify total ETH on main wallet view") wallet_view.just_fyi("Verify total ETH on main wallet view")

View File

@ -29,8 +29,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
sender_password=unique_password ) sender_password=unique_password )
wallet_view.just_fyi('Check that transaction is appeared in transaction history') wallet_view.just_fyi('Check that transaction is appeared in transaction history')
transactions_view = wallet_view.transaction_history_button.click() wallet_view.find_transaction_in_history(amount=transaction_amount)
transactions_view.transactions_table.find_transaction(amount=transaction_amount)
wallet_view.just_fyi('Check logcat for sensitive data') wallet_view.just_fyi('Check logcat for sensitive data')
values_in_logcat = wallet_view.find_values_in_logcat(password=unique_password) values_in_logcat = wallet_view.find_values_in_logcat(password=unique_password)
@ -96,10 +95,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
sign_in_view.just_fyi('Check that transaction is appeared in transaction history') sign_in_view.just_fyi('Check that transaction is appeared in transaction history')
wallet_view.wait_balance_is_changed('STT', initial_amount_STT) wallet_view.wait_balance_is_changed('STT', initial_amount_STT)
if not wallet_view.transaction_history_button.is_element_displayed(): wallet_view.find_transaction_in_history(amount=sending_amount, asset='STT')
wallet_view.accounts_status_account.click()
transactions_view = wallet_view.transaction_history_button.click()
transactions_view.transactions_table.find_transaction(amount=sending_amount, asset='STT')
@marks.testrail_id(5461) @marks.testrail_id(5461)
@marks.medium @marks.medium
@ -248,7 +244,6 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
wallet_view = sign_in_view.wallet_button.click() wallet_view = sign_in_view.wallet_button.click()
wallet_view.set_up_wallet() wallet_view.set_up_wallet()
status_account_address = wallet_view.get_wallet_address()[2:] status_account_address = wallet_view.get_wallet_address()[2:]
# wallet_view.back_button.click()
self.network_api.get_donate(status_account_address, external_faucet=True) self.network_api.get_donate(status_account_address, external_faucet=True)
wallet_view.wait_balance_is_changed() wallet_view.wait_balance_is_changed()
account_name = 'subaccount' account_name = 'subaccount'
@ -285,11 +280,10 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
sub_account_address = wallet_view.get_wallet_address(account_name)[2:] sub_account_address = wallet_view.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)
transactions_view = wallet_view.transaction_history_button.click() wallet_view.find_transaction_in_history(amount=transaction_amount)
wallet_view.find_transaction_in_history(amount=format(float(transaction_amount_1),'.11f').rstrip('0'))
wallet_view.just_fyi("Check transactions on subaccount") wallet_view.just_fyi("Check transactions on subaccount")
transactions_view.transactions_table.find_transaction(amount=transaction_amount)
transactions_view.transactions_table.find_transaction(amount=format(float(transaction_amount_1),'.11f').rstrip('0'))
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_view.just_fyi("Verify total ETH on main wallet view") wallet_view.just_fyi("Verify total ETH on main wallet view")
@ -435,9 +429,9 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
self.errors.append( self.errors.append(
'Expected error %s is not shown' % error) 'Expected error %s is not shown' % error)
if send_transaction_view.back_button.is_element_displayed(): if send_transaction_view.back_button.is_element_displayed():
send_transaction_view.back_button.click() send_transaction_view.back_button.wait_and_click()
else: else:
wallet_view.cancel_button.click() wallet_view.cancel_button.wait_and_click()
self.errors.verify_no_errors() self.errors.verify_no_errors()

View File

@ -116,6 +116,20 @@ class BaseElement(object):
raise TimeoutException("Device %s: %s by %s:* `%s` is still visible on the screen after %s seconds" % ( raise TimeoutException("Device %s: %s by %s:* `%s` is still visible on the screen after %s seconds" % (
self.driver.number, self.name, self.by, self.locator, seconds)) from None self.driver.number, self.name, self.by, self.locator, seconds)) from None
def wait_for_element_text(self, text, wait_time=30):
counter = 0
self.driver.info("*Wait for text element %s to be equal to %s*" % (self.name, text))
while True:
if counter >= wait_time:
self.driver.fail(
"'%s' is not equal to expected '%s' in %s sec" % (self.find_element().text, text, wait_time))
elif self.find_element().text != text:
counter += 10
time.sleep(10)
else:
self.driver.info('*Element %s text is equal to %s*' % (self.name, text))
return
def scroll_to_element(self, depth: int = 9, direction='down'): def scroll_to_element(self, depth: int = 9, direction='down'):
self.driver.info('*Scrolling %s to %s*' % (direction, self.name)) self.driver.info('*Scrolling %s to %s*' % (direction, self.name))
for _ in range(depth): for _ in range(depth):
@ -276,19 +290,6 @@ class Text(BaseElement):
self.driver.info('*%s is %s*' % (self.name, text)) self.driver.info('*%s is %s*' % (self.name, text))
return text return text
def wait_for_element_text(self, text, wait_time=30):
counter = 0
self.driver.info("*Wait for text element %s to be equal to %s*" % (self.name, text))
while True:
if counter >= wait_time:
self.driver.fail(
"'%s' is not equal to expected '%s' in %s sec" % (self.find_element().text, text, wait_time))
elif self.find_element().text != text:
counter += 10
time.sleep(10)
else:
self.driver.info('*Element %s text is equal to %s*' % (self.name, text))
return
class Button(BaseElement): class Button(BaseElement):

View File

@ -106,10 +106,6 @@ class ChatElementByText(Text):
except NoSuchElementException: except NoSuchElementException:
ChatView(self.driver).reconnect() ChatView(self.driver).reconnect()
def click_on_text(self):
self.locator = "%s/ancestor::android.view.ViewGroup[@content-desc='chat-item']/android.view.ViewGroup" % self.message_locator
self.click()
@property @property
def image_in_reply(self): def image_in_reply(self):
class ImageInReply(BaseElement): class ImageInReply(BaseElement):
@ -148,72 +144,11 @@ class ChatElementByText(Text):
return Username(self.driver, self.locator) return Username(self.driver, self.locator)
@property
def send_request_button(self):
class SendRequestButton(Button):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, translation_id="command-button-send")
self.button = SendRequestButton(self.driver, self.locator)
return self.button
@property
def transaction_status(self):
class TransactionStatus(Text):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/*[1]/*[1]/*[5]/android.widget.TextView")
return TransactionStatus(self.driver, self.locator)
def contains_text(self, text, wait_time=5) -> bool: def contains_text(self, text, wait_time=5) -> bool:
element = Text(self.driver, prefix=self.locator, element = Text(self.driver, prefix=self.locator,
xpath="//android.view.ViewGroup//android.widget.TextView[contains(@text,'%s')]" % text) xpath="//android.view.ViewGroup//android.widget.TextView[contains(@text,'%s')]" % text)
return element.is_element_displayed(wait_time) return element.is_element_displayed(wait_time)
@property
def accept_and_share_address(self):
class AcceptAndShareAddress(Button):
def __init__(self, driver, parent_locator):
super().__init__(driver, prefix=parent_locator, translation_id="accept-and-share-address")
def navigate(self):
from views.send_transaction_view import SendTransactionView
return SendTransactionView(self.driver)
def click(self):
self.wait_for_element().click()
return self.navigate()
return AcceptAndShareAddress(self.driver, self.locator)
@property
def decline_transaction(self):
class DeclineTransaction(Button):
def __init__(self, driver, parent_locator):
super().__init__(driver, prefix=parent_locator, translation_id="decline")
def click(self):
self.wait_for_element().click()
return self.navigate()
return DeclineTransaction(self.driver, self.locator)
@property
def sign_and_send(self):
class SignAndSend(Button):
def __init__(self, driver, parent_locator):
super().__init__(driver, prefix=parent_locator, translation_id="sign-and-send")
def navigate(self):
from views.send_transaction_view import SendTransactionView
return SendTransactionView(self.driver)
def click(self):
self.wait_for_element().click()
return self.navigate()
return SignAndSend(self.driver, self.locator)
@property @property
def replied_message_text(self): def replied_message_text(self):
class RepliedMessageText(Text): class RepliedMessageText(Text):
@ -266,6 +201,7 @@ class UsernameOptions(Button):
self.wait_for_element().click() self.wait_for_element().click()
return self.navigate() return self.navigate()
class UsernameCheckbox(Button): class UsernameCheckbox(Button):
def __init__(self, driver, username): def __init__(self, driver, username):
self.username = username self.username = username
@ -277,6 +213,7 @@ class UsernameCheckbox(Button):
except NoSuchElementException: except NoSuchElementException:
self.scroll_to_element(direction='up', depth=20).click() self.scroll_to_element(direction='up', depth=20).click()
class GroupChatInfoView(BaseView): class GroupChatInfoView(BaseView):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver) super().__init__(driver)
@ -292,6 +229,84 @@ class GroupChatInfoView(BaseView):
def get_user_from_group_info(self, username: str): def get_user_from_group_info(self, username: str):
return Text(self.driver, xpath="//*[@text='%s']" % username) return Text(self.driver, xpath="//*[@text='%s']" % username)
class TransactionMessage(ChatElementByText):
def __init__(self, driver, text:str):
super().__init__(driver, text=text)
# Common statuses for incoming and outgoing transactions
self.address_requested = self.get_translation_by_key("address-requested")
self.confirmed = self.get_translation_by_key("status-confirmed")
self.pending = self.get_translation_by_key("pending")
self.declined = self.get_translation_by_key("transaction-declined")
@property
def transaction_status(self):
class TransactionStatus(SilentButton):
def __init__(self, driver, parent_locator: str):
super().__init__(driver, prefix=parent_locator, xpath="/*[1]/*[1]/*[5]/android.widget.TextView")
return TransactionStatus(self.driver, self.locator)
@property
def decline_transaction(self):
class DeclineTransaction(Button):
def __init__(self, driver, parent_locator):
super().__init__(driver, prefix=parent_locator, translation_id="decline")
def click(self):
self.wait_for_element().click()
return self.navigate()
return DeclineTransaction(self.driver, self.locator)
class OutgoingTransaction(TransactionMessage):
def __init__(self, driver, account_name: str):
super().__init__(driver, text="↑ Outgoing transaction")
self.account_name = account_name
self.address_request_accepted = self.get_translation_by_key("address-request-accepted")
self.address_received = self.get_translation_by_key("address-received")
@property
def sign_and_send(self):
class SignAndSend(Button):
def __init__(self, driver, parent_locator):
super().__init__(driver, prefix=parent_locator, translation_id="sign-and-send")
def navigate(self):
from views.send_transaction_view import SendTransactionView
return SendTransactionView(self.driver)
def click(self):
self.wait_for_element().click()
return self.navigate()
return SignAndSend(self.driver, self.locator)
class IncomingTransaction(TransactionMessage):
def __init__(self, driver, account_name: str):
super().__init__(driver, text="↓ Incoming transaction")
self.account_name = account_name
self.shared_account = "Shared '%s'" % account_name
@property
def accept_and_share_address(self):
class AcceptAndShareAddress(Button):
def __init__(self, driver, parent_locator):
super().__init__(driver, prefix=parent_locator, translation_id="accept-and-share-address")
def navigate(self):
from views.send_transaction_view import SendTransactionView
return SendTransactionView(self.driver)
def click(self):
self.wait_for_element().click()
return self.navigate()
return AcceptAndShareAddress(self.driver, self.locator)
class ChatView(BaseView): class ChatView(BaseView):
def __init__(self, driver): def __init__(self, driver):
super().__init__(driver) super().__init__(driver)
@ -400,6 +415,17 @@ class ChatView(BaseView):
self.timeline_open_images_panel_button = Button(self.driver, accessibility_id="open-images-panel-button") self.timeline_open_images_panel_button = Button(self.driver, accessibility_id="open-images-panel-button")
self.timeline_send_my_status_button = Button(self.driver, accessibility_id="send-my-status-button") self.timeline_send_my_status_button = Button(self.driver, accessibility_id="send-my-status-button")
def get_outgoing_transaction(self, account=None):
if account is None:
account = self.status_account_name
return OutgoingTransaction(self.driver, account)
def get_incoming_transaction(self, account=None):
if account is None:
account = self.status_account_name
return IncomingTransaction(self.driver, account)
def delete_chat(self): def delete_chat(self):
self.driver.info("**Delete chat via options**") self.driver.info("**Delete chat via options**")
self.chat_options.click() self.chat_options.click()
@ -616,6 +642,10 @@ class ChatView(BaseView):
def invite_system_message(admin, invited_user): def invite_system_message(admin, invited_user):
return '%s has invited %s' % (admin, invited_user) return '%s has invited %s' % (admin, invited_user)
@staticmethod
def invited_to_join_system_message(username, chat_name):
return '%s invited you to join the group %s' % (username, chat_name)
@staticmethod @staticmethod
def join_system_message(username): def join_system_message(username):
return '%s joined the group' % username return '%s joined the group' % username

View File

@ -86,6 +86,7 @@ class HomeView(BaseView):
def get_chat(self, username): def get_chat(self, username):
self.driver.info("**Looking for chat '%s'**" % username) self.driver.info("**Looking for chat '%s'**" % username)
ChatElement(self.driver, username[:25]).wait_for_element(30)
return ChatElement(self.driver, username[:25]) return ChatElement(self.driver, username[:25])
def get_username_below_start_new_chat_button(self, username_part): def get_username_below_start_new_chat_button(self, username_part):
@ -94,11 +95,11 @@ class HomeView(BaseView):
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)) self.driver.info("**Starting 1-1 chat, add in contacts:%s**" % str(add_in_contacts))
self.plus_button.click_until_presence_of_element(self.start_new_chat_button) self.plus_button.click_until_presence_of_element(self.start_new_chat_button)
contacts_view = self.start_new_chat_button.click() chat = self.start_new_chat_button.click()
contacts_view.public_key_edit_box.click() chat.public_key_edit_box.click()
contacts_view.public_key_edit_box.send_keys(public_key) chat.public_key_edit_box.send_keys(public_key)
one_to_one_chat = self.get_chat_view() one_to_one_chat = self.get_chat_view()
contacts_view.confirm_until_presence_of_element(one_to_one_chat.chat_message_input) chat.confirm_until_presence_of_element(one_to_one_chat.chat_message_input)
if add_in_contacts: if add_in_contacts:
one_to_one_chat.add_to_contacts.click() one_to_one_chat.add_to_contacts.click()
if nickname: if nickname:

View File

@ -135,7 +135,7 @@ class SendTransactionView(BaseView):
self.done_button.click_until_absense_of_element(self.done_button) self.done_button.click_until_absense_of_element(self.done_button)
def sign_transaction(self, sender_password: str = common_password, keycard=False, default_gas_price=True): def sign_transaction(self, sender_password: str = common_password, keycard=False, default_gas_price=True):
self.driver.info("**Signing transaction (keycard:%s, default_gas_price:%s)" % (str(keycard), str(default_gas_price))) self.driver.info("**Signing transaction (keycard:%s, default_gas_price:%s)**" % (str(keycard), str(default_gas_price)))
if not default_gas_price: if not default_gas_price:
self.network_fee_button.click() self.network_fee_button.click()
default_gas_price = self.gas_price_input.text default_gas_price = self.gas_price_input.text
@ -152,11 +152,11 @@ class SendTransactionView(BaseView):
self.ok_button.wait_for_element(120) self.ok_button.wait_for_element(120)
if self.element_by_text_part('Transaction failed').is_element_displayed(): if self.element_by_text_part('Transaction failed').is_element_displayed():
self.driver.fail('Transaction failed') self.driver.fail('Transaction failed')
self.driver.info("**Transaction is signed!") self.driver.info("**Transaction is signed!**")
self.ok_button.click() self.ok_button.click()
def get_transaction_fee_total(self): def get_transaction_fee_total(self):
self.driver.info("**Getting transaction fee") self.driver.info("**Getting transaction fee**")
self.network_fee_button.click_until_presence_of_element(self.gas_limit_input) self.network_fee_button.click_until_presence_of_element(self.gas_limit_input)
fee_value = self.transaction_fee_total_value.text.split()[0] fee_value = self.transaction_fee_total_value.text.split()[0]
self.update_fee_button.click() self.update_fee_button.click()
@ -167,18 +167,18 @@ class SendTransactionView(BaseView):
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)
def get_values_from_send_transaction_bottom_sheet(self, gas=False): def get_values_from_send_transaction_bottom_sheet(self, gas=False):
self.driver.info("**Getting values from send transaction bottom sheet") self.driver.info("**Getting values from send transaction bottom sheet**")
data = { data = {
'amount': self.amount_edit_box.text, 'amount': self.amount_edit_box.text,
'asset': self.asset_text.text, 'asset': self.asset_text.text,
@ -193,7 +193,7 @@ class SendTransactionView(BaseView):
return data return data
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()
self.new_favorite_name_input.set_value(name) self.new_favorite_name_input.set_value(name)
self.new_favorite_add_favorite.click() self.new_favorite_add_favorite.click()

View File

@ -84,7 +84,6 @@ class TransactionTable(BaseElement):
return self.TransactionElement.by_amount(self.driver, amount=amount.replace(',', '.'), asset=asset) return self.TransactionElement.by_amount(self.driver, amount=amount.replace(',', '.'), asset=asset)
def find_transaction(self, amount: str, asset='ETH') -> TransactionElement: def find_transaction(self, amount: str, asset='ETH') -> TransactionElement:
self.driver.info('**Finding %s %s transaction**' % (amount, asset))
element = self.transaction_by_amount(amount=amount, asset=asset) element = self.transaction_by_amount(amount=amount, asset=asset)
for i in range(9): for i in range(9):
try: try:

View File

@ -160,14 +160,15 @@ class WalletView(BaseView):
counter = 0 counter = 0
while True: while True:
if counter >= wait_time: if counter >= wait_time:
self.driver.fail('Balance is not changed during %s seconds!' % wait_time) self.driver.fail('Balance %s %s is not changed during %s seconds!' % (asset, initial_balance,wait_time))
elif self.asset_by_name(asset).is_element_present() and self.get_asset_amount_by_name(asset) == initial_balance: elif self.asset_by_name(asset).is_element_present() and self.get_asset_amount_by_name(asset) == initial_balance:
if not self.transaction_history_button.is_element_displayed(): if not self.transaction_history_button.is_element_displayed():
self.wallet_account_by_name(self.status_account_name).click() self.wallet_account_by_name(self.status_account_name).click()
self.swipe_up() if (counter/60).is_integer():
self.driver.swipe(500, 500, 500, 1000)
self.driver.info("*Refreshing transaction history*")
counter += 10 counter += 10
time.sleep(10) time.sleep(10)
[self.wallet_button.click() for _ in range(2)]
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):
counter += 10 counter += 10
@ -178,7 +179,7 @@ class WalletView(BaseView):
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.accounts_status_account.scroll_to_element(direction='up') self.wallet_button.double_click()
return self return self
def get_sign_in_phrase(self): def get_sign_in_phrase(self):
@ -283,6 +284,16 @@ class WalletView(BaseView):
sender_password=kwargs.get('sender_password', common_password)) sender_password=kwargs.get('sender_password', common_password))
return send_transaction_view return send_transaction_view
def find_transaction_in_history(self, amount, asset='ETH', account_name=None):
if account_name == None:
account_name = self.status_account_name
self.driver.info('**Finding %s %s transaction for %s**' % (amount, asset, account_name))
if not self.transaction_history_button.is_element_displayed():
self.get_account_by_name(account_name).click()
self.transaction_history_button.wait_for_element()
transactions_view = self.transaction_history_button.click()
return transactions_view.transactions_table.find_transaction(amount=amount, asset=asset)
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)