def test_incorrect_password(self): home_page = HomePage(self.driver) home_page.click_sign_in_btn() time.sleep(2) login_page = LoginPage(self.driver) login_page.click_registration_btn() register_page = RegisterPage(self.driver) register_page.fill_name_field(td.valid_name) register_page.fill_surname_field(td.valid_surname) register_page.choose_gender(td.gender) register_page.fill_phone_number_country_code_field(td.valid_country) register_page.fill_phone_field(td.valid_phone) register_page.fill_email_field(td.valid_email) register_page.fill_password_field(td.invalid_password) register_page.fill_country_field(td.valid_country) register_page.select_privacy_policy() register_page.click_register_btn() error_notices = self.driver.find_elements(*RegisterPageLocators.ERROR_NOTICES) visible_error_notices = [] for error in error_notices: if error.is_displayed(): visible_error_notices.append(error) self.assertEqual(len(visible_error_notices),1) self.assertEqual(visible_error_notices[0].get_attribute('innerText'),u"Wpisz hasło") time.sleep(5)
def test_incorrect_email(self): home_page = HomePage(self.driver) #Checks if the word "Python" is in title home_page._verify_page() home_page.click_zaloguj_button() login_page = LoginPage(self.driver) login_page.click_rejestracja_button() register_page = RegisterPage(self.driver) register_page.fill_name_field(td.valid_name) register_page.fill_surname_field(td.valid_surname) register_page.choose_gender(td.gender) register_page.fill_telephone_field(td.valid_telephone) register_page.fill_email_field("sasda.pl") register_page.fill_password_field(td.valid_password) register_page.fill_country_field(td.valid_country) register_page.accept_privacy_policy() errors = register_page.return_displayed_error_notices() assert len(errors) == 1 error_text = errors[0].get_attribute("innerText") assert error_text == u"Nieprawidłowy adres e-mail"
def test_correct_registration(self): home_page = HomePage(self.driver) #Checks if the word "Python" is in title home_page._verify_page() home_page.click_zaloguj_button() login_page = LoginPage(self.driver) login_page.click_rejestracja_button() register_page = RegisterPage(self.driver) register_page.fill_name_field(td.valid_name) register_page.fill_surname_field(td.valid_surname) register_page.choose_gender(td.gender) register_page.fill_telephone_field(td.valid_telephone) register_page.fill_email_field(td.valid_email) register_page.fill_password_field(td.valid_password) register_page.fill_country_field(td.valid_country) register_page.accept_privacy_policy() register_page.check_if_register_button_is_enabled() register_page.check_if_no_error_notice_is_presented() time.sleep(2)