2018-02-09 15:16:07 +00:00
|
|
|
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
|
2018-04-26 12:34:15 +00:00
|
|
|
from tests import transaction_users, api_requests, get_current_time, transaction_users_wallet, marks
|
2018-01-14 17:43:36 +00:00
|
|
|
from selenium.common.exceptions import TimeoutException
|
2017-10-13 08:41:30 +00:00
|
|
|
|
2018-03-01 13:22:01 +00:00
|
|
|
from views.sign_in_view import SignInView
|
|
|
|
|
2017-10-13 08:41:30 +00:00
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.all
|
|
|
|
@marks.transaction
|
2018-02-09 15:16:07 +00:00
|
|
|
class TestTransaction(SingleDeviceTestCase):
|
2017-10-13 08:41:30 +00:00
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
|
|
|
@marks.testrail_case_id(3401)
|
2018-02-09 15:16:07 +00:00
|
|
|
def test_transaction_send_command_one_to_one_chat(self):
|
|
|
|
recipient = transaction_users['B_USER']
|
2018-03-01 13:22:01 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
sign_in_view.create_user()
|
|
|
|
home_view = sign_in_view.get_home_view()
|
2018-02-09 15:16:07 +00:00
|
|
|
transaction_amount = home_view.get_unique_amount()
|
2018-01-26 11:07:09 +00:00
|
|
|
sender_public_key = home_view.get_public_key()
|
|
|
|
sender_address = home_view.public_key_to_address(sender_public_key)
|
2018-01-14 17:43:36 +00:00
|
|
|
home_view.home_button.click()
|
2018-01-03 09:34:40 +00:00
|
|
|
api_requests.get_donate(sender_address)
|
2018-02-09 15:16:07 +00:00
|
|
|
home_view.add_contact(recipient['public_key'])
|
|
|
|
chat_view = home_view.get_chat_with_user(recipient['username']).click()
|
2018-04-26 06:22:11 +00:00
|
|
|
initial_balance_recipient = api_requests.get_balance(recipient['address'])
|
|
|
|
chat_view.send_transaction_in_1_1_chat(transaction_amount, 'qwerty1234')
|
2018-02-09 15:16:07 +00:00
|
|
|
send_transaction_view = chat_view.get_send_transaction_view()
|
|
|
|
send_transaction_view.back_button.click()
|
2018-04-26 06:22:11 +00:00
|
|
|
api_requests.verify_balance_is_updated(initial_balance_recipient, recipient['address'])
|
2018-02-09 15:16:07 +00:00
|
|
|
wallet_view = home_view.wallet_button.click()
|
2018-05-11 19:15:39 +00:00
|
|
|
wallet_view.set_up_wallet()
|
2018-02-09 15:16:07 +00:00
|
|
|
transactions_view = wallet_view.transactions_button.click()
|
|
|
|
transactions_view.transactions_table.find_transaction(amount=transaction_amount)
|
2017-10-13 08:41:30 +00:00
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
|
|
|
@marks.testrail_case_id(3402)
|
2018-02-09 15:16:07 +00:00
|
|
|
def test_transaction_send_command_wrong_password(self):
|
|
|
|
sender = transaction_users['A_USER']
|
|
|
|
recipient = transaction_users['B_USER']
|
2018-03-01 13:22:01 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
|
|
|
home_view = sign_in_view.get_home_view()
|
2018-02-09 15:16:07 +00:00
|
|
|
transaction_amount = '0.001'
|
|
|
|
home_view.add_contact(recipient['public_key'])
|
|
|
|
chat_view = home_view.get_chat_with_user(recipient['username']).click()
|
2018-02-19 11:51:53 +00:00
|
|
|
chat_view.commands_button.click()
|
2018-01-14 17:43:36 +00:00
|
|
|
chat_view.send_command.click()
|
2018-02-09 15:16:07 +00:00
|
|
|
chat_view.send_as_keyevent(transaction_amount)
|
2018-01-14 17:43:36 +00:00
|
|
|
send_transaction_view = chat_view.get_send_transaction_view()
|
2018-02-09 15:16:07 +00:00
|
|
|
chat_view.send_message_button.click_until_presence_of_element(send_transaction_view.sign_transaction_button)
|
|
|
|
send_transaction_view.sign_transaction_button.click_until_presence_of_element(
|
|
|
|
send_transaction_view.enter_password_input)
|
|
|
|
send_transaction_view.enter_password_input.send_keys('wrong_password')
|
2018-01-03 09:34:40 +00:00
|
|
|
send_transaction_view.sign_transaction_button.click()
|
2018-02-09 15:16:07 +00:00
|
|
|
send_transaction_view.find_full_text('Wrong password', 20)
|
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
|
|
|
@marks.testrail_case_id(3403)
|
2018-02-09 15:16:07 +00:00
|
|
|
def test_transaction_send_command_group_chat(self):
|
|
|
|
recipient = transaction_users['A_USER']
|
2018-03-01 13:22:01 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
sign_in_view.create_user()
|
|
|
|
home_view = sign_in_view.get_home_view()
|
2018-02-09 15:16:07 +00:00
|
|
|
transaction_amount = '0.001'
|
|
|
|
sender_public_key = home_view.get_public_key()
|
|
|
|
sender_address = home_view.public_key_to_address(sender_public_key)
|
|
|
|
home_view.home_button.click()
|
|
|
|
api_requests.get_donate(sender_address)
|
|
|
|
home_view.add_contact(recipient['public_key'])
|
|
|
|
home_view.get_back_to_home_view()
|
|
|
|
home_view.create_group_chat([recipient['username']], 'trg_%s' % get_current_time())
|
|
|
|
chat_view = home_view.get_chat_view()
|
2018-04-26 06:22:11 +00:00
|
|
|
initial_recipient_balance = api_requests.get_balance(recipient['address'])
|
|
|
|
chat_view.send_transaction_in_group_chat(transaction_amount, 'qwerty1234', recipient)
|
|
|
|
api_requests.verify_balance_is_updated(initial_recipient_balance, recipient['address'])
|
2017-10-13 08:41:30 +00:00
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
|
|
|
@marks.testrail_case_id(3404)
|
2017-10-13 08:41:30 +00:00
|
|
|
def test_send_transaction_from_daap(self):
|
2018-02-09 15:16:07 +00:00
|
|
|
sender = transaction_users['B_USER']
|
2018-03-01 13:22:01 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
2017-10-23 10:23:14 +00:00
|
|
|
address = transaction_users['B_USER']['address']
|
2018-01-03 09:34:40 +00:00
|
|
|
initial_balance = api_requests.get_balance(address)
|
2018-05-14 14:56:21 +00:00
|
|
|
profile_view = sign_in_view.profile_button.click()
|
|
|
|
profile_view.advanced_button.click()
|
|
|
|
profile_view.debug_mode_toggle.click()
|
|
|
|
home_view = profile_view.home_button.click()
|
2018-01-14 17:43:36 +00:00
|
|
|
start_new_chat_view = home_view.plus_button.click()
|
2018-02-07 13:18:55 +00:00
|
|
|
start_new_chat_view.open_d_app_button.click()
|
2018-05-14 14:56:21 +00:00
|
|
|
start_new_chat_view.simple_dapp_button.scroll_to_element()
|
|
|
|
simple_dapp = start_new_chat_view.simple_dapp_button.click()
|
2018-02-07 13:18:55 +00:00
|
|
|
start_new_chat_view.open_button.click()
|
2018-03-28 10:21:39 +00:00
|
|
|
|
2018-05-14 14:56:21 +00:00
|
|
|
simple_dapp.wait_for_d_aap_to_load()
|
|
|
|
simple_dapp.assets_button.click()
|
|
|
|
simple_dapp.request_stt_button.click()
|
2018-03-28 10:21:39 +00:00
|
|
|
|
2018-01-14 17:43:36 +00:00
|
|
|
send_transaction_view = home_view.get_send_transaction_view()
|
2018-02-09 15:16:07 +00:00
|
|
|
send_transaction_view.sign_transaction(sender['password'])
|
2018-03-28 10:21:39 +00:00
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
api_requests.verify_balance_is_updated(initial_balance, address)
|
2018-02-09 15:16:07 +00:00
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
|
|
|
@marks.testrail_case_id(3406)
|
2018-02-19 11:51:53 +00:00
|
|
|
def test_send_stt_from_wallet_via_enter_recipient_address(self):
|
2018-02-09 15:16:07 +00:00
|
|
|
sender = transaction_users_wallet['A_USER']
|
|
|
|
recipient = transaction_users_wallet['B_USER']
|
2018-03-01 13:22:01 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
|
|
|
home_view = sign_in_view.get_home_view()
|
2018-02-09 15:16:07 +00:00
|
|
|
home_view.add_contact(recipient['public_key'])
|
|
|
|
home_view.get_back_to_home_view()
|
|
|
|
wallet_view = home_view.wallet_button.click()
|
|
|
|
send_transaction = wallet_view.send_button.click()
|
|
|
|
send_transaction.select_asset_button.click_until_presence_of_element(send_transaction.stt_button)
|
|
|
|
send_transaction.stt_button.click()
|
|
|
|
send_transaction.amount_edit_box.click()
|
|
|
|
send_transaction.amount_edit_box.set_value(send_transaction.get_unique_amount())
|
|
|
|
send_transaction.confirm()
|
|
|
|
send_transaction.chose_recipient_button.click()
|
2018-02-19 11:51:53 +00:00
|
|
|
send_transaction.enter_recipient_address_button.click()
|
2018-02-09 15:16:07 +00:00
|
|
|
send_transaction.enter_recipient_address_input.set_value(recipient['address'])
|
|
|
|
send_transaction.done_button.click()
|
|
|
|
send_transaction.sign_transaction_button.click()
|
|
|
|
send_transaction.enter_password_input.send_keys(sender['password'])
|
|
|
|
send_transaction.sign_transaction_button.click()
|
|
|
|
send_transaction.got_it_button.click()
|
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
|
|
|
@marks.testrail_case_id(3407)
|
2018-02-09 15:16:07 +00:00
|
|
|
def test_send_eth_from_wallet_sign_now(self):
|
2018-04-27 15:55:25 +00:00
|
|
|
recipient = transaction_users['F_USER']
|
|
|
|
sender = transaction_users['E_USER']
|
2018-03-01 13:22:01 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
|
|
|
home_view = sign_in_view.get_home_view()
|
2018-04-17 13:26:08 +00:00
|
|
|
home_view.add_contact(recipient['public_key'])
|
|
|
|
home_view.get_back_to_home_view()
|
2018-02-09 15:16:07 +00:00
|
|
|
wallet_view = home_view.wallet_button.click()
|
|
|
|
send_transaction = wallet_view.send_button.click()
|
|
|
|
send_transaction.amount_edit_box.click()
|
|
|
|
send_transaction.amount_edit_box.set_value(send_transaction.get_unique_amount())
|
|
|
|
send_transaction.confirm()
|
|
|
|
send_transaction.chose_recipient_button.click()
|
|
|
|
send_transaction.recent_recipients_button.click()
|
2018-04-17 13:26:08 +00:00
|
|
|
recent_recipient = send_transaction.element_by_text(recipient['username'])
|
2018-02-09 15:16:07 +00:00
|
|
|
send_transaction.recent_recipients_button.click_until_presence_of_element(recent_recipient)
|
|
|
|
recent_recipient.click()
|
|
|
|
send_transaction.sign_transaction_button.click()
|
|
|
|
send_transaction.enter_password_input.send_keys(sender['password'])
|
|
|
|
send_transaction.sign_transaction_button.click()
|
|
|
|
send_transaction.got_it_button.click()
|
|
|
|
|
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.all
|
|
|
|
@marks.transaction
|
2018-02-09 15:16:07 +00:00
|
|
|
class TestTransactions(MultipleDeviceTestCase):
|
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
|
|
|
@marks.testrail_case_id(3408)
|
2018-02-09 15:16:07 +00:00
|
|
|
def test_send_eth_to_request_in_group_chat(self):
|
2018-04-09 11:44:30 +00:00
|
|
|
recipient = transaction_users['E_USER']
|
2018-04-26 06:22:11 +00:00
|
|
|
sender = self.senders['f_user'] = transaction_users['F_USER']
|
2018-02-09 15:16:07 +00:00
|
|
|
self.create_drivers(2)
|
2018-03-01 13:22:01 +00:00
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
2018-02-09 15:16:07 +00:00
|
|
|
for user_details in (recipient, device_1), (sender, device_2):
|
|
|
|
user_details[1].recover_access(passphrase=user_details[0]['passphrase'],
|
2018-03-01 13:22:01 +00:00
|
|
|
password=user_details[0]['password'])
|
2018-02-09 15:16:07 +00:00
|
|
|
device_2_home = device_2.get_home_view()
|
|
|
|
device_1_home = device_1.get_home_view()
|
|
|
|
device_1_home.add_contact(sender['public_key'])
|
|
|
|
device_1_home.get_back_to_home_view()
|
|
|
|
group_chat_name = 'gtr_%s' % get_current_time()
|
|
|
|
device_1_home.create_group_chat([sender['username']], group_chat_name)
|
|
|
|
device_2_home.element_by_text(group_chat_name, 'button').click()
|
|
|
|
device_1_chat = device_1_home.get_chat_view()
|
|
|
|
device_2_chat = device_2_home.get_chat_view()
|
|
|
|
amount = device_1_chat.get_unique_amount()
|
2018-02-19 11:51:53 +00:00
|
|
|
device_1_chat.commands_button.click()
|
2018-02-09 15:16:07 +00:00
|
|
|
device_1_chat.request_command.click()
|
|
|
|
device_1_chat.first_recipient_button.click()
|
|
|
|
device_1_chat.send_as_keyevent(amount)
|
|
|
|
device_1_chat.send_message_button.click()
|
|
|
|
initial_balance_recipient = api_requests.get_balance(recipient['address'])
|
|
|
|
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
|
|
|
|
device_2_chat.send_eth_to_request(request_button, sender['password'])
|
|
|
|
api_requests.verify_balance_is_updated(initial_balance_recipient, recipient['address'])
|
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
|
|
|
@marks.testrail_case_id(3409)
|
2018-02-09 15:16:07 +00:00
|
|
|
def test_send_eth_to_request_in_one_to_one_chat(self):
|
2018-04-09 11:44:30 +00:00
|
|
|
recipient = transaction_users['C_USER']
|
2018-04-26 06:22:11 +00:00
|
|
|
sender = self.senders['d_user'] = transaction_users['D_USER']
|
2018-02-09 15:16:07 +00:00
|
|
|
self.create_drivers(2)
|
2018-03-01 13:22:01 +00:00
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
2018-02-09 15:16:07 +00:00
|
|
|
for user_details in (recipient, device_1), (sender, device_2):
|
|
|
|
user_details[1].recover_access(passphrase=user_details[0]['passphrase'],
|
2018-03-01 13:22:01 +00:00
|
|
|
password=user_details[0]['password'])
|
2018-02-09 15:16:07 +00:00
|
|
|
device_2_home = device_2.get_home_view()
|
|
|
|
device_1_home = device_1.get_home_view()
|
|
|
|
device_1_home.add_contact(sender['public_key'])
|
|
|
|
device_1_home.get_back_to_home_view()
|
|
|
|
one_to_one_chat_device_1 = device_1_home.element_by_text_part(sender['username'][:25], 'button')
|
|
|
|
one_to_one_chat_device_1.scroll_to_element()
|
|
|
|
one_to_one_chat_device_1.click()
|
|
|
|
device_1_chat = device_1_home.get_chat_view()
|
|
|
|
device_2_chat = device_2_home.get_chat_view()
|
|
|
|
amount = device_1_chat.get_unique_amount()
|
|
|
|
one_to_one_chat_device_2 = device_2_chat.element_by_text_part(recipient['username'][:25], 'button')
|
2018-03-28 10:21:39 +00:00
|
|
|
try:
|
|
|
|
one_to_one_chat_device_2.wait_for_visibility_of_element(120)
|
|
|
|
except TimeoutException:
|
|
|
|
device_1_chat.chat_message_input.send_keys('ping')
|
|
|
|
device_1_chat.send_message_button.click()
|
2018-02-09 15:16:07 +00:00
|
|
|
one_to_one_chat_device_2.click()
|
2018-02-19 11:51:53 +00:00
|
|
|
device_1_chat.commands_button.click_until_presence_of_element(device_1_chat.request_command)
|
2018-02-09 15:16:07 +00:00
|
|
|
device_1_chat.request_command.click()
|
|
|
|
device_1_chat.send_as_keyevent(amount)
|
|
|
|
device_1_chat.send_message_button.click()
|
|
|
|
initial_balance_recipient = api_requests.get_balance(recipient['address'])
|
|
|
|
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
|
|
|
|
device_2_chat.send_eth_to_request(request_button, sender['password'])
|
|
|
|
api_requests.verify_balance_is_updated(initial_balance_recipient, recipient['address'])
|
|
|
|
device_2_chat.back_button.click()
|
|
|
|
device_2_wallet = device_2_home.wallet_button.click()
|
|
|
|
transactions_view = device_2_wallet.transactions_button.click()
|
|
|
|
transactions_view.transactions_table.find_transaction(amount=amount)
|
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
|
|
|
@marks.testrail_case_id(3410)
|
2018-02-09 15:16:07 +00:00
|
|
|
def test_send_eth_to_request_from_wallet(self):
|
2018-04-30 09:58:20 +00:00
|
|
|
recipient = transaction_users_wallet['D_USER']
|
2018-04-26 06:22:11 +00:00
|
|
|
sender = self.senders['c_user'] = transaction_users['C_USER']
|
2018-02-09 15:16:07 +00:00
|
|
|
self.create_drivers(2)
|
2018-03-01 13:22:01 +00:00
|
|
|
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
2018-02-09 15:16:07 +00:00
|
|
|
for user_details in (recipient, device_1), (sender, device_2):
|
|
|
|
user_details[1].recover_access(passphrase=user_details[0]['passphrase'],
|
2018-03-01 13:22:01 +00:00
|
|
|
password=user_details[0]['password'])
|
2018-02-09 15:16:07 +00:00
|
|
|
device_2_home = device_2.get_home_view()
|
|
|
|
device_1_home = device_1.get_home_view()
|
|
|
|
device_1_home.add_contact(sender['public_key'])
|
|
|
|
device_1_home.get_back_to_home_view()
|
|
|
|
wallet_view_device_1 = device_1_home.wallet_button.click()
|
|
|
|
send_transaction_device_1 = wallet_view_device_1.request_button.click_until_presence_of_element(
|
|
|
|
wallet_view_device_1.send_transaction_request)
|
|
|
|
wallet_view_device_1.send_transaction_request.click()
|
|
|
|
send_transaction_device_1.amount_edit_box.scroll_to_element()
|
|
|
|
amount = device_1_home.get_unique_amount()
|
|
|
|
send_transaction_device_1.amount_edit_box.set_value(amount)
|
|
|
|
send_transaction_device_1.confirm()
|
|
|
|
send_transaction_device_1.chose_recipient_button.click()
|
|
|
|
sender_button = send_transaction_device_1.element_by_text(sender['username'])
|
|
|
|
send_transaction_device_1.recent_recipients_button.click_until_presence_of_element(sender_button)
|
|
|
|
sender_button.click()
|
|
|
|
wallet_view_device_1.send_request_button.click()
|
|
|
|
device_2_chat = device_2_home.get_chat_view()
|
|
|
|
one_to_one_chat_device_2 = device_2_chat.element_by_text_part(recipient['username'][:25], 'button')
|
2018-03-28 10:21:39 +00:00
|
|
|
one_to_one_chat_device_2.wait_for_visibility_of_element(120)
|
2018-02-09 15:16:07 +00:00
|
|
|
one_to_one_chat_device_2.click()
|
|
|
|
initial_balance_recipient = api_requests.get_balance(recipient['address'])
|
|
|
|
request_button = device_2_chat.element_by_text_part('Requesting %s ETH' % amount, 'button')
|
|
|
|
device_2_chat.send_eth_to_request(request_button, sender['password'])
|
|
|
|
api_requests.verify_balance_is_updated(initial_balance_recipient, recipient['address'])
|