def test_registration_positive(self): """Positive test for check redirect on login page after btn Sign In click""" print('========================================================================') print('Positive test for check redirect on login page after btn Sign In click') #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" #fill all registartion fields 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['confirm_password']) self.reg_page.click_sign_up_btn() #print reg_page.get_login_title() #assert reg_page.is_login_title_matches(), "Login title page doesn't match" time.sleep(1) assert self.reg_page.get_login_title() == 'Snov.io Log In',"Login title page doesn't match" print('--------- SUCCESS test_registration_positive -----------') driver.quit()
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_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_registration_empty_Fields(self): """Negative test for check the validation entering the strigs with spaces on registration fields""" print('========================================================================') print('Negative test for check the validation entering the strigs with spaces on registration fields') # 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" str_with_spaces = ' ' self.reg_page.fill_name(str_with_spaces) self.reg_page.fill_email(str_with_spaces) self.reg_page.fill_password(str_with_spaces) self.reg_page.fill_confirm_password(str_with_spaces) self.reg_page.click_sign_up_btn() #test that regiastartion page is opened assert self.reg_page.is_title_matches(), "Registration title page doesn't match" prifileObj = RegistrationProfile() time.sleep(3) #get count elements with error message cnt_error = self.reg_page.get_count_hasError_fields() print('cnt_error='+str(cnt_error)) #check that we have right the error elements count assert cnt_error == prifileObj.count_registration_hasError_fields, \ "Count requirements fields has Errors doesn't match" # check that we have right the header about incorrect input dara assert self.reg_page.is_error_validation_header(), "No error header" #check that each required field has uder the right error validation text #check field Name assert self.reg_page.get_hasError_validation_text_for_field('Name') == prifileObj.valid_requirement_text_for_name, \ "No validation message for Name field" #check field Email Adress assert self.reg_page.get_hasError_validation_text_for_field('E-Mail Address') == prifileObj.valid_requirement_text_for_email, \ "No validation message for Email field" # check field Password assert self.reg_page.get_hasError_validation_text_for_field( 'Password') == prifileObj.valid_requirement_text_for_password, \ "No validation message for Password field" print('--------- SUCCESS test_registration_empty_Fields -----------') 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_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()
def test_registration_entering_an_existing_email(self): """Negative test for check validation on entering an existing email""" print('========================================================================') print('Negative test for check validation on entering an existing email') #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" #fill all registartion fields prifileObj = RegistrationProfile() email_registration = prifileObj.get_random_email() #First registration with some 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['confirm_password']) self.reg_page.click_sign_up_btn() time.sleep(2) assert self.reg_page.is_login_title_matches(), "Login title page doesn't match" driver.quit() #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" # Second registration with the same 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['confirm_password']) self.reg_page.click_sign_up_btn() time.sleep(2) # test that regiastartion page is opened assert self.reg_page.is_title_matches(), "Registration title page doesn't match" prifileObj = RegistrationProfile() #check that we have right the error elements count # get count elements with error message cnt_error = self.reg_page.get_count_hasError_fields() print('cnt='+str(cnt_error)) assert cnt_error == prifileObj.count_registration_hasError_fields_entering_existing_email, \ "Count fields has Errors doesn't match" # check that we have right the header about incorrect input dara assert self.reg_page.is_error_validation_header(), "No error header" #check that each required field has uder the right error validation text #check field Email Adress assert self.reg_page.get_hasError_validation_text_for_field('E-Mail Address') == prifileObj.valid_exist_for_email_text, \ "No validation message for Email field" print('--------- SUCCESS test_registration_entering_an_existing_email -----------') driver.quit()