2018-05-02 16:01:17 +00:00
|
|
|
import random
|
|
|
|
import emoji
|
2018-02-13 17:22:41 +00:00
|
|
|
import pytest
|
|
|
|
import time
|
|
|
|
from tests.base_test_case import SingleDeviceTestCase
|
2018-04-26 12:34:15 +00:00
|
|
|
from tests import basic_user, marks
|
2018-03-01 13:22:01 +00:00
|
|
|
from views.sign_in_view import SignInView
|
2018-02-13 17:22:41 +00:00
|
|
|
|
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.all
|
2018-02-13 17:22:41 +00:00
|
|
|
class TestProfileView(SingleDeviceTestCase):
|
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.testrail_case_id(3395)
|
2018-02-13 17:22:41 +00:00
|
|
|
def test_qr_code_and_its_value(self):
|
2018-03-01 13:22:01 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
sign_in_view.create_user()
|
|
|
|
profile_view = sign_in_view.profile_button.click()
|
2018-02-13 17:22:41 +00:00
|
|
|
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()
|
2018-05-02 16:01:17 +00:00
|
|
|
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()
|
2018-05-11 19:15:39 +00:00
|
|
|
wallet_view.set_up_wallet()
|
2018-05-02 16:01:17 +00:00
|
|
|
wallet_view.request_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()
|
2018-04-26 12:34:15 +00:00
|
|
|
if key_value not in key_value_from_qr:
|
2018-05-02 16:01:17 +00:00
|
|
|
self.errors.append(
|
|
|
|
"Wallet QR code value '%s' doesn't match wallet address '%s'" % (key_value_from_qr, key_value))
|
|
|
|
self.verify_no_errors()
|
2018-02-13 17:22:41 +00:00
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
2018-05-16 19:59:36 +00:00
|
|
|
@marks.testrail_case_id(3396)
|
2018-02-13 17:22:41 +00:00
|
|
|
def test_contact_profile_view(self):
|
2018-03-01 13:22:01 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
sign_in_view.create_user()
|
|
|
|
home_view = sign_in_view.get_home_view()
|
2018-02-13 17:22:41 +00:00
|
|
|
home_view.add_contact(basic_user['public_key'])
|
|
|
|
chat_view = home_view.get_chat_view()
|
2018-02-19 11:51:53 +00:00
|
|
|
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)
|
2018-05-02 16:01:17 +00:00
|
|
|
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'
|
2018-02-13 17:22:41 +00:00
|
|
|
|
2018-04-26 12:34:15 +00:00
|
|
|
@marks.pr
|
|
|
|
@marks.testrail_case_id(3397)
|
2018-02-13 17:22:41 +00:00
|
|
|
def test_network_switch(self):
|
2018-03-01 13:22:01 +00:00
|
|
|
sign_in_view = SignInView(self.driver)
|
|
|
|
sign_in_view.create_user()
|
|
|
|
profile_view = sign_in_view.profile_button.click()
|
2018-02-13 17:22:41 +00:00
|
|
|
sign_in_view = profile_view.switch_network('Rinkeby with upstream RPC')
|
2018-05-02 16:01:17 +00:00
|
|
|
sign_in_view.click_account_by_position(0)
|
2018-02-19 11:51:53 +00:00
|
|
|
sign_in_view.password_input.set_value('qwerty1234')
|
2018-02-13 17:22:41 +00:00
|
|
|
sign_in_view.sign_in_button.click()
|
2018-03-15 20:01:08 +00:00
|
|
|
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()
|
2018-05-02 16:01:17 +00:00
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
@marks.testrail_case_id(3398)
|
2018-05-02 16:01:17 +00:00
|
|
|
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()
|
2018-05-20 16:34:22 +00:00
|
|
|
self.driver.swipe(500, 500, 500, 1000)
|
2018-05-02 16:01:17 +00:00
|
|
|
if not profile_view.profile_picture.is_element_image_equals_template():
|
|
|
|
pytest.fail('Profile picture was not updated')
|
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
@marks.testrail_case_id(3399)
|
2018-05-02 16:01:17 +00:00
|
|
|
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()
|
|
|
|
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()
|
2018-05-10 10:29:08 +00:00
|
|
|
word_number = profile_view.seed_phrase_word_number.number
|
2018-05-02 16:01:17 +00:00
|
|
|
profile_view.seed_phrase_word_input.set_value(seed_phrase[word_number])
|
|
|
|
profile_view.next_button.click()
|
2018-05-10 10:29:08 +00:00
|
|
|
word_number_1 = profile_view.seed_phrase_word_number.number
|
2018-05-02 16:01:17 +00:00
|
|
|
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()
|
|
|
|
profile_view.logout_button.click()
|
|
|
|
profile_view.confirm_logout_button.click()
|
|
|
|
recover_access_view = sign_in_view.add_existing_account_button.click()
|
2018-04-26 12:34:15 +00:00
|
|
|
recover_access_view.passphrase_input.set_value(' '.join(seed_phrase[key] for key in sorted(seed_phrase)))
|
2018-05-02 16:01:17 +00:00
|
|
|
recover_access_view.password_input.set_value('qwerty1234')
|
|
|
|
recover_access_view.sign_in_button.click()
|
|
|
|
sign_in_view.do_not_share.click()
|
|
|
|
public_key_1 = home_view.get_public_key()
|
|
|
|
assert public_key == public_key_1
|
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
@marks.testrail_case_id(3411)
|
2018-05-16 07:22:02 +00:00
|
|
|
def test_faucet_console_command(self):
|
2018-05-02 16:01:17 +00:00
|
|
|
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.commands_button.click()
|
2018-05-16 07:22:02 +00:00
|
|
|
chat_view.faucet_command.click()
|
|
|
|
chat_view.faucet_send_command.click()
|
2018-05-02 16:01:17 +00:00
|
|
|
chat_view.send_message_button.click()
|
2018-05-16 07:22:02 +00:00
|
|
|
chat_view.wait_for_message_in_one_to_one_chat('Faucet request has been received', self.errors)
|
2018-05-02 16:01:17 +00:00
|
|
|
self.verify_no_errors()
|
2018-05-16 07:22:02 +00:00
|
|
|
chat_view.back_button.click()
|
|
|
|
|
|
|
|
wallet_view = profile_view.wallet_button.click()
|
|
|
|
wallet_view.set_up_wallet()
|
|
|
|
wallet_view.wait_balance_changed_on_wallet_screen()
|
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
@marks.testrail_case_id(3421)
|
2018-05-02 16:01:17 +00:00
|
|
|
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()
|
|
|
|
|
2018-05-16 19:59:36 +00:00
|
|
|
@marks.testrail_case_id(3424)
|
2018-05-02 16:01:17 +00:00
|
|
|
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()
|
|
|
|
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)
|
|
|
|
profile_view = sign_in_view.profile_button.click()
|
|
|
|
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')
|