Added new atomic tests for Smoke phase 1 section
Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
parent
03598d47c2
commit
458e7231bd
|
@ -43,7 +43,7 @@ class NetworkApi:
|
|||
return
|
||||
pytest.fail('Transaction is not found in Ropsten network')
|
||||
|
||||
def find_transaction_by_unique_amount(self, address, amount, token=False, wait_time=600):
|
||||
def find_transaction_by_unique_amount(self, address, amount, token=False, decimals=18, wait_time=600):
|
||||
counter = 0
|
||||
while True:
|
||||
if counter >= wait_time:
|
||||
|
@ -60,10 +60,19 @@ class NetworkApi:
|
|||
info('Looking for a transaction with unique amount %s in list of transactions, address is %s' %
|
||||
(amount, address))
|
||||
for transaction in transactions:
|
||||
if float(int(transaction['value']) / 10 ** 18) == float(amount):
|
||||
if float(int(transaction['value']) / 10 ** decimals) == float(amount):
|
||||
info('Transaction with unique amount %s is found in list of transactions, address is %s' %
|
||||
(amount, address))
|
||||
return
|
||||
return transaction
|
||||
|
||||
def wait_for_confirmation_of_transaction(self, address, amount):
|
||||
start_time = time.time()
|
||||
while round(time.time() - start_time, ndigits=2) < 10:
|
||||
transaction = self.find_transaction_by_unique_amount(address, amount)
|
||||
if int(transaction['confirmations']) > 1:
|
||||
return
|
||||
time.sleep(10)
|
||||
pytest.fail('Transaction with amount %s was not confirmed, address is %s' % (amount, address))
|
||||
|
||||
def verify_balance_is_updated(self, initial_balance, recipient_address, wait_time=360):
|
||||
counter = 0
|
||||
|
|
|
@ -15,7 +15,8 @@ RERUN_ERRORS = [
|
|||
"503 Service Unavailable",
|
||||
"object has no attribute",
|
||||
"[Errno 104] Connection reset by peer",
|
||||
"Sauce could not start your job"
|
||||
"Sauce could not start your job",
|
||||
"HTTP Error 303"
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import pytest
|
|||
from tests import marks, transaction_users
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
from views.web_views.base_web_view import BaseWebView
|
||||
|
||||
|
||||
@marks.all
|
|
@ -1,7 +1,7 @@
|
|||
import pytest
|
||||
|
||||
from tests import marks, group_chat_users, basic_user
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from tests import marks, group_chat_users, basic_user, get_current_time
|
||||
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
|
@ -64,40 +64,6 @@ class TestChatManagement(SingleDeviceTestCase):
|
|||
self.errors.append('Chat history is shown')
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(3694)
|
||||
@marks.smoke_1
|
||||
def test_add_contact_from_public_chat(self):
|
||||
sign_in = SignInView(self.driver)
|
||||
home = sign_in.create_user()
|
||||
chat_name = 'testaddcontact'
|
||||
chat = home.join_public_chat(chat_name)
|
||||
message = 'test message'
|
||||
|
||||
chat.reconnect()
|
||||
chat_element = chat.chat_element_by_text(message)
|
||||
chat_element.find_element()
|
||||
username = chat_element.username.text
|
||||
chat_element.member_photo.click()
|
||||
for element in [chat.contact_profile_picture, chat.add_to_contacts, chat.profile_send_message,
|
||||
chat.profile_send_transaction, chat.public_key_text, chat.element_by_text(username, 'text')]:
|
||||
if not element.is_element_displayed():
|
||||
self.errors.append('%s is not visible' % 'user name' if 'Base' in element.name else element.name)
|
||||
chat.add_to_contacts.click()
|
||||
if not chat.element_by_text('In contacts').is_element_displayed():
|
||||
self.errors.append("'Add to contacts' is not changed to 'In contacts'")
|
||||
|
||||
chat.get_back_to_home_view()
|
||||
start_new_chat = home.plus_button.click()
|
||||
start_new_chat.start_new_chat_button.click()
|
||||
if not start_new_chat.element_by_text(username).is_element_displayed():
|
||||
self.errors.append("List of contacts doesn't contain added user")
|
||||
start_new_chat.get_back_to_home_view()
|
||||
|
||||
home.get_chat_with_user('#' + chat_name).click()
|
||||
chat.chat_message_input.send_keys(message)
|
||||
chat.send_message_button.click()
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(763)
|
||||
@marks.smoke_1
|
||||
def test_add_contact_by_pasting_public_key(self):
|
||||
|
@ -155,3 +121,42 @@ class TestChatManagement(SingleDeviceTestCase):
|
|||
if home.element_by_text(chat_name).is_element_present(5):
|
||||
self.errors.append("Public chat '%s' is shown after re-login, but the chat has been deleted" % chat_name)
|
||||
self.verify_no_errors()
|
||||
|
||||
|
||||
@marks.chat
|
||||
class TestChatManagementMultipleDevice(MultipleDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(3694)
|
||||
@marks.smoke_1
|
||||
def test_add_contact_from_public_chat(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
home_1, home_2 = device_1.create_user(), device_2.create_user()
|
||||
chat_name = 'testaddcontact'
|
||||
chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name)
|
||||
message = 'test message'
|
||||
|
||||
chat_2.chat_message_input.send_keys(message)
|
||||
chat_2.send_message_button.click()
|
||||
self.drivers[1].quit()
|
||||
|
||||
chat_element = chat_1.chat_element_by_text(message)
|
||||
chat_element.find_element()
|
||||
username = chat_element.username.text
|
||||
chat_element.member_photo.click()
|
||||
for element in [chat_1.contact_profile_picture, chat_1.add_to_contacts, chat_1.profile_send_message,
|
||||
chat_1.profile_send_transaction, chat_1.public_key_text,
|
||||
chat_1.element_by_text(username, 'text')]:
|
||||
if not element.is_element_displayed():
|
||||
self.errors.append('%s is not visible' % 'user name' if 'Base' in element.name else element.name)
|
||||
chat_1.add_to_contacts.click()
|
||||
if not chat_1.element_by_text('In contacts').is_element_displayed():
|
||||
self.errors.append("'Add to contacts' is not changed to 'In contacts'")
|
||||
|
||||
chat_1.get_back_to_home_view()
|
||||
start_new_chat = home_1.plus_button.click()
|
||||
start_new_chat.start_new_chat_button.click()
|
||||
if not start_new_chat.element_by_text(username).is_element_displayed():
|
||||
self.errors.append("List of contacts doesn't contain added user")
|
||||
|
||||
self.verify_no_errors()
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import pytest
|
||||
from _pytest.outcomes import Failed
|
||||
from decimal import Decimal as d
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
|
@ -246,11 +247,9 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
|
|||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
home_1 = device_1.recover_access(passphrase=sender['passphrase'], password=sender['password'])
|
||||
home_2 = device_2.recover_access(passphrase=recipient['passphrase'], password=recipient['password'])
|
||||
wallet_1, wallet_2 = home_1.wallet_button.click(), home_2.wallet_button.click()
|
||||
wallet_1 = home_1.wallet_button.click()
|
||||
wallet_1.set_up_wallet()
|
||||
wallet_1.home_button.click()
|
||||
wallet_2.set_up_wallet()
|
||||
wallet_2.home_button.click()
|
||||
|
||||
chat_1 = home_1.add_contact(recipient['public_key'])
|
||||
amount = chat_1.get_unique_amount()
|
||||
|
@ -305,6 +304,28 @@ class TestCommandsMultipleDevices(MultipleDeviceTestCase):
|
|||
self.errors.append(e.msg)
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(3749)
|
||||
@marks.smoke_1
|
||||
def test_transaction_confirmed_on_recipient_side(self):
|
||||
recipient = transaction_users['D_USER']
|
||||
sender = transaction_users['C_USER']
|
||||
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'], password=sender['password'])
|
||||
home_2 = device_2.recover_access(passphrase=recipient['passphrase'], password=recipient['password'])
|
||||
wallet_1 = home_1.wallet_button.click()
|
||||
wallet_1.set_up_wallet()
|
||||
wallet_1.home_button.click()
|
||||
|
||||
chat_1 = home_1.add_contact(recipient['public_key'])
|
||||
amount = chat_1.get_unique_amount()
|
||||
chat_1.send_transaction_in_1_1_chat('ETH', amount, sender['password'])
|
||||
|
||||
chat_2 = home_2.get_chat_with_user(sender['username']).click()
|
||||
self.network_api.wait_for_confirmation_of_transaction(recipient['address'], amount)
|
||||
if not chat_2.chat_element_by_text(amount).contains_text('Confirmed', 60):
|
||||
pytest.fail('Transaction state is not updated on the recipient side')
|
||||
|
||||
|
||||
@marks.chat
|
||||
@marks.transaction
|
||||
|
@ -340,3 +361,49 @@ class TestCommandsSingleDevices(SingleDeviceTestCase):
|
|||
amount = chat.get_unique_amount()
|
||||
chat.send_transaction_in_1_1_chat('ETH', amount, sender['password'])
|
||||
chat.check_no_value_in_logcat(sender['password'])
|
||||
|
||||
@marks.testrail_id(3736)
|
||||
@marks.smoke_1
|
||||
def test_send_transaction_details_in_1_1_chat(self):
|
||||
recipient = transaction_users['D_USER']
|
||||
sender = transaction_users['C_USER']
|
||||
sign_in = SignInView(self.driver)
|
||||
home = sign_in.recover_access(passphrase=sender['passphrase'], password=sender['password'])
|
||||
wallet = home.wallet_button.click()
|
||||
wallet.set_up_wallet()
|
||||
wallet.home_button.click()
|
||||
|
||||
chat = home.add_contact(recipient['public_key'])
|
||||
amount = chat.get_unique_amount()
|
||||
chat.commands_button.click()
|
||||
chat.send_command.click()
|
||||
chat.asset_by_name('ETH').click()
|
||||
chat.send_as_keyevent(amount)
|
||||
send_transaction_view = chat.get_send_transaction_view()
|
||||
chat.send_message_button.click_until_presence_of_element(send_transaction_view.sign_transaction_button)
|
||||
|
||||
if not send_transaction_view.element_by_text(recipient['username']).is_element_displayed():
|
||||
self.errors.append('Recipient name is not shown')
|
||||
if not send_transaction_view.element_by_text('0x' + recipient['address']).is_element_displayed():
|
||||
self.errors.append('Recipient address is not shown')
|
||||
if not send_transaction_view.element_by_text('ETH').is_element_displayed():
|
||||
self.errors.append("Asset field doesn't contain 'ETH' text")
|
||||
if not send_transaction_view.element_by_text(amount).is_element_displayed():
|
||||
self.errors.append('Amount is not visible')
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(3750)
|
||||
@marks.smoke_1
|
||||
def test_transaction_confirmed_on_sender_side(self):
|
||||
sender = transaction_users['D_USER']
|
||||
sign_in = SignInView(self.driver)
|
||||
home = sign_in.recover_access(passphrase=sender['passphrase'], password=sender['password'])
|
||||
wallet = home.wallet_button.click()
|
||||
wallet.set_up_wallet()
|
||||
wallet.home_button.click()
|
||||
chat = home.add_contact(transaction_users['C_USER']['public_key'])
|
||||
amount = chat.get_unique_amount()
|
||||
chat.send_transaction_in_1_1_chat('ETH', amount, sender['password'])
|
||||
self.network_api.wait_for_confirmation_of_transaction(sender['address'], amount)
|
||||
if not chat.chat_element_by_text(amount).contains_text('Confirmed'):
|
||||
pytest.fail('Transaction state is not updated on the sender side')
|
||||
|
|
|
@ -27,10 +27,8 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
|||
device_1_chat.chat_message_input.send_keys(message)
|
||||
device_1_chat.send_message_button.click()
|
||||
|
||||
device_2_home.get_chat_with_user(username_1).click()
|
||||
|
||||
if device_1_chat.chat_element_by_text(message).status.text != 'Seen':
|
||||
pytest.fail("'Seen' status is not shown under the sent text message")
|
||||
device_2_chat = device_2_home.get_chat_with_user(username_1).click()
|
||||
device_2_chat.chat_element_by_text(message).wait_for_visibility_of_element()
|
||||
|
||||
@marks.testrail_id(772)
|
||||
@marks.smoke_1
|
||||
|
@ -101,7 +99,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
|||
|
||||
chat_1.reconnect()
|
||||
chat_element = chat_1.chat_element_by_text(message)
|
||||
chat_1.element_by_text('Resend').click_until_presence_of_element(chat_element)
|
||||
chat_1.element_by_text('Resend').click()
|
||||
chat_element.status.wait_for_visibility_of_element()
|
||||
if chat_element.status.text != 'Sent':
|
||||
self.errors.append("Message status is not 'Sent' after resending the message")
|
||||
|
@ -288,6 +286,31 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
|||
self.errors.append('Offline status is not shown in a public chat')
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(3695)
|
||||
@marks.smoke_1
|
||||
def test_message_marked_as_sent_and_seen_1_1_chat(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
username_1 = 'user_%s' % get_current_time()
|
||||
device_1_home, device_2_home = device_1.create_user(username=username_1), device_2.create_user()
|
||||
device_2_public_key = device_2_home.get_public_key()
|
||||
device_2_home.home_button.click()
|
||||
|
||||
device_1_chat = device_1_home.add_contact(device_2_public_key)
|
||||
|
||||
message = 'test message'
|
||||
device_1_chat.chat_message_input.send_keys(message)
|
||||
device_1_chat.send_message_button.click()
|
||||
if device_1_chat.chat_element_by_text(message).status.text != 'Sent':
|
||||
self.errors.append("'Sent' status is not shown under the sent text message")
|
||||
|
||||
device_2_chat = device_2_home.get_chat_with_user(username_1).click()
|
||||
device_2_chat.chat_element_by_text(message).wait_for_visibility_of_element()
|
||||
|
||||
if device_1_chat.chat_element_by_text(message).status.text != 'Seen':
|
||||
self.errors.append("'Seen' status is not shown under the text message which was read by a receiver")
|
||||
self.verify_no_errors()
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.chat
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import pytest
|
||||
|
||||
from tests import transaction_users, marks, common_password
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
@ -36,6 +38,36 @@ class TestTransactionDApp(SingleDeviceTestCase):
|
|||
send_transaction_view.enter_password_input.send_keys(password)
|
||||
send_transaction_view.sign_transaction_button.click()
|
||||
|
||||
@marks.testrail_id(3696)
|
||||
@marks.smoke_1
|
||||
def test_deploy_contract_from_daap(self):
|
||||
sender = transaction_users['E_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
||||
status_test_dapp = sign_in_view.open_status_test_dapp()
|
||||
status_test_dapp.wait_for_d_aap_to_load()
|
||||
status_test_dapp.transactions_button.click()
|
||||
send_transaction_view = status_test_dapp.deploy_contract_button.click()
|
||||
send_transaction_view.sign_transaction(sender['password'])
|
||||
status_test_dapp.element_starts_with_text('Mining new contract in tx:').wait_for_visibility_of_element()
|
||||
for text in 'Contract deployed at: ', 'Call contract get function', \
|
||||
'Call contract set function', 'Call function 2 times in a row':
|
||||
if not status_test_dapp.element_by_text(text).is_element_displayed(30):
|
||||
pytest.fail('Contract was not created')
|
||||
|
||||
@marks.testrail_id(3782)
|
||||
@marks.smoke_1
|
||||
def test_filters_from_daap(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
status_test_dapp = sign_in_view.open_status_test_dapp()
|
||||
status_test_dapp.wait_for_d_aap_to_load()
|
||||
status_test_dapp.transactions_button.click()
|
||||
status_test_dapp.test_filters_button.click()
|
||||
for element in status_test_dapp.element_by_text('eth_uninstallFilter'), status_test_dapp.ok_button:
|
||||
if element.is_element_displayed(10):
|
||||
pytest.fail("'Test filters' button produced an error")
|
||||
|
||||
@marks.logcat
|
||||
@marks.testrail_id(3772)
|
||||
def test_logcat_send_transaction_from_daap(self):
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import random
|
||||
|
||||
from tests import transaction_users, transaction_users_wallet, marks, common_password
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@marks.transaction
|
||||
class TestTransactionWallet(SingleDeviceTestCase):
|
||||
class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(766)
|
||||
@marks.smoke_1
|
||||
|
@ -74,8 +76,9 @@ class TestTransactionWallet(SingleDeviceTestCase):
|
|||
wallet_view = home_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
send_transaction = wallet_view.send_transaction_button.click()
|
||||
send_transaction.select_asset_button.click_until_presence_of_element(send_transaction.stt_button)
|
||||
send_transaction.stt_button.click()
|
||||
stt_button = send_transaction.asset_by_name('STT')
|
||||
send_transaction.select_asset_button.click_until_presence_of_element(stt_button)
|
||||
stt_button.click()
|
||||
send_transaction.amount_edit_box.click()
|
||||
amount = send_transaction.get_unique_amount()
|
||||
send_transaction.amount_edit_box.set_value(amount)
|
||||
|
@ -189,3 +192,109 @@ class TestTransactionWallet(SingleDeviceTestCase):
|
|||
send_transaction.sign_transaction_button.click()
|
||||
send_transaction.got_it_button.click()
|
||||
send_transaction.check_no_value_in_logcat(sender['password'])
|
||||
|
||||
@marks.testrail_id(3746)
|
||||
@marks.smoke_1
|
||||
def test_send_token_with_7_decimals(self):
|
||||
sender = transaction_users_wallet['A_USER']
|
||||
recipient = transaction_users_wallet['B_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
||||
home_view = sign_in_view.get_home_view()
|
||||
home_view.add_contact(recipient['public_key'])
|
||||
home_view.get_back_to_home_view()
|
||||
wallet_view = home_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
wallet_view.options_button.click()
|
||||
wallet_view.manage_assets_button.click()
|
||||
wallet_view.asset_checkbox_by_name('ADI').click()
|
||||
wallet_view.done_button.click()
|
||||
send_transaction = wallet_view.send_transaction_button.click()
|
||||
adi_button = send_transaction.asset_by_name('ADI')
|
||||
send_transaction.select_asset_button.click_until_presence_of_element(adi_button)
|
||||
adi_button.click()
|
||||
send_transaction.amount_edit_box.click()
|
||||
amount = '0.0%s' % random.randint(100000, 999999)
|
||||
send_transaction.amount_edit_box.set_value(amount)
|
||||
send_transaction.confirm()
|
||||
send_transaction.chose_recipient_button.click()
|
||||
send_transaction.enter_recipient_address_button.click()
|
||||
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()
|
||||
self.network_api.find_transaction_by_unique_amount(sender['address'], amount, token=True, decimals=7)
|
||||
|
||||
@marks.testrail_id(3747)
|
||||
@marks.smoke_1
|
||||
def test_token_with_more_than_allowed_decimals(self):
|
||||
sender = transaction_users_wallet['A_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
||||
wallet_view = sign_in_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
wallet_view.options_button.click()
|
||||
wallet_view.manage_assets_button.click()
|
||||
wallet_view.asset_checkbox_by_name('ADI').click()
|
||||
wallet_view.done_button.click()
|
||||
send_transaction = wallet_view.send_transaction_button.click()
|
||||
adi_button = send_transaction.asset_by_name('ADI')
|
||||
send_transaction.select_asset_button.click_until_presence_of_element(adi_button)
|
||||
adi_button.click()
|
||||
send_transaction.amount_edit_box.click()
|
||||
amount = '0.0%s' % random.randint(1000000, 9999999)
|
||||
send_transaction.amount_edit_box.set_value(amount)
|
||||
error_text = 'Amount is too precise. Max number of decimals is 7.'
|
||||
if not send_transaction.element_by_text(error_text).is_element_displayed():
|
||||
self.errors.append('Warning about too precise amount is not shown when sending a transaction')
|
||||
send_transaction.back_button.click()
|
||||
wallet_view.receive_transaction_button.click()
|
||||
wallet_view.send_transaction_request.click()
|
||||
send_transaction.select_asset_button.click_until_presence_of_element(adi_button)
|
||||
adi_button.click()
|
||||
send_transaction.amount_edit_box.set_value(amount)
|
||||
error_text = 'Amount is too precise. Max number of decimals is 7.'
|
||||
if not send_transaction.element_by_text(error_text).is_element_displayed():
|
||||
self.errors.append('Warning about too precise amount is not shown when requesting a transaction')
|
||||
self.verify_no_errors()
|
||||
|
||||
|
||||
@marks.transaction
|
||||
class TestTransactionWalletMultipleDevice(MultipleDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(3761)
|
||||
@marks.smoke_1
|
||||
def test_transaction_message_sending_from_wallet(self):
|
||||
recipient = transaction_users['D_USER']
|
||||
sender = transaction_users['C_USER']
|
||||
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'], password=sender['password'])
|
||||
home_2 = device_2.recover_access(passphrase=recipient['passphrase'], password=recipient['password'])
|
||||
|
||||
chat_1 = home_1.add_contact(recipient['public_key'])
|
||||
chat_1.get_back_to_home_view()
|
||||
|
||||
wallet_1 = home_1.wallet_button.click()
|
||||
wallet_1.set_up_wallet()
|
||||
send_transaction = wallet_1.send_transaction_button.click()
|
||||
send_transaction.amount_edit_box.click()
|
||||
amount = send_transaction.get_unique_amount()
|
||||
send_transaction.amount_edit_box.set_value(amount)
|
||||
send_transaction.confirm()
|
||||
send_transaction.chose_recipient_button.click()
|
||||
send_transaction.enter_recipient_address_button.click()
|
||||
send_transaction.enter_recipient_address_input.set_value(recipient['address'])
|
||||
send_transaction.done_button.click()
|
||||
send_transaction.sign_transaction(sender['password'])
|
||||
|
||||
wallet_1.home_button.click()
|
||||
home_1.get_chat_with_user(recipient['username']).click()
|
||||
if not chat_1.chat_element_by_text(amount).is_element_displayed():
|
||||
self.errors.append('Transaction message is not shown in 1-1 chat for the sender')
|
||||
chat_2 = home_2.get_chat_with_user(sender['username']).click()
|
||||
if not chat_2.chat_element_by_text(amount).is_element_displayed():
|
||||
self.errors.append('Transaction message is not shown in 1-1 chat for the recipient')
|
||||
self.verify_no_errors()
|
||||
|
|
|
@ -422,7 +422,10 @@ class BaseView(object):
|
|||
connect_status = self.connection_status
|
||||
for i in range(3):
|
||||
if connect_status.is_element_displayed(5) and 'Tap to reconnect' in connect_status.text:
|
||||
connect_status.click()
|
||||
try:
|
||||
connect_status.click()
|
||||
except AttributeError:
|
||||
pass
|
||||
try:
|
||||
connect_status.wait_for_invisibility_of_element()
|
||||
except TimeoutException as e:
|
||||
|
|
|
@ -190,7 +190,8 @@ class ChatElementByText(BaseText):
|
|||
class StatusText(BaseText):
|
||||
def __init__(self, driver, parent_locator: str):
|
||||
super(StatusText, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector(parent_locator + '/android.widget.TextView')
|
||||
text = "//android.widget.TextView[@text='Seen' or @text='Sent' or @text='Not sent. Tap for options']"
|
||||
self.locator = self.Locator.xpath_selector(parent_locator + text)
|
||||
|
||||
return StatusText(self.driver, self.locator.value)
|
||||
|
||||
|
@ -230,11 +231,11 @@ class ChatElementByText(BaseText):
|
|||
|
||||
return SendRequestButton(self.driver, self.locator.value)
|
||||
|
||||
def contains_text(self, text) -> bool:
|
||||
def contains_text(self, text, wait_time=5) -> bool:
|
||||
element = BaseText(self.driver)
|
||||
element.locator = element.Locator.xpath_selector(
|
||||
self.locator.value + "//android.view.ViewGroup//android.widget.TextView[contains(@text,'%s')]" % text)
|
||||
return element.is_element_displayed()
|
||||
return element.is_element_displayed(wait_time)
|
||||
|
||||
|
||||
class ChatView(BaseView):
|
||||
|
|
|
@ -51,11 +51,15 @@ class ChatElement(BaseButton):
|
|||
|
||||
def find_element(self):
|
||||
info('Looking for %s' % self.name)
|
||||
for _ in range(2):
|
||||
for i in range(2):
|
||||
try:
|
||||
return super(ChatElement, self).find_element()
|
||||
except NoSuchElementException:
|
||||
HomeView(self.driver).reconnect()
|
||||
except NoSuchElementException as e:
|
||||
if i == 0:
|
||||
HomeView(self.driver).reconnect()
|
||||
else:
|
||||
e.msg = 'Unable to find chat with user %s' % self.username
|
||||
raise e
|
||||
|
||||
@property
|
||||
def swipe_delete_button(self):
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from views.base_element import BaseButton, BaseEditBox, BaseText
|
||||
from views.base_view import BaseView
|
||||
from views.base_element import BaseElement, BaseButton, BaseEditBox
|
||||
from views.base_element import BaseText
|
||||
from views.base_element import BaseButton, BaseEditBox
|
||||
from views.base_view import BaseView, OkButton
|
||||
|
||||
|
||||
|
@ -90,10 +89,10 @@ class SelectAssetButton(BaseButton):
|
|||
self.locator = self.Locator.accessibility_id('choose-asset-button')
|
||||
|
||||
|
||||
class STTButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(STTButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Status Test Token']")
|
||||
class AssetButton(BaseButton):
|
||||
def __init__(self, driver, asset_name):
|
||||
super(AssetButton, self).__init__(driver)
|
||||
self.locator = self.Locator.text_part_selector(asset_name)
|
||||
|
||||
|
||||
class ErrorDialog(BaseView):
|
||||
|
@ -169,7 +168,6 @@ class SendTransactionView(BaseView):
|
|||
self.got_it_button = GotItButton(self.driver)
|
||||
|
||||
self.select_asset_button = SelectAssetButton(self.driver)
|
||||
self.stt_button = STTButton(self.driver)
|
||||
|
||||
self.error_dialog = ErrorDialog(self.driver)
|
||||
|
||||
|
@ -180,3 +178,6 @@ class SendTransactionView(BaseView):
|
|||
self.enter_password_input.send_keys(sender_password)
|
||||
self.sign_transaction_button.click_until_presence_of_element(self.got_it_button)
|
||||
self.got_it_button.click()
|
||||
|
||||
def asset_by_name(self, asset_name):
|
||||
return AssetButton(self.driver, asset_name)
|
||||
|
|
|
@ -126,6 +126,7 @@ class SignInView(BaseView):
|
|||
self.element_by_text_part('Display name').wait_for_element(30)
|
||||
username = username if username else 'user_%s' % get_current_time()
|
||||
self.name_input.set_value(username)
|
||||
self.confirm()
|
||||
|
||||
self.next_button.click()
|
||||
self.do_not_share_button.wait_for_visibility_of_element(10)
|
||||
|
@ -163,4 +164,4 @@ class SignInView(BaseView):
|
|||
try:
|
||||
self.account_button.find_elements()[position].click()
|
||||
except IndexError:
|
||||
raise NoSuchElementException('Unable to find account by position %s' % position)
|
||||
raise NoSuchElementException('Unable to find account by position %s' % position) from None
|
||||
|
|
|
@ -32,6 +32,20 @@ class TransactionsButton(BaseButton):
|
|||
from views.send_transaction_view import SendTransactionView
|
||||
return SendTransactionView(self.driver)
|
||||
|
||||
class DeployContractButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(TransactionsButton.DeployContractButton, self).__init__(driver)
|
||||
self.locator = self.Locator.text_selector('Deploy simple contract')
|
||||
|
||||
def navigate(self):
|
||||
from views.send_transaction_view import SendTransactionView
|
||||
return SendTransactionView(self.driver)
|
||||
|
||||
class TestFiltersButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(TransactionsButton.TestFiltersButton, self).__init__(driver)
|
||||
self.locator = self.Locator.text_selector('Test filters')
|
||||
|
||||
|
||||
class StatusTestDAppView(BaseWebView):
|
||||
|
||||
|
@ -44,3 +58,5 @@ class StatusTestDAppView(BaseWebView):
|
|||
|
||||
self.transactions_button = TransactionsButton(self.driver)
|
||||
self.sign_message_button = TransactionsButton.SignMessageButton(self.driver)
|
||||
self.deploy_contract_button = TransactionsButton.DeployContractButton(self.driver)
|
||||
self.test_filters_button = TransactionsButton.TestFiltersButton(self.driver)
|
||||
|
|
Loading…
Reference in New Issue