Removed old tests and console, added test for faucet from test DApp
Signed-off-by: yevh-berdnyk <ie.berdnyk@gmail.com>
This commit is contained in:
parent
457f2a157a
commit
a3c25163be
|
@ -107,5 +107,3 @@ class TestBrowsing(SingleDeviceTestCase):
|
|||
status_test_dapp.find_full_text('Sign message')
|
||||
status_test_dapp.browser_refresh_page_button.click()
|
||||
status_test_dapp.find_full_text('defaultAccount')
|
||||
|
||||
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
import pytest
|
||||
|
||||
from tests import marks
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@marks.chat
|
||||
class TestMessagesPublicChat(SingleDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(1380)
|
||||
@marks.smoke_1
|
||||
def test_faucet_console_command(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
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()
|
||||
console_chat = home_view.get_chat_with_user('Status Console')
|
||||
console_view = console_chat.click()
|
||||
console_view.send_faucet_request()
|
||||
console_view.chat_element_by_text('Faucet request has been received').wait_for_visibility_of_element()
|
||||
console_view.get_back_to_home_view()
|
||||
wallet_view = profile_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
wallet_view.wait_balance_changed_on_wallet_screen()
|
||||
|
||||
@marks.testrail_id(1400)
|
||||
@marks.smoke_1
|
||||
def test_web3_block_number(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
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()
|
||||
chat_view = home_view.get_chat_with_user('Status Console').click()
|
||||
chat_view.chat_message_input.send_keys('web3.eth.blockNumber')
|
||||
block_number = self.network_api.get_latest_block_number()
|
||||
chat_view.send_message_button.click()
|
||||
for i in range(4):
|
||||
if chat_view.chat_element_by_text(str(block_number + i)).is_element_displayed():
|
||||
break
|
||||
else:
|
||||
pytest.fail('Actual block number is not shown')
|
||||
|
||||
@marks.testrail_id(3732)
|
||||
def test_show_hide_console_chat(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
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()
|
||||
console_chat = home_view.get_chat_with_user('Status Console')
|
||||
console_chat.swipe_element()
|
||||
chat_view = home_view.get_chat_view()
|
||||
if console_chat.swipe_delete_button.is_element_displayed() or chat_view.chat_options.is_element_displayed():
|
||||
self.errors.append('Console chat can be deleted')
|
||||
home_view.get_back_to_home_view()
|
||||
sign_in_view.profile_button.click()
|
||||
profile_view.advanced_button.click()
|
||||
profile_view.debug_mode_toggle.click()
|
||||
profile_view.home_button.click()
|
||||
if console_chat.is_element_displayed():
|
||||
self.errors.append('Console chat is not hidden after turning off debug mode')
|
||||
self.verify_no_errors()
|
|
@ -51,7 +51,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
|||
|
||||
device_1.set_network_connection(2) # turning on WiFi connection on primary device
|
||||
|
||||
home_1.reconnect()
|
||||
home_1.connection_status.wait_for_invisibility_of_element()
|
||||
chat_element = home_1.get_chat_with_user(username_2)
|
||||
chat_element.wait_for_visibility_of_element(20)
|
||||
chat_1 = chat_element.click()
|
||||
|
|
|
@ -95,3 +95,19 @@ class TestTransactionDApp(SingleDeviceTestCase):
|
|||
send_transaction_view.enter_password_input.send_keys(common_password)
|
||||
send_transaction_view.sign_transaction_button.click()
|
||||
send_transaction_view.check_no_values_in_logcat(password=common_password)
|
||||
|
||||
@marks.testrail_id(1380)
|
||||
@marks.smoke_1
|
||||
def test_request_eth_in_status_test_dapp(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.assets_button.click()
|
||||
status_test_dapp.request_eth_button.click()
|
||||
status_test_dapp.element_by_text('Faucet request recieved').wait_for_visibility_of_element()
|
||||
status_test_dapp.ok_button.click()
|
||||
status_test_dapp.browser_cross_icon.click()
|
||||
wallet_view = sign_in_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
wallet_view.wait_balance_changed_on_wallet_screen()
|
||||
|
|
|
@ -222,7 +222,7 @@ class TestTransactionWalletSingleDevice(SingleDeviceTestCase):
|
|||
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.sign_transaction_button.click_until_presence_of_element(send_transaction.got_it_button)
|
||||
send_transaction.got_it_button.click()
|
||||
self.network_api.find_transaction_by_unique_amount(sender['address'], amount, token=True, decimals=7)
|
||||
|
||||
|
|
|
@ -16,5 +16,4 @@ transaction = pytest.mark.transaction
|
|||
wallet = pytest.mark.wallet
|
||||
sign_in = pytest.mark.sign_in
|
||||
skip = pytest.mark.skip
|
||||
console = pytest.mark.console
|
||||
logcat = pytest.mark.logcat
|
||||
|
|
|
@ -1,195 +0,0 @@
|
|||
import time
|
||||
import pytest
|
||||
import random
|
||||
import string
|
||||
from tests import transaction_users, marks, group_chat_users, get_current_time
|
||||
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.chat_management
|
||||
class TestChatManagementMultiple(MultipleDeviceTestCase):
|
||||
|
||||
@marks.skip
|
||||
def test_delete_1_1_chat(self):
|
||||
self.senders['g_user'] = transaction_users['G_USER']
|
||||
self.senders['h_user'] = transaction_users['H_USER']
|
||||
|
||||
self.create_drivers(2)
|
||||
device_1 = self.drivers[0]
|
||||
device_2 = self.drivers[1]
|
||||
|
||||
device_1_sign_in_view = SignInView(device_1)
|
||||
device_1_sign_in_view.recover_access(self.senders['g_user']['passphrase'], self.senders['g_user']['password'])
|
||||
device_2_sign_in_view = SignInView(device_2)
|
||||
device_2_sign_in_view.recover_access(self.senders['h_user']['passphrase'], self.senders['h_user']['password'])
|
||||
|
||||
device_1_home_view = device_1_sign_in_view.get_home_view()
|
||||
device_2_home_view = device_2_sign_in_view.get_home_view()
|
||||
for home in device_1_home_view, device_2_home_view:
|
||||
wallet = home.wallet_button.click()
|
||||
wallet.set_up_wallet()
|
||||
wallet.home_button.click()
|
||||
|
||||
# Device 1: Start new 1-1 chat
|
||||
device_1_home_view.add_contact(self.senders['h_user']['public_key'])
|
||||
device_1_chat_view = device_1_home_view.get_chat_view()
|
||||
chat_with_g_user = device_2_home_view.get_chat_with_user(self.senders['g_user']['username'])
|
||||
chat_with_g_user.wait_for_element(30)
|
||||
device_2_chat_view = chat_with_g_user.click()
|
||||
|
||||
# Devices: Request and send transactions
|
||||
transaction_amount = '0.00001'
|
||||
device_1_chat_view.request_transaction_in_1_1_chat('ETH', transaction_amount)
|
||||
device_1_chat_view.send_transaction_in_1_1_chat(transaction_amount, self.senders['g_user']['password'])
|
||||
device_2_chat_view.request_transaction_in_1_1_chat('ETH', transaction_amount)
|
||||
device_2_chat_view.send_transaction_in_1_1_chat(transaction_amount, self.senders['h_user']['password'])
|
||||
|
||||
# Device 1: Send message to device 2
|
||||
device_1_message = 'message from user 1'
|
||||
device_1_chat_view.chat_message_input.send_keys(device_1_message)
|
||||
device_1_chat_view.send_message_button.click()
|
||||
|
||||
# Device 2: Send message to device 1
|
||||
device_2_message = 'message from user 2'
|
||||
device_2_chat_view = device_2_home_view.get_chat_view()
|
||||
device_2_chat_view.chat_message_input.send_keys(device_2_message)
|
||||
device_2_chat_view.send_message_button.click()
|
||||
|
||||
# Device 1: See the message from device 2
|
||||
device_1_chat_view.wait_for_message_in_one_to_one_chat(device_2_message, self.errors)
|
||||
|
||||
# Stop device 2, it's not needed anymore
|
||||
device_2.quit()
|
||||
|
||||
# Device 1: Delete chat and make sure it does not reappear after logging in again
|
||||
device_1_chat_view.delete_chat(self.senders['h_user']['username'], self.errors)
|
||||
device_1_profile_view = device_1_sign_in_view.profile_button.click()
|
||||
device_1_sign_in_view = device_1_profile_view.logout()
|
||||
time.sleep(5) # Prevent stale element exception for first_account_button
|
||||
device_1_sign_in_view.account_button.click()
|
||||
device_1_sign_in_view.sign_in(self.senders['g_user']['password'])
|
||||
if device_1_home_view.get_chat_with_user(self.senders['h_user']['username']).is_element_present(20):
|
||||
pytest.fail('The chat is present after re-login')
|
||||
|
||||
# Device 1: Start 1-1 chat with device 2
|
||||
device_1_chat_view = device_1_home_view.start_1_1_chat(self.senders['h_user']['username'])
|
||||
if not device_1_chat_view.no_messages_in_chat.is_element_present():
|
||||
pytest.fail('Message history is shown in a chat which was previously deleted')
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_case_id(3419)
|
||||
def test_public_chat_management(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
chat_name = device_1.get_public_chat_name()
|
||||
for sign_in in device_1, device_2:
|
||||
home = sign_in.create_user()
|
||||
home.join_public_chat(chat_name)
|
||||
chat_1, chat_2 = device_1.get_chat_view(), device_2.get_chat_view()
|
||||
message_1, message_2, message_3, message_4, message_5 = 'm1', 'm2', 'm3', 'm4', 'm5'
|
||||
chat_1.chat_message_input.send_keys(message_1)
|
||||
chat_1.send_message_button.click()
|
||||
chat_2.element_by_text(message_1).is_element_present()
|
||||
|
||||
chat_2.chat_message_input.send_keys(message_2)
|
||||
chat_2.send_message_button.click()
|
||||
chat_1.element_by_text(message_2).is_element_present()
|
||||
chat_1.chat_options.click()
|
||||
chat_1.clear_history_button.click()
|
||||
chat_1.clear_button.click()
|
||||
chat_2.chat_message_input.send_keys(message_3)
|
||||
chat_2.send_message_button.click()
|
||||
chat_1.element_by_text(message_3).is_element_present()
|
||||
for message in message_1, message_2:
|
||||
if chat_1.element_starts_with_text(message).is_element_present():
|
||||
self.errors.append("Message '%s' is shown, but public chat history has been cleared" % message)
|
||||
chat_2.chat_options.click()
|
||||
chat_2.delete_chat_button.click()
|
||||
chat_2.delete_button.click()
|
||||
chat_1.chat_message_input.send_keys(message_4)
|
||||
chat_1.send_message_button.click()
|
||||
public_chat_name = '#' + chat_name
|
||||
home_2 = chat_2.get_home_view()
|
||||
if home_2.element_by_text(public_chat_name).is_element_present(sec=30):
|
||||
self.errors.append("Public chat reappears after deleting")
|
||||
|
||||
chat_1.get_back_to_home_view()
|
||||
home_1 = chat_1.get_home_view()
|
||||
home_1.get_chat_with_user(public_chat_name).swipe_and_delete()
|
||||
|
||||
for home in home_2, home_1:
|
||||
home.relogin()
|
||||
if home_1.element_by_text(public_chat_name).is_element_present(20):
|
||||
self.errors.append("Public chat '%s' is shown, but the chat has been deleted via 'swipe to delete'"
|
||||
% public_chat_name)
|
||||
if home_2.element_by_text(public_chat_name).is_element_present(20):
|
||||
self.errors.append("Public chat '%s' is shown, but the user deleted it" % public_chat_name)
|
||||
self.verify_no_errors()
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.chat_management
|
||||
class TestChatManagement(SingleDeviceTestCase):
|
||||
|
||||
@marks.testrail_case_id(3413)
|
||||
def test_swipe_and_delete_1_1_chat(self):
|
||||
recipient = transaction_users['A_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
home_view.add_contact(recipient['public_key'])
|
||||
chat_view = home_view.get_chat_view()
|
||||
chat_view.chat_message_input.send_keys('test message')
|
||||
chat_view.send_message_button.click()
|
||||
chat_view.get_back_to_home_view()
|
||||
home_view.get_chat_with_user(recipient['username']).swipe_and_delete()
|
||||
home_view.relogin()
|
||||
if home_view.get_chat_with_user(recipient['username']).is_element_present(20):
|
||||
pytest.fail('The chat is present after re-login')
|
||||
|
||||
@marks.testrail_case_id(3412)
|
||||
def test_delete_1_1_chat(self):
|
||||
sender = transaction_users['G_USER']
|
||||
recipient = transaction_users['E_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'])
|
||||
chat_view = home_view.get_chat_view()
|
||||
chat_view.chat_message_input.send_keys('test message')
|
||||
chat_view.send_message_button.click()
|
||||
transaction_amount = '0.00001'
|
||||
chat_view.request_transaction_in_1_1_chat('ETH', transaction_amount)
|
||||
chat_view.send_transaction_in_1_1_chat(transaction_amount, sender['password'], wallet_set_up=True)
|
||||
chat_view.delete_chat(recipient['username'], self.errors)
|
||||
if home_view.get_chat_with_user(recipient['username']).is_element_present(5):
|
||||
pytest.fail('Deleted chat is shown on Home screen')
|
||||
home_view.relogin(sender['password'])
|
||||
if home_view.get_chat_with_user(recipient['username']).is_element_present(20):
|
||||
pytest.fail('Deleted chat is shown on Home screen after re-login')
|
||||
home_view.start_1_1_chat(recipient['username'])
|
||||
if not chat_view.no_messages_in_chat.is_element_present():
|
||||
pytest.fail('Message history is shown in a chat which was previously deleted')
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_case_id(3418)
|
||||
@marks.skip
|
||||
def test_swipe_and_delete_group_chat(self):
|
||||
recipient = group_chat_users['A_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
home_view.add_contact(recipient['public_key'])
|
||||
home_view.get_back_to_home_view()
|
||||
chat_name = 'a_chat_%s' % get_current_time()
|
||||
home_view.create_group_chat([recipient['username']], chat_name)
|
||||
chat_view = home_view.get_chat_view()
|
||||
chat_view.chat_message_input.send_keys('This is text message!')
|
||||
chat_view.send_message_button.click()
|
||||
chat_view.get_back_to_home_view()
|
||||
home_view.get_chat_with_user(chat_name).swipe_and_delete()
|
||||
home_view.relogin()
|
||||
if home_view.get_chat_with_user(chat_name).is_element_displayed():
|
||||
pytest.fail('The chat is present after re-login')
|
|
@ -1,79 +0,0 @@
|
|||
import pytest
|
||||
from tests import transaction_users, marks
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@pytest.mark.all
|
||||
class TestDAppsAndBrowsing(SingleDeviceTestCase):
|
||||
|
||||
@pytest.mark.pr
|
||||
@pytest.mark.testrail_case_id(3389)
|
||||
def test_browse_link_entering_url_in_dapp_view(self):
|
||||
"""
|
||||
Navigate to non-Dapp site with non-english content
|
||||
Check back and forward browsing buttons works as expected
|
||||
"""
|
||||
|
||||
sign_in = SignInView(self.driver)
|
||||
sign_in.create_user()
|
||||
home_view = sign_in.get_home_view()
|
||||
start_new_chat = home_view.plus_button.click()
|
||||
start_new_chat.open_d_app_button.click()
|
||||
start_new_chat.enter_url_editbox.set_value('www.wikipedia.org')
|
||||
start_new_chat.confirm()
|
||||
browsing_view = home_view.get_base_web_view()
|
||||
browsing_view.wait_for_d_aap_to_load()
|
||||
|
||||
wikipedia_home_text_list = ['Español','日本語', 'Français', 'English']
|
||||
for wikitext in wikipedia_home_text_list:
|
||||
browsing_view.find_text_part(wikitext, 15)
|
||||
browsing_view.element_by_text_part('Русский', 'button').click()
|
||||
browsing_view.find_text_part('Избранная статья')
|
||||
browsing_view.browser_previous_page_button.click()
|
||||
browsing_view.find_text_part(wikipedia_home_text_list[0], 15)
|
||||
|
||||
browsing_view.browser_next_page_button.click()
|
||||
browsing_view.find_text_part('Избранная статья')
|
||||
browsing_view.back_to_home_button.click()
|
||||
expected_title = 'Browser'
|
||||
expected_url = 'https://ru.m.wikipedia.org'
|
||||
|
||||
if not home_view.chat_name_text.text.startswith(expected_title):
|
||||
self.errors.append("'%s' web page title instead of '%s'", (home_view.chat_name_text.text, expected_title))
|
||||
if not home_view.chat_url_text.text.startswith(expected_url):
|
||||
self.errors.append("'%s' web page URL instead of '%s'", (home_view.chat_url_text.text, expected_url))
|
||||
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3404)
|
||||
def test_send_transaction_from_daap(self):
|
||||
sender = transaction_users['B_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(sender['passphrase'], sender['password'])
|
||||
address = transaction_users['B_USER']['address']
|
||||
initial_balance = self.network_api.get_balance(address)
|
||||
status_test_dapp = sign_in_view.open_status_test_dapp()
|
||||
status_test_dapp.wait_for_d_aap_to_load()
|
||||
status_test_dapp.assets_button.click()
|
||||
send_transaction_view = status_test_dapp.request_stt_button.click()
|
||||
send_transaction_view.sign_transaction(sender['password'])
|
||||
self.network_api.verify_balance_is_updated(initial_balance, address)
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3675)
|
||||
def test_sign_message_from_daap(self):
|
||||
password = 'passwordfordaap'
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user(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.sign_message_button.click()
|
||||
send_transaction_view.find_full_text('Kudos to Andrey!')
|
||||
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(password)
|
||||
send_transaction_view.sign_transaction_button.click()
|
||||
|
|
@ -1,341 +0,0 @@
|
|||
import random
|
||||
import string
|
||||
import emoji
|
||||
import time
|
||||
from tests.base_test_case import MultipleDeviceTestCase
|
||||
from tests import group_chat_users, get_current_time, marks
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
unicode_text_message = '%s%s%s%s %s%s%s%s%s%s%s' % (chr(355), chr(275), chr(353), chr(539), chr(1084), chr(949),
|
||||
chr(349), chr(353), chr(513), chr(485), chr(283))
|
||||
unicode_chinese = '%s%s' % (chr(29320), chr(22909))
|
||||
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
|
||||
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
|
||||
emoji_name_1 = random.choice(list(emoji.EMOJI_UNICODE))
|
||||
emoji_unicode_1 = emoji.EMOJI_UNICODE[emoji_name_1]
|
||||
message_with_new_line = 'message' '\n' 'with new line'
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.chat
|
||||
class TestMessages(MultipleDeviceTestCase):
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3390)
|
||||
def test_one_to_one_chat_messages(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for sign_in in device_1, device_2:
|
||||
sign_in.create_user()
|
||||
device_1_home, device_2_home = device_1.get_home_view(), device_2.get_home_view()
|
||||
device_2_public_key = device_2_home.get_public_key()
|
||||
device_1_home.add_contact(device_2_public_key)
|
||||
device_1_chat = device_1_home.get_chat_view()
|
||||
|
||||
message = 'hello'
|
||||
device_1_chat.chat_message_input.send_keys(message)
|
||||
device_1_chat.send_message_button.click()
|
||||
device_2_home.home_button.click()
|
||||
device_2_home.element_by_text(message, 'button').click()
|
||||
device_2_chat = device_2_home.get_chat_view()
|
||||
|
||||
device_2_chat.chat_message_input.send_keys('~abc~ !@#$%%^&(() *bold*')
|
||||
device_2_chat.send_message_button.click()
|
||||
device_1_chat.wait_for_message_in_one_to_one_chat('abc !@#$%%^&(() bold', self.errors)
|
||||
|
||||
device_1_chat.chat_message_input.send_keys(unicode_text_message)
|
||||
device_1_chat.send_message_button.click()
|
||||
device_2_chat.wait_for_message_in_one_to_one_chat(unicode_text_message, self.errors)
|
||||
|
||||
device_2_chat.chat_message_input.send_keys(unicode_chinese)
|
||||
device_2_chat.send_message_button.click()
|
||||
device_1_chat.wait_for_message_in_one_to_one_chat(unicode_chinese, self.errors)
|
||||
|
||||
device_1_chat.chat_message_input.send_keys(emoji.emojize(emoji_name))
|
||||
device_1_chat.send_message_button.click()
|
||||
device_2_chat.wait_for_message_in_one_to_one_chat(emoji_unicode, self.errors)
|
||||
|
||||
message_with_emoji = 'message with emoji'
|
||||
device_2_chat.chat_message_input.send_keys(emoji.emojize('%s %s' % (message_with_emoji, emoji_name_1)))
|
||||
device_2_chat.send_message_button.click()
|
||||
device_1_chat.wait_for_message_in_one_to_one_chat('%s %s' % (message_with_emoji, emoji_unicode_1), self.errors)
|
||||
|
||||
device_1_chat.chat_message_input.click()
|
||||
device_1_chat.send_as_keyevent(message_with_new_line)
|
||||
device_1_chat.send_message_button.click()
|
||||
device_2_chat.wait_for_message_in_one_to_one_chat(message_with_new_line, self.errors)
|
||||
|
||||
url_message = 'status.im'
|
||||
device_2_chat.chat_message_input.send_keys(url_message)
|
||||
device_2_chat.send_message_button.click()
|
||||
device_1_chat.wait_for_message_in_one_to_one_chat(url_message, self.errors)
|
||||
if device_1_chat.element_by_text(url_message, 'button').is_element_present():
|
||||
device_1_chat.element_by_text(url_message, 'button').click()
|
||||
web_view = device_1_chat.open_in_status_button.click()
|
||||
web_view.find_full_text('Status, the Ethereum discovery tool.')
|
||||
device_1_chat.back_button.click()
|
||||
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3391)
|
||||
@marks.skip
|
||||
def test_group_chat_messages_and_delete_chat(self):
|
||||
self.create_drivers(3)
|
||||
|
||||
device_1, device_2, device_3 = \
|
||||
SignInView(self.drivers[0]), SignInView(self.drivers[1]), SignInView(self.drivers[2])
|
||||
|
||||
for data in (device_1, group_chat_users['A_USER']), \
|
||||
(device_2, group_chat_users['B_USER']), \
|
||||
(device_3, group_chat_users['C_USER']):
|
||||
data[0].recover_access(data[1]['passphrase'], data[1]['password'])
|
||||
|
||||
home_1, home_2, home_3 = device_1.get_home_view(), device_2.get_home_view(), device_3.get_home_view()
|
||||
|
||||
public_key_2, public_key_3 = \
|
||||
group_chat_users['B_USER']['public_key'], \
|
||||
group_chat_users['C_USER']['public_key']
|
||||
|
||||
username_1, username_2, username_3 = \
|
||||
group_chat_users['A_USER']['username'], \
|
||||
group_chat_users['B_USER']['username'], \
|
||||
group_chat_users['C_USER']['username']
|
||||
|
||||
for public_key in public_key_2, public_key_3:
|
||||
home_1.add_contact(public_key)
|
||||
home_1.get_back_to_home_view()
|
||||
|
||||
chat_name = 'a_chat_%s' % get_current_time()
|
||||
home_1.create_group_chat(sorted([username_2, username_3]), chat_name)
|
||||
chat_1 = home_1.get_chat_view()
|
||||
text_message = 'This is text message!'
|
||||
chat_1.chat_message_input.send_keys(text_message)
|
||||
chat_1.send_message_button.click()
|
||||
for home in home_2, home_3:
|
||||
home.element_by_text(chat_name, 'button').click()
|
||||
|
||||
chat_2, chat_3 = home_2.get_chat_view(), home_3.get_chat_view()
|
||||
for chat in chat_2, chat_3:
|
||||
chat.wait_for_messages(username_1, text_message, self.errors)
|
||||
|
||||
chat_2.chat_message_input.send_keys(emoji.emojize(emoji_name))
|
||||
chat_2.send_message_button.click()
|
||||
for chat in chat_1, chat_3:
|
||||
chat.wait_for_messages(username_2, emoji_unicode, self.errors)
|
||||
|
||||
message_with_emoji = 'message with emoji'
|
||||
chat_3.chat_message_input.send_keys(emoji.emojize('%s %s' % (message_with_emoji, emoji_name_1)))
|
||||
chat_3.send_message_button.click()
|
||||
for chat in chat_1, chat_2:
|
||||
chat.wait_for_messages(username_3, '%s %s' % (message_with_emoji, emoji_unicode_1), self.errors)
|
||||
|
||||
chat_1.chat_message_input.send_keys(unicode_text_message)
|
||||
chat_1.send_message_button.click()
|
||||
|
||||
for chat in chat_2, chat_3:
|
||||
chat.wait_for_messages(username_1, unicode_text_message, self.errors)
|
||||
|
||||
# for chat in chat_1, chat_2, chat_3:
|
||||
# chat.delete_chat(chat_name, self.errors)
|
||||
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3392)
|
||||
def test_public_chat(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
users = ['user_1', 'user_2']
|
||||
home_1, home_2 = device_1.create_user(username=users[0]), device_2.create_user(username=users[1])
|
||||
chat_name = home_1.get_public_chat_name()
|
||||
chat_1, chat_2 = home_1.join_public_chat(chat_name), home_2.join_public_chat(chat_name)
|
||||
|
||||
chat_1.chat_message_input.send_keys('/command')
|
||||
chat_1.send_message_button.click()
|
||||
|
||||
message_with_emoji = 'message with emoji'
|
||||
|
||||
chat_2.chat_message_input.send_keys(emoji.emojize(emoji_name))
|
||||
chat_2.send_message_button.click()
|
||||
|
||||
chat_1.chat_message_input.send_keys('%s %s' % (unicode_text_message, unicode_chinese))
|
||||
chat_1.send_message_button.click()
|
||||
|
||||
chat_2.chat_message_input.send_keys('%s %s' % (message_with_emoji, emoji_unicode_1))
|
||||
chat_2.send_message_button.click()
|
||||
|
||||
chat_1.chat_message_input.send_keys('This is text message.')
|
||||
chat_1.send_message_button.click()
|
||||
|
||||
chat_2.chat_message_input.click()
|
||||
chat_2.send_as_keyevent(message_with_new_line)
|
||||
chat_2.send_message_button.click()
|
||||
|
||||
messages_from_user_2 = [emoji_unicode, '%s %s' % (message_with_emoji, emoji_unicode_1), message_with_new_line]
|
||||
chat_1.wait_for_messages(users[1], messages_from_user_2, self.errors)
|
||||
|
||||
messages_from_user_1 = ['/command', '%s %s' % (unicode_text_message, unicode_chinese), 'This is text message.']
|
||||
chat_2.wait_for_messages(users[0], messages_from_user_1, self.errors)
|
||||
|
||||
for chat in chat_1, chat_2:
|
||||
chat.delete_chat(chat_name, self.errors)
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_case_id(3423)
|
||||
def test_username_and_profile_picture_in_chats(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
username_1, username_2 = 'user_1', 'user_2'
|
||||
home_1, home_2 = device_1.create_user(username=username_1), device_2.create_user(username=username_2)
|
||||
device_2_public_key = home_2.get_public_key()
|
||||
profile_2 = home_2.get_profile_view()
|
||||
file_name = 'sauce_logo.png'
|
||||
profile_2.edit_profile_picture(file_name)
|
||||
home_1.add_contact(device_2_public_key)
|
||||
chat_1 = home_1.get_chat_view()
|
||||
chat_1.chat_message_input.send_keys('ping')
|
||||
chat_1.send_message_button.click()
|
||||
profile_2.home_button.click()
|
||||
chat_2 = home_2.get_chat_with_user(username_1).click()
|
||||
chat_2.add_to_contacts.click()
|
||||
time.sleep(3)
|
||||
if chat_1.user_name_text.text != username_2:
|
||||
self.errors.append("Real username '%s' is not shown in one-to-one chat" % username_2)
|
||||
chat_1.chat_options.click()
|
||||
chat_1.view_profile_button.click()
|
||||
if not chat_1.contact_profile_picture.is_element_image_equals_template(file_name):
|
||||
self.errors.append("Updated profile picture is not shown in one-to-one chat")
|
||||
|
||||
# home_1.get_back_to_home_view()
|
||||
# chat_name = 'a_chat_%s' % get_current_time()
|
||||
# home_1.create_group_chat([username_2], chat_name)
|
||||
# group_chat_1 = home_1.get_chat_view()
|
||||
#
|
||||
# home_2.get_back_to_home_view()
|
||||
# group_chat_2 = home_2.get_chat_with_user(chat_name).click()
|
||||
# message_text = 'test message'
|
||||
# group_chat_2.chat_message_input.send_keys(message_text)
|
||||
# group_chat_2.send_message_button.click()
|
||||
#
|
||||
# group_chat_1.wait_for_messages(username_2, message_text, self.errors)
|
||||
# group_chat_1.verify_username_is_shown_per_message(username_2, message_text, self.errors)
|
||||
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_case_id(3429)
|
||||
def test_copy_and_paste_messages(self):
|
||||
self.create_drivers(1)
|
||||
sign_in = SignInView(self.drivers[0])
|
||||
sign_in.create_user()
|
||||
home = sign_in.get_home_view()
|
||||
home.join_public_chat(home.get_public_chat_name())
|
||||
chat = sign_in.get_chat_view()
|
||||
message_text = 'test'
|
||||
message_input = chat.chat_message_input
|
||||
message_input.send_keys(message_text)
|
||||
chat.send_message_button.click()
|
||||
|
||||
# copy text message
|
||||
chat.chat_element_by_text(message_text).long_press_element()
|
||||
chat.element_by_text('Copy to clipboard').click()
|
||||
|
||||
# paste text into the input field
|
||||
message_input.paste_text_from_clipboard()
|
||||
assert message_input.text == message_text
|
||||
|
||||
# delete part of the message
|
||||
message_input.delete_last_symbols(2)
|
||||
assert message_input.text == message_text[:-2]
|
||||
|
||||
# cut message text
|
||||
message_input.cut_text()
|
||||
|
||||
# paste selected text
|
||||
message_input.paste_text_from_clipboard()
|
||||
chat.send_message_button.click()
|
||||
|
||||
# verify correct text is sent
|
||||
chat.chat_element_by_text(message_text[:-2] + ' ').wait_for_visibility_of_element(2)
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.chat
|
||||
class TestOfflineMessages(MultipleDeviceTestCase):
|
||||
|
||||
@marks.testrail_case_id(3420)
|
||||
def test_offline_messaging_1_1_chat(self):
|
||||
self.create_drivers(2, offline_mode=True)
|
||||
device_1, device_2 = self.drivers[0], self.drivers[1]
|
||||
sign_in_1, sign_in_2 = SignInView(device_1), SignInView(device_2)
|
||||
username_1 = sign_in_1.create_user()
|
||||
sign_in_2.create_user()
|
||||
home_1, home_2 = sign_in_1.get_home_view(), sign_in_2.get_home_view()
|
||||
device_2_public_key = home_2.get_public_key()
|
||||
home_1.add_contact(device_2_public_key)
|
||||
chat_1 = home_1.get_chat_view()
|
||||
chat_1.chat_message_input.send_keys('ping')
|
||||
chat_1.send_message_button.click()
|
||||
home_2.home_button.click()
|
||||
home_2.get_chat_with_user(username_1).is_element_present(20)
|
||||
profile_2 = home_2.profile_button.click()
|
||||
profile_2.logout()
|
||||
device_2.set_network_connection(1) # airplane mode
|
||||
message_text = 'test message'
|
||||
chat_1.chat_message_input.send_keys(message_text)
|
||||
chat_1.send_message_button.click()
|
||||
sign_in_2.click_account_by_position(0)
|
||||
sign_in_2.sign_in()
|
||||
sign_in_2.home_button.wait_for_visibility_of_element()
|
||||
if home_2.connection_status.text != 'Offline':
|
||||
self.errors.append('Offline label is not shown on Home view while being offline')
|
||||
chat_2 = home_2.get_chat_with_user(username_1).click()
|
||||
if chat_2.connection_status.text != 'Offline':
|
||||
self.errors.append('Offline label is not shown on Chat view while being offline')
|
||||
device_2.set_network_connection(2) # turning on WiFi connection
|
||||
chat_2.wait_for_message_in_one_to_one_chat(message_text, self.errors, wait_time=120)
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_case_id(3430)
|
||||
@marks.skip
|
||||
def test_offline_messaging_group_chat(self):
|
||||
self.create_drivers(2, offline_mode=True)
|
||||
device_1, device_2 = self.drivers[0], self.drivers[1]
|
||||
sign_in_1, sign_in_2 = SignInView(device_1), SignInView(device_2)
|
||||
username_1, username_2 = 'user_1', 'user_2'
|
||||
home_1, home_2 = sign_in_1.create_user(), sign_in_2.create_user()
|
||||
|
||||
device_2_public_key = home_2.get_public_key()
|
||||
home_1.add_contact(device_2_public_key)
|
||||
home_1.get_back_to_home_view()
|
||||
|
||||
home_2.home_button.click()
|
||||
chat_view_2 = home_2.get_chat_with_user(username_1).click()
|
||||
chat_view_2.add_to_contacts.click()
|
||||
chat_view_2.get_back_to_home_view()
|
||||
|
||||
chat_name = 'a_chat_%s' % get_current_time()
|
||||
home_1.create_group_chat([username_2], chat_name)
|
||||
chat_1 = home_1.get_chat_view()
|
||||
|
||||
chat_element_2 = home_2.get_chat_with_user(chat_name)
|
||||
chat_element_2.wait_for_visibility_of_element()
|
||||
device_2.set_network_connection(1) # airplane mode
|
||||
|
||||
if home_2.connection_status.text != 'Offline':
|
||||
self.errors.append('Offline label is not shown on Home view while being offline')
|
||||
chat_2 = chat_element_2.click()
|
||||
if chat_2.connection_status.text != 'Offline':
|
||||
self.errors.append('Offline label is not shown on Chat view while being offline')
|
||||
|
||||
message_text = 'test message'
|
||||
chat_1.chat_message_input.send_keys(message_text)
|
||||
chat_1.send_message_button.click()
|
||||
|
||||
chat_1.get_back_to_home_view()
|
||||
profile_1 = home_1.profile_button.click()
|
||||
profile_1.logout()
|
||||
|
||||
device_2.set_network_connection(2) # turning on WiFi connection
|
||||
chat_2.wait_for_messages(username_1, message_text, self.errors, wait_time=120)
|
||||
self.verify_no_errors()
|
|
@ -1,55 +0,0 @@
|
|||
import pytest
|
||||
from selenium.common.exceptions import NoSuchElementException, TimeoutException
|
||||
from tests.base_test_case import MultipleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
class TestMultipleDevices(MultipleDeviceTestCase):
|
||||
|
||||
def test_group_chat_send_receive_messages_and_remove_user(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for sign_in in device_1, device_2:
|
||||
sign_in.create_user()
|
||||
device_1_home = device_1.get_home_view()
|
||||
device_2_home = device_2.get_home_view()
|
||||
device_1_public_key = device_1_home.get_public_key()
|
||||
device_2_home.add_contact(device_1_public_key)
|
||||
device_2_chat = device_2_home.get_chat_view()
|
||||
device_1_user_name = device_2_chat.user_name_text.text
|
||||
device_2_home.get_back_to_home_view()
|
||||
chat_name = 'new_chat'
|
||||
message_1 = 'first SOMETHING'
|
||||
message_2 = 'second SOMETHING'
|
||||
message_3 = 'third SOMETHING'
|
||||
device_2_home.create_group_chat([device_1_user_name], chat_name)
|
||||
|
||||
# send_and_receive_messages
|
||||
device_2_chat.chat_message_input.send_keys(message_1)
|
||||
device_2_chat.send_message_button.click()
|
||||
device_1.home_button.click()
|
||||
device_1_home.find_full_text(message_1)
|
||||
device_1_home.element_by_text(chat_name, 'button').click()
|
||||
group_chat_d1 = device_1_home.get_chat_view()
|
||||
group_chat_d1.chat_message_input.send_keys(message_2)
|
||||
group_chat_d1.send_message_button.click()
|
||||
device_2_chat.find_full_text(message_2)
|
||||
|
||||
# remove user
|
||||
device_2_chat.chat_options.click()
|
||||
device_2_chat.chat_settings.click()
|
||||
for _ in range(2):
|
||||
try:
|
||||
device_2_chat.user_options.click()
|
||||
except (NoSuchElementException, TimeoutException):
|
||||
pass
|
||||
device_2_chat.remove_button.click()
|
||||
device_2_chat.confirm()
|
||||
device_2.back_button.click()
|
||||
|
||||
# verify removed user receives no messages
|
||||
device_2_chat.chat_message_input.send_keys(message_3)
|
||||
device_2_chat.send_message_button.click()
|
||||
group_chat_d1.find_text_part("removed you from group chat")
|
||||
if group_chat_d1.element_by_text(message_3, 'text').is_element_present(20):
|
||||
pytest.fail('Message is shown for the user which has been removed from the GroupChat', False)
|
|
@ -1,79 +0,0 @@
|
|||
import pytest
|
||||
from itertools import combinations_with_replacement
|
||||
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
class TestNetwork(SingleDeviceTestCase):
|
||||
|
||||
@pytest.mark.network
|
||||
@pytest.mark.parametrize("network", ['Ropsten', 'Rinkeby', 'Rinkeby with upstream RPC',
|
||||
'Mainnet', 'Mainnet with upstream RPC'])
|
||||
def test_network_switch(self, network):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.switch_network(network)
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.find_full_text('Wallet', 20)
|
||||
|
||||
|
||||
class TestNetworkChats(MultipleDeviceTestCase):
|
||||
network_combinations = list(combinations_with_replacement(
|
||||
['Ropsten', 'Rinkeby', 'Mainnet',
|
||||
'Rinkeby with upstream RPC', 'Mainnet with upstream RPC', 'Rinkeby with upstream RPC'], 2))
|
||||
|
||||
@pytest.mark.network_chat
|
||||
@pytest.mark.parametrize("network", network_combinations,
|
||||
ids=[i[0] + ' & ' + i[1] for i in network_combinations])
|
||||
def test_one_to_one_chat_between(self, network):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for sign_in in device_1, device_2:
|
||||
sign_in.create_user()
|
||||
device_1_profile_view = device_1.profile_button.click()
|
||||
device_1_public_key = device_1_profile_view.public_key_text.text
|
||||
if network[0] != 'Ropsten with upstream RPC':
|
||||
login_d1 = device_1_profile_view.switch_network(network[0])
|
||||
login_d1.click_account_by_position(0)
|
||||
login_d1.password_input.send_keys('qwerty1234')
|
||||
login_d1.sign_in_button.click()
|
||||
login_d1.find_full_text('Wallet', 60)
|
||||
else:
|
||||
device_1_profile_view.back_button.click()
|
||||
device_2_home_view = device_2.get_home_view()
|
||||
if network[1] != 'Ropsten with upstream RPC':
|
||||
device_2_profile_view = device_2.profile_button.click()
|
||||
device_2_sign_in = device_2_profile_view.switch_network(network[1])
|
||||
device_2_sign_in.click_account_by_position(0)
|
||||
device_2_sign_in.password_input.send_keys('qwerty1234')
|
||||
device_2_home_view = device_2_sign_in.sign_in_button.click()
|
||||
device_2_home_view.find_full_text('Wallet', 60)
|
||||
device_2_home_view.add_contact(device_1_public_key)
|
||||
device_2_chat = device_2.get_chat_view()
|
||||
message_1 = network[0]
|
||||
message_2 = network[1]
|
||||
device_2_chat.chat_message_input.send_keys(message_2)
|
||||
device_2_chat.send_message_button.click()
|
||||
errors = list()
|
||||
try:
|
||||
device_1.find_full_text(message_2)
|
||||
except TimeoutException:
|
||||
errors.append("Message '%s' wasn't received by Device #1")
|
||||
device_1.element_by_text(message_2, 'button').click()
|
||||
device_1_chat = device_1.get_chat_view()
|
||||
device_1_chat.chat_message_input.send_keys(message_1)
|
||||
device_1_chat.send_message_button.click()
|
||||
try:
|
||||
device_2_chat.find_full_text(message_1)
|
||||
except TimeoutException:
|
||||
errors.append("Message '%s' wasn't received by Device #2")
|
||||
if errors:
|
||||
msg = ''
|
||||
for error in errors:
|
||||
msg += (error + '\n')
|
||||
pytest.fail(msg, pytrace=False)
|
|
@ -1,156 +0,0 @@
|
|||
import random
|
||||
import emoji
|
||||
import pytest
|
||||
import time
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from tests import basic_user, marks
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@marks.all
|
||||
class TestProfileView(SingleDeviceTestCase):
|
||||
|
||||
@marks.testrail_case_id(3395)
|
||||
def test_qr_code_and_its_value(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.share_my_contact_key_button.click()
|
||||
key_value = profile_view.public_key_text.text
|
||||
time.sleep(5)
|
||||
key_value_from_qr = profile_view.get_text_from_qr()
|
||||
if key_value != key_value_from_qr:
|
||||
self.errors.append("QR code value '%s' doesn't match public key '%s'" % (key_value_from_qr, key_value))
|
||||
profile_view.cross_icon.click()
|
||||
wallet_view = profile_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
wallet_view.receive_transaction_button.click()
|
||||
wallet_view.qr_code_image.wait_for_element()
|
||||
key_value = wallet_view.address_text.text
|
||||
key_value_from_qr = wallet_view.get_text_from_qr()
|
||||
if key_value not in key_value_from_qr:
|
||||
self.errors.append(
|
||||
"Wallet QR code value '%s' doesn't match wallet address '%s'" % (key_value_from_qr, key_value))
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3396)
|
||||
def test_contact_profile_view(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
home_view.add_contact(basic_user['public_key'])
|
||||
chat_view = home_view.get_chat_view()
|
||||
chat_view.chat_options.click_until_presence_of_element(chat_view.view_profile_button)
|
||||
chat_view.view_profile_button.click()
|
||||
for text in basic_user['username'], 'In contacts', 'Send transaction', 'Send message', 'Contact code':
|
||||
chat_view.find_full_text(text)
|
||||
chat_view.profile_send_message.click()
|
||||
chat_view.chat_message_input.wait_for_visibility_of_element()
|
||||
chat_view.chat_options.click_until_presence_of_element(chat_view.view_profile_button)
|
||||
chat_view.view_profile_button.click()
|
||||
chat_view.profile_send_transaction.click()
|
||||
assert chat_view.chat_message_input.text.strip() == '/send'
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3397)
|
||||
def test_network_switch(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
sign_in_view = profile_view.switch_network('Rinkeby with upstream RPC')
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.sign_in()
|
||||
sign_in_view.profile_button.click_until_presence_of_element(profile_view.advanced_button)
|
||||
profile_view.advanced_button.click()
|
||||
desired_network = profile_view.element_by_text('RINKEBY WITH UPSTREAM RPC', 'text')
|
||||
desired_network.scroll_to_element()
|
||||
assert desired_network.is_element_displayed()
|
||||
|
||||
@marks.testrail_case_id(3398)
|
||||
def test_profile_picture(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.edit_profile_picture(file_name='sauce_logo.png')
|
||||
profile_view.relogin()
|
||||
sign_in_view.profile_button.click()
|
||||
profile_view.swipe_down()
|
||||
if not profile_view.profile_picture.is_element_image_equals_template():
|
||||
pytest.fail('Profile picture was not updated')
|
||||
|
||||
@marks.testrail_case_id(3399)
|
||||
def test_backup_seed_phrase_and_recover_account(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user(password='qwerty1234')
|
||||
home_view = sign_in_view.get_home_view()
|
||||
public_key = home_view.get_public_key()
|
||||
profile_view = home_view.get_profile_view()
|
||||
seed_phrase = profile_view.backup_seed_phrase()
|
||||
profile_view.logout_button.click()
|
||||
profile_view.confirm_logout_button.click()
|
||||
recover_access_view = sign_in_view.add_existing_account_button.click()
|
||||
recover_access_view.passphrase_input.click()
|
||||
recover_access_view.send_as_keyevent(' '.join(seed_phrase[key] for key in sorted(seed_phrase)))
|
||||
recover_access_view.password_input.click()
|
||||
recover_access_view.send_as_keyevent('qwerty1234')
|
||||
recover_access_view.sign_in_button.click()
|
||||
public_key_1 = home_view.get_public_key()
|
||||
assert public_key == public_key_1
|
||||
|
||||
@marks.testrail_case_id(3411)
|
||||
def test_faucet_console_command(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
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()
|
||||
console_view = home_view.get_chat_with_user('Status Console').click()
|
||||
console_view.send_faucet_request()
|
||||
console_view.back_button.click()
|
||||
wallet_view = profile_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
wallet_view.wait_balance_changed_on_wallet_screen()
|
||||
|
||||
@marks.testrail_case_id(3421)
|
||||
def test_switch_users(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
for _ in range(3):
|
||||
sign_in_view.create_user(password='qwerty1234')
|
||||
home_view = sign_in_view.get_home_view()
|
||||
profile_view = home_view.profile_button.click()
|
||||
profile_view.logout_button.click()
|
||||
profile_view.confirm_logout_button.click()
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.home_button.wait_for_visibility_of_element()
|
||||
|
||||
@marks.testrail_case_id(3424)
|
||||
def test_incorrect_password(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_account_button.click()
|
||||
sign_in_view.password_input.set_value('123456')
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.confirm_password_input.set_value('123455')
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.find_full_text("Password confirmation doesn't match password.")
|
||||
sign_in_view.confirm_password_input.clear()
|
||||
sign_in_view.confirm_password_input.set_value('123456')
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.name_input.wait_for_element(45)
|
||||
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
|
||||
username = 'user'
|
||||
sign_in_view.name_input.click()
|
||||
sign_in_view.name_input.send_keys(emoji.emojize('%s %s' % (username, emoji_name)))
|
||||
sign_in_view.next_button.click()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.swipe_down()
|
||||
assert profile_view.username_text.text == '%s %s' % (username, emoji.EMOJI_UNICODE[emoji_name])
|
||||
profile_view.logout_button.click()
|
||||
profile_view.confirm_logout_button.click()
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys('123455')
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.find_full_text('Wrong password')
|
|
@ -1,143 +0,0 @@
|
|||
import pytest
|
||||
from tests import marks
|
||||
from tests import transaction_users, transaction_users_wallet
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from tests import basic_user
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@pytest.mark.all
|
||||
class TestSanity(SingleDeviceTestCase):
|
||||
|
||||
@pytest.mark.profile
|
||||
def test_change_user_name(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.edit_button.click()
|
||||
profile_view.username_input.clear()
|
||||
new_username = 'NewUserName!'
|
||||
profile_view.username_input.send_keys(new_username)
|
||||
profile_view.confirm_button.click()
|
||||
profile_view.relogin()
|
||||
sign_in_view.profile_button.click()
|
||||
profile_view.edit_button.click()
|
||||
profile_view.find_full_text(new_username, 5)
|
||||
|
||||
@pytest.mark.recover
|
||||
def test_recover_access(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.logout()
|
||||
recover_access_view = sign_in_view.add_existing_account_button.click()
|
||||
recover_access_view.passphrase_input.send_keys(basic_user['passphrase'])
|
||||
recover_access_view.password_input.send_keys(basic_user['password'])
|
||||
home_view = recover_access_view.sign_in_button.click()
|
||||
home_view.find_full_text('Wallet', 60)
|
||||
if basic_user['password'] in str(home_view.logcat):
|
||||
pytest.fail('Password in logcat!!!', pytrace=False)
|
||||
|
||||
@pytest.mark.group_chat
|
||||
@marks.skip
|
||||
def test_group_chat_members(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
|
||||
users = [transaction_users_wallet['A_USER'], transaction_users_wallet['B_USER'],
|
||||
transaction_users['A_USER'], transaction_users['B_USER'], basic_user]
|
||||
user_names = sorted([user['username'] for user in users])
|
||||
|
||||
for user in users:
|
||||
home_view.add_contact(user['public_key'])
|
||||
home_view.back_button.click(2)
|
||||
home_view.create_group_chat(sorted([user['username'] for user in users]))
|
||||
group_chat = home_view.get_chat_view()
|
||||
group_chat.chat_options.click()
|
||||
group_chat.chat_settings.click()
|
||||
group_chat.confirm()
|
||||
group_chat.more_users_button.click()
|
||||
for username in user_names:
|
||||
group_chat.find_full_text(username, 10)
|
||||
|
||||
def test_commands_on_second_app_run(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
contact_user = basic_user
|
||||
home_view.add_contact(contact_user['public_key'])
|
||||
home_view.get_back_to_home_view()
|
||||
start_new_chat_view = home_view.plus_button.click()
|
||||
start_new_chat_view.start_new_chat_button.click()
|
||||
contact_name = home_view.element_by_text(contact_user['username'], 'button')
|
||||
contact_name.scroll_to_element()
|
||||
contact_name.click()
|
||||
chat_view = home_view.get_chat_view()
|
||||
|
||||
commands = '/request', '/send'
|
||||
|
||||
for command in commands:
|
||||
chat_view.find_full_text(command, 2)
|
||||
self.driver.close_app()
|
||||
sign_in_view.apps_button.click()
|
||||
sign_in_view.status_app_icon.scroll_to_element()
|
||||
sign_in_view.status_app_icon.click()
|
||||
sign_in_view.ok_button.click()
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys('qwerty1234')
|
||||
sign_in_view.sign_in_button.click()
|
||||
contact_name.wait_for_element(30)
|
||||
contact_name.click()
|
||||
for command in commands:
|
||||
chat_view.find_full_text(command, 2)
|
||||
chat_view.back_button.click()
|
||||
home_view.create_group_chat([contact_user['username']])
|
||||
|
||||
@pytest.mark.sign_in
|
||||
@pytest.mark.parametrize("input_text,outcome",
|
||||
[("qwerty1234", "Wallet"), ("12345ewq", "Wrong password")],
|
||||
ids=['Sign on with valid password', 'Sign in with wrong password'])
|
||||
def test_sign_in(self, input_text, outcome):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.logout_button.scroll_to_element()
|
||||
sign_in_view = profile_view.logout_button.click()
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.password_input.send_keys(input_text)
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.find_full_text(outcome, 60)
|
||||
if input_text in str(sign_in_view.logcat):
|
||||
pytest.fail('Password in logcat!!!', pytrace=False)
|
||||
|
||||
@pytest.mark.password
|
||||
def test_password_logcat(self):
|
||||
password = 'qwerty1234'
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user(password=password)
|
||||
sign_in_view.home_button.wait_for_visibility_of_element()
|
||||
if password in str(sign_in_view.logcat):
|
||||
pytest.fail('Password in logcat!!!', pytrace=False)
|
||||
|
||||
@pytest.mark.password
|
||||
def test_password_mismatch(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_account_button.click()
|
||||
sign_in_view.password_input.send_keys('password1')
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.confirm_password_input.send_keys("password2")
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.find_full_text('Password confirmation doesn\'t match password.')
|
||||
logcat = str(sign_in_view.logcat)
|
||||
if 'password1' in logcat or 'password2' in logcat:
|
||||
pytest.fail('Password in logcat!!!', pytrace=False)
|
||||
|
||||
@pytest.mark.password
|
||||
def test_password_too_short(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_account_button.click()
|
||||
sign_in_view.password_input.send_keys('qwe1')
|
||||
sign_in_view.next_button.click()
|
||||
sign_in_view.password_input.find_element()
|
||||
assert not sign_in_view.confirm_password_input.is_element_present()
|
|
@ -1,298 +0,0 @@
|
|||
import pytest
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
from tests import transaction_users, get_current_time, transaction_users_wallet, marks, common_password
|
||||
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
from views.web_views.base_web_view import BaseWebView
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.transaction
|
||||
class TestTransaction(SingleDeviceTestCase):
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3401)
|
||||
def test_transaction_send_command_one_to_one_chat(self):
|
||||
recipient = transaction_users['B_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
transaction_amount = home_view.get_unique_amount()
|
||||
sender_public_key = home_view.get_public_key()
|
||||
sender_address = home_view.public_key_to_address(sender_public_key)
|
||||
home_view.home_button.click()
|
||||
self.network_api.get_donate(sender_address)
|
||||
wallet_view = home_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
wallet_view.wait_balance_changed_on_wallet_screen()
|
||||
wallet_view.home_button.click()
|
||||
home_view.add_contact(recipient['public_key'])
|
||||
chat_view = home_view.get_chat_with_user(recipient['username']).click()
|
||||
chat_view.send_transaction_in_1_1_chat(transaction_amount, common_password)
|
||||
self.network_api.find_transaction_by_unique_amount(recipient['address'], transaction_amount)
|
||||
chat_view.get_back_to_home_view()
|
||||
home_view.wallet_button.click()
|
||||
transactions_view = wallet_view.transaction_history_button.click()
|
||||
transactions_view.transactions_table.find_transaction(amount=transaction_amount)
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3402)
|
||||
def test_transaction_send_command_wrong_password(self):
|
||||
sender = transaction_users['A_USER']
|
||||
recipient = transaction_users['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()
|
||||
transaction_amount = '0.001'
|
||||
home_view.add_contact(recipient['public_key'])
|
||||
chat_view = home_view.get_chat_with_user(recipient['username']).click()
|
||||
chat_view.commands_button.click()
|
||||
chat_view.send_command.click()
|
||||
chat_view.asset_by_name('ETH').click()
|
||||
chat_view.send_as_keyevent(transaction_amount)
|
||||
wallet_view = chat_view.get_wallet_view()
|
||||
chat_view.send_message_button.click_until_presence_of_element(wallet_view.sign_in_phrase)
|
||||
wallet_view.done_button.click()
|
||||
wallet_view.yes_button.click()
|
||||
|
||||
send_transaction_view = chat_view.get_send_transaction_view()
|
||||
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')
|
||||
send_transaction_view.sign_transaction_button.click()
|
||||
send_transaction_view.find_full_text('Wrong password', 20)
|
||||
|
||||
@marks.pr
|
||||
@marks.skip
|
||||
@marks.testrail_case_id(3403)
|
||||
def test_transaction_send_command_group_chat(self):
|
||||
recipient = transaction_users['A_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
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()
|
||||
self.network_api.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()
|
||||
chat_view.send_transaction_in_group_chat(transaction_amount, 'qwerty1234', recipient)
|
||||
self.network_api.find_transaction_by_unique_amount(transaction_amount, recipient['address'])
|
||||
|
||||
@pytest.mark.transactions
|
||||
@pytest.mark.testrail_case_id(3422)
|
||||
def test_open_transaction_on_etherscan(self):
|
||||
user = transaction_users['A_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(user['passphrase'], user['password'])
|
||||
home_view = sign_in_view.get_home_view()
|
||||
wallet_view = home_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
transactions_view = wallet_view.transaction_history_button.click()
|
||||
transaction_details = transactions_view.transactions_table.get_first_transaction().click()
|
||||
transaction_hash = transaction_details.get_transaction_hash()
|
||||
transaction_details.options_button.click()
|
||||
transaction_details.open_transaction_on_etherscan_button.click()
|
||||
base_web_view = BaseWebView(self.driver)
|
||||
base_web_view.web_view_browser.click()
|
||||
base_web_view.always_button.click()
|
||||
base_web_view.find_text_part(transaction_hash)
|
||||
|
||||
@pytest.mark.pr
|
||||
@pytest.mark.testrail_case_id(3406)
|
||||
def test_send_stt_from_wallet_via_enter_recipient_address(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()
|
||||
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()
|
||||
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.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()
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3407)
|
||||
def test_send_eth_from_wallet_sign_now(self):
|
||||
recipient = transaction_users['F_USER']
|
||||
sender = transaction_users['E_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()
|
||||
send_transaction = wallet_view.send_transaction_button.click()
|
||||
send_transaction.amount_edit_box.click()
|
||||
transaction_amount = send_transaction.get_unique_amount()
|
||||
send_transaction.amount_edit_box.set_value(transaction_amount)
|
||||
send_transaction.confirm()
|
||||
send_transaction.chose_recipient_button.click()
|
||||
send_transaction.recent_recipients_button.click()
|
||||
recent_recipient = send_transaction.element_by_text(recipient['username'])
|
||||
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.click()
|
||||
send_transaction.send_as_keyevent(sender['password'])
|
||||
send_transaction.sign_transaction_button.click()
|
||||
send_transaction.got_it_button.click()
|
||||
if sender['password'] in str(home_view.logcat):
|
||||
pytest.fail('Password in logcat!!!', pytrace=False)
|
||||
self.network_api.find_transaction_by_unique_amount(sender['address'], transaction_amount)
|
||||
|
||||
@marks.testrail_case_id(3452)
|
||||
def test_sign_transaction_twice(self):
|
||||
recipient = transaction_users['E_USER']
|
||||
sender = transaction_users['F_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()
|
||||
sign_in_phrase = wallet_view.set_up_wallet()
|
||||
send_transaction = wallet_view.send_transaction_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()
|
||||
recent_recipient = send_transaction.element_by_text(recipient['username'])
|
||||
send_transaction.recent_recipients_button.click_until_presence_of_element(recent_recipient)
|
||||
recent_recipient.click()
|
||||
send_transaction.sign_transaction_button.click()
|
||||
assert send_transaction.sign_in_phrase_text.text == sign_in_phrase
|
||||
send_transaction.enter_password_input.send_keys(sender['password'])
|
||||
send_transaction.cancel_button.click()
|
||||
send_transaction.sign_transaction_button.click()
|
||||
send_transaction.enter_password_input.wait_for_visibility_of_element()
|
||||
send_transaction.sign_transaction_button.click()
|
||||
send_transaction.enter_password_input.wait_for_visibility_of_element()
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.transaction
|
||||
class TestTransactions(MultipleDeviceTestCase):
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3408)
|
||||
@marks.skip
|
||||
def test_send_eth_to_request_in_group_chat(self):
|
||||
recipient = transaction_users['E_USER']
|
||||
sender = self.senders['f_user'] = transaction_users['F_USER']
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for user_details in (recipient, device_1), (sender, device_2):
|
||||
user_details[1].recover_access(passphrase=user_details[0]['passphrase'],
|
||||
password=user_details[0]['password'])
|
||||
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()
|
||||
device_1_chat.commands_button.click()
|
||||
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()
|
||||
device_2_chat.send_funds_to_request(amount, sender['password'])
|
||||
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount)
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3409)
|
||||
def test_send_eth_to_request_in_one_to_one_chat(self):
|
||||
recipient = transaction_users['C_USER']
|
||||
sender = self.senders['d_user'] = transaction_users['D_USER']
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for user_details in (recipient, device_1), (sender, device_2):
|
||||
user_details[1].recover_access(passphrase=user_details[0]['passphrase'],
|
||||
password=user_details[0]['password'])
|
||||
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')
|
||||
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()
|
||||
one_to_one_chat_device_2.click_until_presence_of_element(device_2_chat.commands_button)
|
||||
device_1_chat.commands_button.click_until_presence_of_element(device_1_chat.request_command)
|
||||
device_1_chat.request_command.click()
|
||||
device_1_chat.asset_by_name('ETH').click()
|
||||
device_1_chat.send_as_keyevent(amount)
|
||||
device_1_chat.send_message_button.click()
|
||||
device_2_chat.send_funds_to_request(amount, sender['password'], wallet_set_up=True)
|
||||
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount)
|
||||
device_2_chat.back_button.click()
|
||||
device_2_wallet = device_2_home.wallet_button.click()
|
||||
transactions_view = device_2_wallet.transaction_history_button.click()
|
||||
transactions_view.transactions_table.find_transaction(amount=amount)
|
||||
|
||||
@marks.pr
|
||||
@marks.testrail_case_id(3410)
|
||||
def test_send_eth_to_request_from_wallet(self):
|
||||
recipient = transaction_users_wallet['D_USER']
|
||||
sender = self.senders['c_user'] = transaction_users['C_USER']
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
for user_details in (recipient, device_1), (sender, device_2):
|
||||
user_details[1].recover_access(passphrase=user_details[0]['passphrase'],
|
||||
password=user_details[0]['password'])
|
||||
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()
|
||||
wallet_view_device_1.set_up_wallet()
|
||||
send_transaction_device_1 = wallet_view_device_1.receive_transaction_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')
|
||||
one_to_one_chat_device_2.wait_for_visibility_of_element(120)
|
||||
one_to_one_chat_device_2.click()
|
||||
device_2_chat.send_funds_to_request(amount, sender['password'], wallet_set_up=True)
|
||||
self.network_api.find_transaction_by_unique_amount(recipient['address'], amount)
|
|
@ -1,106 +0,0 @@
|
|||
from tests import transaction_users_wallet, marks
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.wallet
|
||||
class TestWallet(SingleDeviceTestCase):
|
||||
|
||||
@marks.testrail_case_id(3425)
|
||||
def test_wallet_error_messages(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()
|
||||
wallet_view = home_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
send_transaction = wallet_view.send_transaction_button.click()
|
||||
|
||||
# Check valid amount
|
||||
invalid_amount = 'asd'
|
||||
error_message = 'Amount is not a valid number'
|
||||
send_transaction.amount_edit_box.send_keys(invalid_amount)
|
||||
try:
|
||||
send_transaction.find_full_text(error_message)
|
||||
except TimeoutException:
|
||||
self.errors.append(error_message + ' error did not appear')
|
||||
send_transaction.amount_edit_box.clear()
|
||||
|
||||
# Check insufficient funds
|
||||
send_transaction.amount_edit_box.send_keys('100000')
|
||||
send_transaction.find_full_text('Insufficient funds')
|
||||
send_transaction.amount_edit_box.clear()
|
||||
|
||||
# Check invalid address
|
||||
incorrect_public_key = '5261ceba31e3a7204b498b2dd20220a6057738d'
|
||||
send_transaction.chose_recipient_button.click()
|
||||
send_transaction.enter_recipient_address_button.click()
|
||||
send_transaction.enter_recipient_address_input.set_value(incorrect_public_key)
|
||||
send_transaction.done_button.click()
|
||||
error_message = 'Invalid address'
|
||||
try:
|
||||
send_transaction.error_dialog.wait_for_error_message(error_message)
|
||||
except TimeoutException:
|
||||
self.errors.append(error_message + ' error did not appear')
|
||||
send_transaction.error_dialog.ok_button.click()
|
||||
|
||||
# Check wrong password
|
||||
incorrect_password = 'wrongpasswd'
|
||||
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.amount_edit_box.click()
|
||||
send_transaction.amount_edit_box.set_value('0.00001')
|
||||
send_transaction.sign_transaction_button.click()
|
||||
send_transaction.enter_password_input.send_keys(incorrect_password)
|
||||
send_transaction.sign_transaction_button.click()
|
||||
error_message = 'Wrong password'
|
||||
try:
|
||||
send_transaction.find_full_text(error_message)
|
||||
except TimeoutException:
|
||||
self.errors.append(error_message + ' error did not appear')
|
||||
|
||||
self.verify_no_errors()
|
||||
|
||||
def test_eth_and_currency_balance(self):
|
||||
errors = list()
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.recover_access(passphrase=transaction_users_wallet['A_USER']['passphrase'],
|
||||
password=transaction_users_wallet['A_USER']['password'])
|
||||
wallet = sign_in_view.wallet_button.click()
|
||||
wallet.set_up_wallet()
|
||||
address = transaction_users_wallet['A_USER']['address']
|
||||
balance = self.network_api.get_balance(address) / 1000000000000000000
|
||||
eth_rate = self.network_api.get_ethereum_price_in_usd()
|
||||
wallet_balance = wallet.get_eth_value()
|
||||
if wallet_balance != balance:
|
||||
errors.append('Balance %s is not equal to the expected %s' % (wallet_balance, balance))
|
||||
wallet.verify_currency_balance(eth_rate, errors)
|
||||
assert not errors, 'errors occurred:\n{}'.format('\n'.join(errors))
|
||||
|
||||
@marks.testrail_case_id(3453)
|
||||
def test_set_up_wallet(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
home_view = sign_in_view.get_home_view()
|
||||
sender_public_key = home_view.get_public_key()
|
||||
sender_address = home_view.public_key_to_address(sender_public_key)
|
||||
self.network_api.get_donate(sender_address)
|
||||
wallet_view = sign_in_view.wallet_button.click()
|
||||
sign_in_phrase = wallet_view.set_up_wallet()
|
||||
|
||||
send_transaction = wallet_view.send_transaction_button.click()
|
||||
send_transaction.chose_recipient_button.click()
|
||||
send_transaction.enter_recipient_address_button.click()
|
||||
recipient_address = transaction_users_wallet['A_USER']['address']
|
||||
send_transaction.enter_recipient_address_input.set_value(recipient_address)
|
||||
send_transaction.done_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.sign_transaction_button.click()
|
||||
assert send_transaction.sign_in_phrase_text.text == sign_in_phrase
|
|
@ -197,6 +197,12 @@ class ConfirmButton(BaseButton):
|
|||
self.locator = self.Locator.xpath_selector("//*[@text='CONFIRM']")
|
||||
|
||||
|
||||
class ProgressBar(BaseElement):
|
||||
def __init__(self, driver, parent_locator: str = ''):
|
||||
super(ProgressBar, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector(parent_locator + '//android.widget.ProgressBar')
|
||||
|
||||
|
||||
class BaseView(object):
|
||||
def __init__(self, driver):
|
||||
self.driver = driver
|
||||
|
|
|
@ -3,8 +3,8 @@ import time
|
|||
import pytest
|
||||
from selenium.common.exceptions import TimeoutException, NoSuchElementException
|
||||
from tests import info
|
||||
from views.base_element import BaseButton, BaseEditBox, BaseText, BaseElement
|
||||
from views.base_view import BaseView
|
||||
from views.base_element import BaseButton, BaseEditBox, BaseText
|
||||
from views.base_view import BaseView, ProgressBar
|
||||
from views.profile_view import ProfilePictureElement, PublicKeyText
|
||||
|
||||
|
||||
|
@ -36,13 +36,13 @@ class TransactionPopupText(BaseText):
|
|||
class SendCommand(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(SendCommand, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('send-payment-button')
|
||||
self.locator = self.Locator.accessibility_id('send-button')
|
||||
|
||||
|
||||
class RequestCommand(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(RequestCommand, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('request-payment-button')
|
||||
self.locator = self.Locator.accessibility_id('request-button')
|
||||
|
||||
|
||||
class AssetCommand(BaseButton):
|
||||
|
@ -198,11 +198,6 @@ class ChatElementByText(BaseText):
|
|||
|
||||
@property
|
||||
def progress_bar(self):
|
||||
class ProgressBar(BaseElement):
|
||||
def __init__(self, driver, parent_locator: str):
|
||||
super(ProgressBar, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector(parent_locator + '//android.widget.ProgressBar')
|
||||
|
||||
return ProgressBar(self.driver, self.locator.value)
|
||||
|
||||
@property
|
||||
|
@ -348,7 +343,7 @@ class ChatView(BaseView):
|
|||
send_transaction_view.sign_transaction(password)
|
||||
chat_elem = self.chat_element_by_text(amount)
|
||||
chat_elem.wait_for_visibility_of_element()
|
||||
chat_elem.progress_bar.wait_for_invisibility_of_element()
|
||||
chat_elem.progress_bar.wait_for_invisibility_of_element(20)
|
||||
if chat_elem.status.text not in ('Sent', 'Delivered', 'Seen'):
|
||||
pytest.fail('Sent transaction message was not sent')
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
from views.base_element import BaseButton
|
||||
from views.chat_view import ChatView
|
||||
|
||||
|
||||
class FaucetCommand(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(FaucetCommand, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector(
|
||||
"//*[contains(@text,'Get some ETH')]/preceding-sibling::*[@text='/faucet']")
|
||||
|
||||
|
||||
class FaucetSendCommand(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(FaucetSendCommand, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Status Testnet Faucet']")
|
||||
|
||||
|
||||
class ConsoleView(ChatView):
|
||||
def __init__(self, driver):
|
||||
super(ConsoleView, self).__init__(driver)
|
||||
self.faucet_command = FaucetCommand(self.driver)
|
||||
self.faucet_send_command = FaucetSendCommand(self.driver)
|
||||
|
||||
def send_faucet_request(self):
|
||||
self.commands_button.click()
|
||||
self.faucet_command.click()
|
||||
self.faucet_send_command.click()
|
||||
self.send_message_button.click()
|
|
@ -27,13 +27,6 @@ class PlusButton(BaseButton):
|
|||
return self.navigate()
|
||||
|
||||
|
||||
class ConsoleButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(ConsoleButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector(
|
||||
"//*[@text='Console']")
|
||||
|
||||
|
||||
class ChatElement(BaseButton):
|
||||
def __init__(self, driver, username_part):
|
||||
super(ChatElement, self).__init__(driver)
|
||||
|
@ -42,10 +35,6 @@ class ChatElement(BaseButton):
|
|||
"//*[@content-desc='chat-item'][.//*[starts-with(@text,'%s')]]" % self.username)
|
||||
|
||||
def navigate(self):
|
||||
if self.username == 'Status Console':
|
||||
from views.console_view import ConsoleView
|
||||
return ConsoleView(self.driver)
|
||||
else:
|
||||
from views.chat_view import ChatView
|
||||
return ChatView(self.driver)
|
||||
|
||||
|
@ -115,7 +104,6 @@ class HomeView(BaseView):
|
|||
super(HomeView, self).__init__(driver)
|
||||
self.welcome_image = WelcomeImageElement(self.driver)
|
||||
self.plus_button = PlusButton(self.driver)
|
||||
self.console_button = ConsoleButton(self.driver)
|
||||
self.chat_name_text = ChatNameText(self.driver)
|
||||
self.chat_url_text = ChatUrlText(self.driver)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from views.base_element import BaseText
|
||||
from views.base_element import BaseButton, BaseEditBox
|
||||
from views.base_view import BaseView, OkButton
|
||||
from views.base_view import BaseView, OkButton, ProgressBar
|
||||
|
||||
|
||||
class FirstRecipient(BaseButton):
|
||||
|
@ -165,11 +165,13 @@ class SendTransactionView(BaseView):
|
|||
self.error_dialog = ErrorDialog(self.driver)
|
||||
|
||||
self.share_button = ShareButton(self.driver)
|
||||
self.progress_bar = ProgressBar(self.driver)
|
||||
|
||||
def sign_transaction(self, sender_password):
|
||||
self.sign_transaction_button.click_until_presence_of_element(self.enter_password_input)
|
||||
self.enter_password_input.send_keys(sender_password)
|
||||
self.sign_transaction_button.click_until_presence_of_element(self.got_it_button)
|
||||
self.sign_transaction_button.click()
|
||||
self.progress_bar.wait_for_invisibility_of_element(30)
|
||||
self.got_it_button.click()
|
||||
|
||||
def asset_by_name(self, asset_name):
|
||||
|
|
|
@ -7,6 +7,11 @@ class AssetsButton(BaseButton):
|
|||
super(AssetsButton, self).__init__(driver)
|
||||
self.locator = self.Locator.text_selector('Assets')
|
||||
|
||||
class RequestETHButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(AssetsButton.RequestETHButton, self).__init__(driver)
|
||||
self.locator = self.Locator.text_selector('Request Ropsten ETH')
|
||||
|
||||
class RequestSTTButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(AssetsButton.RequestSTTButton, self).__init__(driver)
|
||||
|
@ -54,6 +59,7 @@ class StatusTestDAppView(BaseWebView):
|
|||
self.driver = driver
|
||||
|
||||
self.assets_button = AssetsButton(self.driver)
|
||||
self.request_eth_button = AssetsButton.RequestETHButton(self.driver)
|
||||
self.request_stt_button = AssetsButton.RequestSTTButton(self.driver)
|
||||
|
||||
self.transactions_button = TransactionsButton(self.driver)
|
||||
|
|
Loading…
Reference in New Issue