mirror of
https://github.com/status-im/status-react.git
synced 2025-02-22 15:48:50 +00:00
Added atomic tests for account management
Signed-off-by: Anton Danchenko <ant.danchenko@gmail.com>
This commit is contained in:
parent
6359b3a834
commit
0cef5041de
@ -0,0 +1,64 @@
|
||||
import pytest
|
||||
|
||||
from tests import marks, common_password, get_current_time
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.account
|
||||
class TestCreateAccount(SingleDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(758)
|
||||
def test_create_account(self):
|
||||
if not self.test_fairy_warning_is_shown:
|
||||
self.errors.append('TestFairy warning is not shown')
|
||||
sign_in = SignInView(self.driver)
|
||||
if not sign_in.i_have_account_button.is_element_displayed():
|
||||
self.errors.append("'I have an account' button is not displayed")
|
||||
sign_in.create_account_button.click()
|
||||
sign_in.password_input.set_value(common_password)
|
||||
sign_in.next_button.click()
|
||||
sign_in.confirm_password_input.set_value(common_password)
|
||||
sign_in.next_button.click()
|
||||
|
||||
sign_in.element_by_text_part('Display name').wait_for_element(30)
|
||||
sign_in.name_input.send_keys('user_%s' % get_current_time())
|
||||
|
||||
sign_in.next_button.click()
|
||||
if not sign_in.learn_more_link.is_element_displayed(10):
|
||||
self.errors.append("'Learn more about what we collect' is not shown")
|
||||
if not sign_in.share_data_button.is_element_displayed(10):
|
||||
self.errors.append("'Share data' button is not visible")
|
||||
if not sign_in.do_not_share_button.is_element_displayed(10):
|
||||
self.errors.append("'Do not share' button is not visible")
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(1433)
|
||||
def test_switch_users_and_add_new_account(self):
|
||||
sign_in = SignInView(self.driver)
|
||||
sign_in.create_user()
|
||||
public_key = sign_in.get_public_key()
|
||||
profile = sign_in.get_profile_view()
|
||||
profile.logout_button.click()
|
||||
profile.confirm_logout_button.click()
|
||||
sign_in.create_user()
|
||||
if sign_in.get_public_key() == public_key:
|
||||
pytest.fail('New account was not created')
|
||||
|
||||
@marks.testrail_id(3692)
|
||||
def test_home_view(self):
|
||||
sign_in = SignInView(self.driver)
|
||||
home = sign_in.create_user()
|
||||
for text in ['Welcome to Status',
|
||||
('Here you can securely chat with people, or browse and interact with DApps. '
|
||||
'Tap the “Plus” icon to begin.')]:
|
||||
if not home.element_by_text(text).is_element_displayed():
|
||||
self.errors.append("'%s' text is not shown" % text)
|
||||
home.profile_button.click()
|
||||
home.home_button.click()
|
||||
text = ('There are no recent Chats or DApps here yet. '
|
||||
'Tap the “Plus” button to see the list of Dapps or discover people to chat with.')
|
||||
if not home.element_by_text(text).is_element_displayed():
|
||||
self.errors.append("'%s' text is not shown" % text)
|
||||
self.verify_no_errors()
|
116
test/appium/tests/atomic/account_management/test_profile.py
Normal file
116
test/appium/tests/atomic/account_management/test_profile.py
Normal file
@ -0,0 +1,116 @@
|
||||
import pytest
|
||||
from selenium.common.exceptions import NoSuchElementException, TimeoutException
|
||||
|
||||
from tests import marks, group_chat_users
|
||||
from tests.base_test_case import SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.account
|
||||
class TestProfileSingleDevice(SingleDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(760)
|
||||
def test_set_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.home_button.click()
|
||||
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_id(1403)
|
||||
def test_share_contact_code_and_wallet_address(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()
|
||||
profile_view.share_button.click()
|
||||
try:
|
||||
profile_view.element_by_text('Gmail').is_element_displayed()
|
||||
profile_view.element_by_text('Gmail', 'button').click()
|
||||
profile_view.element_by_text('Welcome to Gmail').wait_for_visibility_of_element()
|
||||
except (NoSuchElementException, TimeoutException):
|
||||
self.errors.append('Can\'t share contact code via email')
|
||||
profile_view.click_system_back_button()
|
||||
profile_view.cross_icon.click()
|
||||
wallet = profile_view.wallet_button.click()
|
||||
wallet.set_up_wallet()
|
||||
request = wallet.receive_transaction_button.click()
|
||||
request.share_button.click()
|
||||
try:
|
||||
profile_view.element_by_text('Gmail').is_element_displayed()
|
||||
profile_view.element_by_text('Gmail', 'button').click()
|
||||
profile_view.element_by_text('Welcome to Gmail').wait_for_visibility_of_element()
|
||||
except (NoSuchElementException, TimeoutException):
|
||||
self.errors.append('Can\'t share wallet address via email')
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.skip
|
||||
@marks.testrail_id(3704)
|
||||
def test_copy_contact_code_and_wallet_address(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()
|
||||
profile_view.share_my_contact_key_button.click()
|
||||
public_key = profile_view.public_key_text.text
|
||||
profile_view.public_key_text.long_press_element()
|
||||
self.driver.press_keycode(278)
|
||||
profile_view.cross_icon.click()
|
||||
home = profile_view.home_button.click()
|
||||
chat = home.add_contact(group_chat_users['A_USER']['public_key'])
|
||||
chat.chat_message_input.click()
|
||||
self.driver.press_keycode(279)
|
||||
if chat.chat_message_input.text != public_key:
|
||||
self.errors.append('Public key was not copied')
|
||||
chat.chat_message_input.clear()
|
||||
chat.get_back_to_home_view()
|
||||
|
||||
wallet = home.wallet_button.click()
|
||||
wallet.set_up_wallet()
|
||||
wallet.receive_transaction_button.click()
|
||||
address = wallet.address_text.text
|
||||
wallet.address_text.long_press_element()
|
||||
self.driver.press_keycode(278)
|
||||
wallet.get_back_to_home_view()
|
||||
wallet.home_button.click()
|
||||
home.get_chat_with_user(group_chat_users['A_USER']['username']).click()
|
||||
chat.chat_message_input.click()
|
||||
self.driver.press_keycode(279)
|
||||
if chat.chat_message_input.text != address:
|
||||
self.errors.append('Wallet address was not copied')
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(1407)
|
||||
def test_change_profile_picture_several_times(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
for file_name in ['sauce_logo.png', 'sauce_logo_red.png', 'saucelabs_sauce.png']:
|
||||
profile_view.edit_profile_picture(file_name=file_name)
|
||||
profile_view.swipe_down()
|
||||
if not profile_view.profile_picture.is_element_image_equals_template():
|
||||
pytest.fail('Profile picture was not updated')
|
||||
|
||||
@marks.skip
|
||||
@marks.testrail_id(2374)
|
||||
def test_backup_seed_phrase(self):
|
||||
sign_in_view = SignInView(self.driver)
|
||||
sign_in_view.create_user()
|
||||
if sign_in_view.profile_button.counter.text != '1':
|
||||
self.errors.append('Profile button counter is not shown')
|
||||
profile_view = sign_in_view.profile_button.click()
|
||||
profile_view.logout()
|
||||
sign_in_view.click_account_by_position(0)
|
||||
sign_in_view.sign_in()
|
||||
if sign_in_view.profile_button.counter.text != '1':
|
||||
self.errors.append('Profile button counter is not shown after relogin')
|
||||
sign_in_view.profile_button.click()
|
||||
profile_view.backup_seed_phrase()
|
||||
if sign_in_view.profile_button.counter.is_element_displayed():
|
||||
self.errors.append('Profile button counter is shown after seed phrase backup')
|
||||
self.verify_no_errors()
|
86
test/appium/tests/atomic/account_management/test_recover.py
Normal file
86
test/appium/tests/atomic/account_management/test_recover.py
Normal file
@ -0,0 +1,86 @@
|
||||
import pytest
|
||||
|
||||
from tests import marks, common_password, group_chat_users
|
||||
from tests.base_test_case import SingleDeviceTestCase, MultipleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.account
|
||||
class TestRecoverAccountMultipleDevice(MultipleDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(759)
|
||||
def test_recover_account(self):
|
||||
self.create_drivers(2)
|
||||
device, device_2 = self.drivers[0], self.drivers[1]
|
||||
sign_in, sign_in_2 = SignInView(device), SignInView(device_2)
|
||||
username_1 = 'user_1'
|
||||
username_2 = group_chat_users['A_USER']['username']
|
||||
home = sign_in.create_user(username_1)
|
||||
home_2 = sign_in_2.recover_access(passphrase=group_chat_users['A_USER']['passphrase'],
|
||||
password=group_chat_users['A_USER']['password'])
|
||||
public_key = home.get_public_key()
|
||||
chat_2 = home_2.add_contact(public_key)
|
||||
message = 'test message'
|
||||
chat_2.chat_message_input.send_keys(message)
|
||||
chat_2.send_message_button.click()
|
||||
device_2.quit()
|
||||
|
||||
profile = home.get_profile_view()
|
||||
profile.backup_seed_phrase_button.click()
|
||||
profile.ok_continue_button.click()
|
||||
seed_phrase = profile.get_seed_phrase()
|
||||
profile.back_button.click()
|
||||
profile.advanced_button.click()
|
||||
profile.debug_mode_toggle.click()
|
||||
profile.home_button.click()
|
||||
console_chat = home.get_chat_with_user('Status Console').click()
|
||||
console_chat.send_faucet_request()
|
||||
console_chat.get_back_to_home_view()
|
||||
wallet = home.wallet_button.click()
|
||||
wallet.set_up_wallet()
|
||||
address = wallet.get_wallet_address()
|
||||
wallet.wait_balance_changed_on_wallet_screen()
|
||||
|
||||
device.reset()
|
||||
sign_in.accept_agreements()
|
||||
sign_in.recover_access(passphrase=' '.join(seed_phrase.values()), password=common_password)
|
||||
home.connection_status.wait_for_invisibility_of_element(30)
|
||||
chat_element = home.get_chat_with_user(username_2)
|
||||
if chat_element.is_element_displayed():
|
||||
chat = chat_element.click()
|
||||
if not chat.chat_element_by_text(message).is_element_displayed():
|
||||
self.errors.append("Message with text '%s' was not received" % message)
|
||||
chat.get_back_to_home_view()
|
||||
else:
|
||||
self.errors.append('Chat with user %s is not recovered' % username_2)
|
||||
home.wallet_button.click()
|
||||
wallet.set_up_wallet()
|
||||
if wallet.get_wallet_address() != address:
|
||||
self.errors.append('Wallet address is changed after recover')
|
||||
if wallet.get_eth_value() != 0.1:
|
||||
self.errors.append('Wallet balance is changed after recover')
|
||||
if wallet.get_public_key() != public_key:
|
||||
self.errors.append('Public key is changed after recover')
|
||||
self.verify_no_errors()
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.account
|
||||
class TestRecoverAccountSingleDevice(SingleDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(845)
|
||||
def test_recover_account_with_incorrect_passphrase(self):
|
||||
sign_in = SignInView(self.driver)
|
||||
sign_in.create_user()
|
||||
public_key = sign_in.get_public_key()
|
||||
profile = sign_in.get_profile_view()
|
||||
profile.backup_seed_phrase_button.click()
|
||||
profile.ok_continue_button.click()
|
||||
seed_phrase = profile.get_seed_phrase()
|
||||
|
||||
self.driver.reset()
|
||||
sign_in.accept_agreements()
|
||||
sign_in.recover_access(passphrase=' '.join(list(seed_phrase.values())[::-1]), password=common_password)
|
||||
if sign_in.get_public_key() == public_key:
|
||||
pytest.fail('The same account is recovered with reversed passphrase')
|
60
test/appium/tests/atomic/account_management/test_sign_in.py
Normal file
60
test/appium/tests/atomic/account_management/test_sign_in.py
Normal file
@ -0,0 +1,60 @@
|
||||
from tests import marks, common_password
|
||||
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.sign_in
|
||||
class TestSignIn(SingleDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(1381)
|
||||
def test_login_with_new_account(self):
|
||||
sign_in = SignInView(self.driver)
|
||||
username = 'test_user'
|
||||
sign_in.create_user(username=username)
|
||||
|
||||
self.driver.close_app()
|
||||
self.driver.launch_app()
|
||||
|
||||
sign_in.accept_agreements()
|
||||
if not sign_in.test_fairy_warning.is_shown:
|
||||
self.errors.append('TestFairy warning is not shown')
|
||||
if not sign_in.element_by_text(username).is_element_displayed():
|
||||
self.errors.append('Username is not shown while login')
|
||||
sign_in.sign_in()
|
||||
if not sign_in.home_button.is_element_displayed():
|
||||
self.errors.append('User is not logged in')
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(2169)
|
||||
def test_login_with_incorrect_password(self):
|
||||
sign_in = SignInView(self.driver)
|
||||
sign_in.create_user()
|
||||
profile = sign_in.profile_button.click()
|
||||
profile.logout()
|
||||
sign_in.click_account_by_position(0)
|
||||
sign_in.password_input.set_value(common_password + '1')
|
||||
sign_in.sign_in_button.click()
|
||||
sign_in.find_full_text('Wrong password')
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.sign_in
|
||||
class TestSignInOffline(MultipleDeviceTestCase):
|
||||
|
||||
@marks.testrail_case_id(3740)
|
||||
@marks.testrail_id(1432)
|
||||
def test_offline_login(self):
|
||||
self.create_drivers(1, offline_mode=True)
|
||||
driver = self.drivers[0]
|
||||
sign_in = SignInView(driver)
|
||||
sign_in.create_user()
|
||||
|
||||
driver.close_app()
|
||||
driver.set_network_connection(1) # airplane mode
|
||||
|
||||
driver.launch_app()
|
||||
sign_in.accept_agreements()
|
||||
home = sign_in.sign_in()
|
||||
home.home_button.wait_for_visibility_of_element()
|
||||
assert home.connection_status.text == 'Offline'
|
94
test/appium/tests/atomic/account_management/test_wallet.py
Normal file
94
test/appium/tests/atomic/account_management/test_wallet.py
Normal file
@ -0,0 +1,94 @@
|
||||
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
|
||||
@marks.account
|
||||
class TestWallet(SingleDeviceTestCase):
|
||||
|
||||
@marks.testrail_id(3698)
|
||||
def test_wallet_set_up(self):
|
||||
sign_in = SignInView(self.driver)
|
||||
sign_in.create_user()
|
||||
wallet = sign_in.wallet_button.click()
|
||||
text = 'Simple and secure cryptocurrency wallet'
|
||||
if not wallet.element_by_text(text).is_element_displayed():
|
||||
self.errors.append("'%s' is not displayed" % text)
|
||||
wallet.set_up_button.click()
|
||||
text = ('This is your personal transaction phrase that you’ll use everytime you make a transaction. '
|
||||
'Make sure to write it down on a piece of paper, store it somewhere, '
|
||||
'and only confirm transactions when you see these three words.')
|
||||
if not wallet.element_by_text(text).is_element_displayed():
|
||||
self.errors.append("'%s' text is not displayed" % text)
|
||||
phrase_length = len(wallet.sign_in_phrase.list)
|
||||
if phrase_length != 3:
|
||||
self.errors.append('Transaction phrase length is %s' % phrase_length)
|
||||
wallet.done_button.click()
|
||||
for text in ['Wrote it down?', 'You won’t be able to see your 3-word transaction phrase again after this.']:
|
||||
if not wallet.element_by_text(text).is_element_displayed():
|
||||
self.errors.append("'%s' text is not displayed" % text)
|
||||
wallet.yes_button.click()
|
||||
for element in [wallet.send_transaction_button, wallet.receive_transaction_button,
|
||||
wallet.transaction_history_button]:
|
||||
if not element.is_element_displayed():
|
||||
self.errors.append('%s button is not shown after wallet setup' % element.name)
|
||||
self.verify_no_errors()
|
||||
|
||||
@marks.testrail_id(1449)
|
||||
def test_open_transaction_on_etherscan(self):
|
||||
user = transaction_users['A_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
home_view = sign_in_view.recover_access(user['passphrase'], user['password'])
|
||||
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)
|
||||
|
||||
@marks.testrail_id(1450)
|
||||
def test_copy_transaction_hash(self):
|
||||
user = transaction_users['A_USER']
|
||||
sign_in_view = SignInView(self.driver)
|
||||
home_view = sign_in_view.recover_access(user['passphrase'], user['password'])
|
||||
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.copy_transaction_hash_button.click()
|
||||
transaction_details.get_back_to_home_view()
|
||||
wallet_view.home_button.click()
|
||||
chat_view = home_view.get_chat_with_user('user').click()
|
||||
chat_view.chat_message_input.paste_text_from_clipboard()
|
||||
if chat_view.chat_message_input.text != transaction_hash:
|
||||
pytest.fail('Transaction hash was not copied')
|
||||
|
||||
@marks.testrail_id(3713)
|
||||
def test_manage_assets(self):
|
||||
sign_in = SignInView(self.driver)
|
||||
sign_in.create_user()
|
||||
wallet = sign_in.wallet_button.click()
|
||||
wallet.set_up_wallet()
|
||||
wallet.options_button.click()
|
||||
wallet.manage_assets_button.click()
|
||||
select_asset = 'MDS'
|
||||
deselect_asset = 'STT'
|
||||
wallet.asset_checkbox_by_name(select_asset).click()
|
||||
wallet.asset_checkbox_by_name(deselect_asset).click()
|
||||
wallet.done_button.click()
|
||||
if not wallet.asset_by_name(select_asset).is_element_displayed():
|
||||
self.errors.append('%s asset is not shown in wallet' % select_asset)
|
||||
if wallet.asset_by_name(deselect_asset).is_element_displayed():
|
||||
self.errors.append('%s asset is shown in wallet but was deselected' % deselect_asset)
|
||||
self.verify_no_errors()
|
@ -188,7 +188,7 @@ class TestCommands(MultipleDeviceTestCase):
|
||||
wallet_1 = home_1.wallet_button.click()
|
||||
wallet_1.set_up_wallet()
|
||||
|
||||
send_transaction_device_1 = wallet_1.request_button.click_until_presence_of_element(
|
||||
send_transaction_device_1 = wallet_1.receive_transaction_button.click_until_presence_of_element(
|
||||
wallet_1.send_transaction_request)
|
||||
wallet_1.send_transaction_request.click()
|
||||
send_transaction_device_1.amount_edit_box.scroll_to_element()
|
||||
|
@ -135,7 +135,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
||||
chat_2 = home_2.get_chat_with_user(username_1).click()
|
||||
chat_2.chat_element_by_text(message).wait_for_visibility_of_element()
|
||||
|
||||
public_chat_name = ''.join(random.choice(string.ascii_lowercase) for _ in range(7))
|
||||
public_chat_name = home_1.get_public_chat_name()
|
||||
chat_1.get_back_to_home_view()
|
||||
home_1.join_public_chat(public_chat_name)
|
||||
chat_2.get_back_to_home_view()
|
||||
@ -278,7 +278,7 @@ class TestMessagesOneToOneChatMultiple(MultipleDeviceTestCase):
|
||||
self.errors.append('Offline status is not shown in 1-1 chat')
|
||||
chat.get_back_to_home_view()
|
||||
|
||||
public_chat = home.join_public_chat(''.join(random.choice(string.ascii_lowercase) for _ in range(7)))
|
||||
public_chat = home.join_public_chat(home.get_public_chat_name())
|
||||
if public_chat.connection_status.text != 'Offline':
|
||||
self.errors.append('Offline status is not shown in a public chat')
|
||||
self.verify_no_errors()
|
||||
@ -345,7 +345,7 @@ class TestMessagesOneToOneChatSingle(SingleDeviceTestCase):
|
||||
sign_in = SignInView(self.driver)
|
||||
home = sign_in.create_user()
|
||||
|
||||
home.join_public_chat(''.join(random.choice(string.ascii_lowercase) for _ in range(7)))
|
||||
home.join_public_chat(home.get_public_chat_name())
|
||||
chat = sign_in.get_chat_view()
|
||||
emoji_name = random.choice(list(emoji.EMOJI_UNICODE))
|
||||
emoji_unicode = emoji.EMOJI_UNICODE[emoji_name]
|
||||
|
@ -21,7 +21,7 @@ class TestMessagesPublicChat(MultipleDeviceTestCase):
|
||||
home_1.add_contact(public_key_2)
|
||||
home_1.get_back_to_home_view()
|
||||
|
||||
public_chat_name = ''.join(random.choice(string.ascii_lowercase) for _ in range(7))
|
||||
public_chat_name = home_1.get_public_chat_name()
|
||||
chat_1, chat_2 = home_1.join_public_chat(public_chat_name), home_2.join_public_chat(public_chat_name)
|
||||
|
||||
if chat_2.connection_status.text != 'Fetching messages...':
|
||||
|
@ -1,25 +0,0 @@
|
||||
from tests import marks
|
||||
from tests.base_test_case import MultipleDeviceTestCase
|
||||
from views.sign_in_view import SignInView
|
||||
|
||||
|
||||
@marks.all
|
||||
@marks.sign_in
|
||||
class TestSignIn(MultipleDeviceTestCase):
|
||||
|
||||
@marks.testrail_case_id(3740)
|
||||
@marks.testrail_id(1432)
|
||||
def test_offline_login(self):
|
||||
self.create_drivers(1, offline_mode=True)
|
||||
driver = self.drivers[0]
|
||||
sign_in = SignInView(driver)
|
||||
sign_in.create_user()
|
||||
|
||||
driver.close_app()
|
||||
driver.set_network_connection(1) # airplane mode
|
||||
|
||||
driver.launch_app()
|
||||
sign_in.accept_agreements()
|
||||
home = sign_in.sign_in()
|
||||
home.home_button.wait_for_visibility_of_element()
|
||||
assert home.connection_status.text == 'Offline'
|
@ -110,6 +110,8 @@ class AbstractTestCase:
|
||||
|
||||
network_api = NetworkApi()
|
||||
|
||||
test_fairy_warning_is_shown = bool()
|
||||
|
||||
def verify_no_errors(self):
|
||||
if self.errors:
|
||||
pytest.fail('. '.join([self.errors.pop(0) for _ in range(len(self.errors))]))
|
||||
@ -129,7 +131,9 @@ class SingleDeviceTestCase(AbstractTestCase):
|
||||
self.driver = webdriver.Remote(capabilities[self.environment]['executor'],
|
||||
capabilities[self.environment]['capabilities'])
|
||||
self.driver.implicitly_wait(self.implicitly_wait)
|
||||
BaseView(self.driver).accept_agreements()
|
||||
view = BaseView(self.driver)
|
||||
view.accept_agreements()
|
||||
self.test_fairy_warning_is_shown = view.test_fairy_warning.is_shown
|
||||
test_suite_data.current_test.testruns[-1].jobs.append(self.driver.session_id)
|
||||
break
|
||||
except WebDriverException:
|
||||
|
@ -4,6 +4,7 @@ pr = pytest.mark.pr
|
||||
testrail_case_id = pytest.mark.testrail_case_id
|
||||
testrail_id = pytest.mark.testrail_id # atomic tests
|
||||
|
||||
account = pytest.mark.account
|
||||
all = pytest.mark.all
|
||||
api = pytest.mark.api
|
||||
chat = pytest.mark.chat
|
||||
|
@ -83,7 +83,7 @@ class TestChatManagementMultiple(MultipleDeviceTestCase):
|
||||
def test_public_chat_management(self):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
chat_name = ''.join(random.choice(string.ascii_lowercase) for _ in range(19))
|
||||
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)
|
||||
|
@ -135,7 +135,7 @@ class TestMessageReliability(MessageReliabilityTestCase):
|
||||
driver = self.drivers[0]
|
||||
sign_in_view = SignInView(driver)
|
||||
home_view = sign_in_view.create_user()
|
||||
chat_name = chat_name if chat_name else ''.join(random.choice(string.ascii_lowercase) for _ in range(7))
|
||||
chat_name = chat_name if chat_name else home_view.get_public_chat_name()
|
||||
home_view.join_public_chat(chat_name)
|
||||
|
||||
start_time = time.time()
|
||||
|
@ -147,8 +147,8 @@ class TestMessages(MultipleDeviceTestCase):
|
||||
self.create_drivers(2)
|
||||
device_1, device_2 = SignInView(self.drivers[0]), SignInView(self.drivers[1])
|
||||
users = ['user_1', 'user_2']
|
||||
chat_name = ''.join(random.choice(string.ascii_lowercase) for _ in range(7))
|
||||
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')
|
||||
@ -229,7 +229,7 @@ class TestMessages(MultipleDeviceTestCase):
|
||||
sign_in = SignInView(self.drivers[0])
|
||||
sign_in.create_user()
|
||||
home = sign_in.get_home_view()
|
||||
home.join_public_chat(''.join(random.choice(string.ascii_lowercase) for _ in range(7)))
|
||||
home.join_public_chat(home.get_public_chat_name())
|
||||
chat = sign_in.get_chat_view()
|
||||
message_text = 'test'
|
||||
message_input = chat.chat_message_input
|
||||
|
@ -24,7 +24,7 @@ class TestProfileView(SingleDeviceTestCase):
|
||||
profile_view.cross_icon.click()
|
||||
wallet_view = profile_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
wallet_view.request_button.click()
|
||||
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()
|
||||
@ -86,18 +86,7 @@ class TestProfileView(SingleDeviceTestCase):
|
||||
home_view = sign_in_view.get_home_view()
|
||||
public_key = home_view.get_public_key()
|
||||
profile_view = home_view.get_profile_view()
|
||||
profile_view.backup_seed_phrase_button.click()
|
||||
profile_view.ok_continue_button.click()
|
||||
seed_phrase = profile_view.get_seed_phrase()
|
||||
profile_view.next_button.click()
|
||||
word_number = profile_view.seed_phrase_word_number.number
|
||||
profile_view.seed_phrase_word_input.set_value(seed_phrase[word_number])
|
||||
profile_view.next_button.click()
|
||||
word_number_1 = profile_view.seed_phrase_word_number.number
|
||||
profile_view.seed_phrase_word_input.set_value(seed_phrase[word_number_1])
|
||||
profile_view.done_button.click()
|
||||
profile_view.yes_button.click()
|
||||
profile_view.ok_got_it_button.click()
|
||||
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()
|
||||
@ -106,7 +95,7 @@ class TestProfileView(SingleDeviceTestCase):
|
||||
recover_access_view.password_input.click()
|
||||
recover_access_view.send_as_keyevent('qwerty1234')
|
||||
recover_access_view.sign_in_button.click()
|
||||
sign_in_view.do_not_share.click()
|
||||
sign_in_view.do_not_share_button.click()
|
||||
public_key_1 = home_view.get_public_key()
|
||||
assert public_key == public_key_1
|
||||
|
||||
@ -157,8 +146,8 @@ class TestProfileView(SingleDeviceTestCase):
|
||||
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()
|
||||
sign_in_view.do_not_share.wait_for_element(10)
|
||||
sign_in_view.do_not_share.click_until_presence_of_element(sign_in_view.home_button)
|
||||
sign_in_view.do_not_share_button.wait_for_element(10)
|
||||
sign_in_view.do_not_share_button.click_until_presence_of_element(sign_in_view.home_button)
|
||||
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])
|
||||
|
@ -32,7 +32,7 @@ class TestTransaction(SingleDeviceTestCase):
|
||||
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.transactions_button.click()
|
||||
transactions_view = wallet_view.transaction_history_button.click()
|
||||
transactions_view.transactions_table.find_transaction(amount=transaction_amount)
|
||||
|
||||
@marks.pr
|
||||
@ -92,7 +92,7 @@ class TestTransaction(SingleDeviceTestCase):
|
||||
home_view = sign_in_view.get_home_view()
|
||||
wallet_view = home_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
transactions_view = wallet_view.transactions_button.click()
|
||||
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()
|
||||
@ -114,7 +114,7 @@ class TestTransaction(SingleDeviceTestCase):
|
||||
home_view.get_back_to_home_view()
|
||||
wallet_view = home_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
send_transaction = wallet_view.send_button.click()
|
||||
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()
|
||||
@ -141,7 +141,7 @@ class TestTransaction(SingleDeviceTestCase):
|
||||
home_view.get_back_to_home_view()
|
||||
wallet_view = home_view.wallet_button.click()
|
||||
wallet_view.set_up_wallet()
|
||||
send_transaction = wallet_view.send_button.click()
|
||||
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)
|
||||
@ -171,7 +171,7 @@ class TestTransaction(SingleDeviceTestCase):
|
||||
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_button.click()
|
||||
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()
|
||||
@ -259,7 +259,7 @@ class TestTransactions(MultipleDeviceTestCase):
|
||||
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.transactions_button.click()
|
||||
transactions_view = device_2_wallet.transaction_history_button.click()
|
||||
transactions_view.transactions_table.find_transaction(amount=amount)
|
||||
|
||||
@marks.pr
|
||||
@ -278,7 +278,7 @@ class TestTransactions(MultipleDeviceTestCase):
|
||||
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.request_button.click_until_presence_of_element(
|
||||
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()
|
||||
|
@ -17,7 +17,7 @@ class TestWallet(SingleDeviceTestCase):
|
||||
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_button.click()
|
||||
send_transaction = wallet_view.send_transaction_button.click()
|
||||
|
||||
# Check valid amount
|
||||
invalid_amount = 'asd'
|
||||
@ -93,7 +93,7 @@ class TestWallet(SingleDeviceTestCase):
|
||||
wallet_view = sign_in_view.wallet_button.click()
|
||||
sign_in_phrase = wallet_view.set_up_wallet()
|
||||
|
||||
send_transaction = wallet_view.send_button.click()
|
||||
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']
|
||||
|
@ -1,3 +1,5 @@
|
||||
import random
|
||||
import string
|
||||
import time
|
||||
import base64
|
||||
import zbarlight
|
||||
@ -72,7 +74,20 @@ class ContinueButton(BaseButton):
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='CONTINUE' or @text='Continue']")
|
||||
|
||||
|
||||
class HomeButton(BaseButton):
|
||||
class TabButton(BaseButton):
|
||||
|
||||
@property
|
||||
def counter(self):
|
||||
class Counter(BaseText):
|
||||
def __init__(self, driver, parent_locator):
|
||||
super(Counter, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector(
|
||||
"//*[@content-desc='%s']/android.view.ViewGroup[2]/android.widget.TextView" % parent_locator)
|
||||
|
||||
return Counter(self.driver, self.locator.value)
|
||||
|
||||
|
||||
class HomeButton(TabButton):
|
||||
def __init__(self, driver):
|
||||
super(HomeButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('home-tab-button')
|
||||
@ -82,7 +97,7 @@ class HomeButton(BaseButton):
|
||||
return HomeView(self.driver)
|
||||
|
||||
|
||||
class WalletButton(BaseButton):
|
||||
class WalletButton(TabButton):
|
||||
def __init__(self, driver):
|
||||
super(WalletButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('wallet-tab-button')
|
||||
@ -92,7 +107,7 @@ class WalletButton(BaseButton):
|
||||
return WalletView(self.driver)
|
||||
|
||||
|
||||
class ProfileButton(BaseButton):
|
||||
class ProfileButton(TabButton):
|
||||
def __init__(self, driver):
|
||||
super(ProfileButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('profile-tab-button')
|
||||
@ -153,6 +168,13 @@ class ConnectionStatusText(BaseText):
|
||||
"//*[@content-desc='connection-status-text']/android.widget.TextView")
|
||||
|
||||
|
||||
class TestFairyWarning(BaseText):
|
||||
def __init__(self, driver):
|
||||
super(TestFairyWarning, self).__init__(driver)
|
||||
self.locator = self.Locator.text_part_selector('session recording')
|
||||
self.is_shown = bool()
|
||||
|
||||
|
||||
class BaseView(object):
|
||||
def __init__(self, driver):
|
||||
self.driver = driver
|
||||
@ -178,6 +200,8 @@ class BaseView(object):
|
||||
self.apps_button = AppsButton(self.driver)
|
||||
self.status_app_icon = StatusAppIcon(self.driver)
|
||||
|
||||
self.test_fairy_warning = TestFairyWarning(self.driver)
|
||||
|
||||
self.element_types = {
|
||||
'base': BaseElement,
|
||||
'button': BaseButton,
|
||||
@ -191,6 +215,8 @@ class BaseView(object):
|
||||
while iterations <= 3 and not (CreateAccountButton(self.driver).is_element_displayed() or PasswordInput(
|
||||
self.driver).is_element_displayed()):
|
||||
for button in self.ok_button, self.continue_button:
|
||||
if self.test_fairy_warning.is_element_displayed():
|
||||
self.test_fairy_warning.is_shown = True
|
||||
try:
|
||||
button.wait_for_element(15)
|
||||
button.click()
|
||||
@ -295,9 +321,14 @@ class BaseView(object):
|
||||
from views.wallet_view import WalletView
|
||||
return WalletView(self.driver)
|
||||
|
||||
def get_unique_amount(self):
|
||||
@staticmethod
|
||||
def get_unique_amount():
|
||||
return '0.0%s' % datetime.now().strftime('%-m%-d%-H%-M%-S').strip('0')
|
||||
|
||||
@staticmethod
|
||||
def get_public_chat_name():
|
||||
return ''.join(random.choice(string.ascii_lowercase) for _ in range(7))
|
||||
|
||||
def get_text_from_qr(self):
|
||||
image = Image.open(BytesIO(base64.b64decode(self.driver.get_screenshot_as_base64())))
|
||||
image.load()
|
||||
@ -330,3 +361,11 @@ class BaseView(object):
|
||||
sign_in_view.password_input.send_keys(password)
|
||||
sign_in_view.sign_in_button.click()
|
||||
sign_in_view.home_button.wait_for_visibility_of_element()
|
||||
|
||||
def get_public_key(self):
|
||||
profile_view = self.profile_button.click()
|
||||
profile_view.share_my_contact_key_button.click()
|
||||
profile_view.public_key_text.wait_for_visibility_of_element()
|
||||
public_key = profile_view.public_key_text.text
|
||||
profile_view.cross_icon.click()
|
||||
return public_key
|
||||
|
BIN
test/appium/views/elements_templates/sauce_logo_red.png
Normal file
BIN
test/appium/views/elements_templates/sauce_logo_red.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
test/appium/views/elements_templates/saucelabs_sauce.png
Normal file
BIN
test/appium/views/elements_templates/saucelabs_sauce.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -128,14 +128,6 @@ class HomeView(BaseView):
|
||||
from views.chat_view import ChatView
|
||||
return ChatView(self.driver)
|
||||
|
||||
def get_public_key(self):
|
||||
profile_view = self.profile_button.click()
|
||||
profile_view.share_my_contact_key_button.click()
|
||||
profile_view.public_key_text.wait_for_visibility_of_element()
|
||||
public_key = profile_view.public_key_text.text
|
||||
profile_view.cross_icon.click()
|
||||
return public_key
|
||||
|
||||
def swipe_and_delete_chat(self, chat_name: str):
|
||||
chat_element = self.get_chat_with_user(chat_name)
|
||||
counter = 0
|
||||
|
@ -146,6 +146,13 @@ class CrossIcon(BaseButton):
|
||||
self.locator = self.Locator.accessibility_id('done-button')
|
||||
|
||||
|
||||
class ShareButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(ShareButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('share-code-button')
|
||||
|
||||
|
||||
class AdvancedButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
@ -253,6 +260,7 @@ class ProfileView(BaseView):
|
||||
self.edit_picture_button = EditPictureButton(self.driver)
|
||||
self.confirm_button = ConfirmButton(self.driver)
|
||||
self.cross_icon = CrossIcon(self.driver)
|
||||
self.share_button = ShareButton(self.driver)
|
||||
self.advanced_button = AdvancedButton(self.driver)
|
||||
self.debug_mode_toggle = DebugModeToggle(self.driver)
|
||||
|
||||
@ -284,6 +292,21 @@ class ProfileView(BaseView):
|
||||
text = [i.text for i in self.seed_phrase_table.find_elements()]
|
||||
return dict(zip(map(int, text[::2]), text[1::2]))
|
||||
|
||||
def backup_seed_phrase(self):
|
||||
self.backup_seed_phrase_button.click()
|
||||
self.ok_continue_button.click()
|
||||
seed_phrase = self.get_seed_phrase()
|
||||
self.next_button.click()
|
||||
word_number = self.seed_phrase_word_number.number
|
||||
self.seed_phrase_word_input.set_value(seed_phrase[word_number])
|
||||
self.next_button.click()
|
||||
word_number_1 = self.seed_phrase_word_number.number
|
||||
self.seed_phrase_word_input.set_value(seed_phrase[word_number_1])
|
||||
self.done_button.click()
|
||||
self.yes_button.click()
|
||||
self.ok_got_it_button.click()
|
||||
return seed_phrase
|
||||
|
||||
def edit_profile_picture(self, file_name: str):
|
||||
if not AbstractTestCase().environment == 'sauce':
|
||||
raise NotImplementedError('Test case is implemented to run on SauceLabs only')
|
||||
|
@ -140,6 +140,13 @@ class TotalFeeInput(BaseEditBox):
|
||||
self.locator = self.Locator.xpath_selector("//*[@content-desc='total-fee-input']/android.widget.TextView")
|
||||
|
||||
|
||||
class ShareButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(ShareButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('share-button')
|
||||
|
||||
|
||||
class SendTransactionView(BaseView):
|
||||
def __init__(self, driver):
|
||||
super(SendTransactionView, self).__init__(driver)
|
||||
@ -170,6 +177,8 @@ class SendTransactionView(BaseView):
|
||||
|
||||
self.error_dialog = ErrorDialog(self.driver)
|
||||
|
||||
self.share_button = ShareButton(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)
|
||||
|
@ -71,10 +71,24 @@ class NameInput(BaseEditBox):
|
||||
self.locator = self.Locator.xpath_selector("//android.widget.EditText")
|
||||
|
||||
|
||||
class DonNotShare(BaseButton):
|
||||
class LearnMoreLink(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(DonNotShare, self).__init__(driver)
|
||||
super(LearnMoreLink, self).__init__(driver)
|
||||
self.locator = self.Locator.text_selector('Learn more about what we collect')
|
||||
|
||||
|
||||
class ShareDataButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(ShareDataButton, self).__init__(driver)
|
||||
self.locator = self.Locator.text_selector('Share data')
|
||||
|
||||
|
||||
class DonNotShareButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(DonNotShareButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector('//*[@text="NO, I DON%sT WANT TO SHARE" '
|
||||
'or @text="Do not share"]' % "'")
|
||||
|
||||
@ -96,7 +110,9 @@ class SignInView(BaseView):
|
||||
self.add_existing_account_button = AddExistingAccountButton(self.driver)
|
||||
self.confirm_password_input = ConfirmPasswordInput(self.driver)
|
||||
self.name_input = NameInput(self.driver)
|
||||
self.do_not_share = DonNotShare(self.driver)
|
||||
self.learn_more_link = LearnMoreLink(self.driver)
|
||||
self.share_data_button = ShareDataButton(self.driver)
|
||||
self.do_not_share_button = DonNotShareButton(self.driver)
|
||||
|
||||
def create_user(self, username: str = '', password=common_password):
|
||||
self.create_account_button.click()
|
||||
@ -110,8 +126,8 @@ class SignInView(BaseView):
|
||||
self.name_input.send_keys(username)
|
||||
|
||||
self.next_button.click()
|
||||
self.do_not_share.wait_for_visibility_of_element(10)
|
||||
self.do_not_share.click_until_presence_of_element(self.home_button)
|
||||
self.do_not_share_button.wait_for_visibility_of_element(10)
|
||||
self.do_not_share_button.click_until_presence_of_element(self.home_button)
|
||||
return self.get_home_view()
|
||||
|
||||
def recover_access(self, passphrase, password):
|
||||
@ -121,8 +137,8 @@ class SignInView(BaseView):
|
||||
recover_access_view.password_input.click()
|
||||
recover_access_view.send_as_keyevent(password)
|
||||
recover_access_view.sign_in_button.click()
|
||||
self.do_not_share.wait_for_element(10)
|
||||
self.do_not_share.click_until_presence_of_element(self.home_button)
|
||||
self.do_not_share_button.wait_for_element(10)
|
||||
self.do_not_share_button.click_until_presence_of_element(self.home_button)
|
||||
return self.get_home_view()
|
||||
|
||||
def open_status_test_dapp(self):
|
||||
|
@ -2,7 +2,6 @@ import time
|
||||
|
||||
import pytest
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
from appium.webdriver.common.mobileby import MobileBy
|
||||
from views.base_element import BaseElement, BaseButton, BaseText
|
||||
from views.base_view import BaseView
|
||||
|
||||
@ -13,10 +12,15 @@ class OptionsButton(BaseButton):
|
||||
self.locator = self.Locator.xpath_selector(
|
||||
'(//android.view.ViewGroup[@content-desc="icon"])[2]')
|
||||
|
||||
class CopyTransactionHashButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(OptionsButton.CopyTransactionHashButton, self).__init__(driver)
|
||||
self.locator = self.Locator.text_selector('Copy transaction hash')
|
||||
|
||||
class OpenOnEtherscanButton(BaseButton):
|
||||
def __init__(self, driver):
|
||||
super(OptionsButton.OpenOnEtherscanButton, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='Open on Etherscan.io']")
|
||||
self.locator = self.Locator.text_selector('Open on Etherscan.io')
|
||||
|
||||
|
||||
class TransactionTable(BaseElement):
|
||||
@ -49,6 +53,7 @@ class TransactionTable(BaseElement):
|
||||
self.driver = driver
|
||||
self.locators = dict(transaction_hash="//android.widget.TextView[@text='Hash']/following-sibling::*[1]")
|
||||
self.options_button = OptionsButton(driver)
|
||||
self.copy_transaction_hash_button = OptionsButton.CopyTransactionHashButton(driver)
|
||||
self.open_transaction_on_etherscan_button = OptionsButton.OpenOnEtherscanButton(driver)
|
||||
|
||||
class DetailsTextElement(BaseText):
|
||||
|
@ -1,14 +1,13 @@
|
||||
from tests import info
|
||||
import time
|
||||
import pytest
|
||||
from views.base_view import BaseView
|
||||
from views.base_element import BaseButton, BaseText
|
||||
|
||||
|
||||
class SendButton(BaseButton):
|
||||
class SendTransactionButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(SendButton, self).__init__(driver)
|
||||
super(SendTransactionButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('send-transaction-button')
|
||||
|
||||
def navigate(self):
|
||||
@ -16,10 +15,10 @@ class SendButton(BaseButton):
|
||||
return SendTransactionView(self.driver)
|
||||
|
||||
|
||||
class RequestButton(BaseButton):
|
||||
class ReceiveTransactionButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(RequestButton, self).__init__(driver)
|
||||
super(ReceiveTransactionButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('receive-transaction-button')
|
||||
|
||||
def navigate(self):
|
||||
@ -41,10 +40,10 @@ class ChooseRecipientButton(BaseButton):
|
||||
self.locator = self.Locator.accessibility_id('choose-recipient-button')
|
||||
|
||||
|
||||
class TransactionsButton(BaseButton):
|
||||
class TransactionHistoryButton(BaseButton):
|
||||
|
||||
def __init__(self, driver):
|
||||
super(TransactionsButton, self).__init__(driver)
|
||||
super(TransactionHistoryButton, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('transaction-history-button')
|
||||
|
||||
def navigate(self):
|
||||
@ -124,19 +123,39 @@ class SignInPhraseText(BaseText):
|
||||
self.locator = self.Locator.xpath_selector(
|
||||
"//*[contains(@text,'phrase')]/preceding-sibling::*[1]/android.widget.TextView")
|
||||
|
||||
@property
|
||||
def list(self):
|
||||
return [element.text for element in self.find_elements()]
|
||||
|
||||
@property
|
||||
def string(self):
|
||||
return ' '.join(self.list)
|
||||
|
||||
|
||||
class AssetTextElement(BaseText):
|
||||
def __init__(self, driver, asset_name):
|
||||
super(AssetTextElement, self).__init__(driver)
|
||||
self.locator = self.Locator.accessibility_id('%s-asset-value-text' % asset_name.lower())
|
||||
|
||||
|
||||
class AssetCheckBox(BaseButton):
|
||||
def __init__(self, driver, asset_name):
|
||||
super(AssetCheckBox, self).__init__(driver)
|
||||
self.locator = self.Locator.xpath_selector("//*[@text='%s']/../android.widget.CheckBox" % asset_name)
|
||||
|
||||
|
||||
class WalletView(BaseView):
|
||||
def __init__(self, driver):
|
||||
super(WalletView, self).__init__(driver)
|
||||
self.driver = driver
|
||||
|
||||
self.send_button = SendButton(self.driver)
|
||||
self.transactions_button = TransactionsButton(self.driver)
|
||||
self.send_transaction_button = SendTransactionButton(self.driver)
|
||||
self.transaction_history_button = TransactionHistoryButton(self.driver)
|
||||
self.eth_asset = EthAssetText(self.driver)
|
||||
self.usd_total_value = UsdTotalValueText(self.driver)
|
||||
|
||||
self.send_transaction_request = SendTransactionRequestButton(self.driver)
|
||||
self.request_button = RequestButton(self.driver)
|
||||
self.receive_transaction_button = ReceiveTransactionButton(self.driver)
|
||||
|
||||
self.send_request_button = SendRequestButton(self.driver)
|
||||
self.options_button = OptionsButton(self.driver)
|
||||
@ -171,7 +190,8 @@ class WalletView(BaseView):
|
||||
counter = 0
|
||||
while True:
|
||||
if counter >= wait_time:
|
||||
pytest.fail('Balance is not changed during %s seconds!' % wait_time)
|
||||
info('Balance is not changed during %s seconds!' % wait_time)
|
||||
return
|
||||
elif self.get_eth_value() != expected_balance:
|
||||
counter += 10
|
||||
time.sleep(10)
|
||||
@ -186,7 +206,19 @@ class WalletView(BaseView):
|
||||
|
||||
def set_up_wallet(self):
|
||||
self.set_up_button.click()
|
||||
phrase = self.get_sign_in_phrase()
|
||||
phrase = self.sign_in_phrase.string
|
||||
self.done_button.click()
|
||||
self.yes_button.click()
|
||||
return phrase
|
||||
|
||||
def get_wallet_address(self):
|
||||
self.receive_transaction_button.click()
|
||||
address = self.address_text.text
|
||||
self.back_button.click()
|
||||
return address
|
||||
|
||||
def asset_by_name(self, asset_name):
|
||||
return AssetTextElement(self.driver, asset_name)
|
||||
|
||||
def asset_checkbox_by_name(self, asset_name):
|
||||
return AssetCheckBox(self.driver, asset_name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user