2020-05-14 10:41:09 +00:00
|
|
|
import time
|
|
|
|
|
|
|
|
from tests import marks
|
2020-05-15 14:51:59 +00:00
|
|
|
from tests.users import transaction_senders, transaction_recipients, ens_user_ropsten
|
2020-05-14 10:41:09 +00:00
|
|
|
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
|
|
|
|
from views.sign_in_view import SignInView
|
|
|
|
|
|
|
|
@marks.transaction
|
|
|
|
class TestCommandsMultipleDevices(MultipleDeviceTestCase):
|
|
|
|
|
|
|
|
@marks.testrail_id(6293)
|
|
|
|
@marks.critical
|
|
|
|
def test_keycard_send_eth_in_1_1_chat(self):
|
2020-07-22 13:30:07 +00:00
|
|
|
sender = transaction_senders['E']
|
2020-05-14 10:41:09 +00:00
|
|
|
self.create_drivers(2)
|
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
|
|
|
home_1 = device_1.recover_access(passphrase=sender['passphrase'], keycard=True)
|
2020-07-06 13:04:39 +00:00
|
|
|
home_2 = device_2.create_user(keycard=True)
|
|
|
|
recipient_public_key, recipient_username = home_2.get_public_key_and_username(return_username=True)
|
2020-05-14 10:41:09 +00:00
|
|
|
wallet_1, wallet_2 = home_1.wallet_button.click(), home_2.wallet_button.click()
|
|
|
|
for wallet in (wallet_1, wallet_2):
|
|
|
|
wallet.set_up_wallet()
|
|
|
|
wallet.home_button.click()
|
|
|
|
|
2020-07-06 13:04:39 +00:00
|
|
|
chat_1 = home_1.add_contact(recipient_public_key)
|
2020-05-14 10:41:09 +00:00
|
|
|
amount = chat_1.get_unique_amount()
|
|
|
|
|
|
|
|
home_1.just_fyi('Send %s ETH in 1-1 chat and check it for sender and receiver: Address requested' % amount)
|
2020-08-14 16:05:41 +00:00
|
|
|
chat_1.commands_button.click_until_presence_of_element(chat_1.send_command)
|
2020-05-14 10:41:09 +00:00
|
|
|
send_transaction = chat_1.send_command.click()
|
2020-07-06 13:04:39 +00:00
|
|
|
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()
|
2020-05-14 10:41:09 +00:00
|
|
|
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')
|
|
|
|
send_transaction.amount_edit_box.set_value(amount)
|
|
|
|
send_transaction.confirm()
|
|
|
|
send_transaction.sign_transaction_button.click()
|
|
|
|
chat_1_sender_message = chat_1.chat_element_by_text('↑ Outgoing transaction')
|
|
|
|
if not chat_1_sender_message.is_element_displayed():
|
|
|
|
self.driver.fail('No message is shown after sending ETH in 1-1 chat for sender')
|
2020-11-10 17:07:39 +00:00
|
|
|
chat_1_sender_message.transaction_status.wait_for_element_text('Address requested')
|
2020-05-14 10:41:09 +00:00
|
|
|
|
|
|
|
chat_2 = home_2.get_chat(sender['username']).click()
|
|
|
|
chat_2_receiver_message = chat_2.chat_element_by_text('↓ Incoming transaction')
|
|
|
|
timestamp_sender = chat_1_sender_message.timestamp_message.text
|
|
|
|
if not chat_2_receiver_message.is_element_displayed():
|
|
|
|
self.driver.fail('No message about incoming transaction in 1-1 chat is shown for receiver')
|
2020-11-10 17:07:39 +00:00
|
|
|
chat_2_receiver_message.transaction_status.wait_for_element_text('Address requested')
|
2020-05-14 10:41:09 +00:00
|
|
|
|
|
|
|
home_2.just_fyi('Accept and share address for sender and receiver')
|
|
|
|
for text in ('Accept and share address', 'Decline'):
|
|
|
|
if not chat_2_receiver_message.contains_text(text):
|
|
|
|
self.driver.fail("Transaction message doesn't contain required option %s" % text)
|
|
|
|
select_account_bottom_sheet = chat_2_receiver_message.accept_and_share_address.click()
|
2020-11-12 17:28:34 +00:00
|
|
|
if not select_account_bottom_sheet.get_account_in_select_account_bottom_sheet_button(wallet_1.status_account_name).is_element_displayed():
|
2020-05-14 10:41:09 +00:00
|
|
|
self.errors.append('Not expected value in "From" in "Select account": "Status" is expected')
|
|
|
|
select_account_bottom_sheet.select_button.click()
|
2020-11-11 15:37:27 +00:00
|
|
|
chat_2_receiver_message.transaction_status.wait_for_element_text("Shared '%s'" % home_1.status_account_name)
|
2020-11-10 17:07:39 +00:00
|
|
|
chat_1_sender_message.transaction_status.wait_for_element_text('Address request accepted')
|
2020-05-14 10:41:09 +00:00
|
|
|
|
|
|
|
home_1.just_fyi("Sign and send transaction and check that timestamp on message is updated")
|
|
|
|
time.sleep(40)
|
|
|
|
send_message = chat_1_sender_message.sign_and_send.click()
|
|
|
|
send_message.next_button.click()
|
2020-07-22 13:30:07 +00:00
|
|
|
send_message.sign_transaction(keycard=True, default_gas_price=False)
|
2020-11-10 17:07:39 +00:00
|
|
|
chat_1_sender_message.transaction_status.wait_for_element_text('Pending')
|
2020-05-14 10:41:09 +00:00
|
|
|
updated_timestamp_sender = chat_1_sender_message.timestamp_message.text
|
|
|
|
if updated_timestamp_sender == timestamp_sender:
|
|
|
|
self.errors.append("Timestamp of message is not updated after signing transaction")
|
|
|
|
|
|
|
|
chat_1.wallet_button.click()
|
|
|
|
wallet_1.accounts_status_account.click()
|
|
|
|
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)
|
2020-11-03 13:37:37 +00:00
|
|
|
wallet_1.home_button.click(desired_view='chat')
|
2020-05-14 10:41:09 +00:00
|
|
|
|
|
|
|
home_1.just_fyi("Check 'Confirmed' state for sender")
|
2020-11-10 17:07:39 +00:00
|
|
|
chat_1_sender_message.transaction_status.wait_for_element_text('Confirmed')
|
2020-05-14 10:41:09 +00:00
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
|
|
@marks.testrail_id(6294)
|
2020-07-29 15:54:45 +00:00
|
|
|
@marks.medium
|
2020-09-02 15:57:19 +00:00
|
|
|
def test_keycard_request_and_receive_stt_in_1_1_chat_offline_opened_from_push(self):
|
2020-07-22 13:30:07 +00:00
|
|
|
sender = transaction_senders['D']
|
2020-05-14 10:41:09 +00:00
|
|
|
self.create_drivers(2)
|
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
|
|
|
|
|
|
|
device_1.just_fyi('Grab user data for transactions and public chat, set up wallets')
|
|
|
|
home_1 = device_1.create_user(keycard=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.set_up_wallet()
|
|
|
|
recipient_address = wallet_1.get_wallet_address()
|
|
|
|
wallet_1.back_button.click()
|
|
|
|
wallet_1.select_asset('STT')
|
|
|
|
wallet_1.home_button.click()
|
|
|
|
|
2020-09-02 15:57:19 +00:00
|
|
|
home_2 = device_2.recover_access(passphrase=sender['passphrase'], keycard=True, enable_notifications=True)
|
2020-05-14 10:41:09 +00:00
|
|
|
wallet_2 = home_2.wallet_button.click()
|
|
|
|
wallet_2.set_up_wallet()
|
|
|
|
wallet_2.home_button.click()
|
|
|
|
|
|
|
|
device_2.just_fyi('Add recipient to contact and send 1 message')
|
|
|
|
chat_2 = home_2.add_contact(recipient_public_key)
|
|
|
|
chat_2.send_message("Hey there!")
|
|
|
|
amount = chat_2.get_unique_amount()
|
|
|
|
asset_name = 'STT'
|
|
|
|
profile_2 = wallet_2.profile_button.click()
|
2020-07-06 13:04:39 +00:00
|
|
|
profile_2.airplane_mode_button.click()
|
|
|
|
device_2.home_button.click()
|
2020-09-02 15:57:19 +00:00
|
|
|
device_2.click_system_home_button()
|
2020-05-14 10:41:09 +00:00
|
|
|
chat_element = home_1.get_chat(sender['username'])
|
|
|
|
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)
|
|
|
|
chat_1.commands_button.click()
|
|
|
|
request_transaction = chat_1.request_command.click()
|
|
|
|
request_transaction.amount_edit_box.set_value(amount)
|
|
|
|
request_transaction.confirm()
|
|
|
|
asset_button = request_transaction.asset_by_name(asset_name)
|
|
|
|
request_transaction.select_asset_button.click_until_presence_of_element(asset_button)
|
|
|
|
asset_button.click()
|
|
|
|
request_transaction.request_transaction_button.click()
|
|
|
|
chat_1_request_message = chat_1.chat_element_by_text('↓ Incoming transaction')
|
|
|
|
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')
|
|
|
|
|
|
|
|
home_2.just_fyi('Check that transaction message is fetched from offline and sign transaction')
|
2020-07-06 13:04:39 +00:00
|
|
|
profile_2.airplane_mode_button.click()
|
2020-09-02 15:57:19 +00:00
|
|
|
transaction_request_pn = 'Request transaction'
|
|
|
|
device_2.open_notification_bar()
|
|
|
|
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")
|
|
|
|
device_2.element_by_text(transaction_request_pn).click()
|
2020-05-14 10:41:09 +00:00
|
|
|
chat_2_sender_message = chat_2.chat_element_by_text('↑ Outgoing transaction')
|
|
|
|
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')
|
2020-11-10 17:07:39 +00:00
|
|
|
chat_2_sender_message.transaction_status.wait_for_element_text('Address received')
|
2020-05-14 10:41:09 +00:00
|
|
|
send_message = chat_2_sender_message.sign_and_send.click()
|
|
|
|
send_message.next_button.click()
|
2020-07-22 13:30:07 +00:00
|
|
|
send_message.sign_transaction(keycard=True, default_gas_price=False)
|
2020-05-14 10:41:09 +00:00
|
|
|
|
|
|
|
home_2.just_fyi('Check that transaction message is updated with new status after offline')
|
|
|
|
chat_2.toggle_airplane_mode()
|
2020-07-22 13:30:07 +00:00
|
|
|
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, token=True)
|
2020-05-14 10:41:09 +00:00
|
|
|
chat_2.toggle_airplane_mode()
|
2020-07-08 10:03:28 +00:00
|
|
|
chat_2.connection_status.wait_for_invisibility_of_element(60)
|
2020-11-10 17:07:39 +00:00
|
|
|
chat_2_sender_message.transaction_status.wait_for_element_text('Confirmed')
|
2020-05-14 10:41:09 +00:00
|
|
|
self.errors.verify_no_errors()
|
|
|
|
|
|
|
|
|
|
|
|
@marks.transaction
|
|
|
|
class TestCommandsSingleDevices(SingleDeviceTestCase):
|
|
|
|
|
|
|
|
@marks.testrail_id(6295)
|
|
|
|
@marks.high
|
|
|
|
def test_keycard_send_eth_to_ens(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
|
|
|
sender = transaction_senders['E']
|
|
|
|
home = sign_in.recover_access(sender['passphrase'], keycard=True)
|
2020-05-15 14:51:59 +00:00
|
|
|
chat = home.add_contact(ens_user_ropsten['ens'])
|
2020-05-14 10:41:09 +00:00
|
|
|
chat.commands_button.click()
|
|
|
|
amount = chat.get_unique_amount()
|
|
|
|
|
|
|
|
send_message = chat.send_command.click()
|
|
|
|
send_message.amount_edit_box.set_value(amount)
|
|
|
|
send_message.confirm()
|
|
|
|
send_message.next_button.click()
|
|
|
|
|
|
|
|
from views.send_transaction_view import SendTransactionView
|
|
|
|
send_transaction = SendTransactionView(self.driver)
|
|
|
|
send_transaction.sign_transaction(keycard=True)
|
|
|
|
chat_sender_message = chat.chat_element_by_text('↑ Outgoing transaction')
|
|
|
|
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount, confirmations=15)
|
2020-11-10 17:07:39 +00:00
|
|
|
chat_sender_message.transaction_status.wait_for_element_text('Confirmed')
|