def test_searchCustomerByName(self, setup): self.logger.info("***** ***** TEST_005 Search Customer By Name ***** *****") self.driver = setup self.driver.get(self.baseURL) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("***** Login Successful *****") self.logger.info("***** Starting Search Customer By Name *****") self.adcust = AddCustomer(self.driver) self.adcust.clickOnCustomersMenu() self.adcust.clickOnCustomersMenuItem() searchcust = SearchCustomer(self.driver) searchcust.setFirstName("Victoria") searchcust.setLastName("Terces") searchcust.clickSearch() time.sleep(5) status = searchcust.searchCustomerByName("Victoria Terces") assert status == True self.logger.info("***** ***** TEST_005 Search Customer By Name Finished ***** *****") self.driver.close()
class Test_005_SearchCustomerByName: baseURL = ReadConfig.getApplicationURL() username = ReadConfig.getUserEmail() password = ReadConfig.getPassword() logger = LogGen.loggen() @pytest.mark.regression def test_searchCustomerByName(self, setup): self.logger.info("***** ***** TEST_005 Search Customer By Name ***** *****") self.driver = setup self.driver.get(self.baseURL) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("***** Login Successful *****") self.logger.info("***** Starting Search Customer By Name *****") self.adcust = AddCustomer(self.driver) self.adcust.clickOnCustomersMenu() self.adcust.clickOnCustomersMenuItem() searchcust = SearchCustomer(self.driver) searchcust.setFirstName("Victoria") searchcust.setLastName("Terces") searchcust.clickSearch() time.sleep(5) status = searchcust.searchCustomerByName("Victoria Terces") assert status == True self.logger.info("***** ***** TEST_005 Search Customer By Name Finished ***** *****") self.driver.close()
def test_searchCustomerByEmail(self, setUp): self.driver = setUp self.driver.get(self.baseURL) self.lp = LoginPage(self.driver) self.lp.setUsername(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info( "*******************Login Successful**********************") self.logger.info( "*******************Start searching Customer by Email**********************" ) self.addcust = AddCustomer(self.driver) self.addcust.clickOnCustomersMenu( ) # only these two methods are required from addCustomerPage.py self.addcust.clickOnCustomersMenuItem() self.logger.info( "*******************Searching Customer by Email**********************" ) # creating object of SearchCustomer class to access methods searchcust = SearchCustomer(self.driver) searchcust.setEmail("*****@*****.**") searchcust.clickOnSearchButton() time.sleep(5) status = searchcust.searchCustomerByEmail( "*****@*****.**") self.driver.close() assert True == status self.logger.info( "***************Test_004_SearchCustomerByEmail Finished*********** " )
def test_search_customer_by_name(self, setup): self.logger.info("************* SearchCustomerByName_005 **********") self.driver = setup self.driver.get(self.baseURL) self.driver.maximize_window() self.lp = LoginPage(self.driver) self.lp.set_user_name(self.username) self.lp.set_password(self.password) self.lp.click_login() self.logger.info("************* Login successful **********") self.logger.info("******* Starting Search Customer By Name **********") self.addcust = AddCustomer(self.driver) self.addcust.click_on_customers_menu() self.addcust.click_on_customers_menu_item() time.sleep(2) self.logger.info("************* searching customer by Name **********") searchcust = SearchCustomer(self.driver) searchcust.set_first_name("James") searchcust.set_last_name("Pan") searchcust.click_search() time.sleep(5) status = searchcust.search_customer_by_name("James Pan") self.driver.close() assert True == status self.logger.info("*************** TC_SearchCustomerByName_005 Finished *********** ")
def test_search_customer_by_email(self, setup): self.logger.info("************* SearchCustomerByEmail_004 **********") self.driver = setup self.driver.get(self.baseURL) self.driver.maximize_window() self.lp = LoginPage(self.driver) self.lp.set_user_name(self.username) self.lp.set_password(self.password) self.lp.click_login() self.logger.info("************* Login succesful **********") self.logger.info( "******* Starting Search Customer By Email **********") self.addcust = AddCustomer(self.driver) self.addcust.click_on_customers_menu() self.addcust.click_on_customers_menu_item() self.logger.info( "************* searching customer by emailID **********") searchcust = SearchCustomer(self.driver) #searchcust.set_email("*****@*****.**") searchcust.set_email("*****@*****.**") time.sleep(5) searchcust.click_search() time.sleep(5) status = searchcust.search_customer_by_email( "*****@*****.**") print(status) self.driver.close() assert True == status self.logger.info( "*************** TC_SearchCustomerByEmail_004 Finished *********** " )
def test_add_customer(self, setup): self.logger.info("************* Test_003_AddCustomer **********") self.driver = setup self.driver.get(self.baseURL) self.driver.maximize_window() self.lp = LoginPage(self.driver) self.lp.set_user_name(self.username) self.lp.set_password(self.password) self.lp.click_login() self.logger.info("************* Login successful **********") self.logger.info("******* Starting Add Customer Test **********") self.addcust = AddCustomer(self.driver) self.addcust.click_on_customers_menu() self.addcust.click_on_customers_menu_item() time.sleep(2) self.addcust.click_on_add_new() time.sleep(2) self.logger.info("************* Providing customer info **********") self.email = random_generator() + "@gmail.com" self.addcust.set_email(self.email) self.addcust.set_password("test123") self.addcust.set_customer_roles("Guests") self.addcust.set_manager_of_vendor("Vendor 2") self.addcust.set_gender("Male") self.addcust.set_first_name("Amit") self.addcust.set_last_name("Singh") self.addcust.set_dob("07/21/1991") # Format: D / MM / YYY self.addcust.set_company_name("XYZ_ABC") self.addcust.set_admin_content("This is for testing.........") self.addcust.click_on_save() self.logger.info("************* Saving customer info **********") self.logger.info("********* Add customer validation started *****************") self.msg = self.driver.find_element_by_tag_name("body").text print(self.msg) if 'customer has been added successfully.' in self.msg: assert True self.logger.info("********* Add customer Test Passed *********") else: self.driver.save_screenshot(".\\Screenshots\\" + "test_addCustomer_scr.png") # Screenshot self.logger.error("********* Add customer Test Failed ************") assert False self.driver.close() self.logger.info("******* Ending Add customer test **********")
def test_addCustomer(self, setup): self.logger.info("***** ***** Test_003_AddCustomer ***** *****") self.driver = setup self.driver.get(self.baseURL) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("***** Login Successful *****") self.logger.info("***** Starting Add Customer Test *****") self.adcust = AddCustomer(self.driver) self.adcust.clickOnCustomersMenu() self.adcust.clickOnCustomersMenuItem() self.adcust.clickOnAddNew() self.logger.info("***** Providing Customer Details *****") self.email = self.random_generator() + "@gmail.com" self.adcust.setEmail(self.email) self.adcust.setPassword("test123") self.adcust.setCustomerRoles("Guests") self.adcust.setManagerOfVendor("Vendor 2") self.adcust.setGender("Male") self.adcust.setFirstName("John") self.adcust.setLastName("Doe") self.adcust.setDOB("7/05/1985") self.adcust.setCompanyName("CG") self.adcust.setAdminComment("This is for testing") self.adcust.clickOnSave() self.logger.info("***** Saving Customer Info *****") self.logger.info("***** Saved Customer Validation Started *****") self.msg = self.driver.find_element_by_tag_name("body").text if 'customer has been added successfully.' in self.msg: assert True == True self.logger.info("***** Add Customer Test Passed *****") else: self.driver.save_screenshot(".\\screenshots\\" + "test_addCustomer_scr.png") self.logger.error("***** Add Customer Test Failed *****") assert False == False self.driver.close() self.logger.info("***** Add Customer Test complete *****")
def test_searchCustomerByName(self, setUp): self.driver = setUp self.driver.get(self.baseURL) lp = LoginPage(self.driver) lp.setUsername(self.username) lp.setPassword(self.password) lp.clickLogin() self.logger.info( "*******************Login Successful**********************") self.logger.info( "*******************Start searching Customer by Name**********************" ) addcust = AddCustomer(self.driver) addcust.clickOnCustomersMenu( ) # only these two methods are required from addCustomerPage.py addcust.clickOnCustomersMenuItem() self.logger.info( "*******************Searching Customer by Name**********************" ) searchcust = SearchCustomer(self.driver) searchcust.setFirstName("Victoria") searchcust.setLastName("Terces") searchcust.clickOnSearchButton() time.sleep(5) status = searchcust.searchCustomerByName("Victoria Terces") self.driver.close() assert True == status self.logger.info( "***************Test_004_SearchCustomerByName Finished*********** " )
class Test_003_AddCustomer: baseURL = ReadConfig.getApplicationURL() username = ReadConfig.getUserEmail() password = ReadConfig.getPassword() logger = LogGen.loggen() def random_generator(self, size=8, chars=string.ascii_lowercase + string.digits): return ''.join(random.choice(chars) for x in range(size)) @pytest.mark.sanity def test_addCustomer(self, setup): self.logger.info("***** ***** Test_003_AddCustomer ***** *****") self.driver = setup self.driver.get(self.baseURL) self.driver.maximize_window() self.lp = Login(self.driver) self.lp.setUserName(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info("***** Login Successful *****") self.logger.info("***** Starting Add Customer Test *****") self.adcust = AddCustomer(self.driver) self.adcust.clickOnCustomersMenu() self.adcust.clickOnCustomersMenuItem() self.adcust.clickOnAddNew() self.logger.info("***** Providing Customer Details *****") self.email = self.random_generator() + "@gmail.com" self.adcust.setEmail(self.email) self.adcust.setPassword("test123") self.adcust.setCustomerRoles("Guests") self.adcust.setManagerOfVendor("Vendor 2") self.adcust.setGender("Male") self.adcust.setFirstName("John") self.adcust.setLastName("Doe") self.adcust.setDOB("7/05/1985") self.adcust.setCompanyName("CG") self.adcust.setAdminComment("This is for testing") self.adcust.clickOnSave() self.logger.info("***** Saving Customer Info *****") self.logger.info("***** Saved Customer Validation Started *****") self.msg = self.driver.find_element_by_tag_name("body").text if 'customer has been added successfully.' in self.msg: assert True == True self.logger.info("***** Add Customer Test Passed *****") else: self.driver.save_screenshot(".\\screenshots\\" + "test_addCustomer_scr.png") self.logger.error("***** Add Customer Test Failed *****") assert False == False self.driver.close() self.logger.info("***** Add Customer Test complete *****")
def test_add_customer(self, setUp): self.logger.info( "*********************Login into portal************************") self.driver = setUp self.driver.get(self.baseURL) self.lp = LoginPage(self.driver) self.lp.setUsername(self.username) self.lp.setPassword(self.password) self.lp.clickLogin() self.logger.info( "***********************Login Successful*******************************" ) self.logger.info( "***********************Starting addCustomer test*******************************" ) # Creating object of AddCustomer class to access methods self.addcust = AddCustomer(self.driver) self.addcust.clickOnCustomersMenu() self.addcust.clickOnCustomersMenuItem() self.addcust.clickOnAddNewButton() self.logger.info( "**********************Providing Customer Info******************************" ) self.email = random_generator() + "@gmail.com" self.addcust.setEmail(self.email) self.addcust.setPassword("test12345") self.addcust.setFirstName("Shilpa") self.addcust.setLastName("Chourasia") self.addcust.selectGender("Female") self.addcust.setDOB("11/12/1989") self.addcust.setCompanyName("QAPython") #self.addcust.setNewsLetter("Your store name") self.addcust.setCustomerRoles("Guests") self.addcust.setManagerOfVender("Vendor 1") self.addcust.setAdminComments("This is just for testing") self.addcust.clickOnSaveButton() self.logger.info( "**********************Saving Customer Info******************************" ) self.logger.info( "**********************Add Customer Validation started******************************" ) self.msg = self.driver.find_element_by_tag_name("body").text print(self.msg) if "The new customer has been added successfully." in self.msg: assert True == True self.logger.info( "******************test_add_customer test case is passed******************" ) else: self.driver.save_screenshots(".\\Screenshots\\" + "test_add_customer.png") self.logger.info( "********************test_add_customer test case is failed******************" ) assert True == False self.driver.close() self.logger.info( "********************Ending of Test_003_add_customer******************" )