Esempio n. 1
0
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()
Esempio n. 2
0
class Test_002_DDT_Login:
    baseURL = ReadConfig.getApplicationURL()
    path = ".//testData/LoginData.xlsx"

    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_login_ddt(self, setup):
        self.logger.info("**********Test_002_DDT_Login**********")
        self.logger.info("*****Verifying Login Test*****")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = Login(self.driver)

        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')
        print("Number of rows in EXcel:", self.rows)

        lst_status = []

        for row in range(2, self.rows + 1):
            self.user = XLUtils.readData(self.path, 'Sheet1', row, 1)
            self.password = XLUtils.readData(self.path, 'Sheet1', row, 2)
            self.exp = XLUtils.readData(self.path, 'Sheet1', row, 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.driver.save_screenshot(".\\screenshots\\" +
                                                "test_login_ddt.png")
                    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.error("Login DDT test Failed.......")
            self.driver.close()
            assert False

        self.logger.info("***** End of Login DDT Test *****")
        self.logger.info("***** ***** Completed TC_LoginDDT_002 ***** *****")
Esempio n. 3
0
class Test_001_Login:
    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getUseremail()
    password = ReadConfig.getPassword()

    logger = LogGen.loggen()

    @pytest.mark.regression
    def test_homePageTitle(self, setup):
        self.logger.info("******************** Test_001_Login **********")
        self.logger.info("****** verifying home page title ********")
        self.driver = setup
        self.driver.get(self.baseURL)
        act_title = self.driver.title
        if act_title == "Your store. Login":
            self.logger.info(
                "**** Home page title test is passed ************")
            assert True
        else:
            self.driver.save_screenshot("./Screenshots/" +
                                        "test_homePageTitle.png")
            self.logger.info(
                "**** Home page title test is failed ************")
            assert False
        self.driver.close()

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_Login(self, setup):
        self.logger.info(
            "******************** Verifying Login Test **********")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = Login(self.driver)
        self.lp.setUserName(self.username)
        self.lp.setPassword(self.password)
        self.lp.clickUserLogin()
        act_title = self.driver.title
        if act_title == "Dashboard / nopCommerce administration":
            self.logger.info(
                "******************** Login Test is passed **********")
            assert True
        else:
            self.driver.save_screenshot("./Screenshots/" + "test_Login.png")
            self.logger.error(
                "******************** Login Test is failed **********")
            assert False
        self.driver.close()
Esempio n. 4
0
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 *****")