def test_incorrect_email(self): """Test rejestracji nowego użytkownika - błędny e-mail""" # Tworzę instancję klasy HomePage, dzięki czemu zyskuję możliwość # korzystania z metod w niej zawartych hp = HomePage(self.driver) hp.click_zaloguj_btn() lp = LoginPage(self.driver) lp.click_register_btn() rp = RegisterPage(self.driver) # Wpisz imię rp.fill_name("Przemek") # Wpisz nazwisko rp.fill_surname("Nowak") # Wybierz płeć rp.choose_gender("M") # Wybierz kod kraju rp.choose_country_code("+48") # Wpisz numer telefonu rp.fill_telephone('321321321') # Wpisz niepoprawny e-mail rp.fill_email('dddd.pl') # Wpisz hasło rp.fill_password('Qwessdry123@') # Wybierz narodowość rp.choose_nationality("Polska") # Zaznacz "Akceptuję Informację o polityce prywatności" rp.accept_privacy_policy() # Kliknij ZAREJESTRUJ [ NIE STOSOWAĆ DLA PRZYPADKU POZYTYWNEGO !!!!] # Sprawdź poprawność wyświetlanych błędów rp.verify_visible_errors(1, ["Nieprawidłowy adres e-mail"]) time.sleep(2)
def test_empty_password(self): register_page = RegisterPage(self.driver) register_page.enter_email(Variables.VALID_EMAIL) register_page.accept_privacy_policy() register_page.click_register_button() register_page.error_should_be_visible(Variables.NO_PASSWORD_MESSAGE)
def test_empty_email(self): register_page = RegisterPage(self.driver) register_page.enter_password(Variables.VALID_PASSWORD) register_page.enter_password_confirm(Variables.VALID_PASSWORD) register_page.accept_privacy_policy() register_page.click_register_button() register_page.email_should_be_required()
def test_different_passwords(self): register_page = RegisterPage(self.driver) register_page.enter_email(Variables.VALID_EMAIL) register_page.enter_password_confirm(Variables.VALID_PASSWORD) register_page.enter_password_confirm(Variables.OTHER_PASSWORD) register_page.accept_privacy_policy() register_page.click_register_button() register_page.error_should_be_visible( Variables.PASSWORD_NOT_MATCH_MESSAGE)
def test_short_password(self): register_page = RegisterPage(self.driver) register_page.enter_email(Variables.VALID_EMAIL) register_page.enter_password(Variables.SHORT_PASSWORD) register_page.enter_password_confirm(Variables.SHORT_PASSWORD) register_page.accept_privacy_policy() register_page.click_register_button() register_page.error_should_be_visible( Variables.PASSWORD_TOO_SHORT_MESSAGE)
def test_existing_email(self): register_page = RegisterPage(self.driver) register_page.enter_email(Variables.VALID_EMAIL) register_page.enter_password(Variables.VALID_PASSWORD) register_page.enter_password_confirm(Variables.VALID_PASSWORD) register_page.accept_privacy_policy() register_page.click_register_button() register_page.error_should_be_visible( Variables.USER_ALREADY_EXISTS_MESSAGE)
def test_incorrect_email(self, name, surname, country_code, phone, invalid_email, password, country, gender): hp = HomePage(self.driver) hp.click_zaloguj_btn() lp = LoginPage(self.driver) lp.click_register_btn() rp = RegisterPage(self.driver) rp.fill_name(name) rp.fill_surname(surname) rp.choose_gender(gender) rp.choose_country_code(country_code) rp.fill_telephone(phone) rp.fill_email(invalid_email) rp.fill_password(password) rp.choose_nationality(country) rp.accept_privacy_policy() rp.accept_terms() rp.verify_visible_errors(1, ["Nieprawidłowy adres e-mail"])
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)