def test_searchcustomerbyemail(self, setup):
        self.logger.info("***Test_searchcustomerbyemail004 starting*")
        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 successfull**************")

        self.logger.info("*******Starting search customer**************")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickoncustomersmain()
        self.addcust.clickoncustomersub()

        self.logger.info("*******Searching  customer by email**************")
        searchcust = Searchcustomer(self.driver)
        searchcust.email("*****@*****.**")
        searchcust.search()
        time.sleep(3)
        status = searchcust.searchCustomerByemail(
            "*****@*****.**")
        assert True == status
        self.logger.info("*** Test_searchcustomerbyemail004 finihed*****")

        self.driver.close()
    def test_searchcustomerbyname(self, setup):
        self.logger.info("***Test_searchcustomerbyname005 starting*")
        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 successfull**************")

        self.logger.info("*******Starting search customer**************")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickoncustomersmain()
        self.addcust.clickoncustomersub()

        self.logger.info("*******Searching  customer by name**************")
        searchcust = Searchcustomer(self.driver)
        searchcust.frisrname("John")
        searchcust.lastname("Smith")
        searchcust.search()
        time.sleep(3)
        status = searchcust.searchCustomerbyname("John Smith")
        assert True == status
        self.logger.info("*** Test_searchcustomerbyemail004 finihed*****")

        self.driver.close()
    def test_login_ddt(self, setup):
        self.logger.info("*********Test_02__ddt_Login********")
        self.logger.info("*******verifying login ddt test**************")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        self.lp = login(self.driver)

        self.rows = ExcelUtils.getRowcount(self.path, 'Sheet1')
        print("Number of rows in the excel", self.rows)

        list_results = []  # empty list

        for r in range(2, self.rows + 1):
            self.user = ExcelUtils.readData(self.path, 'Sheet1', r,
                                            1)  # read user name from excel
            self.password = ExcelUtils.readData(self.path, 'Sheet1', r,
                                                2)  # read password  from excel
            self.expected = ExcelUtils.readData(
                self.path, 'Sheet1', r,
                3)  # read expected pass/fail  from excel

            self.lp.setUserName(self.user)  # get user name
            self.lp.setPassword(self.password)  # get password
            self.lp.clicklogin()
            time.sleep(5)
            act_title = self.driver.title
            expect_title = "Dashboard / nopCommerce administration"

            if act_title == expect_title:
                if self.expected == 'Pass':
                    self.logger.info("*** passed**")
                    self.lp.clicklogout()
                    list_results.append("Pass")
                elif self.expected == "Fail":
                    self.logger.info("*** Failed**")
                    self.lp.clicklogout()
                    list_results.append("Fail")

            elif act_title != expect_title:
                if self.expected == 'Pass':
                    self.logger.info("*** failed**")
                    list_results.append("fail")
                elif self.expected == "Fail":
                    self.logger.info("*** passed**")
                    list_results.append("pass")

        if "fail" not in list_results:
            self.logger.info("Login DDT is passed")
            self.driver.close()
            assert True
        else:
            self.logger.info("Log  in DDT is failed")
            self.driver.close()
            assert False

        self.logger.info("*******End of Login DDT********* ")
        self.logger.info("********Completed Test_02__ddt_Login*******")
    def test_addcustomer(self, setup):
        self.logger.info("*******Test_03_Login**************")
        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 successfull**************")

        self.logger.info("*******Starting add customer test**************")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickoncustomersmain()
        self.addcust.clickoncustomersub()

        self.addcust.addnew()

        self.logger.info("*******providing customer details**************")

        self.email = random_generator() + "@gmail.com"
        self.addcust.email(self.email)
        self.addcust.password("test123")
        self.addcust.firstname("QA")
        self.addcust.lastname("Tester")
        self.addcust.genderset("male")
        self.addcust.DOB("01/01/1995")
        self.addcust.companyname("TEST")
        self.addcust.tax_exempt()
        self.addcust.news_letter("test")
        self.addcust.customerroles("moderators")
        self.addcust.manage_vendor("Vendor 2")
        self.addcust.admin_comment("this is for testing purpose")
        self.addcust.save()

        self.logger.info("saving customer info")

        self.logger.info("validating customer info")

        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
        else:
            self.driver.save_screenshot(
                '.\\Screenshots\\' + 'test_add_customer.png'
            )  # here instead of giving complete path add . (dot) current project\\folder name
            self.logger.info("**Add customer test failed")
            assert True == False

        self.driver.close()
        self.logger.info("****Testing completed")
Esempio n. 5
0
    def test_login(self,setup):
        self.logger.info("*******verifying login test**************")

        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()

        title=self.driver.title
        if title == "Dashboard / nopCommerce administration":
            assert True
            self.logger.info("*******Login test is passes**************")
            self.driver.close()
        else:
            self.driver.save_screenshot('.\\Screenshots\\'+'test_login.png') # here instead of giving complete path add . (dot) current project\\folder name
            self.logger.error("*******Login test is failed**************")
            self.driver.close()
            assert False