2017-08-28 10:02:20 +00:00
|
|
|
import pytest
|
2018-01-03 09:34:40 +00:00
|
|
|
from tests.base_test_case import SingleDeviceTestCase
|
|
|
|
from views.console_view import ConsoleView
|
|
|
|
from tests import user_flow
|
2017-10-13 08:41:30 +00:00
|
|
|
from tests import basic_user
|
2017-08-28 10:02:20 +00:00
|
|
|
|
|
|
|
|
2017-10-11 20:10:57 +00:00
|
|
|
@pytest.mark.all
|
2018-01-03 09:34:40 +00:00
|
|
|
class TestSanity(SingleDeviceTestCase):
|
2017-09-21 17:01:04 +00:00
|
|
|
|
2017-11-09 10:58:11 +00:00
|
|
|
@pytest.mark.sign_in
|
2017-09-21 17:01:04 +00:00
|
|
|
@pytest.mark.parametrize("verification", ["invalid", "valid"])
|
|
|
|
def test_sign_in(self, verification):
|
|
|
|
verifications = {"valid":
|
|
|
|
{"input": "qwerty1234",
|
2018-01-14 17:43:36 +00:00
|
|
|
"outcome": "Wallet"},
|
2017-09-21 17:01:04 +00:00
|
|
|
"invalid":
|
|
|
|
{"input": "12345ewq",
|
|
|
|
"outcome": "Wrong password"}}
|
2018-01-03 09:34:40 +00:00
|
|
|
console_view = ConsoleView(self.driver)
|
|
|
|
user_flow.create_user(console_view)
|
2018-01-14 17:43:36 +00:00
|
|
|
console_view.back_button.click()
|
|
|
|
profile_view = console_view.profile_button.click()
|
|
|
|
profile_view.logout_button.scroll_to_element()
|
|
|
|
sign_in_view = profile_view.logout_button.click()
|
2018-01-03 09:34:40 +00:00
|
|
|
sign_in_view.first_account_button.click()
|
|
|
|
sign_in_view.password_input.send_keys(verifications[verification]['input'])
|
|
|
|
sign_in_view.sign_in_button.click()
|
2018-01-14 17:43:36 +00:00
|
|
|
sign_in_view.find_full_text(verifications[verification]["outcome"], 60)
|
2018-01-03 09:34:40 +00:00
|
|
|
if verifications[verification]["input"] in str(console_view.logcat):
|
2017-11-09 10:58:11 +00:00
|
|
|
pytest.fail('Password in logcat!!!', pytrace=False)
|
2017-09-21 17:01:04 +00:00
|
|
|
|
2017-11-09 10:58:11 +00:00
|
|
|
@pytest.mark.password
|
|
|
|
@pytest.mark.parametrize("verification", ["logcat", "mismatch", "short"])
|
2017-08-28 10:02:20 +00:00
|
|
|
def test_password(self, verification):
|
2017-11-09 10:58:11 +00:00
|
|
|
verifications = {
|
2018-01-14 17:43:36 +00:00
|
|
|
"short": {"input": "qwe1",
|
|
|
|
"outcome": "Password should be not less then 6 symbols."},
|
2017-11-09 10:58:11 +00:00
|
|
|
|
2018-01-14 17:43:36 +00:00
|
|
|
"mismatch": {"input": "mismatch1234",
|
|
|
|
"outcome": "Password confirmation doesn\'t match password."},
|
2017-11-09 10:58:11 +00:00
|
|
|
|
2018-01-14 17:43:36 +00:00
|
|
|
"logcat": {"input": "new_unique_password",
|
|
|
|
"outcome": "Here is your signing phrase. "
|
|
|
|
"You will use it to verify your transactions. "
|
|
|
|
"Write it down and keep it safe!"}}
|
2018-01-03 09:34:40 +00:00
|
|
|
console = ConsoleView(self.driver)
|
|
|
|
console.request_password_icon.click()
|
|
|
|
console.chat_request_input.send_keys(verifications[verification]["input"])
|
|
|
|
console.confirm()
|
2017-08-28 10:02:20 +00:00
|
|
|
if 'short' not in verification:
|
2018-01-03 09:34:40 +00:00
|
|
|
console.chat_request_input.send_keys("new_unique_password")
|
|
|
|
console.confirm()
|
|
|
|
console.find_full_text(verifications[verification]["outcome"])
|
|
|
|
if verifications[verification]["input"] in str(console.logcat):
|
|
|
|
pytest.fail('Password in logcat!!!', pytrace=False)
|
|
|
|
|
|
|
|
@pytest.mark.profile
|
|
|
|
def test_change_profile_name_and_status(self):
|
|
|
|
new_status = '#newstatus'
|
|
|
|
new_username = 'NewUserName!'
|
|
|
|
console_view = ConsoleView(self.driver)
|
|
|
|
user_flow.create_user(console_view)
|
2018-01-14 17:43:36 +00:00
|
|
|
console_view.back_button.click()
|
|
|
|
profile_view = console_view.profile_button.click()
|
2018-01-03 09:34:40 +00:00
|
|
|
profile_view.user_status_box.click()
|
|
|
|
profile_view.user_status_input.clear()
|
|
|
|
profile_view.user_status_input.send_keys(new_status)
|
2018-01-14 17:43:36 +00:00
|
|
|
profile_view.username_input.click()
|
2018-01-03 09:34:40 +00:00
|
|
|
profile_view.username_input.clear()
|
|
|
|
profile_view.username_input.send_keys(new_username)
|
|
|
|
profile_view.save_button.click()
|
2018-01-14 17:43:36 +00:00
|
|
|
sign_in_view = profile_view.logout_button.click()
|
|
|
|
sign_in_view.first_account_button.click()
|
2018-01-03 09:34:40 +00:00
|
|
|
sign_in_view.password_input.send_keys('qwerty1234')
|
2018-01-14 17:43:36 +00:00
|
|
|
home_view = sign_in_view.sign_in_button.click()
|
|
|
|
home_view.find_full_text('Wallet', 60)
|
|
|
|
home_view.profile_button.click()
|
2018-01-03 09:34:40 +00:00
|
|
|
for text in new_status + ' ', new_username:
|
2018-01-14 17:43:36 +00:00
|
|
|
home_view.find_full_text(text, 5)
|
2018-01-03 09:34:40 +00:00
|
|
|
|
|
|
|
@pytest.mark.recover
|
|
|
|
def test_recover_access(self):
|
|
|
|
console_view = ConsoleView(self.driver)
|
|
|
|
user_flow.create_user(console_view)
|
2018-01-14 17:43:36 +00:00
|
|
|
console_view.back_button.click()
|
|
|
|
profile_view = console_view.profile_button.click()
|
|
|
|
sign_in_view = profile_view.logout_button.click()
|
2018-01-03 09:34:40 +00:00
|
|
|
recover_access_view = sign_in_view.recover_access_button.click()
|
|
|
|
recover_access_view.passphrase_input.send_keys(basic_user['passphrase'])
|
|
|
|
recover_access_view.password_input.send_keys(basic_user['password'])
|
|
|
|
recover_access_view.confirm_recover_access.click()
|
|
|
|
recovered_user = sign_in_view.element_by_text(basic_user['username'], 'button')
|
|
|
|
recovered_user.click()
|
|
|
|
sign_in_view.password_input.send_keys(basic_user['password'])
|
|
|
|
sign_in_view.sign_in_button.click()
|
2018-01-14 17:43:36 +00:00
|
|
|
console_view.find_full_text('Wallet', 60)
|
2018-01-03 09:34:40 +00:00
|
|
|
if basic_user['password'] in str(console_view.logcat):
|
2017-11-09 10:58:11 +00:00
|
|
|
pytest.fail('Password in logcat!!!', pytrace=False)
|