class Test_searchCustomerByEmail_004:
    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getUseremail()
    password = ReadConfig.getPassword()
    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_searchCustomerByEmail(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.setUserName(self.username)
        self.lp.setPassword(self.password)
        self.lp.clickLogin()

        self.logger.info("***** Login Successfully *****")
        self.logger.info("***** Starting Add Customer Test *****")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomerMenu()
        self.addcust.clickOnCustomerMenuItem()

        self.logger.info("***** searching customer by email *****")
        searchcust = SearchCustomer(self.driver)
        searchcust.setEmail("*****@*****.**")
        searchcust.clickSearch()
        time.sleep(5)

        status = searchcust.searchCustomerByEmail(
            "*****@*****.**")
        assert True == status
        self.logger.info("***** TC_SearchCustomerbyEmail_004 Finished *****")
        self.driver.close()
Exemplo n.º 2
0
class Test_003_AddCustomer:
    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getUseremail()
    password = ReadConfig.getPassword()
    logger = LogGen.loggen()

    @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 = LoginPage(self.driver)
        self.lp.setUserName(self.username)
        self.lp.setPassword(self.password)
        self.lp.clickLogin()

        self.logger.info("***** Login Successfully *****")
        self.logger.info("***** Starting Add Customer Test *****")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomerMenu()
        self.addcust.clickOnCustomerMenuItem()

        self.addcust.clickOnAddnew()

        self.logger.info("***** Providing Customer Details *****")

        self.email = random_generator() + "@gmail.com"
        self.addcust.setEmail(self.email)
        self.addcust.setPassword("smd@li9916")
        self.addcust.setFirstname("Mohammad")
        self.addcust.setLastname("Ali")
        self.addcust.setGender("Male")
        self.addcust.setDob("7/05/1987")
        self.addcust.setCompanyName("TechMahindra")
        #self.addcust.setNewsLetter("Test store 2")
        self.addcust.setCustomerRoles("Registered")
        self.addcust.setManagerOfVendor("Vendor 2")
        self.addcust.setAdminContent(
            "This is for Testing Requirement ---------")
        self.addcust.clickOnSave()

        self.logger.info("***** Saving Customer Details *****")
        self.logger.info("***** Add Customer Validation Details *****")

        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 == True
            self.logger.info("***** Add Customer Test Pass *****")
        else:
            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_addcustomer_scr.png")
            self.logger.error("***** Add Customer Test Failed *****")
            assert True == False

        self.driver.close()
        self.logger.info("***** Ending Test_003_AddCustomer Test *****")