2018-06-29 17:27:30 +00:00
|
|
|
import pytest
|
2019-07-22 23:19:30 +00:00
|
|
|
import random
|
|
|
|
|
2018-10-17 08:55:33 +00:00
|
|
|
from tests import marks, common_password, get_current_time, unique_password
|
2018-06-29 17:27:30 +00:00
|
|
|
from tests.base_test_case import SingleDeviceTestCase
|
|
|
|
from views.sign_in_view import SignInView
|
2019-02-26 18:05:22 +00:00
|
|
|
from tests.users import basic_user
|
2018-06-29 17:27:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
@marks.all
|
|
|
|
@marks.account
|
|
|
|
class TestCreateAccount(SingleDeviceTestCase):
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5300)
|
|
|
|
@marks.critical
|
2018-11-07 12:26:32 +00:00
|
|
|
@marks.battery_consumption
|
2019-03-05 16:43:30 +00:00
|
|
|
@marks.skip
|
2018-06-29 17:27:30 +00:00
|
|
|
def test_create_account(self):
|
2018-08-10 10:09:19 +00:00
|
|
|
sign_in = SignInView(self.driver, skip_popups=False)
|
|
|
|
sign_in.accept_agreements()
|
2019-07-03 14:29:01 +00:00
|
|
|
if not sign_in.i_have_multiaccount_button.is_element_displayed():
|
2018-06-29 17:27:30 +00:00
|
|
|
self.errors.append("'I have an account' button is not displayed")
|
2019-07-03 14:29:01 +00:00
|
|
|
sign_in.create_multiaccount_button.click()
|
2018-06-29 17:27:30 +00:00
|
|
|
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()
|
2018-08-10 10:09:19 +00:00
|
|
|
self.verify_no_errors()
|
2018-06-29 17:27:30 +00:00
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5356)
|
|
|
|
@marks.critical
|
2018-06-29 17:27:30 +00:00
|
|
|
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()
|
2018-07-17 16:27:00 +00:00
|
|
|
profile.logout()
|
2018-07-16 12:57:01 +00:00
|
|
|
if sign_in.ok_button.is_element_displayed():
|
|
|
|
sign_in.ok_button.click()
|
2019-07-09 11:37:18 +00:00
|
|
|
sign_in.back_button.click()
|
|
|
|
sign_in.generate_new_key_button.click()
|
|
|
|
sign_in.generate_key_button.click()
|
2019-05-13 07:58:41 +00:00
|
|
|
sign_in.next_button.click()
|
|
|
|
sign_in.next_button.click()
|
2019-07-09 11:37:18 +00:00
|
|
|
sign_in.create_password_input.set_value(common_password)
|
|
|
|
sign_in.next_button.click()
|
|
|
|
sign_in.confirm_your_password_input.set_value(common_password)
|
2019-05-13 07:58:41 +00:00
|
|
|
sign_in.next_button.click()
|
2019-07-09 11:37:18 +00:00
|
|
|
|
2018-06-29 17:27:30 +00:00
|
|
|
if sign_in.get_public_key() == public_key:
|
|
|
|
pytest.fail('New account was not created')
|
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5379)
|
|
|
|
@marks.high
|
2018-06-29 17:27:30 +00:00
|
|
|
def test_home_view(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
2019-07-22 23:19:30 +00:00
|
|
|
sign_in.get_started_button.click()
|
|
|
|
sign_in.generate_key_button.click()
|
|
|
|
account_button = sign_in.get_account_by_position(random.randint(1, 4))
|
|
|
|
username = account_button.username.text
|
|
|
|
account_button.click()
|
|
|
|
sign_in.next_button.click()
|
|
|
|
sign_in.next_button.click()
|
|
|
|
sign_in.create_password_input.set_value(common_password)
|
|
|
|
sign_in.next_button.click()
|
|
|
|
sign_in.confirm_your_password_input.set_value(common_password)
|
|
|
|
sign_in.next_button.click()
|
|
|
|
sign_in.maybe_later_button.click()
|
|
|
|
home_view = sign_in.get_home_view()
|
2019-03-19 09:02:41 +00:00
|
|
|
text = 'There are no recent chats here yet. \nUse the (+) button to discover people \nto chat with'
|
2019-07-22 23:19:30 +00:00
|
|
|
if not home_view.element_by_text(text).is_element_displayed():
|
2018-06-29 17:27:30 +00:00
|
|
|
self.errors.append("'%s' text is not shown" % text)
|
2019-07-22 23:19:30 +00:00
|
|
|
profile_view = home_view.profile_button.click()
|
2019-08-23 10:24:52 +00:00
|
|
|
shown_username = profile_view.default_username_text.text
|
|
|
|
if shown_username != username:
|
|
|
|
self.errors.append("Default username '%s' doesn't match '%s'" % (shown_username, username))
|
2018-06-29 17:27:30 +00:00
|
|
|
self.verify_no_errors()
|
2018-06-30 12:17:38 +00:00
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5460)
|
|
|
|
@marks.medium
|
2018-06-30 12:17:38 +00:00
|
|
|
def test_create_account_short_and_mismatch_password(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
2019-07-11 15:44:12 +00:00
|
|
|
sign_in.get_started_button.click()
|
|
|
|
sign_in.generate_key_button.click()
|
|
|
|
sign_in.next_button.click()
|
|
|
|
sign_in.next_button.click()
|
|
|
|
sign_in.create_password_input.set_value('12345')
|
2018-06-30 12:17:38 +00:00
|
|
|
|
2018-08-08 15:30:48 +00:00
|
|
|
mismatch_error = "Passwords don't match"
|
2018-06-30 12:17:38 +00:00
|
|
|
|
|
|
|
sign_in.next_button.click()
|
2019-07-11 15:44:12 +00:00
|
|
|
if sign_in.confirm_your_password_input.is_element_displayed():
|
2018-06-30 12:17:38 +00:00
|
|
|
self.errors.append('Next button is clickable when password is less then 6 symbols')
|
|
|
|
|
2019-07-11 15:44:12 +00:00
|
|
|
sign_in.create_password_input.set_value('123456')
|
2018-06-30 12:17:38 +00:00
|
|
|
sign_in.next_button.click()
|
2019-07-11 15:44:12 +00:00
|
|
|
sign_in.confirm_your_password_input.set_value('1234567')
|
2018-06-30 12:17:38 +00:00
|
|
|
sign_in.next_button.click()
|
|
|
|
|
|
|
|
if not sign_in.find_text_part(mismatch_error):
|
|
|
|
self.errors.append("'%s' is not shown")
|
|
|
|
self.verify_no_errors()
|
2018-07-09 19:47:50 +00:00
|
|
|
|
2018-09-28 15:30:06 +00:00
|
|
|
@marks.testrail_id(5414)
|
|
|
|
@marks.critical
|
2018-08-23 13:50:19 +00:00
|
|
|
@marks.logcat
|
2018-07-09 19:47:50 +00:00
|
|
|
def test_password_in_logcat_creating_account(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
2018-08-23 13:50:19 +00:00
|
|
|
sign_in.create_user(password=unique_password)
|
2019-09-24 14:22:20 +00:00
|
|
|
values_in_logcat = sign_in.find_values_in_logcat(password=unique_password)
|
|
|
|
if values_in_logcat:
|
|
|
|
self.driver.fail(values_in_logcat)
|
2019-02-26 18:05:22 +00:00
|
|
|
|
|
|
|
@marks.testrail_id(5718)
|
|
|
|
@marks.medium
|
|
|
|
def test_special_characters_in_password_when_creating_new_account(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
|
|
|
sign_in.create_user(password=basic_user['special_chars_password'])
|
|
|
|
sign_in.relogin(password=basic_user['special_chars_password'])
|