Beispiel #1
0
class Test_006_AddDiscount:
    baseurl = ReadConfig.getApplicationURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getpasswordL()
    logger = logGen.loggen()

    @pytest.mark.regression
    def test_AddDiscount(self, setup):
        self.logger.info("******** Test_006_AddDiscount *********")
        self.logger.info(
            "****************** Verifying Adding New Discount **********************"
        )
        self.driver = setup
        self.driver.get(self.baseurl)
        self.driver.maximize_window()
        self.obj_log = Login(self.driver)
        self.obj_log.setUsername(self.username)
        self.obj_log.setpassword(self.password)
        self.obj_log.loginbutton()

        self.logger.info("************* Login succesful **********")
        self.logger.info("******* Starting Adding New Discount **********")

        self.obj_New_Discount = AddDiscountPage(self.driver)
        self.obj_New_Discount.clickonPromotion()
        self.obj_New_Discount.clickonDiscounts()
        self.obj_New_Discount.clickonAddnewButton()
        self.obj_New_Discount.enterName('TestOnceEcommerce')
        self.obj_New_Discount.selectDiscounttype('Assigned to products')
        self.obj_New_Discount.enterDiscountAmt('10')
        self.obj_New_Discount.enterStartDate('7/05/2019')
        self.obj_New_Discount.enterEndDate('7/05/2022')
        self.obj_New_Discount.selectDiscountLimit('Unlimited')
        self.obj_New_Discount.enterMaximumDiscountQuatity('5')
        self.obj_New_Discount.enterAdminComment('Adding comment')
        self.obj_New_Discount.clickSaveButton()

        self.succesMsg = self.driver.find_element_by_xpath(
            "//div[@class='alert alert-success alert-dismissable']").text

        expedtedSring = 'The new discount has been added successfully.'

        if self.succesMsg.find(expedtedSring) != -1:
            self.logger.info(
                '******* Added New Discount coupan sucessfully **********')
            self.logger.info('******* Test Case Passed  **************')
            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_AddDiscount_scr.png")
            assert True

        else:
            self.logger.info('******* Test Case Failed  **************')
            self.driver.save_screenshot(".\\Screenshots\\" +
                                        "test_AddDiscount_scr.png")
            assert False

        self.obj_log.clickLogout()
        self.driver.close()
Beispiel #2
0
class Test_002_DDT_login:
    baseURL = ReadConfig.getApplicationURL()
    path = "./nopcommerceApp/TestData/testdata.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 DDT test ****")
        self.driver = setup
        self.driver.get(self.baseURL)

        self.lp = login(self.driver)
        self.rows = XLUtils.getColumnCount(self.path, "Sheet1")
        print(f'Number of Rows in a Excel, {self.rows}')
        lst_status = []  #empty list variable
        for r in range(2, self.rows + 1):
            self.username = XLUtils.readData(self.path, 'Sheet1', r, 1)
            self.password = XLUtils.readData(self.path, 'Sheet1', r, 2)

            self.exp = XLUtils.readData(self.path, 'Sheet1', r, 3)

            self.lp.setUserName(self.username)
            self.lp.setPassword(self.password)
            self.lp.clickLogin()
            time.sleep(2)

            act_title = self.driver.title
            exp_title = "Dashboard / nopCommerce administration"
            if act_title == exp_title:
                if self.exp == 'Pass':
                    self.logger.info("The test Passed")
                    lst_status.append('Pass')
                elif self.exp == 'Fail':
                    self.logger.info("The test Failed")
                    #self.lp.clickLogout()
                    lst_status.append('Fail')
                self.lp.clickLogout()
            else:
                if self.exp == 'Pass':
                    self.logger.info("*** The test Failed ***")
                    lst_status.append('Fail')
                elif self.exp == 'Fail':
                    self.logger.info("*** The test Passed ***")
                    #self.lp.clickLogout()
                    lst_status.append('Pass')
                self.lp.clickLogout()

        if "Fail" not in lst_status:
            self.logger.info("**** Login DDT test passed ****")
            assert True
        else:
            self.logger.error("**** Login DDT test failed ****")
            assert False
        self.logger.error("**** Login DDT test completed ****")
        self.driver.close()
Beispiel #3
0
class Test_002_DDT_Login:
    baseurl = ReadConfig.getApplicationURL()
    path = ".\\TestData\\LoginTestData.xlsx"
    logger = logGen.loggen()

    @pytest.mark.regression
    def test_Login(self, setup):
        self.logger.info("****************** Test_002_DDT_Login **********************")
        self.logger.info("****************** Verifying Login Test **********************")
        self.driver = setup
        self.driver.get(self.baseurl)
        self.driver.maximize_window
        self.obj_log = Login(self.driver)

        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')
        print(self.rows)
        lst_status=[]

        for r in range(2,self.rows+1):
            self.user=XLUtils.readData(self.path,'Sheet1',r,1)
            self.password = XLUtils.readData(self.path, 'Sheet1', r, 2)
            self.expected = XLUtils.readData(self.path, 'Sheet1', r, 3)
            self.obj_log.setUsername(self.user)
            self.obj_log.setpassword(self.password)
            self.obj_log.loginbutton()
            time.sleep(5)
            act_title = self.driver.title
            exp_title="Dashboard / nopCommerce administration"

            if act_title==exp_title:
                if self.expected=='Pass':
                    self.logger.info("*** Passed ***")
                    self.obj_log.clickLogout()
                    lst_status.append("Pass")
                    XLUtils.writeData(self.path, 'Sheet1', r, 4, 'Pass')
                elif self.expected=='Fail':
                    self.logger.info("*** Failed ***")
                    self.obj_log.clickLogout()
                    lst_status.append("Fail")
            elif act_title!=exp_title:
                if self.expected=='Pass':
                    self.logger.info("*** Failed ***")
                    lst_status.append("Fail")
                    XLUtils.writeData(self.path, 'Sheet1', r, 4, 'Fail')
                elif self.expected=='Fail':
                    self.logger.info('*** Passed ***')
                    lst_status.append("Pass")
                    XLUtils.writeData(self.path, 'Sheet1', r, 4, 'Pass')
        if "Fail" not in lst_status:
            self.logger.info('*** Data Driven Test is Passed ***')
            self.driver.close
            assert True
        else:
            self.logger.info('*** Data Driven Test is Failed ***')
            self.driver.close
            assert False
Beispiel #4
0
class Test_003_AddCustomer:
    baseurl = ReadConfig.getApplicationURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getpasswordL()
    logger = logGen.loggen()


    @pytest.mark.sanity
    def test_AddCustomer(self, setup):
        self.logger.info("******** Test_003_AddCustomer *********")
        self.logger.info("****************** Verifying Adding New Customer **********************")
        self.driver = setup
        self.driver.get(self.baseurl)
        self.driver.maximize_window
        self.obj_log = Login(self.driver)
        self.obj_log.setUsername(self.username)
        self.obj_log.setpassword(self.password)
        self.obj_log.loginbutton()
        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("******* Adding New Customer *******")

        self.email = random_generator() + '@gmail.com'
        self.addcust.setEmail(self.email)
        self.addcust.setPassword("test123")
        self.addcust.setCustomerRoles("Guests")
        self.addcust.setManagerOfVendor("Vendor 2")
        self.addcust.setGender("Male")
        self.addcust.setFirstName("Sai")
        self.addcust.setLastName("Kiran")
        self.addcust.setDob("7/05/1985")  # Format: D / MM / YYY
        self.addcust.setCompanyName("busyQA")
        self.addcust.setAdminContent("This is for testing.........")
        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

        if 'customer has been added successfully.' in self.msg:
            self.logger.info("********* Add customer Test Passed *********")
            assert True
        else:
            self.driver.save_screenshot(".\\Screenshots\\" + "test_addCustomer_scr.png")  # Screenshot
            self.logger.error("********* Add customer Test Failed ************")
            assert False
        self.obj_log.clickLogout()
Beispiel #5
0
class Test_004_SearchCustomerByEmail:
    baseurl = ReadConfig.getApplicationURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getpasswordL()
    logger = logGen.loggen()

    @pytest.mark.regression
    def test_searchCustomerByEmail(self, setup):
        self.logger.info(
            "****************** Test_004_SearchCustomerByEmail **********************"
        )
        self.logger.info(
            "****************** Verifying Home Page Tittle **********************"
        )
        self.driver = setup
        self.driver.get(self.baseurl)
        self.driver.maximize_window

        self.obj_log = Login(self.driver)
        self.obj_log.setUsername(self.username)
        self.obj_log.setpassword(self.password)
        self.obj_log.loginbutton()
        self.logger.info("************* Login succesful **********")
        self.logger.info(
            "******* Starting Search Customer By Email **********")
        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomersMenu()
        self.addcust.clickOnCustomersMenuItem()
        self.logger.info(
            "************* searching customer by emailID **********")

        searchcust = SearchCustomer(self.driver)
        searchcust.setEmail("*****@*****.**")
        searchcust.clickSearch()
        time.sleep(4)
        status = searchcust.searchCustomerByEmail(
            "*****@*****.**")
        self.driver.close()

        if status == True:
            self.logger.info(
                "***************  Test_004_SearchCustomerByEmail Passed  *********** "
            )
        else:
            self.logger.info(
                "***************  Test_004_SearchCustomerByEmail Failed  *********** "
            )
Beispiel #6
0
class Test_001_login:
    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getUseremail()
    password = ReadConfig.getPassword()
    logger = logGen.loggen()

    @pytest.mark.sanity
    def test_homepageTitle(self, setup):
        self.logger.info("**** Test_001_login ****")
        self.logger.info("**** Verifying Home title page ****")
        self.driver = setup
        self.driver.get(self.baseURL)
        act_title = self.driver.title
        if act_title == "Your store. Login":
            assert True
            self.logger.info("**** homepageTitle passed ****")
            self.driver.close()
        else:
            self.driver.save_screenshot("./nopcommerceApp/Screenshots/" + "test_homepageTitle.png")
            self.logger.error("**** homepageTitle failed ****")
            self.driver.close()
            assert False

    @pytest.mark.sanity
    @pytest.mark.regression
    def test_login(self, setup):
        self.logger.info("**** Test_002_login ****")
        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.clickLogin()
        act_title = self.driver.title
        if act_title == "Dashboard / nopCommerce administration123":
            assert True
            self.logger.info("**** Login test passed ****")
            self.driver.close()
        else:
            self.driver.save_screenshot(
                "./nopcommerceApp/Screenshots/test_login.png")
            self.logger.error("**** homepageTitle failed ****")
            self.logger.error("**** Login test failed ****")
            self.driver.close()
            assert False
Beispiel #7
0
class Test_001_Login:
    baseurl = ReadConfig.getApplicationURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getpasswordL()
    logger = logGen.loggen()

    @pytest.mark.sanity
    def test_homePageTittle(self, setup):
        self.logger.info("****************** Test_001_Login **********************")
        self.logger.info("****************** Verifying Home Page Tittle **********************")
        self.driver = setup
        self.driver.get(self.baseurl)
        self.driver.maximize_window
        act_tittle = self.driver.title

        if act_tittle == "Your store. Login":
            self.driver.close()
            self.logger.info("****************** Home Page Tittle Test is Passed **********************")
            assert True
        else:
            self.driver.save_screenshot(".\\Screenshots\\" + "test_homePageTittle.png")
            self.driver.close()
            self.logger.error("****************** Home Page Tittle Test is Failed **********************")
            assert False

    @pytest.mark.regression
    def test_Login(self, setup):
        self.logger.info("****************** Verifying Login Test **********************")
        self.driver = setup
        self.driver.get(self.baseurl)
        self.driver.maximize_window
        self.obj_log = Login(self.driver)
        self.obj_log.setUsername(self.username)
        self.obj_log.setpassword(self.password)
        self.obj_log.loginbutton()
        logTitle = self.driver.title

        if logTitle == "Dashboard / nopCommerce administration":
            self.logger.info("****************** Login Test is Passed **********************")
            self.driver.close()
            assert True
        else:
            self.driver.save_screenshot(".\\Screenshots" + "test_Login.png")
            self.driver.close()
            self.logger.error("****************** Login Test is Failed **********************")
            assert False
Beispiel #8
0
class Test_005_SearchCustomerByName:
    baseurl = ReadConfig.getApplicationURL()
    username = ReadConfig.getUsername()
    password = ReadConfig.getpasswordL()
    logger = logGen.loggen()

    @pytest.mark.regression
    def test_searchCustomerByName(self, setup):
        self.logger.info(
            "****************** Test_005_SearchCustomerByName **********************"
        )
        self.logger.info(
            "****************** Verifying Home Page Tittle **********************"
        )
        self.driver = setup
        self.driver.get(self.baseurl)
        self.driver.maximize_window

        self.obj_log = Login(self.driver)
        self.obj_log.setUsername(self.username)
        self.obj_log.setpassword(self.password)
        self.obj_log.loginbutton()
        self.logger.info("************* Login succesful **********")
        self.logger.info(
            "******* Starting Search Customer By Email **********")
        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomersMenu()
        self.addcust.clickOnCustomersMenuItem()
        self.logger.info(
            "************* searching customer by emailID **********")

        searchcust = SearchCustomer(self.driver)
        searchcust.setFirstName("Victoria")
        searchcust.setLastName("Terces")
        searchcust.clickSearch()
        time.sleep(4)
        status = searchcust.searchCustomerByName("Victoria Terces")
        self.driver.quit
        assert True == status
        self.logger.info(
            "***************  Test_005_SearchCustomerByName Finished  *********** "
        )
Beispiel #9
0
class Test_SearchCustomerByName_005:
    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getUseremail()
    password = ReadConfig.getPassword()
    logger = logGen.loggen()  # Logger

    @pytest.mark.regression
    def test_searchCustomerByName(self, setup):
        self.logger.info("************* SearchCustomerByName_005 **********")
        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 succesful **********")

        self.logger.info("******* Starting Search Customer By Name **********")

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomersMenu()
        time.sleep(1)
        self.addcust.clickOnCustomersMenuItem()
        time.sleep(2)

        self.logger.info("************* searching customer by Name **********")
        searchcust = SearchCustomer(self.driver)
        searchcust.setFirstName("Victoria")
        searchcust.setLastName("Terces")
        searchcust.clickSearch()
        time.sleep(2)
        status = searchcust.searchCustomerByName("Victoria Terces")
        self.driver.close()
        assert True == status
        self.logger.info(
            "***************  TC_SearchCustomerByName_005 Finished  *********** "
        )
class Test_003_AddCustomer:
    baseURL = ReadConfig.getApplicationURL()
    username = ReadConfig.getUseremail()
    password = ReadConfig.getPassword()
    logger = logGen.loggen()  # Logger

    @pytest.mark.sanity
    @pytest.mark.regression
    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 succesful **********")

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

        self.addcust = AddCustomer(self.driver)
        self.addcust.clickOnCustomersMenu()
        time.sleep(1)
        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.setCustomerRoles("Guests")
        self.addcust.setManagerOfVendor("Vendor 2")
        self.addcust.setGender("Male")
        self.addcust.setFirstName("Tester")
        self.addcust.setLastName("Yang")
        self.addcust.setDob("7/05/1985")  # Format: D / MM / YYY
        self.addcust.setCompanyName("seleniumQA")
        self.addcust.setAdminContent("This is for testing.........")
        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
            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 **********")