2017-08-28 10:02:20 +00:00
|
|
|
import pytest
|
2017-10-05 19:41:17 +00:00
|
|
|
import time
|
2017-08-28 10:02:20 +00:00
|
|
|
from tests.basetestcase import SingleDeviceTestCase
|
|
|
|
from views.home import HomeView
|
2017-10-13 08:41:30 +00:00
|
|
|
from tests.preconditions import set_password_as_new_user
|
|
|
|
from tests import basic_user
|
2017-08-28 10:02:20 +00:00
|
|
|
|
|
|
|
|
2017-10-11 20:10:57 +00:00
|
|
|
@pytest.mark.all
|
2017-10-05 19:41:17 +00:00
|
|
|
class TestAccess(SingleDeviceTestCase):
|
2017-08-28 10:02:20 +00:00
|
|
|
|
2017-10-30 11:11:58 +00:00
|
|
|
@pytest.mark.profile
|
|
|
|
def test_change_profile_name_and_status(self):
|
|
|
|
home = HomeView(self.driver)
|
|
|
|
set_password_as_new_user(home)
|
|
|
|
chats = home.get_chats()
|
|
|
|
chats.back_button.click()
|
|
|
|
chats.profile_button.click()
|
|
|
|
profile = chats.profile_icon.click()
|
|
|
|
|
|
|
|
new_status = '#newstatus'
|
|
|
|
new_username = 'NewUserName!'
|
|
|
|
|
|
|
|
profile.user_status_box.click()
|
|
|
|
profile.user_status_input.clear()
|
|
|
|
profile.user_status_input.send_keys(new_status)
|
|
|
|
profile.username_input.clear()
|
|
|
|
profile.username_input.send_keys(new_username)
|
|
|
|
profile.save_button.click()
|
|
|
|
profile.back_button.click()
|
|
|
|
|
|
|
|
chats.profile_button.click()
|
|
|
|
login = chats.switch_users_button.click()
|
|
|
|
user = login.element_by_text(new_username, 'button')
|
|
|
|
user.click()
|
|
|
|
login.password_input.send_keys('qwerty1234')
|
|
|
|
login.sign_in_button.click()
|
|
|
|
home.find_full_text('Chats', 60)
|
|
|
|
chats.profile_button.click()
|
|
|
|
for text in new_status + ' ', new_username:
|
|
|
|
chats.find_full_text(text, 5)
|
|
|
|
|
2017-11-09 10:58:11 +00:00
|
|
|
@pytest.mark.recover
|
2017-09-26 10:50:34 +00:00
|
|
|
def test_recover_access(self):
|
2017-09-21 17:01:04 +00:00
|
|
|
home = HomeView(self.driver)
|
|
|
|
set_password_as_new_user(home)
|
|
|
|
chats = home.get_chats()
|
|
|
|
chats.back_button.click()
|
|
|
|
chats.profile_button.click()
|
2017-09-26 10:50:34 +00:00
|
|
|
login = chats.switch_users_button.click()
|
|
|
|
login.recover_access_button.click()
|
|
|
|
login.passphrase_input.send_keys(basic_user['passphrase'])
|
|
|
|
login.password_input.send_keys(basic_user['password'])
|
|
|
|
login.confirm_recover_access.click()
|
|
|
|
recovered_user = login.element_by_text(basic_user['username'], 'button')
|
|
|
|
recovered_user.click()
|
|
|
|
login.password_input.send_keys(basic_user['password'])
|
|
|
|
login.sign_in_button.click()
|
2017-10-05 19:41:17 +00:00
|
|
|
home.find_full_text('Chats', 60)
|
2017-11-09 10:58:11 +00:00
|
|
|
if basic_user['password'] in str(home.logcat):
|
|
|
|
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.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",
|
|
|
|
"outcome": "Chats"},
|
|
|
|
"invalid":
|
|
|
|
{"input": "12345ewq",
|
|
|
|
"outcome": "Wrong password"}}
|
|
|
|
home = HomeView(self.driver)
|
|
|
|
set_password_as_new_user(home)
|
|
|
|
chats = home.get_chats()
|
|
|
|
chats.back_button.click()
|
|
|
|
chats.profile_button.click()
|
|
|
|
login = chats.switch_users_button.click()
|
|
|
|
login.first_account_button.click()
|
|
|
|
login.password_input.send_keys(verifications[verification]['input'])
|
|
|
|
login.sign_in_button.click()
|
2017-10-19 13:49:20 +00:00
|
|
|
home.find_full_text(verifications[verification]["outcome"], 60)
|
2017-11-09 10:58:11 +00:00
|
|
|
if verifications[verification]["input"] in str(home.logcat):
|
|
|
|
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 = {
|
|
|
|
"short": {"input": "qwe1",
|
|
|
|
"outcome": "Password should be not less then 6 symbols."},
|
|
|
|
|
|
|
|
"mismatch": {"input": "mismatch1234",
|
|
|
|
"outcome": "Password confirmation doesn\'t match password."},
|
|
|
|
|
|
|
|
"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!"}}
|
2017-08-28 10:02:20 +00:00
|
|
|
home = HomeView(self.driver)
|
|
|
|
home.request_password_icon.click()
|
2017-09-26 10:50:34 +00:00
|
|
|
home.chat_request_input.send_keys(verifications[verification]["input"])
|
2017-08-28 10:02:20 +00:00
|
|
|
home.confirm()
|
|
|
|
if 'short' not in verification:
|
2017-11-09 10:58:11 +00:00
|
|
|
home.chat_request_input.send_keys("new_unique_password")
|
2017-08-28 10:02:20 +00:00
|
|
|
home.confirm()
|
2017-09-13 14:34:42 +00:00
|
|
|
home.find_full_text(verifications[verification]["outcome"])
|
2017-11-09 10:58:11 +00:00
|
|
|
if verifications[verification]["input"] in str(home.logcat):
|
|
|
|
pytest.fail('Password in logcat!!!', pytrace=False)
|