def test_user_extend_abonement(self): driver = self.driver main_steps = MainPage(driver) popup_steps = PopupSignIn(driver) user_steps = PaymNotYandexRu(driver) main_steps.go_to_sgnIn() user_steps.enter_email() user_steps.enter_password() popup_steps.click_button_login() for el in range(2): try: self.driver.find_element_by_link_text("Привет") print('Ok. Found on %s iteration' % el) break except NoSuchElementException: driver.get("https://web-dev01.interneturok.ru/signout") main_steps.go_to_sgnIn() user_steps.enter_email() user_steps.enter_password() popup_steps.click_button_login() raise NoSuchElementException
def test_simulator_passed_in_pay_lesson(self): driver = self.driver main_steps = MainPage(driver) user_steps = PaymNotYandexRu(driver) popup_steps = PopupSignIn(driver) steps_exercise = Exercise(driver) get_url = URLPaidLesson(driver) with allure.step("Нажать на кнопку Войти"): main_steps.go_to_sgnIn() with allure.step("Ввожу [email protected]/password=123456"): user_steps.enter_email() user_steps.enter_password() with allure.step("Нажать на кнопку Авторизоваться"): popup_steps.click_button_login() with allure.step("Перейти на урок =Плотность"): get_url.go_physics_7_grade_trainers() with allure.step("Нажать на кнопку Пройти"): steps_exercise.go_exercise() with allure.step("Начать отвечать на ответы в Тренажере"): steps_exercise.test() with allure.step("Нажать на кнопку Завершить"): steps_exercise.click_button_finish() with allure.step("Пройденный Тренажёр помечается как Пройден"): self.assertEquals( u"Пройден", self.driver.find_element_by_css_selector( "span.result-mark.good").text) with allure.step( "После пройденного Тренажёра название кнопки Пройти поменялась на Повторить" ): self.assertEquals( u"Повторить", self.driver.find_element_by_xpath("//li/div[2]/span/a").text)
def test_user_ask_question_In_pay_lesson(self): driver = self.driver main_steps = MainPage(driver) popup_steps = PopupSignIn(driver) user_steps = PaymNotYandexRu(driver) user = PagePaidLessonQuestion(driver) get_url = URLPaidLesson(driver) delete_steps = Cycles(driver) with allure.step("Нажать на кнопку Войти"): main_steps.go_to_sgnIn() with allure.step("Ввожу [email protected]/password=123456"): user_steps.enter_email() user_steps.enter_password() with allure.step("Нажать на кнопку Авторизоваться"): popup_steps.click_button_login() with allure.step("Перейти на урок =Химические элементы. Символы химических элементов"): get_url.go_chemistry_8_grade_questions() with allure.step("Удалить существующие вопросы в списке"): delete_steps.delete_all_question() with allure.step("Ввести текст в поле ввода Привет Rich"): user.ask_question() with allure.step("Нажать на кнопку Отправить"): user.post_question() with allure.step("Проверяю отображение опубликованного в списке Вопроса"): # self.assertEqual(u"Привет Rich", self.driver.find_element_by_css_selector("p.comment__text").text) self.assertEquals(u"Привет Rich", self.driver.find_element_by_css_selector("p.comment__text").text)
def test_user_note_in_pay_lesson(self): driver = self.driver main_steps = MainPage(driver) user_steps = PaymNotYandexRu(driver) popup_steps = PopupSignIn(driver) notes_steps = Notes(driver) get_url = URLPaidLesson(driver) with allure.step("Нажать на кнопку Войти"): main_steps.go_to_sgnIn() with allure.step("Ввожу [email protected]/password=123456"): user_steps.enter_email() user_steps.enter_password() with allure.step("Нажать на кнопку Авторизоваться"): popup_steps.click_button_login() with allure.step( "Перейти на урок =Химические элементы. Символы химических элементов" ): get_url.go_chemistry_8_grade_video() with allure.step("На странице урока нажать на виджет Заметка"): notes_steps.open_notes() with allure.step("В поле ввода ввести текст Hello"): notes_steps.write_note() with allure.step("Нажать на кнопку Сохранить"): notes_steps.save_note() with allure.step("Перейти в ЛК во вкладку Заметка"): notes_steps.go_to_profile() with allure.step("В ЛК отображается сохранённая Заметка"): self.assertEquals( "Hello", self.driver.find_element_by_css_selector( "p.profile-content__note").text)
def test_confirm_the_mail(self): driver = self.driver steps_mail = DataMail(driver) steps_main = MainPage(driver) steps_user = PaymNotYandexRu(driver) steps_popup = PopupSignIn(driver) with allure.step("Авторизоваться в почте mail П [email protected]"): steps_mail.login_in_accaunt_user_Paymnotyandex_check_mail() with allure.step("Зайти в пришедшее письмо и подтверить почту"): steps_mail.open_mail_click_on_the_link_to_confirm_the_mail() with allure.step("Перейти на сайт ИУ на главную страницу"): steps_main.go_to_internetUrok() with allure.step("Нажать на кнопку Войти"): steps_main.go_to_sgnIn() with allure.step("Ввожу [email protected]/password=123456"): steps_user.enter_email() steps_user.enter_password() with allure.step("Нажать на кнопку Авторизоваться"): steps_popup.click_button_login() with allure.step("После авторизации у П не отображается нотификация " "Подтвердите адрес электронной почты в течение 48 ч." " "): self.assertFalse( self.is_element_present(By.CSS_SELECTOR, "div.top-banner__buttons")) with allure.step( "После авторизации у П отображается нотификация (Адрес электронной почты успешно подтвержден)" ): self.assertEqual( u"Адрес электронной почты успешно подтвержден", driver.find_element_by_css_selector("p.top-banner__text").text)
def test_user_write_comment_in_pay_lesson(self): driver = self.driver main_steps = MainPage(driver) user_steps = PaymNotYandexRu(driver) popup_steps = PopupSignIn(driver) user = PagePaidLessonComment(driver) get_url = URLPaidLesson(driver) with allure.step("Нажать на кнопку Войти"): main_steps.go_to_sgnIn() with allure.step("Ввожу [email protected]/password=123456"): user_steps.enter_email() user_steps.enter_password() with allure.step("Нажать на кнопку Авторизоваться"): popup_steps.click_button_login() with allure.step( "Перейти на урок =Урок 17. Вопрос 3. Выполняйте проверку в уравнениях и неравенствах." ): get_url.go_algebra_11_grade_comment() with allure.step("На странице урока нажать на кнопку Комментарии"): user.click_link_comments() with allure.step("Ввести текст в поле ввода Привет Rich"): user.write_comment() with allure.step("Нажать на кнопку Отправить"): user.post_comment() with allure.step( "Проверяю отображение опубликованного в списке комментария"): self.assertEquals( u"Привет Rich", self.driver.find_element_by_css_selector( "p.comment__text").text) with allure.step("Удалить опубликованный комментарий"): user.delete_comment()
def test_validate_data(self): driver = self.driver session = PaymNotYandexRu(driver) popup = PopupSignIn(driver) driver.execute_script("window.open()") session.enter_email() session.enter_password() popup.click_button_login() driver.get_cookies() self.assertTrue(driver.find_element_by_link_text("Мой профиль"))
def test_buy_ticket_per_100_rubles(self): driver = self.driver steps_main_page = MainPage(driver) steps_popup = PopupRegistration(driver) steps_user = PaymNotYandexRu(driver) steps_in_profile = PageProfile(driver) refresh_page = RefreshPage(driver) with allure.step("Нажать на кнопку Войти"): steps_main_page.go_to_sgnIn() with allure.step("В поп-апе регистрации нажать Зарегистрироваться"): steps_popup.go_to_popup_registration() with allure.step("Ввожу email/password = [email protected]"): steps_user.reg_enter_email() steps_user.reg_enter_password() with allure.step("Нажать на кнопку Зарегистрироваться"): steps_popup.click_sign_up() with allure.step("Перейти в мой профиль"): steps_in_profile.go_to_my_profile() with allure.step( "В ЛК, в виджете абонемент нажать на кнопку оплатить абонемент" ): steps_in_profile.click_button_buy_subscription() with allure.step("В поп-апе оплаты отключить автоплатеж"): steps_in_profile.popup_click_enable_autopayment() with allure.step( "В поп-апе оплаты нажать на кнопку Оплатить абонемент"): steps_in_profile.popup_click_buy_subscription() with allure.step("На сайте ЯК ввести данные карты"): steps_in_profile.enter_data_card() with allure.step("Вернулся в Мой профиль"): steps_in_profile.go_to_my_profile() with allure.step("Обновить страницу"): refresh_page.refresh() assert (self.driver.find_element_by_css_selector( ".profile-abonement__row:nth-child(1)")) with allure.step( "В виджете отображается купленный абонемент без автоплатежа с тарифом 31 день" ): self.assertIn( "Осталось:\n31 день\nАвтопродление:\nВыкл.\nПодробнее об абонементе Продлить абонемент", driver.find_element_by_css_selector( "div.profile-abonement__body").text)
def test_no_stub_in_pay_lesson(self): driver = self.driver main_steps = MainPage(driver) popup_steps = PopupSignIn(driver) user_steps = PaymNotYandexRu(driver) get_url = URLPaidLesson(driver) with allure.step("Нажать на кнопку Войти"): main_steps.go_to_sgnIn() with allure.step("Ввожу [email protected]/password=123456"): user_steps.enter_email() user_steps.enter_password() with allure.step("Нажать на кнопку Авторизоваться"): popup_steps.click_button_login() with allure.step( "Перейти на урок= Химические элементы. Символы химических элементов" ): get_url.go_chemistry_8_grade_video() with allure.step("Проверить отсуствия заглушки видеоурока"): self.assertFalse( self.is_element_present(By.CLASS_NAME, "video-blocker__body"))
def test_user_extend_subscription(self): driver = self.driver main_steps = MainPage(driver) popup_steps = PopupSignIn(driver) user_steps = PaymNotYandexRu(driver) profile_steps = PageProfile(driver) refresh_page = RefreshPage(driver) with allure.step("Нажать на кнопку Войти"): main_steps.go_to_sgnIn() with allure.step("Ввожу [email protected]/password=123456"): user_steps.enter_email() user_steps.enter_password() with allure.step("Нажать на кнопку Авторизоваться"): popup_steps.click_button_login() with allure.step("Перейти в ЛК"): profile_steps.go_to_my_profile() with allure.step( "В ЛК, в виджете абонемент нажать на кнопку продлить абонемент" ): profile_steps.click_extend_subscription() with allure.step("В поп-апе оплаты нажать на кнопку Оплатить"): profile_steps.popup_click_buy_subscription() with allure.step("На сайте ЯК ввести данные карты"): profile_steps.enter_data_card() with allure.step("Вернуться в ЛК"): profile_steps.go_to_my_profile() with allure.step("Обновить страницу"): refresh_page.refresh() assert (self.driver.find_element_by_css_selector( ".profile-abonement__row:nth-child(1)")) with allure.step( "После продления абонемента в виджете отображается дата 62 дня" ): self.assertIn( "Осталось:\n62 дня\nАвтопродление:\n\nВкл.\nПодробнее об абонементе Продлить абонемент", driver.find_element_by_css_selector( "div.profile-abonement__body").text)
def test_passed_in_free_lesson(self): driver = self.driver main_steps = MainPage(driver) user_steps = PaymNotYandexRu(driver) popup_steps = PopupSignIn(driver) steps_test = FreeTest(driver) get_url = URLFreeLesson(driver) with allure.step("Нажать на кнопку Войти"): main_steps.go_to_sgnIn() with allure.step("Ввожу [email protected]/password=123456"): user_steps.enter_email() user_steps.enter_password() with allure.step("Нажать на кнопку Авторизоваться"): popup_steps.click_button_login() with allure.step("Перейти на урок =Ленточные черви"): get_url.go_biology_7_grade_test() with allure.step("Нажать на кнопку Пройти"): steps_test.go_test() with allure.step("Отвечать на вопросы в тесте"): steps_test.start_test() with allure.step("В финальном поп-апе нажать на кнопку Завершить"): steps_test.click_button_finish() with allure.step("После пройденного Теста название кнопки Пройти поменялась на Повторить"): self.assertEquals(u"Повторить", self.driver.find_element_by_xpath("//li/div[2]/span/a").text)