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_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_invalid_postalCode(self, gender, first_name, last_name, email, password, day, month, year, company, address, city, state, postal_code, add_info, home_phone, mobile_phone, alias): """Attempt to register user with invalid postal code""" hp = HomePage(self.driver) hp.click_zaloguj_btn() lp = LoginPage(self.driver) lp.fill_email(email) lp.click_create_btn() rp = RegisterPage(self.driver) rp.choose_gender(gender) rp.fill_name(first_name) rp.fill_surname(last_name) rp.fill_password(password) rp.choose_day(day) rp.choose_month(month) rp.choose_year(year) rp.accept_newsletter() rp.accept_specialOffers() rp.fill_company(company) rp.fill_address(address) rp.fill_city(city) rp.choose_state(state) rp.fill_postalCode(postal_code) rp.fill_addInfo(add_info) rp.fill_homePhone(home_phone) rp.fill_mobilePhone(mobile_phone) rp.fill_alias(alias) rp.click_registerButton() rp.check_postalCode_error()
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)