2018-08-16 19:47:13 +03:00
|
|
|
import pytest
|
2018-08-13 15:09:53 +03:00
|
|
|
|
2018-08-23 16:50:19 +03:00
|
|
|
from tests import marks, common_password, unique_password
|
2018-06-29 19:27:30 +02:00
|
|
|
from tests.base_test_case import MultipleDeviceTestCase, SingleDeviceTestCase
|
|
|
|
from views.sign_in_view import SignInView
|
|
|
|
|
|
|
|
|
|
|
|
@marks.all
|
|
|
|
@marks.sign_in
|
|
|
|
class TestSignIn(SingleDeviceTestCase):
|
|
|
|
|
2018-09-28 18:30:06 +03:00
|
|
|
@marks.testrail_id(5312)
|
|
|
|
@marks.critical
|
2018-06-29 19:27:30 +02:00
|
|
|
def test_login_with_new_account(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
2019-05-13 10:58:41 +03:00
|
|
|
sign_in.create_user()
|
|
|
|
profile = sign_in.profile_button.click()
|
|
|
|
default_username = profile.default_username_text.text
|
2018-06-29 19:27:30 +02:00
|
|
|
self.driver.close_app()
|
|
|
|
self.driver.launch_app()
|
|
|
|
sign_in.accept_agreements()
|
2019-05-13 10:58:41 +03:00
|
|
|
if not sign_in.element_by_text(default_username).is_element_displayed():
|
2019-08-19 02:31:42 +03:00
|
|
|
self.driver.fail('Username is not shown while login')
|
2018-06-29 19:27:30 +02:00
|
|
|
sign_in.sign_in()
|
|
|
|
if not sign_in.home_button.is_element_displayed():
|
2019-08-19 02:31:42 +03:00
|
|
|
self.driver.fail('User is not logged in')
|
2018-06-29 19:27:30 +02:00
|
|
|
|
2018-09-28 18:30:06 +03:00
|
|
|
@marks.testrail_id(5463)
|
|
|
|
@marks.medium
|
2018-06-29 19:27:30 +02:00
|
|
|
def test_login_with_incorrect_password(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
|
|
|
sign_in.create_user()
|
|
|
|
profile = sign_in.profile_button.click()
|
|
|
|
profile.logout()
|
2018-07-17 18:27:00 +02:00
|
|
|
if sign_in.ok_button.is_element_displayed():
|
|
|
|
sign_in.ok_button.click()
|
2020-04-07 16:57:31 +02:00
|
|
|
sign_in.multi_account_on_login_button.click()
|
2018-06-29 19:27:30 +02:00
|
|
|
sign_in.password_input.set_value(common_password + '1')
|
|
|
|
sign_in.sign_in_button.click()
|
2019-07-15 18:53:56 +03:00
|
|
|
sign_in.find_full_text("Wrong password")
|
2018-06-29 19:27:30 +02:00
|
|
|
|
2018-07-11 16:14:39 +02:00
|
|
|
@marks.logcat
|
2018-09-28 18:30:06 +03:00
|
|
|
@marks.testrail_id(5415)
|
|
|
|
@marks.critical
|
2018-07-09 21:47:50 +02:00
|
|
|
def test_password_in_logcat_sign_in(self):
|
|
|
|
sign_in = SignInView(self.driver)
|
2018-08-23 16:50:19 +03:00
|
|
|
sign_in.create_user(password=unique_password)
|
2018-07-09 21:47:50 +02:00
|
|
|
profile = sign_in.profile_button.click()
|
|
|
|
profile.logout()
|
|
|
|
sign_in.sign_in()
|
2019-09-24 17:22:20 +03:00
|
|
|
values_in_logcat = sign_in.find_values_in_logcat(password=unique_password)
|
|
|
|
if values_in_logcat:
|
|
|
|
self.driver.fail(values_in_logcat)
|
2018-07-09 21:47:50 +02:00
|
|
|
|
2018-09-28 18:30:06 +03:00
|
|
|
@marks.testrail_id(5327)
|
2019-03-05 18:43:30 +02:00
|
|
|
@marks.medium
|
2018-06-29 19:27:30 +02:00
|
|
|
def test_offline_login(self):
|
2019-10-10 20:38:50 +03:00
|
|
|
sign_in = SignInView(self.driver)
|
2018-06-29 19:27:30 +02:00
|
|
|
sign_in.create_user()
|
2019-10-10 20:38:50 +03:00
|
|
|
self.driver.close_app()
|
2018-10-22 23:30:32 +03:00
|
|
|
sign_in.toggle_airplane_mode()
|
2019-10-10 20:38:50 +03:00
|
|
|
self.driver.launch_app()
|
2018-06-29 19:27:30 +02:00
|
|
|
home = sign_in.sign_in()
|
|
|
|
home.home_button.wait_for_visibility_of_element()
|
2019-02-11 22:24:36 +01:00
|
|
|
connection_text = sign_in.connection_status.text
|
2018-08-16 19:47:13 +03:00
|
|
|
if connection_text != 'Offline':
|
2019-10-21 14:48:45 +02:00
|
|
|
self.driver.fail("Connection status text '%s' doesn't match expected 'Offline'" % connection_text)
|