def test_validation_email_with_numbers_after_dog(self): """Test for check validation Email field when email with numbers after dog""" print( '========================================================================' ) print( 'Test for check validation Email field when email with numbers after dog' ) # Load Registrtion page self.reg_page.open_registration_page() driver = self.reg_page.driver global_m = Global_Methods(driver) # cheks if right title assert self.reg_page.is_title_matches( ), "Registration title page doesn't match" prifileObj = RegistrationProfile() self.reg_page.fill_email(prifileObj.email_with_numbers_after_dog) self.reg_page.click_sign_up_btn() #time.sleep(2) # check has field Email error text assert global_m.is_exist_by_xpath(RegistrationPageLocators.HAS_ERROR_FLD_TEXT['valuename'], 'E-Mail Address') == False, \ "The Email field is right. There should be no message about error for Email field for email with numbers after dog" print( '--------- SUCCESS test_validation_email_with_numbers_after_dog -----------' ) driver.quit()
def test_validation_not_match_passwrd_to_confirm_passwrd(self): """Test for check validation not matched fields Confirm password and password""" print( '========================================================================' ) print( 'Test for check validation not matched fields Confirm password and password' ) #Load Registrtion page self.reg_page.open_registration_page() driver = self.reg_page.driver global_m = Global_Methods(driver) #cheks if right title assert self.reg_page.is_title_matches( ), "Registration title page doesn't match" prifileObj = RegistrationProfile() email_registration = prifileObj.get_random_email() self.reg_page.fill_name(prifileObj.new_user_date['name']) self.reg_page.fill_email(email_registration) self.reg_page.fill_password(prifileObj.new_user_date['password']) self.reg_page.fill_confirm_password( prifileObj.new_user_date['not_right_confirm_password']) self.reg_page.click_sign_up_btn() time.sleep(2) # check has field Password error text assert global_m.is_exist_by_xpath(RegistrationPageLocators.HAS_ERROR_FLD_TEXT['valuename'], 'Password') == True, \ "The Confirm password field is not right. There should be message about error for do not match password" # check field Password on right error message about not match the password assert self.reg_page.get_hasError_validation_text_for_field('Password') == prifileObj.valid_for_not_match_password_text, \ "No validation message for Password and Confirm password fields are do not matched" print( '--------- SUCCESS test_validation_not_match_passwrd_to_confirm_passwrd -----------' ) driver.quit()
def test_validation_email_with_max_length_greater_64_befor_dog(self): """Test for check field email when email with email with max length greater 64 befor dog""" print( '========================================================================' ) print( 'Test for check field email when email with email with max length greater 64 befor dog' ) # Load Registrtion page self.reg_page.open_registration_page() driver = self.reg_page.driver global_m = Global_Methods(driver) # cheks if right title assert self.reg_page.is_title_matches( ), "Registration title page doesn't match" prifileObj = RegistrationProfile() self.reg_page.fill_email( prifileObj.email_with_max_length_greater_64_befor_dog) self.reg_page.click_sign_up_btn() #time.sleep(2) # check has field Email error text assert global_m.is_exist_by_xpath(RegistrationPageLocators.HAS_ERROR_FLD_TEXT['valuename'], 'E-Mail Address') == True, \ "The Email field is not right. There should be message about error for Email field for email \ with email_with_max_length_greater_64_befor_dog" # check field Email on right error message about not valid field assert self.reg_page.get_hasError_validation_text_for_field('E-Mail Address') == prifileObj.no_valid_for_email_text, \ "No validation message for Email field about it'is not valid" print( '--------- SUCCESS test_validation_email_with_max_length_64_befor_dog -----------' ) driver.quit()
def test_validation_passwrd_length_less_6(self): """Test for check validation field password on length less 6""" print( '========================================================================' ) print('Test for check validation field password on length less 6') #Load Registrtion page self.reg_page.open_registration_page() driver = self.reg_page.driver global_m = Global_Methods(driver) #cheks if right title assert self.reg_page.is_title_matches( ), "Registration title page doesn't match" prifileObj = RegistrationProfile() email_registration = prifileObj.get_random_email() self.reg_page.fill_name(prifileObj.new_user_date['name']) self.reg_page.fill_email(email_registration) self.reg_page.fill_password(prifileObj.password_5_length) self.reg_page.fill_confirm_password(prifileObj.password_5_length) self.reg_page.click_sign_up_btn() time.sleep(2) # check has field Password error text assert global_m.is_exist_by_xpath(RegistrationPageLocators.HAS_ERROR_FLD_TEXT['valuename'], 'Password') == True, \ "The password field is not right. There should be message about error that password length have not be less 6 " # check field Password on right error message about ;ength should be 6 and greater assert self.reg_page.get_hasError_validation_text_for_field('Password') == prifileObj.valid_for_password_length_less_6, \ "No validation message for Password that password field length should not be less 6" print( '--------- SUCCESS test_validation_passwrd_length_less_6 -----------' ) driver.quit()
def test_validation_name_field(self): """Test for check validation Name field""" print('========================================================================') print('Test for check validation Name field') #Load Registrtion page self.reg_page.open_registration_page() driver = self.reg_page.driver #cheks if right title assert self.reg_page.is_title_matches(), "Registration title page doesn't match" prifileObj = RegistrationProfile() #========================================================================= #check field name when field name is right (has 255 lendth) self.reg_page.fill_name(prifileObj.name_255_length) self.reg_page.click_sign_up_btn() #check has field Name error text global_m = Global_Methods(driver) assert global_m.is_exist_by_xpath(RegistrationPageLocators.HAS_ERROR_FLD_TEXT['valuename'], 'Name') == False, \ "The Name field is right. There should be no message about error for Name field long" # ========================================================================= # check field name when field name has more than 255 long and isn' right (has 256 lendth) self.reg_page.clear_name() #time.sleep(3) self.reg_page.fill_name(prifileObj.name_256_length) self.reg_page.click_sign_up_btn() time.sleep(1) # check has field Name error text and this validation text is right assert global_m.is_exist_by_xpath(RegistrationPageLocators.HAS_ERROR_FLD_TEXT['valuename'], 'Name') == True, \ "The Name field is not right. There should be message about error for Name field long" # check field Name on right error message about length assert self.reg_page.get_hasError_validation_text_for_field('Name') == prifileObj.valid_for_long_name_text, \ "No validation message for Name field about it's long" # ========================================================================= # check field name when field name has different characters not lattes and not numbers self.reg_page.clear_name() self.reg_page.fill_name(prifileObj.name_with_different_characters) self.reg_page.click_sign_up_btn() time.sleep(1) # check has field Name error text and this validation text is right assert global_m.is_exist_by_xpath(RegistrationPageLocators.HAS_ERROR_FLD_TEXT['valuename'], 'Name') == False, \ "The Name field is right. There should be no message about error for Name field" # ========================================================================= # check field name when field name has capital letters self.reg_page.clear_name() self.reg_page.fill_name(prifileObj.name_with_capital_letters) self.reg_page.click_sign_up_btn() time.sleep(1) # check has field Name error text and this validation text is right assert global_m.is_exist_by_xpath(RegistrationPageLocators.HAS_ERROR_FLD_TEXT['valuename'], 'Name') == False, \ "The Name field is right. There should be no message about error for Name field" # ========================================================================= # check field name when field name has cirillic letters self.reg_page.clear_name() self.reg_page.fill_name(prifileObj.name_with_cirillic_letters) self.reg_page.click_sign_up_btn() time.sleep(1) # check has field Name error text and this validation text is right assert global_m.is_exist_by_xpath(RegistrationPageLocators.HAS_ERROR_FLD_TEXT['valuename'], 'Name') == False, \ "The Name field is right. There should be no message about error for Name field" # ========================================================================= # check field name when field name has one letter self.reg_page.clear_name() self.reg_page.fill_name(prifileObj.name_with_one_letter) self.reg_page.click_sign_up_btn() time.sleep(1) # check has field Name error text and this validation text is right assert global_m.is_exist_by_xpath(RegistrationPageLocators.HAS_ERROR_FLD_TEXT['valuename'], 'Name') == False, \ "The Name field is right. There should be no message about error for Name field" print('--------- SUCCESS test_validation_name_field -----------') driver.quit()