2019-07-22 23:19:30 +00:00
|
|
|
import random
|
|
|
|
|
2020-07-13 16:06:19 +00:00
|
|
|
from tests import marks, common_password, 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
|
|
|
|
|
|
|
|
|
|
|
class TestCreateAccount(SingleDeviceTestCase):
|
|
|
|
|
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()
|
2020-04-10 10:25:46 +00:00
|
|
|
public_key = sign_in.get_public_key_and_username()
|
2018-06-29 17:27:30 +00:00
|
|
|
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()
|
2020-01-28 12:00:05 +00:00
|
|
|
sign_in.your_keys_more_icon.click()
|
2019-07-09 11:37:18 +00:00
|
|
|
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()
|
2020-07-07 10:20:46 +00:00
|
|
|
sign_in.maybe_later_button.click_until_presence_of_element(sign_in.lets_go_button)
|
2019-11-18 09:38:34 +00:00
|
|
|
sign_in.lets_go_button.click()
|
2019-07-09 11:37:18 +00:00
|
|
|
|
2020-04-10 10:25:46 +00:00
|
|
|
if sign_in.get_public_key_and_username() == public_key:
|
2019-10-21 12:48:45 +00:00
|
|
|
self.driver.fail('New account was not created')
|
2018-06-29 17:27:30 +00:00
|
|
|
|
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()
|
2020-07-13 16:06:19 +00:00
|
|
|
from views.sign_in_view import MultiAccountButton
|
|
|
|
account_button = sign_in.get_multiaccount_by_position(position=random.randint(1, 4), element_class=MultiAccountButton)
|
2019-07-22 23:19:30 +00:00
|
|
|
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.confirm_your_password_input.set_value(common_password)
|
|
|
|
sign_in.next_button.click()
|
2020-07-07 10:20:46 +00:00
|
|
|
for element in sign_in.maybe_later_button, sign_in.lets_go_button:
|
|
|
|
element.wait_for_element(10)
|
|
|
|
element.click()
|
2019-07-22 23:19:30 +00:00
|
|
|
home_view = sign_in.get_home_view()
|
2020-01-07 12:33:47 +00:00
|
|
|
texts = ['Chat and transact privately with friends',
|
|
|
|
'Jump into a public chat and meet new people',
|
2019-12-26 11:56:59 +00:00
|
|
|
'#status']
|
2019-11-18 09:38:34 +00:00
|
|
|
for text in texts:
|
|
|
|
if not home_view.element_by_text(text).is_element_displayed():
|
|
|
|
self.errors.append("'%s' text is not shown" % text)
|
2020-07-10 14:39:26 +00:00
|
|
|
for chat in ('#status', '#crypto'):
|
|
|
|
sign_in.element_by_text(chat).click()
|
2020-10-20 15:34:52 +00:00
|
|
|
sign_in.back_button.click_until_presence_of_element(home_view.search_input)
|
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))
|
2020-09-09 15:06:07 +00:00
|
|
|
profile_view.home_button.click_until_presence_of_element(home_view.element_by_text('#status'))
|
2020-04-03 11:01:55 +00:00
|
|
|
home_view.cross_icon_iside_welcome_screen_button.click()
|
2020-07-10 14:39:26 +00:00
|
|
|
for chat in ('#status', '#crypto'):
|
|
|
|
home_view.delete_chat_long_press(chat)
|
2019-11-18 09:38:34 +00:00
|
|
|
if home_view.element_by_text(texts[0]).is_element_displayed():
|
|
|
|
self.errors.append("'%s' text is shown, but welcome view was closed" % texts[0])
|
|
|
|
home_view.relogin()
|
|
|
|
if home_view.element_by_text(texts[0]).is_element_displayed():
|
|
|
|
self.errors.append("'%s' text is shown after relogin, but welcome view was closed" % texts[0])
|
|
|
|
text_after_closing_welcome_screen = "Your chats will appear here. To start new chats press the ⊕ button"
|
|
|
|
if not home_view.element_by_text(text_after_closing_welcome_screen).is_element_displayed():
|
|
|
|
self.errors.append("'%s' text is not shown after welcome view was closed" % text_after_closing_welcome_screen)
|
|
|
|
|
2019-10-29 08:25:57 +00:00
|
|
|
self.errors.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()
|
2018-08-08 15:30:48 +00:00
|
|
|
mismatch_error = "Passwords don't match"
|
2020-07-22 13:30:07 +00:00
|
|
|
cases = ['password is not confirmed', 'password is too short', "passwords don't match"]
|
|
|
|
error = "Can create multiaccount when"
|
2018-06-30 12:17:38 +00:00
|
|
|
|
2020-07-22 13:30:07 +00:00
|
|
|
sign_in.just_fyi('Checking case when %s' % cases[0])
|
|
|
|
sign_in.create_password_input.send_keys('123456')
|
2018-06-30 12:17:38 +00:00
|
|
|
sign_in.next_button.click()
|
2020-07-22 13:30:07 +00:00
|
|
|
if sign_in.maybe_later_button.is_element_displayed(10):
|
|
|
|
self.driver.fail('%s %s' % (error, cases[0]))
|
2018-06-30 12:17:38 +00:00
|
|
|
|
2020-07-22 13:30:07 +00:00
|
|
|
sign_in.just_fyi('Checking case when %s'% cases[1])
|
|
|
|
sign_in.create_password_input.send_keys('123456')
|
|
|
|
[field.send_keys('123456') for field in (sign_in.create_password_input, sign_in.confirm_your_password_input)]
|
|
|
|
sign_in.confirm_your_password_input.delete_last_symbols(1)
|
|
|
|
sign_in.create_password_input.delete_last_symbols(1)
|
2018-06-30 12:17:38 +00:00
|
|
|
sign_in.next_button.click()
|
2020-07-22 13:30:07 +00:00
|
|
|
if sign_in.maybe_later_button.is_element_displayed(10):
|
|
|
|
self.driver.fail('%s %s' % (error, cases[1]))
|
2018-06-30 12:17:38 +00:00
|
|
|
|
2020-07-22 13:30:07 +00:00
|
|
|
sign_in.just_fyi("Checking case %s" % cases[2])
|
|
|
|
sign_in.create_password_input.send_keys('1234565')
|
|
|
|
sign_in.confirm_your_password_input.send_keys('1234567')
|
2018-06-30 12:17:38 +00:00
|
|
|
if not sign_in.find_text_part(mismatch_error):
|
2020-07-22 13:30:07 +00:00
|
|
|
self.errors.append("'%s' is not shown" % mismatch_error)
|
|
|
|
sign_in.next_button.click()
|
|
|
|
if sign_in.maybe_later_button.is_element_displayed(10):
|
|
|
|
self.driver.fail('%s %s' % (error, cases[2]))
|
|
|
|
|
2019-10-29 08:25:57 +00:00
|
|
|
self.errors.verify_no_errors()
|
2018-07-09 19:47:50 +00:00
|
|
|
|
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'])
|