Example #1
0
class Test_005_SearchCustomerByName:
    baseURL = readConfig.getApplicationURL()
    username = readConfig.getUsername()
    password = readConfig.getPassword()
    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_SearchCustomerByName(self, setup):
        self.logger.info("***********Search customer by email*************")
        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 succesful*************")
        self.logger.info(
            "***********Starting Search Customer by name test ************")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomersMenu()
        self.addcust.clickOnCustomersMenuItem()

        searchcust = SearchCustomer(self.driver)
        searchcust.setFirstName("Victoria")
        searchcust.setLastName("Terces")
        searchcust.clickOnSearch()
        status = searchcust.SearchCustomerByName("Victoria Terces")
        assert True == status
        self.driver.quit()
Example #2
0
class Test_003_AddCustomer:
    baseURL = readConfig.getApplicationURL()
    username = readConfig.getUsername()
    password = readConfig.getPassword()
    logger = LogGen.loggen()

    @pytest.mark.sanity
    def test_AddCustomer(self, setup):
        self.logger.info("***********Test_001_Login*************")
        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 succesful*************")
        self.logger.info("***********Starting Add Customer test ************")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomersMenu()
        self.addcust.clickOnCustomersMenuItem()
        self.addcust.clickOnAddnew()
        self.logger.info("***********Providing Customer Info ************")

        self.email = random_generator() + "@gmail.com"
        self.addcust.setEmail(self.email)
        self.addcust.setPassword("test123")
        self.addcust.setFirstName("Pooja")
        self.addcust.setLastName("Gupta")
        self.addcust.setGender("Female")
        self.addcust.setDob("09/16/1997")
        self.addcust.setCompanyName("BusyQA")
        self.addcust.setAdminContent("This s for testing")
        self.addcust.setMgrOfVendor("Not a vendor")
        self.addcust.setCustomerRole("Registered")
        self.addcust.clickOnSave()
        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 == True
            self.logger.info("******Add customer Test passed*************")
        else:
            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_addcustomer_scr.png")
            self.logger.info("******Add customer Test failed*************")
            assert True == False
        self.driver.close()
        self.logger.info("**********Ending Add Customer Test*********")
Example #3
0
class Test_001_Login:
    baseURL = readConfig.getApplicationURL()
    username = readConfig.getUsername()
    password = readConfig.getPassword()

    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_homepageTitle(self, setup):
        self.logger.info("***********Test_001_Login*************")
        self.logger.info("***********Verify homepageTitle*************")

        self.driver = setup
        self.driver.get(self.baseURL)
        act_title = self.driver.title

        if act_title == "Your store. Login":
            assert True
            self.driver.close()
            self.logger.info(
                "***********home page title is passed*************")
        else:

            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_homepageTitle.png")
            self.driver.close()
            self.logger.error(
                "***********home page title is failed*************")
            assert False

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_login(self, setup):
        self.logger.info("**********verify login test*************")
        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()
        act_title = self.driver.title

        if act_title == "Dashboard / nopCommerce administration":
            assert True
            self.logger.info(
                "***********home page title is passed*************")
            self.driver.close()
        else:
            self.driver.save_screenshot(".\\Screenshots\\" + "test_login.png")
            self.driver.close()
            self.logger.error(
                "***********home page title is failed*************")
            assert False
Example #4
0
class Test_003_AddCustomer:
    baseURL = readConfig.getApplicationURL()
    username = readConfig.getUsername()
    password = readConfig.getPassword()
    logger = LogGen.loggen()

    def test_AddCustomer(self, setup):
        self.logger.info("***********Test_001_Login*************")
        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 succesful*************")
        self.logger.info("***********Starting Add Customer test ************")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomersMenu()
        self.addcust.clickOnCustomersMenuItem()
        self.addcust.clickOnAddnew()
        self.logger.info("***********Providing Customer Info ************")
Example #5
0
class Test_002_DDT_Login:
    baseURL = readConfig.getApplicationURL()
    path = ".//Testdata/xltestdata.xlsx"
    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_login_ddt(self, setup):
        self.logger.info("****Test_002_DDT_Login")
        self.logger.info("**********verify login_ddt test*************")
        self.driver = setup
        self.driver.get(self.baseURL)

        self.lp = LoginPage(self.driver)

        self.rows = ExcelUtils.getRowCount(self.path, 'Sheet1')
        print("no.of rows in excel", self.rows)

        lst_status = []  #empty list variable

        for r in range(2, self.rows + 1):
            self.user = ExcelUtils.readdata(self.path, 'Sheet1', r, 1)
            self.password = ExcelUtils.readdata(self.path, 'Sheet1', r, 2)
            self.exp = ExcelUtils.readdata(self.path, 'Sheet1', r, 3)

            self.lp.setUserName(self.user)
            self.lp.setPassword(self.password)
            self.lp.clickLogin()
            time.sleep(5)

            act_title = self.driver.title
            exp_title = "Dashboard/nopCommerce administration"

            if act_title == exp_title:
                if self.exp == "Pass":
                    self.logger.info("******passed")
                    self.lp.clickLogout()
                    lst_status.append("pass")
                elif self.exp == "fail":
                    self.logger.info("*********failed*****")
                    self.lp.clickLogout()
                    lst_status.append("fail")

            elif act_title != exp_title:
                if self.exp == 'Pass':
                    self.logger.info("********failed*****")
                    lst_status.append("Fail")
                elif self.exp == 'fail':
                    self.logger.info("*********passed****")
                    lst_status.append("Pass")

        if "Fail" not in lst_status:
            self.logger.info("**********login ddt test passed****")
            self.driver.close()
            assert True
        else:
            self.logger.info("**********login ddt test failed****")
            self.driver.close()
            assert False

        self.logger.info("end of login ddt test")
        self.logger.info("completed test_002_login_ddt")