def test_login_ddt(self, setup):
        self.logger.info("******* Starting Test_002_DDT_Login Test **********")
        self.logger.info("******* Starting Login DDT Test **********")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        self.lp = LoginPage(self.driver)

        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')
        print('Number of rows...', 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.exp = XLUtils.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")
            print(lst_status)
        if "Fail" not in lst_status:
            self.logger.info("******* DDT Login test passed **********")
            self.driver.close()
            assert True
        else:
            self.logger.error("******* DDT Login test failed **********")
            self.driver.close()
            assert False

        self.logger.info("******* End of Login DDT Test **********")
        self.logger.info(
            "**************** Completed  TC_LoginDDT_002 ************* ")


#pytest -v -s testCases\test_login_ddt.py
Beispiel #2
0
    def test_login_ddt(self, setup):
        self.logger.info(("**********************Test_002_Login***************"))
        self.logger.info("*****************verify login DDt test*********************")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = Login(self.driver)

        self.rows=XLUtils.getRowCount(self.path,'Sheet1')
        print("no.of rows in Excelsheet:",self.rows)
        list_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.exp=XLUtils.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 to login****************")
                    self.lp.clickLogout()
                    list_status.append("pass")

                elif self.exp =="Fail":
                    self.logger.info("******************failed to login***********************")
                    self.lp.clickLogout()
                    list_status.append("Fail")

            elif act_title != exp_title:

                if self.exp == "Pass":
                    self.logger.info("*****************failed*********************")

                    list_status.append("Fail")

                elif self.exp =="Fail":
                    self.logger.info("**************Passed*******************")

                    list_status.append("Pass")

        if "Fail" not in list_status:
            self.logger.info("*******************LoginDDT test Passed************")
            self.driver.close()
            assert True

        else:
            self.logger.info("****************LoginDDt Test failed********************")
            self.driver.close()
            assert False

        self.logger.info("***************End of Login DDT Test****************")
        self.logger.info("*************completed TC_Test_002_Login******************")
Beispiel #3
0
    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 = LoginPage(self.driver)

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

        list_status = []  # Empty list variable

        for r in range(2, self.rows+1):
            self.user = XLUtils.readData(self.path,'Sheet1',r,1)
            self.psword = XLUtils.readData(self.path, 'Sheet1',r,2)
            self.expected = XLUtils.readData(self.path, 'Sheet1', r, 3)

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

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

            if act_title == exp_title:
                if self.expected == "Pass":
                    self.logger.info("********Passed************")
                    self.lp.clickLogout()
                    list_status.append("Pass")

                elif self.expected == "Fail":
                    self.logger.info("*******Failed*******")
                    self.lp.clickLogout()
                    list_status.append("Fail")
            elif act_title != exp_title:
                if self.expected == "Pass":
                    self.logger.info("***Failed********")
                    list_status.append("Fail")
                elif self.expected == "Fail":
                    self.logger.info("*************Passed**********")
                    list_status.append("Pass")

        if "Fail" not in list_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 TC_Login_DDT_002 ***********")
Beispiel #4
0
    def test_login(self,setup):
        self.logs.info("***** Test_002_Login *****")
        self.logs.info("***** Verifying Login DDT test *****")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = LoginPage(self.driver)

        self.rows = XLUtils.getRowCount(self.path,'Sheet1')
        print("Number of Rows i a Excel:",self.rows)
        lst_status = []

        for r in range(2,self.rows+1):
            #self.logs.info("***** Test Row "+ str(r) +" *****")

            self.user = XLUtils.readData(self.path,'Sheet1',r,1)
            self.passw = XLUtils.readData(self.path,'Sheet1',r,2)
            self.exp = XLUtils.readData(self.path,'Sheet1',r,3)
            print(self.user)
            print("test",str(r))
            self.lp.setUsername(self.user)
            self.lp.setPassword(self.passw)
            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.logs.info("***** Test Pass *****")
                    self.lp.clickLogout()
                    lst_status.append("Pass")
                elif self.exp == "Fail":
                    self.logs.info("***** Test Fail *****")
                    self.lp.clickLogout()
                    lst_status.append("Fail")
                
            elif act_title != exp_title:
                if self.exp == "Pass":
                    self.logs.info("***** Test Fail *****")
                    lst_status.append("Fail")
                elif self.exp == "Fail":
                    self.logs.info("***** Test Pass *****")
                    lst_status.append("Pass")

        if "Fail" not in lst_status:
            self.logs.info("***** Login DDT Test Passed *****")
            self.driver.close()
            assert True
        else:
            self.logs.info("***** Login DDT Test Failed *****")
            assert False

        self.logs.info("***** End Of Login DDT Test Passed *****")
        self.logs.info("***** Complete Of Login DDT Test Passed *****")
Beispiel #5
0
    def test_login(self, setup):
        self.logger.info('****Verify login page******')
        # self.driver = setup
        # self.driver.get(self.base_url)
        self.rowcount = XLUtils.getRowCount(self.file_path, 'Sheet1')
        print('RowCount====', self.rowcount)
        lp_status = []

        for r in range(2, self.rowcount):
            base_url = ReadConfig.getApplicationUrl()
            self.driver = setup
            self.driver.get(base_url)
            user = XLUtils.readData(self.file_path, 'Sheet1', r, 1)
            pwd = XLUtils.readData(self.file_path, 'Sheet1', r, 2)
            result = XLUtils.readData(self.file_path, 'Sheet1', r, 3)

            self.lp = LoginPage(self.driver)
            self.lp.setusername(user)
            self.lp.setpassword(pwd)
            self.lp.clicklogin()
            time.sleep(5)

            act_title = self.driver.title
            if act_title == "Dashboard / nopCommerce administration":
                if result == 'Pass':
                    # self.logger.info('*****Login DDT verification passed*****')
                    self.lp.clicklogout()
                    lp_status.append("passed")
                    self.driver.close()
                elif self.result == 'Fail':
                    # self.logger.info('*****Login DDT verification failed*****')
                    self.lp.clicklogout()
                    lp_status.append('failed')
                    self.driver.close()
            elif act_title != "Dashboard / nopCommerce administration":
                if self.result == 'Pass':
                    # self.logger.info('*****Login DDT verification passed*****')
                    self.lp.clicklogout()
                    lp_status.append("failed")
                    self.driver.close()
                elif self.result == 'Fail':
                    # self.logger.info('*****Login DDT verification passed*****')
                    self.lp.clicklogout()
                    lp_status.append('passed')
                    self.driver.close()
            if 'failed' not in lp_status:
                # self.logger.info("Login DDT testcase Pass")
                # self.driver.close()
                assert True
            else:
                # self.logger.info("Login DDT testcase Fail")
                # self.driver.close()
                assert False
        print('List Status===', lp_status)
        self.logger.info('******END OF DDT TESTCASE*******')
    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.lp = LoginPage(self.driver)

        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')
        print('number of Rows:', self.rows)

        status_list = []

        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.exp = XLUtils.readData(self.path, 'Sheet1', r, 3)

            self.lp.setUserName(self.user)
            self.lp.setUserPassword(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 == 'test passed':
                    self.logger.info('*********  passed  ********')
                    self.lp.clickLogout()
                    status_list.append('pass')
                elif self.exp == 'test fail':
                    self.logger.info('*******  failed ********')
                    self.lp.clickLogout()
                    status_list.append('fail')

            elif act_title != exp_title:
                if self.exp == 'test passed':
                    self.logger.info('******* failed ********')
                    status_list.append('fail')
                elif self.exp == 'test fail':
                    self.logger.info('******  pass  ******')
                    status_list.append('pass')

        if 'fail' not in status_list:
            self.logger.info('############## login DDT test pass ############')
            self.driver.close()
            assert True
        else:
            self.logger.info('############ login DDT test fail ############')
            self.driver.close()
            assert False

        self.logger.info('------------- end of login DDT test  ----------')
        self.logger.info('------------- Complete login DDT test  ----------')
    def test_DDT_Login(self, setup):
        self.logger.info("*************Test_002_DDT_Login**************")
        self.logger.info("*************test_DDTLogin**************")
        self.row = XLUtils.getRowCount(self.path, "Sheet1")
        lst_status = []

        for r in range(2, self.row + 1):
            self.driver = setup
            self.driver.get(self.baseURL)
            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.login = LoginPage(self.driver)
            self.login.set_username(self.username)
            self.login.set_password(self.password)
            self.login.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.login.clicklogout()
                    lst_status.append("Pass")
                elif self.exp == 'Fail':
                    self.logger.info("***************Failed***********")
                    #self.login.clicklogout()
                    lst_status.append("Fail")
                self.login.clicklogout()
            elif act_title != exp_title:
                if self.exp == 'Pass':
                    self.logger.info("*************Failed***********")
                    #self.login.clicklogout()
                    lst_status.append("Fail")
                elif self.exp == 'Fail':
                    self.logger.info("***************Passed***********")
                    #self.login.clicklogout()
                    lst_status.append("Pass")

        if "Fail" not in lst_status:
            self.logger.info("***************Login_DDT_TC_Passed*************")
            assert True
            self.driver.close()
        else:
            self.logger.info("***************Login_DDT_TC_failed*************")
            self.driver.close()
            assert False

        self.logger.info("***********End of DDT Login*********")
        self.logger.info(
            "***********Completed Test_002_DDT_Login***************")
Beispiel #8
0
    def test_login_ddt(self,setup):
        self.logger.info("******* Test_002_DDT_Login*****")
        self.logger.info("****Started Login DDT Test****")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = LoginPage(self.driver)

        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')
        print("number of Rows i a Excel: ", self.rows)

        lst_status=[]   #Empty list Variable

        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.exp = XLUtils.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 - FleetCart Admin"

            if act_title == exp_title:
                if self.exp == "Pass":
                    self.logger.info("****Pass***")
                    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("******* DDT Login test passed **********")
            self.driver.close()
            assert True
        else:
            self.logger.error("******* DDT Login test failed **********")
            self.driver.close()
            assert False

        self.logger.info("******* End of Login DDT Test **********")
        self.logger.info("**************** Completed  TC_LoginDDT_002 ************* ");
    def test_DDT_login(self):
        self.driver = webdriver.Chrome(
            executable_path=".\\venv\\chromedriver_win32\\chromedriver")
        self.driver.get(self.baseURl)
        self.driver.implicitly_wait(5)
        self.lp = LoginPage(self.driver)

        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')

        list_status = []
        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(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()
                    list_status.append('pass')

                elif self.exp == 'fail':
                    self.logger.info("***********Failed**********")
                    self.lp.clickLogout()
                    list_status.append('fail')

            elif act_title != exp_title:
                if self.exp == 'fail':
                    self.logger.info("********Passed********")
                    list_status.append('pass')

                elif self.exp == 'pass':
                    self.logger.info("***********Failed**********")
                    list_status.append('fail')

        if 'fail' not in list_status:
            self.logger.info("Login_DDT_test Passed")
            self.driver.close()
            assert True

        else:
            self.logger.error("Login_DDT_Test is failed")
            self.driver.close()
            assert False

        self.logger.info("**********End of TC_002_DDT_login**********")
    def test_ddt_Login(self, setup):
        self.logger.info("***********test_ddt_Login***********")
        self.logger.info("***********Verifying The Login Test***********")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = LoginPage(self.driver)
        self.rows = XLUtils.getRowCount(self.path, "Sheet1")
        print("No of Rows in Excel : ", 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.exp = XLUtils.readData(self.path, "Sheet1", r, 3)
            self.lp.setUsername(self.user)
            self.lp.setPassword(self.password)
            self.lp.clickLogin()
            time.sleep(10)
            act_title = self.driver.title
            exp_title = "Dashboard / nopCommerce administration"
            if act_title == exp_title:
                if self.exp == "Pass":
                    self.logger.info("************Login Test Passed**********")
                    lst_status.append("Pass")
                    print(lst_status)
                    self.lp.clickLogout()
                    assert True
                elif self.exp == "Fail":
                    self.logger.info("************Login Test Failed**********")
                    lst_status.append("Fail")
                    print(lst_status)
                    self.lp.clickLogout()
                    assert False
            elif act_title != exp_title:
                if self.exp == "Fail":
                    self.logger.info("************Login Test Passed**********")
                    lst_status.append("Pass")
                    print(lst_status)
                    assert True
                elif self.exp == "Pass":
                    self.logger.info("************Login Test Failed**********")
                    lst_status.append("Fail")
                    print(lst_status)
                    assert False

        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 Test*****************")
Beispiel #11
0
    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 ***** *****")
Beispiel #12
0
    def test_login(self, setup):
        self.logger.info("************** Test_002_DDT_Login **************")
        self.logger.info("************** Verifying test_login **************")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = LoginPage(self.driver)
        self.numOfTests = XLUtils.gerRowCount(self.dataPath, "Sheet1")

        test_status_lst = []
        for data in range(2,self.numOfTests+1):
            self.user = XLUtils.readData(self.dataPath, "Sheet1", data, 1)
            self.pwd = XLUtils.readData(self.dataPath, "Sheet1", data, 2)
            self.exp = XLUtils.readData(self.dataPath, "Sheet1", data, 3)

            self.lp.setUsername(self.user)
            self.lp.setPassword(self.pwd)
            self.lp.clickLogin()
            time.sleep(5)

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

            print("Data %: % %", data, self.user, self.pwd)

            if act_title == exp_title:
                if self.exp == "Pass":
                    self.logger.info("*** PASSED ***")
                    test_status_lst.append("Pass")
                    self.lp.clickLogout()
                elif self.exp == "Fail":
                    self.logger.info("*** FAILED ***")
                    test_status_lst.append("Fail")
                    self.lp.clickLogout()
            if act_title != exp_title:
                if self.exp == "Pass":
                    self.logger.info("*** FAILED ***")
                    test_status_lst.append("Fail")
                elif self.exp == "Pass":
                    self.logger.info("*** PASSED ***")
                    test_status_lst.append("Pass")


        if "Fail" not in test_status_lst:
            self.logger.info("DDT Test is Pass")
            self.driver.close()
            assert True
        else:
            self.logger.info("DDT Test is Fail")
            self.driver.close()
            assert False

        self.logger.info(" ********** End of Login DDT Test **********")
        self.logger.info(" *************** Completed TC_LoginDDT_002 **************")
    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.getRowCount(self.path, "Sheet1")
        print('No of rows in sheet are: ', 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.exp = XLUtils.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 DDT login test *******')
        self.logger.info('******* Completed TC_LoginDDT_002 ******')
Beispiel #14
0
    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 #15
0
    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 #16
0
    def test_login_DDT(self, setUp):

        self.logger.info(
            "*********************Test_Login_2_DDT**********************************"
        )
        self.logger.info(
            "*********************Verifying_Home_Page_Title**********************************"
        )
        self.driver = setUp
        self.driver.get(self.baseUrl)
        self.lp = LoginPage(self.driver)

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

        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.result = XLUtils.readData(self.path, 'Sheet1', r, 3)
            self.lp.setUserName(self.username)
            self.lp.setPassword(self.password)
            self.lp.clickLogin()
            act_titile = self.driver.title
            exp_title = "Dashboard / nopCommerce administration"
            if act_titile == exp_title:
                if self.result == "pass":
                    self.logger.info(
                        "*********************HomePage_Title_Test_Passed********************************"
                    )
                    self.lp.clickLogout()

                elif self.result == "fail":
                    self.logger.info(
                        "*********************HomePage_Title_Test_Failed********************************"
                    )
                    self.lp.clickLogout()

            elif act_titile != exp_title:
                if self.result == "pass":
                    self.logger.info(
                        "*********************HomePage_Title_Test_Failed********************************"
                    )

                elif self.result == "fail":
                    self.logger.info(
                        "*********************HomePage_Title_Test_Passed********************************"
                    )

        self.logger.info("*******End of DTT Test Cases********")
        self.logger.info("**********Completion of Test_Login_2_DDT******")
Beispiel #17
0
    def test_login_ddt(self, setup):
        self.logger.info(
            "---------------------- Test_002_DDT_Login ----------------------")
        self.driver = setup
        self.driver.get(self.baseURL)
        self.lp = LoginPage(self.driver)

        self.rows = XLUtils.getRowCount(self.path, "Sheet1")

        lst_status = []  # Empty list variable
        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.exp = XLUtils.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("*** Pass ***")
                    self.lp.clickLogout()
                    lst_status.append("Pass")
                elif self.exp == "Fail":
                    lst_status.append("Fail")
            elif act_title != exp_title:
                if self.exp == "Pass":
                    self.logger.info("*** Fail ***")
                    lst_status.append("Fail")
                elif self.exp == "Fail":
                    self.logger.info("*** Pass ***")
                    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 TC_Login_002_DDT ***")
Beispiel #18
0
    def testloginfunc(self, setup):
        self.logger.info("***********Verifying Login page  **********")
        self.driver = setup
        self.driver.get(self.baseurl)
        self.lp = loginpage(self.driver)
        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')
        print("number of rows in an excel", self.rows)
        lst_status = []  #Empty list variable

        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.lp.setusername(self.user)
            self.lp.setpassword(self.password)
            self.lp.loginbuttonclick()
            time.sleep(5)

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

            if act_title == expected_title:
                if self.expected == "Pass":
                    print("Test is working")
                    self.lp.logoutbuttonclick()
                    lst_status.append("Pass")
                    self.driver.save_screenshot(".\\screenshots\\" +
                                                "testloginfunc.png")
                    time.sleep(5)
                elif self.expected == "Fail":
                    print("cases are failed")
                    self.lp.logoutbuttonclick()
                    lst_status.append("Fail")
                    self.driver.save_screenshot(".\\screenshots\\" +
                                                "testloginfunc.png")
            elif act_title != expected_title:
                if self.expected == "Pass":
                    lst_status.append("Fail")
                elif self.expected == "Fail":
                    lst_status.append("Pass")

        if "Fail" not in lst_status:
            print("login ddt is passed")
            assert True
        else:
            print("login fails")
            assert False
    def test_ddt(self,setup):
        self.logger.info("*****Test_002_login*****")
        self.logger.info("*****Verifying Login DDT test*****")
        self.driver=setup
        self.driver.get(self.URL)

        self.lp=login(self.driver)
        self.lp.clickLogin()
        self.rows=XLUtils.getRowcount(self.path,'Sheet1')

        for r in range(2,self.rows+1):
            self.user=XLUtils.readData(self.path,'Sheet1',r,1)
            self.pwd=XLUtils.readData(self.path,'Sheet1',r,2)
            self.driver.save_screenshot('C:\\Users\\Priyabrata Debolina\\PycharmProjects\\Selenium with python\\Screenshots\\test_DDT.png')


        self.lp.username(self.user)
        self.lp.password(self.pwd)
    def test_login_ddt(self,setup):
        self.logger.info("***************test_login started DDT test***************")
        self.logger.info("***************test_login started***************")
        self.driver = setup
        self.driver.get(self.baseUrl)
        #Create an object to call class of LoginPage from Page Object class
        self.lp = Login(self.driver)

        #excel utils code

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

        lst_status = [] #Empty List variable we need to create
        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.exp = XLUtils.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("**********DDT Test is Passed**********")
                    self.lp.clickLogout()

                    lst_status.append("Pass")
                    time.sleep(5)

                elif self.exp == "Fail":
                    self.logger.info("**********DDT Test Case Failed**********")
                    lst_status.append("Fail")
                    self.driver.close()
                    time.sleep(5)
Beispiel #21
0
    def test_login_ddt(self):
        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')
        self.logger.info("******* Starting Test_002_DDT_Login Test **********")
        self.logger.info("******* Starting Login DDT Test **********")
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        self.lp = LoginPage(self.driver)

        self.logger.info("******* Reading data from excel **********")
        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.status = XLUtils.readData(self.path, 'Sheet1', r, 3)

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

            if self.status == "True":
                if self.driver.title=="Dashboard / nopCommerce administration":
                    self.logger.info("Login Test Passed")
                    self.ts.mark("Pass", "Login Test Passed")
                    self.lp.clickLogout()
                else:
                    self.ts.mark("Fail", "Login Test Failed")
                    self.logger.info("Login Test Failed")

            elif self.status == "False":
                if self.driver.title!="Dashboard / nopCommerce administration":
                    self.ts.mark("Pass", "Login Test Passed")
                    self.logger.info("Login Test Passed")
                else:
                    self.ts.mark("Fail", "Login Test Failed")
                    self.logger.info("Login Test Failed")
                    self.lp.clickLogout()

        self.ts.markFinal("test_login_ddt", "Pass", "Login was successful")
        self.logger.info("******* Ending Login DDT Test **********")
        self.driver.close()
    def test_login_ddt(self,setup):
        self.driver = setup
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        self.lp = LoginPage(self.driver)
        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')
        print('Number of rows...',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.exp = XLUtils.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.lp.clickLogout();
                    lst_status.append("Pass")
                elif self.exp=='Fail':
                    self.lp.clickLogout();
                    lst_status.append("Fail")

            elif act_title!=exp_title:
                if self.exp == 'Pass':
                    lst_status.append("Fail")
                elif self.exp == 'Fail':
                    lst_status.append("Pass")
            print(lst_status)
        if "Fail" not in lst_status:
            self.driver.close()
            assert True
        else:
            self.driver.close()
            assert False
Beispiel #23
0
    def test_login_ddt(self, setup):
        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 a Exel: ", 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, 1)
            self.exp = XLUtils.readData(self.path, 'Sheet1', r, 3)

            self.lp.setUserName(self.user)
            self.lp.setPassword(self.password)
            self.lp.clickLogin()
            time.sleep(5)
            actual_title = self.driver.title
            print(r)

            if actual_title == "Dashboard / nopCommerce administration":
                if self.exp == "Pass":
                    assert True
                    self.lp.clickLogout()
                    lst_status.append("Pass")

            elif actual_title != "Dashboard / nopCommerce administration":
                if self.exp == 'Fail':
                    lst_status.append("Pass")

            if "Fail" not in lst_status:
                assert True
                self.driver.close()
            else:
                assert False
                self.driver.close()
def test_data_driven(setup):
    driver = setup
    driver.maximize_window()
    driver.get(baseURL)
    driver.find_element_by_xpath("//a[contains(text(),'Sign in')]").click()
    lp = LoginStep(driver)
    status = []

    rows = XLUtils.getRowCount(path, "Sheet1")
    for r in range(2, rows + 1):
        user = XLUtils.readData(path, "Sheet1", r, 1)
        password = XLUtils.readData(path, "Sheet1", r, 2)
        expected = XLUtils.readData(path, "Sheet1", r, 3)
        lp.setEmail(user)
        lp.setPassword(password)
        lp.clickLogin()
        time.sleep(3)
        act_title = driver.title
        exp_title = "Login - My Store"

        if act_title == exp_title:
            if expected == "Fail":
                status.append("Pass")
            elif expected == "Pass":
                status.append("Fail")
        elif act_title != exp_title:
            if expected == "Pass":
                status.append("Pass")
            elif expected == "Fail":
                status.append("Fail")

        if "Fail" not in status:
            assert True
        else:
            assert False
    driver.close()
Beispiel #25
0
    def test_CreateHH(self, setup):
        self.logger.info("**************** Test HOH Creation ****************")
        self.driver = setup
        self.driver.maximize_window()
        self.driver.get(self.url)
        time.sleep(3)
        self.lp = LoginPage(self.driver)
        self.lp.EnterUsername(self.username)
        time.sleep(1)
        self.lp.EnterPassword(self.password)
        time.sleep(1)
        self.lp.ClickLogin()
        time.sleep(5)
        self.logger.info("***** Login has been successfully done. *****")
        self.lp.SelectDis(self.Sdis)
        time.sleep(2)
        self.lp.SelectDisSite(self.SdisS)
        time.sleep(2)
        self.lp.ClickGoto()
        time.sleep(2)
        self.lp.ClickAccept()
        time.sleep(3)
        self.logger.info(
            "***** Selected disaster and disaster site successfully. *****")
        self.driver.get(self.HH_url)
        time.sleep(8)
        self.logger.info("***** Creation of HH *****")
        self.CHH = CreateHHPO(self.driver)  # Creation of HH
        self.CHH.Click_New()
        time.sleep(5)
        self.CHH.Click_IsHomless()
        time.sleep(1)
        self.CHH.Click_IsHomless_N()
        time.sleep(1)
        self.CHH.Enter_ResAdd_Str1(self.ResAddstr1)
        time.sleep(1)
        self.CHH.Enter_ResAdd_Str2(self.ResAddstr2)
        time.sleep(1)
        self.CHH.Enter_ResAdd_City(self.ResAddCity)
        time.sleep(1)
        self.CHH.Enter_ResAdd_ZipC(self.ResAddZip)
        time.sleep(1)
        actions = ActionChains(setup)
        for _ in range(1):
            actions.send_keys(Keys.PAGE_DOWN).perform()
            time.sleep(2)
        self.CHH.Click_POO()
        time.sleep(1)
        self.CHH.Click_POO_Acadia()
        time.sleep(1)
        self.CHH.Click_MailAdd_Same()
        time.sleep(1)
        self.CHH.Click_MailAdd_Same_Y()
        self.CHH.Click_MailAdd_Str2()
        time.sleep(1)
        for _ in range(1):
            actions.send_keys(Keys.PAGE_DOWN).perform()
            time.sleep(2)
        self.CHH.Click_Rec_SNAP()
        time.sleep(1)
        self.CHH.Click_Rec_SNAP_N()
        time.sleep(1)
        self.CHH.Click_Mem_DCFS()
        time.sleep(1)
        self.CHH.Click_Mem_DCFS_N()
        self.CHH.Click_SNAPState()
        for _ in range(1):
            actions.send_keys(Keys.PAGE_DOWN).perform()
            time.sleep(2)
        self.CHH.Click_AuthRep()
        time.sleep(1)
        self.CHH.Click_AuthRep_N()
        time.sleep(1)
        self.CHH.Click_Save()
        time.sleep(5)
        self.logger.info("***** HH has been created successfully *****")
        self.CHOH = CreateHOH(self.driver)
        self.CHOH.ClickNewHHMem()
        time.sleep(5)

        self.rows = XLUtils.getRowCount(self.path, 'HOH details')
        for r in range(2, self.rows + 1):
            self.FN = XLUtils.readData(self.path, 'HOH details', r, 1)
            self.LN = XLUtils.readData(self.path, 'HOH details', r, 2)
            self.DOB = XLUtils.readData(self.path, 'HOH details', r, 3)

        self.CHOH.EnterFN(self.FN)
        time.sleep(1.5)
        self.CHOH.EnterLN(self.LN)
        time.sleep(1)
        self.CHOH.EnterDOB(self.DOB)
        time.sleep(1)
        self.CHOH.SelectGender(self.GenderValue)
        time.sleep(1)
        self.CHOH.EnterSSN(self.SSN)
        time.sleep(1)
        self.CHOH.Click_Save()
        time.sleep(3)
        self.TextMess = self.CHOH.ToastMess()

        if self.TextMess == "The record has been Saved successfully.":
            assert True
            self.logger.info("***** HOH has been added successfully *****")
            self.driver.close()
        else:
            self.logger.info("***** HOH has not been added successfully *****")
            self.driver.save_screenshot(
                "C:\\Users\\mkalamshabaz\\PycharmProjects\\DSNAP\\Screenshots\\CreateHOH.png"
            )
            self.driver.close()
            assert False
Beispiel #26
0
    def test_login_ddt(self, setup):
        logger.info(
            "***********************Test_02_login_DDT***************************"
        )
        logger.info(
            "*********************** Verifying login test ddt ******************"
        )
        self.driver = setup
        self.driver.get(self.baseurl)
        self.lp = LoginPage(self.driver)
        self.rows = XLUtils.getRowCount(file=self.path, sheetname='Sheet1')
        print("the number of row count is :", self.rows)
        lst_status = []
        for i in range(2, self.rows + 1):
            print("iterating rown number ", i)
            user = XLUtils.readData(self.path, 'Sheet1', i, 1)
            print("username:"******"password:"******"exp:", exp)
            self.lp.setUserName(user)
            self.lp.setPassword(password)
            self.lp.clickLogin()
            time.sleep(5)

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

            if actual_text == exp_title:
                if exp == 'Pass':
                    logger.info("*******Passed*********")
                    self.lp.clickLogout()
                    lst_status.append('Pass')
                elif exp == 'Fail':
                    logger.info("********** Failed ********")
                    self.lp.clickLogout()
                    lst_status.append('Fail')
            elif actual_text != exp_title:
                if exp == 'Pass':
                    logger.info("************ failed***********")
                    lst_status.append('Fail')
                elif exp == 'Fail':
                    logger.info("**************** Passed **********")
                    lst_status.append('Pass')

        print("LIst value after appended", lst_status)
        if 'Fail' not in lst_status:
            logger.info(
                "****************Login DDT test Passed*****************")
            self.driver.close()
            assert True
        else:
            logger.info("**************** Failed *************")
            self.driver.close()
            assert False

        logger.info(
            "***************** End of the DDT test case****************")
        logger.info(
            "********************** End of the Test_002_login_DDt test ****************"
        )
    def test_login_ddt(self, setup):
        self.logger.info("*************** Started Test_003_DDT_Login test ***********")
        self.driver=setup
        #self.driver = webdriver.Chrome()
        self.driver.get(self.baseURL)
        self.driver.maximize_window()
        self.lp=LoginPage(self.driver)


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

        for r in range(2,self.rows+1):
            self.username=XLUtils.readData(self.path, 'Sheet1', r,1) # user name
            self.password = XLUtils.readData(self.path, 'Sheet1', r, 2) # password
            self.exp = XLUtils.readData(self.path, 'Sheet1', r, 3) # expected



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

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

            if act_title==exp_title: # Login Success
                if self.exp=='Pass':
                    self.logger.info('*****Passed*****')
                    self.lp.clickLogout()
                    lst_status.append("Pass")
                    assert True
                elif self.exp=='Fail':
                    self.logger.info('*****Failed*****')
                    self.lp.clickLogout()
                    lst_status.append("Failed")
                    assert False

            elif act_title!=exp_title: # Login is NOT Succesful
                if self.exp=='Pass':
                    self.logger.info('*****Failed*****')
                    lst_status.append("Failed")

                elif self.exp=='Fail':
                    self.logger.info('*****Passed*****')
                    lst_status.append("Pass")

            print(lst_status)


        if'Fail' not in lst_status:
            self.logger.info("*****DDT Login test Passed*****")
            self.driver.close()
            assert True
        else:
            self.logger.error("*****DDT Login test Failed*****")
            self.driver.close()
            assert False
        self.logger.info("*************Finished Test_003_DDT_Login**************")
        self.logger.info("**************** Completed  TC_LoginDDT_003 ************* ")
    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 = LoginPage(self.driver)

        self.rows = XLUtils.getRowCount(self.path, 'Sheet1')
        print("Number of Rows in the Excel", self.rows)
        lst_status = []  # empty list variable

        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.exp = XLUtils.readData(self.path, 'Sheet1', r, 3)

            #self.logger.info(r)
            #self.logger.info(self.user)
            #self.logger.info(self.password)
            #self.logger.info(self.exp)

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



            act_title = self.driver.title
            #self.logger.info(act_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:  # can also be if statement
                if self.exp == "Pass":
                    self.logger.info("*** Failed ***")
                    lst_status.append("Fail")
                elif self.exp == "Fail":
                    self.logger.info("*** Passed1 ***")
                    lst_status.append("Pass")

        self.logger.info(lst_status)

        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 Test_002_DDT_Login --------")
        self.logger.info("-------- Completed Login DDT test ---------")
    def test_N_DSNAPC(self, setup):
        self.logger.info(
            "**************** Test Regression Cycle ****************")
        self.driver = setup
        self.driver.maximize_window()
        self.driver.get(self.url)
        time.sleep(3)
        self.lp = LoginPage(self.driver)
        self.lp.EnterUsername(self.username)
        time.sleep(1)
        self.lp.EnterPassword(self.password)
        time.sleep(1)
        self.lp.ClickLogin()
        time.sleep(5)
        self.logger.info("***** Login has been successfully done. *****")
        self.lp.SelectDis(self.Sdis)
        time.sleep(2)
        self.lp.SelectDisSite(self.SdisS)
        time.sleep(2)
        self.lp.ClickGoto()
        time.sleep(2)
        self.lp.ClickAccept()
        time.sleep(3)
        self.logger.info(
            "***** Selected disaster and disaster site successfully. *****")
        self.driver.get(self.HH_url)
        time.sleep(8)
        self.logger.info("***** Creation of HH *****")
        self.CHH = CreateHHPO(self.driver)  # Creation of HH
        self.CHH.Click_New()
        time.sleep(5)
        self.CHH.Click_IsHomless()
        time.sleep(1)
        self.CHH.Click_IsHomless_N()
        time.sleep(1)
        self.CHH.Enter_ResAdd_Str1(self.ResAddstr1)
        time.sleep(1)
        self.CHH.Enter_ResAdd_Str2(self.ResAddstr2)
        time.sleep(1)
        self.CHH.Enter_ResAdd_City(self.ResAddCity)
        time.sleep(1)
        self.CHH.Enter_ResAdd_ZipC(self.ResAddZip)
        time.sleep(1)
        actions = ActionChains(setup)
        for _ in range(1):
            actions.send_keys(Keys.PAGE_DOWN).perform()
            time.sleep(2)
        self.CHH.Click_POO()
        time.sleep(1)
        self.CHH.Click_POO_Acadia()
        time.sleep(1)
        self.CHH.Click_MailAdd_Same()
        time.sleep(1)
        self.CHH.Click_MailAdd_Same_Y()
        self.CHH.Click_MailAdd_Str2()
        time.sleep(1)
        for _ in range(1):
            actions.send_keys(Keys.PAGE_DOWN).perform()
            time.sleep(2)
        self.CHH.Click_Rec_SNAP()
        time.sleep(1)
        self.CHH.Click_Rec_SNAP_N()
        time.sleep(1)
        self.CHH.Click_Mem_DCFS()
        time.sleep(1)
        self.CHH.Click_Mem_DCFS_N()
        self.CHH.Click_SNAPState()
        for _ in range(1):
            actions.send_keys(Keys.PAGE_DOWN).perform()
            time.sleep(2)
        self.CHH.Click_AuthRep()
        time.sleep(1)
        self.CHH.Click_AuthRep_N()
        time.sleep(1)
        self.CHH.Click_Save()
        time.sleep(8)
        self.logger.info("***** HH has been created successfully *****")
        self.driver.save_screenshot(
            "C:\\Users\\mkalamshabaz\\PycharmProjects\\DSNAP\\Screenshots\\HHCreated.png"
        )
        self.logger.info("***** Creation of HOH *****")
        self.CHOH = CreateHOH(self.driver)
        self.CHOH.ClickNewHHMem()
        time.sleep(6.5)

        self.rows = XLUtils.getRowCount(self.path, 'Regression details')
        for r in range(1, self.rows):
            self.FN = XLUtils.readData(self.path, 'Regression details', r, 1)
            self.LN = XLUtils.readData(self.path, 'Regression details', r, 2)
            self.DOB = XLUtils.readData(self.path, 'Regression details', r, 3)

        self.CHOH.EnterFN(self.FN)
        time.sleep(1.5)
        self.CHOH.EnterLN(self.LN)
        time.sleep(1)
        self.CHOH.EnterDOB(self.DOB)
        time.sleep(1)
        self.CHOH.SelectGender(self.GenderValue)
        time.sleep(1)
        self.CHOH.EnterSSN(self.SSN)
        time.sleep(1)
        self.CHOH.Click_Save()
        time.sleep(5.5)
        self.CHOH.ClickNewHHMem()
        time.sleep(6)

        for r in range(1, self.rows + 1):
            self.FN = XLUtils.readData(self.path, 'Regression details', r, 1)
            self.LN = XLUtils.readData(self.path, 'Regression details', r, 2)
            self.DOB = XLUtils.readData(self.path, 'Regression details', r, 3)

        self.CHOH.EnterFN(self.FN)
        time.sleep(1.5)
        self.CHOH.EnterLN(self.LN)
        time.sleep(1)
        self.CHOH.EnterDOB(self.DOB)
        time.sleep(1)
        self.CHOH.SelectGender(self.GenderValue)
        time.sleep(1)
        self.CHOH.EnterSSN(self.MSSN)
        time.sleep(1)
        self.CHOH.Click_Save()
        time.sleep(5)
        self.logger.info(
            "***** HOH and member have been added successfully *****")
        self.logger.info("***** Performing MPI Search for HOH *****")
        self.MPIS = MPISearch(self.driver)
        self.MPIS.ClickHOH()
        time.sleep(4.5)
        self.MPIS.ClickLS()
        time.sleep(5)
        self.MPIS.ClickLS_Cancl()
        time.sleep(3.5)
        self.MPIS.ClickMPIS()
        time.sleep(5)
        self.MPIS.ClickMPIS_Cancl()
        time.sleep(3.5)
        self.logger.info(
            "***** MPI search for HOH has been done successfully *****")
        self.MPIS.ClickHOHBck()
        time.sleep(4)
        self.logger.info("***** Performing MPI Search for Member *****")
        actions.send_keys(Keys.PAGE_DOWN, Keys.PAGE_DOWN).perform()
        time.sleep(4)
        self.MPIS.ClickMem()
        time.sleep(6)
        self.driver.refresh()
        time.sleep(8)
        self.MPIS.ClickLS_M()
        time.sleep(5.5)
        self.MPIS.Click_Excep_Cncl_LS()
        time.sleep(3.5)
        self.MPIS.ClickMPIS_M()
        time.sleep(5)
        self.MPIS.Click_Excep_Cncl_LS()
        time.sleep(4)
        self.logger.info(
            "***** MPI search for Member has been done successfully *****")
        self.MPIS.ClickMBck()
        time.sleep(6.5)
        self.logger.info("***** Adding Interviewee *****")
        self.AI = Interviewee(self.driver)
        self.AI.Click_MenuOptn()
        time.sleep(2)
        self.AI.Click_New_Inter()
        time.sleep(4)
        self.AI.Click_SearchMem()
        time.sleep(2.5)
        self.AI.Click_Mem()
        time.sleep(1.5)
        self.AI.Select_DocID(self.DocIDvalue)
        time.sleep(1.5)
        elm = self.driver.find_element_by_tag_name('html')
        elm.send_keys(Keys.TAB, Keys.TAB, Keys.TAB, Keys.ENTER)
        time.sleep(4)
        self.logger.info("***** Interviewee has been added successfully *****")
        self.logger.info(
            "***** New DSNAP case creation has been started *****")
        self.NDSNPC = N_DSNAPCase(self.driver)
        self.NDSNPC.Click_MenuOptn()
        time.sleep(2)
        self.NDSNPC.Click_New_DSNAPC()
        time.sleep(4)
        self.NDSNPC.Click_DisName(self.Sdis)
        time.sleep(2.5)
        self.NDSNPC.Sel_DisName()
        time.sleep(1.5)
        self.NDSNPC.Click_IntSel()
        time.sleep(2)
        self.NDSNPC.Click_OptnIntSel()
        time.sleep(2)
        elm.send_keys(Keys.TAB, Keys.TAB, Keys.TAB, Keys.TAB, Keys.TAB,
                      Keys.ENTER)
        time.sleep(6.5)
        self.logger.info(
            "***** New DSNAP case has been created successfully *****")
        self.driver.save_screenshot(
            "C:\\Users\\mkalamshabaz\\PycharmProjects\\DSNAP\\Screenshots\\DSNAPCaseCreated.png"
        )
        self.logger.info("***** Certification of DSNAP Case *****")
        self.logger.info(
            "***** Inserting Voter Registration Information *****")
        self.DC_Cert = DC_CertPO(self.driver)
        self.DC_Cert.Click_VR()
        time.sleep(4.5)
        self.DC_Cert.Sel_VRQ1(self.VRQ1)
        time.sleep(1)
        self.DC_Cert.Sel_VRQ2(self.VRQ2)
        time.sleep(2.5)
        self.DC_Cert.Click_PunderVRQ2()
        time.sleep(1.5)
        actions.send_keys(Keys.TAB, Keys.ENTER).perform()
        time.sleep(4)
        self.logger.info(
            "***** Voter Registration Information has been entered successfully *****"
        )
        self.logger.info("***** Inserting Disaster Impact Details *****")
        self.DC_Cert.Click_DID()
        time.sleep(3.5)
        self.DC_Cert.Sel_DIDQ1(self.DIDR)
        time.sleep(1)
        self.DC_Cert.Sel_DIDQ2(self.DIDR)
        time.sleep(1)
        self.DC_Cert.Sel_DIDQ3(self.DIDR)
        time.sleep(1)
        self.DC_Cert.Sel_DIDQ4(self.DIDR)
        time.sleep(1)
        self.DC_Cert.Sel_DIDQ5(self.DIDR)
        time.sleep(1)
        self.DC_Cert.Sel_DIDQ6(self.DIDR)
        time.sleep(1)
        self.DC_Cert.Ent_DIDQ7(self.DIDR)
        time.sleep(1)
        self.DC_Cert.Ent_DIDQ8(self.DIDR)
        time.sleep(1)
        self.DC_Cert.Ent_DIDQ9(self.Exp)
        time.sleep(1)
        actions.send_keys(Keys.TAB, Keys.ENTER).perform()
        time.sleep(4)
        self.logger.info(
            "***** Disaster Impact Details has been entered successfully *****"
        )
        self.logger.info(
            "***** Inserting Rights and Responsibilities Details *****")
        self.DC_Cert.Click_RR()
        time.sleep(4)
        elm.send_keys(Keys.TAB, Keys.TAB, Keys.SPACE)
        time.sleep(2)
        elm.send_keys(Keys.TAB, Keys.TAB, Keys.SPACE)
        time.sleep(2)
        self.DC_Cert.Click_RRQ1(self.Sign)
        time.sleep(1)
        self.DC_Cert.Click_RRQ2(self.Sign)
        time.sleep(1)
        self.DC_Cert.Click_RRQ2_Sign(self.Sign)
        time.sleep(1.5)
        elm.send_keys(Keys.TAB, Keys.TAB, Keys.SPACE)
        time.sleep(2.5)
        elm.send_keys(Keys.TAB, Keys.TAB, Keys.TAB, Keys.ENTER)
        time.sleep(5)
        self.logger.info(
            "***** Rights and Responsibilities Details has been entered successfully *****"
        )
        self.logger.info("***** Performing Address Verification *****")
        self.DC_Cert.Click_MenuOptn()
        time.sleep(2.5)
        self.DC_Cert.Click_AddVer_Optn()
        time.sleep(4)
        actions.send_keys(Keys.PAGE_DOWN).perform()
        time.sleep(2)
        self.DC_Cert.Click_Save_AddVer()
        time.sleep(3.5)
        self.DC_Cert.Click_MenuOptn()
        time.sleep(2.5)
        self.DC_Cert.Click_Certify()
        time.sleep(6)
        self.TextMess = self.MPIS.ToastMess()
        if self.TextMess == "The record has been Saved successfully.":
            assert True
            self.logger.info(
                "***** DSNAP Case has been certified successfully *****")
            self.driver.close()
        else:
            self.logger.info(
                "***** DSNAP Case has not been certified successfully *****")
            self.driver.save_screenshot(
                "C:\\Users\\mkalamshabaz\\PycharmProjects\\DSNAP\\Screenshots\\CaseNotCertified.png"
            )
            self.driver.close()
            assert False
Beispiel #30
0
    def test_login_ddt(self,setup):

        self.logger.info("************* Test_002_DDT_Login Started *******")
        self.logger.info("************* Verifying test_login_ddt Test Case *******")

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

        self.lp=LoginPage(self.driver)

        self.rows=XLUtils.getRowCount(self.path,'Sheet1')
        self.logger.info("The row counts is %s",self.rows)

        list_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.logger.info('username is %s',self.username)
            self.logger.info('password is %s',self.password)
            self.logger.info('expected result is %s',self.exp)

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

            actual_title=self.driver.title
            exp_title="Salesforce - Unlimited Edition"

            if actual_title==exp_title:
                self.logger.info("************* Login Is successful due to Correct credentials *******")
                if self.exp=="Pass":
                    self.logger.info("*******Test Data sheet expected given as Pass So the test also passed *******")
                    self.lp.clickLogout()
                    list_status.append("Pass")

                elif self.exp=="Fail":
                    self.logger.info("************* Test Data sheet expected given as Fail rather than Pass *******")
                    self.lp.clickLogout()
                    list_status.append("Fail")

            elif actual_title != exp_title:
                self.logger.info("************* Login Failed due to incorrect credentials *******")
                if self.exp=="Pass":
                    self.logger.info("************* Test Data sheet expected given as Pass rather than Fail *******")
                    list_status.append("Fail")

                elif self.exp=="Fail":
                    self.logger.info("****** Test Data sheet expected given as Fail So the test also passed *******")
                    list_status.append("Pass")

        self.logger.info("The status in the list are: ")
        for item in list_status:
            self.logger.info(item)

        if "Fail" not in list_status:
            self.logger.info("*** Login DDT test is passed ***")
            assert True
        else:
            self.logger.info("*** Login DDT test is Failed ***")
            assert False

        self.logger.info("*** End of Verifying test_login_ddt ***")
        self.logger.info("*** Completed Test_002_DDT_Login ***")