def setUp(self): self.driver = DriverFactory().get_web_driver("chrome") login = ConfigHelper().getConfigOption('username1_valid', 'login') password = ConfigHelper().getConfigOption("username1_valid", "password") login_page = Login_Page(selenium_driver=self.driver) self.payment_page = login_page.login(login, password)
def _test_func(self): "авторизация тестовыми наборами пользователей" login_page = Login_Page(selenium_driver=self.driver) paymentPage = login_page.login(login, password) self.assertTrue(paymentPage.is_PaymentPage(), 'не Ожидалось ошибки авторизации')
def _test_func(self): "авторизация тестовыми негативными наборами тест пользователей" login_page = Login_Page(selenium_driver=self.driver) error = login_page.login(login, password) self.assertEqual('Wrong password, try again', error, 'Ожидалась ошибка авторизации')
def get_driver(): """setUp / teaeDown""" driver = DriverFactory().get_web_driver("chrome") login = ConfigHelper().getConfigOption('username1_valid', 'login') password = ConfigHelper().getConfigOption("username1_valid", "password") login_page = Login_Page(selenium_driver=driver) payment_page = login_page.login(login, password) # def teardown(): # driver.close() # request.addfinalizer(teardown) # return payment_page yield driver driver.close()
def test_ibit_login_negativ(self): """авторизация тестовыми негативными наборами тест пользователей""" login_page = Login_Page(selenium_driver=self.driver) error = login_page.login("*****@*****.**", "123456") self.assertEqual(error, 'Wrong password, try again', 'Ожидалась ошибка авторизации')
def test_ibit_login(self): # browser="chrome" "авторизация тестовыми наборами тест пользователей" login = ConfigHelper().getConfigOption('username1_valid', 'login') password = ConfigHelper().getConfigOption("username1_valid", "password") # убрал PageFactory # loginPage = PageFactory().getPageObject("login page", self.driver) login_page = Login_Page(selenium_driver=self.driver) payment_page = login_page.login(login, password) payment_page.select_status("mini") payment_page.select_payment_system("Payweb") proceed_page = payment_page.submit_payment() result_text = proceed_page.get_message_result() print(result_text) payment_page = proceed_page.goto_forvard() ''' print("bonus state before check: {0}".format(payment_page.get_state_bonus())) payment_page.check_bonus() print("bonus state after check: {0}".format(payment_page.get_state_bonus())) print("bonus value: %s" % payment_page.get_bonus_value()) print("you get value: %s" % payment_page.get_you_get()) print("amount: %s" % payment_page.get_amount_value()) payment_page.set_amount_value(666) # 999.2 граничные значения, дробные, отрицыт print("active status: %s" % payment_page.get_active_status()) payment_system = "WebMoney" payment_page.select_payment_system(payment_system) payment_system_actual = payment_page.get_value_payment_system() self.assertEqual(payment_system_actual, payment_system, "Ожидаем плат систему") time.sleep(2) pricing_page = payment_page.goto_pricing() time.sleep(2) payment_page = pricing_page.goto_payment() time.sleep(2) currency = "CNH" payment_page.select_currency(currency) currency_actual = payment_page.get_value_currency() self.assertTrue(currency in currency_actual, "Ожидается выбранная валюта") # payment_page.select_payment_system("QIWI") payment_page.submit_payment(False) time.sleep(2) payment_page.qiwi_close() # ошибка ввода телефона qiwi payment_page.submit_payment(False) payment_page.qiwi_set_phone("+70") proceed_page = payment_page.qiwi_submit(True) is_error = payment_page.is_error_qiwi_phone() self.assertTrue(is_error, "Должна быть ошибка в форме ввода телефона") payment_page.qiwi_close() # корректный телефон qiwi payment_page.submit_payment(False) payment_page.qiwi_set_phone("+79271591181") proceed_page = payment_page.qiwi_submit() result_text = proceed_page.get_message_result() print(result_text) payment_page = proceed_page.goto_forvard() ''' time.sleep(7) self.assertTrue(True, 'all ok')