예제 #1
0
class CheckAuth(unittest.TestCase):

    def setUp(self) -> None:
        default_setup(self)

        self.page = MainPage(self.driver)
        self.page.open()

    def test_check_auth(self):
        self.page.open_auth_popup()
        self.page.auth(self.EMAIL, self.PASSWORD)
        is_all_right = self.page.check_auth()
        self.assertTrue(is_all_right)

    def test_check_exit(self):
        self.page.open_auth_popup()
        self.page.auth(self.EMAIL, self.PASSWORD)
        is_all_right = self.page.check_auth()
        self.assertTrue(is_all_right)
        self.page.open_exit_popup()
        self.page.check_exit()
    
    def test_check_wrong_passwrd_auth(self):
        self.page.open_auth_popup()
        self.page.auth(self.EMAIL, "wrong_password")
        is_all_right = self.page.check_auth_password_error("Неверный пароль")
        self.assertTrue(is_all_right)

    def test_check_empty_password_auth(self):
        self.page.open_auth_popup()
        self.page.auth(self.EMAIL, "")
        is_all_right = self.page.check_auth_password_error("Пароль должен содержать не менее 6 символов")
        self.assertTrue(is_all_right)

    def test_check_unexisting_account_auth(self):
        self.page.open_auth_popup()
        self.page.auth("*****@*****.**", "wrong_password")
        is_all_right = self.page.check_auth_email_error("Такого пользователя не существует")
        self.assertTrue(is_all_right)

    def test_check_empty_email_auth(self):
        self.page.open_auth_popup()
        self.page.auth("", self.PASSWORD)
        is_all_right = self.page.check_auth_email_error("Введите E-mail")
        self.assertTrue(is_all_right)

    def test_check_wrong_format_email_auth(self):
        self.page.open_auth_popup()
        self.page.auth("wrong_emailmail.ru", self.PASSWORD)
        is_all_right = self.page.check_auth_email_error("Неправильный формат E-mail")
        self.assertTrue(is_all_right)

    def test_check_move_to_registration(self):
        self.page.open_auth_popup()
        self.page.move_to_reg_popup()
        is_all_right = self.page.check_reg_popup_appearance()
        self.assertTrue(is_all_right)

    def tearDown(self):
        self.driver.quit()
예제 #2
0
class CheckFilmPopup(unittest.TestCase):
    def setUp(self) -> None:
        default_setup(self)

        self.page = MainPage(self.driver)
        self.page.open()

    def test_popup_like(self):
        self.page.open_auth_popup()
        self.page.auth(self.EMAIL, self.PASSWORD)
        is_auth_right = self.page.check_auth()
        self.assertTrue(is_auth_right)
        self.page.open_popup()
        self.page.click_infoblock_like_button()
        is_all_right = self.page.check_infoblock_liked()
        self.assertTrue(is_all_right)

    def test_popup_dislike(self):
        self.page.open_auth_popup()
        self.page.auth(self.EMAIL, self.PASSWORD)
        is_auth_right = self.page.check_auth()
        self.assertTrue(is_auth_right)
        self.page.open_popup()
        self.page.click_infoblock_dislike_button()
        is_all_right = self.page.check_infoblock_disliked()
        self.assertTrue(is_all_right)

    def test_genre_redirect(self):
        self.page.open_popup()
        self.page.click_genre()
        is_all_right = self.page.check_genre_redirect()
        self.assertTrue(is_all_right)

    def test_actor_redirect(self):
        self.page.open_popup()
        self.page.click_actor()
        is_all_right = self.page.check_actor_redirect()
        self.assertTrue(is_all_right)

    def test_director_redirect(self):
        self.page.open_popup()
        self.page.click_director()
        is_all_right = self.page.check_director_redirect()
        self.assertTrue(is_all_right)

    def test_same_film_open(self):
        while True:
            self.page.open_popup()
            if self.page.is_same_films():
                break
            else:
                self.page.open()
        self.page.click_same_film()
        is_all_right = self.page.check_same_film_popup_open()
        self.assertTrue(is_all_right)

    def tearDown(self):
        self.driver.quit()
예제 #3
0
class CheckMyList(unittest.TestCase):
    def setUp(self) -> None:
        default_setup(self)

        self.film_page = FilmPage(self.driver)
        self.main_page = MainPage(self.driver)
        self.my_list_page = MyListPage(self.driver)
        self.main_page.open()

    def test_my_list_add(self):
        self.main_page.open_auth_popup()
        self.main_page.auth(self.EMAIL, self.PASSWORD)
        is_all_right = self.main_page.check_auth()
        self.assertTrue(is_all_right)
        self.my_list_page.open()
        self.my_list_page.count_films()
        self.film_page.open()
        self.film_page.open_infoblock()
        is_added = self.film_page.click_add_mylist_button()
        self.my_list_page.open()
        is_number_changed = self.my_list_page.check_films_number_changed(
            is_added)
        self.assertTrue(is_number_changed)

    def test_subscription_popup_open(self):
        self.main_page.open_auth_popup()
        self.main_page.auth(self.EMAIL, self.PASSWORD)
        is_all_right = self.main_page.check_auth()
        self.assertTrue(is_all_right)
        self.film_page.open()
        self.film_page.find_subscription_film()
        self.film_page.click_play_button()
        is_popup_open = self.film_page.check_subscription_popup_open()
        self.assertTrue(is_popup_open)

    def tearDown(self):
        self.driver.quit()
예제 #4
0
class CheckAuth(unittest.TestCase):
    def setUp(self) -> None:
        default_setup(self)

        self.page = MainPage(self.driver)
        self.page.open()

    def test_check_auth(self):
        self.page.open_auth_popup()
        self.page.auth(self.EMAIL, self.PASSWORD)
        is_all_right = self.page.check_auth()
        self.assertTrue(is_all_right)

    def tearDown(self):
        self.driver.quit()
예제 #5
0
class CheckMain(unittest.TestCase):

    def setUp(self) -> None:
        default_setup(self)
        self.page = MainPage(self.driver)
        self.page.open()
    
    def test_check_preview_player_appearance(self):
        self.page.open_auth_popup()
        self.page.auth(self.EMAIL, self.PASSWORD)
        self.page.open_player()
        is_all_right = self.page.check_player_appearance()
        self.assertTrue(is_all_right)

    def test_check_preview_info_popup_appearance(self):
        self.page.open_preview_info_popup()
        is_all_right = self.page.check_info_popup_appearance()
        self.assertTrue(is_all_right)

    def test_check_card_info_block_appearance(self):
        self.page.move_to_card()
        self.page.open_card_info_block()
        is_all_right = self.page.check_info_block_appearance()
        self.assertTrue(is_all_right)

    def test_check_card_player_appearance(self):
        self.page.open_auth_popup()
        self.page.auth(self.EMAIL, self.PASSWORD)
        self.page.move_to_card()
        self.page.open_card_player()
        is_all_right = self.page.check_player_appearance()
        self.assertTrue(is_all_right)

    def test_check_card_info_block_appearance_via_card_click(self):
        self.page.open_card_info_block_via_card_click()
        is_all_right = self.page.check_info_block_appearance()
        self.assertTrue(is_all_right)

    def test_check_like_needs_auth(self):
        self.page.open_infoblock()
        self.page.click_like()
        is_all_right = self.page.check_auth_popup_open()
        self.assertTrue(is_all_right)

    def test_check_dislike_needs_auth(self):
        self.page.open_infoblock()
        self.page.click_dislike()
        is_all_right = self.page.check_auth_popup_open()
        self.assertTrue(is_all_right)

    def test_check_add_my_list_needs_auth(self):
        self.page.open_infoblock()
        self.page.click_add_my_list_infoblock()
        is_all_right = self.page.check_auth_popup_open()
        self.assertTrue(is_all_right)

    def test_check_add_my_list_button(self):
        self.page.open_auth_popup()
        self.page.auth(self.EMAIL, self.PASSWORD)
        is_auth_right = self.page.check_auth()
        self.assertTrue(is_auth_right)
        self.page.open_popup()
        self.page.click_add_my_list_popup()
        is_all_right = self.page.check_add_my_list_clicked()
        self.assertTrue(is_all_right)

    def tearDown(self):
        self.driver.quit()
예제 #6
0
class CheckSettingsChange(unittest.TestCase):
    def setUp(self) -> None:
        default_setup(self)

        self.profile_page = ProfilePage(self.driver)
        self.main_page = MainPage(self.driver)
        self.main_page.open()

    def test_open_settings(self):
        self.main_page.open_auth_popup()
        self.main_page.auth(self.EMAIL, self.PASSWORD)
        is_auth = self.main_page.check_auth()
        self.assertTrue(is_auth)
        self.profile_page.open()
        self.profile_page.click_settings_form_button()
        is_settings_open = self.profile_page.check_settings_form_open()
        self.assertTrue(is_settings_open)

    def test_change_login(self):
        self.test_open_settings()
        self.profile_page.change_login(self.EMAIL + "123")
        is_error = self.profile_page.check_login_changed(self.EMAIL + "123")
        self.assertTrue(is_error)

    def test_change_email(self):
        self.test_open_settings()
        self.profile_page.change_email(self.EMAIL, self.EMAIL + "abc")
        is_error = self.profile_page.check_email_changed(self.EMAIL + "abc")
        self.profile_page.change_email(self.EMAIL + "abc", self.EMAIL)
        self.assertTrue(is_error)

    def test_change_email_exist(self):
        self.test_open_settings()
        self.profile_page.change_email(self.EMAIL, "*****@*****.**")
        is_error = self.profile_page.check_error_with_text(
            "Данный Email адрес уже существует")
        self.assertTrue(is_error)

    def test_change_email_wrong_format(self):
        self.test_open_settings()
        self.profile_page.change_email(self.EMAIL,
                                       "[email protected]@mail.ru")
        is_error = self.profile_page.check_error_with_text(
            "Неправильный формат E-mail")
        self.assertTrue(is_error)

    def test_click_safety_button(self):
        self.test_open_settings()
        self.profile_page.click_safety_button()
        is_clicked = self.profile_page.check_safety_button_clicked()
        self.assertTrue(is_clicked)

    def test_change_password(self):
        self.test_click_safety_button()
        self.profile_page.change_password(self.PASSWORD, self.PASSWORD + "s")
        self.profile_page.click_info_button()
        self.profile_page.click_safety_button()
        self.profile_page.submit_form()
        is_error = self.profile_page.check_error_with_text("Неверный пароль")
        self.assertTrue(is_error)

        self.profile_page.open()
        self.profile_page.click_settings_form_button()
        is_settings_open = self.profile_page.check_settings_form_open()
        self.assertTrue(is_settings_open)
        self.profile_page.click_safety_button()
        self.profile_page.check_safety_button_clicked()

        self.profile_page.change_password(self.PASSWORD + "s", self.PASSWORD)

    def test_password_short_error(self):
        self.test_click_safety_button()
        self.profile_page.change_new_password("123")
        self.profile_page.submit_form()
        is_error = self.profile_page.check_error_with_text(
            "Пароль должен содержать не менее 6 символов")
        self.assertTrue(is_error)

    def test_upload_avatar(self):
        self.main_page.open_auth_popup()
        self.main_page.auth(self.EMAIL, self.PASSWORD)
        self.main_page.check_auth()
        self.profile_page.open()
        result = self.profile_page.check_changing_avatar()
        self.assertTrue(result)

    def test_passwords_different(self):
        self.test_click_safety_button()
        self.profile_page.change_new_password("12334467456")
        self.profile_page.change_again_password("122343434")
        self.profile_page.submit_form()
        is_error = self.profile_page.check_error_with_text(
            "Пароли не совпадают")
        self.assertTrue(is_error)

    def test_settings_close(self):
        self.test_open_settings()
        self.profile_page.click_close_button()
        is_closed = self.profile_page.check_close_clicked()
        self.assertTrue(is_closed)

    def test_subscription(self):
        self.main_page.open_auth_popup()
        self.main_page.auth(self.EMAIL, self.PASSWORD)
        is_auth = self.main_page.check_auth()
        self.assertTrue(is_auth)
        self.profile_page.open()
        self.profile_page.click_subscription_button()
        is_closed = self.profile_page.check_umoney_redirected()
        self.assertTrue(is_closed)

    def tearDown(self):
        self.driver.quit()