Exemple #1
0
def TC_003_FileUpload():
    try:
        globVal.testCaseName = 'TC_003_FileUpload'
        globVal.testType = 'Regression'

        #Creating object to global function
        GF_Obj = GlobalFunction()

        # Step 1
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Open the browser and Navigate to ' + globVal.testURL
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        GF_Obj.launchApplication()
        GF_Obj.verifyWebObjDisplayed('SignUp_page', 'Passed', 'Failed',
                                     'StepName', 'ExitTest', 'WaitTime')

        # Step 2
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Login to the application'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        GF_Obj.clickOnWebObj('SignUp_Login_Link', 'LoginPage', 'Passed',
                             'Failed', 'Click on Login link in SignUp page',
                             'ExitTest', 'WaitTime')
        testData = GF_Obj.getDataFromDataSheet(
            'filepath', globVal.testData_Credentials_SheetName, 'TestingWorld',
            'UserName', 'Passed', 'Failed', 'StepName', 'ExitTest')
        GF_Obj.setDataToWebObj('Login_UserID_TextBox', testData, 'Passed',
                               'Failed', 'Enter value into user id textbox',
                               'ExitTest', 'WaitTime')
        testData = GF_Obj.getDataFromDataSheet(
            'filepath', globVal.testData_Credentials_SheetName, 'TestingWorld',
            'Password', 'Passed', 'Failed', 'StepName', 'ExitTest')
        GF_Obj.setDataToWebObj('Login_Password_TextBox', testData, 'Passed',
                               'Failed', 'Enter value into password textbox',
                               'ExitTest', 'WaitTime')
        GF_Obj.clickOnWebObj('Login_Login_Btn', 'HomePage', 'Passed', 'Failed',
                             'Click on Login button', 'ExitTest', 'WaitTime')

        # Step 3
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Select "" from sex dropdown in homepage'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        #GF_Obj.setValToObj('HomePage_ViewLarge_ChooseFile', '‪C:/Users/Dell/Desktop/Sample.png', 'Passed', 'Failed', 'Enter value into user id textbox',
        # 'ExitTest', 'WaitTime')

        GF_Obj.clickOnWebObj(
            'HomePage_ViewLarge_ChooseFile', '', 'Passed', 'Failed',
            'Click on "Choose File" button under View Large Section  in Home page',
            'ExitTest', 'WaitTime')
        time.sleep(3)

        GF_Obj.closeAllBrowser('Yes')
    except Exception as e:
        pass
def TC_MC_001_LoginVerification():
    try:
        # ******************************************************
        reportStep = ''
        waitTime = ''
        exitTestOnStepFail = True
        dontExitTestOnStepFail = False
        passed = 'passed'
        failed = 'failed'

        globVal.testCaseName = 'TC_MC_001_LoginVerification'
        globVal.testType = 'Regression'
        globVal.testBrowserName = 'Chrome'

        # Creating object to global function
        GF_Obj = GlobalFunction()
        # *********************************************************

        # Step 1
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Open the browser and Navigate to Application'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        globVal.testURL = GF_Obj.getDataFromDataSheet(
            globVal.testData_ExcelPath, globVal.testData_URLs_SheetName,
            'Mercury Tours', 'ApplicationURL', passed, failed, reportStep,
            exitTestOnStepFail, 1)
        GF_Obj.launchApplication(globVal.testBrowserName, globVal.testURL,
                                 waitTime)

        # Step 2
        # ===================================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Login with valid credentials'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ====================================================================
        stepData = GF_Obj.getDataFromDataSheet(
            globVal.testData_ExcelPath, globVal.testData_Credentials_SheetName,
            globVal.testCaseName, 'UserName', passed, failed, reportStep,
            exitTestOnStepFail, 1)
        GF_Obj.setDataToWebObj('MC_UserName_TextBox', stepData, passed, failed,
                               reportStep, waitTime, exitTestOnStepFail)
        stepData = GF_Obj.getDataFromDataSheet(
            globVal.testData_ExcelPath, globVal.testData_Credentials_SheetName,
            globVal.testCaseName, 'Password', passed, failed, reportStep,
            exitTestOnStepFail, 1)
        GF_Obj.setDataToWebObj('MC_Password_TextBox', stepData, passed, failed,
                               reportStep, waitTime, exitTestOnStepFail)

        GF_Obj.clickOnWebObj('MC_UserName_TextBox', '', passed, failed,
                             reportStep, waitTime, dontExitTestOnStepFail)
        GF_Obj.clickOnWebObj('MC_SignIn_Button', '', passed, failed,
                             reportStep, waitTime, exitTestOnStepFail)
        GF_Obj.clickOnWebObj('MC_SignIn_Button', '', passed, failed,
                             reportStep, waitTime, dontExitTestOnStepFail)
        GF_Obj.clickOnWebObj('MC_SignOff_Link', '', passed, failed, reportStep,
                             waitTime, exitTestOnStepFail)
        GF_Obj.clickOnWebObj('MC_SignOff_Link', '', passed, failed, reportStep,
                             waitTime, dontExitTestOnStepFail)

        # Step 3
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Logout from the application and close all the browsers'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        GF_Obj.closeAllBrowser(True)

    # Catch if Exception is occurred
    except Exception as e:
        pass
Exemple #3
0
def TC_004_WebTable():
    try:
        reportStep = ''
        waitTime = ''
        exitTestOnStepFail = True
        dontExitTestOnStepFail = False
        globVal.testCaseName = 'TC_004_WebTable'
        globVal.testType = 'Regression'
        globVal.testBrowser = 'chrome'
        globVal.testURL = 'https://chercher.tech/python/table-selenium-python#'

        # Creating object to global function
        GF_Obj = GlobalFunction()

        testData = GF_Obj.getDataFromDataSheet(
            '', globVal.testData_TestData_SheetName, 'TC_001_Login',
            'UserName', 'passed', 'failed', reportStep, dontExitTestOnStepFail,
            3)
        # Step 1
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Open the browser and Navigate to ' + globVal.testURL
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        GF_Obj.launchApplication(globVal.testBrowser, globVal.testURL,
                                 waitTime)
        #GF_Obj.verifyWebObjDisplayed('SignUp_page', 'Passed', 'Failed', 'stepName', 'ExitTest', 'WaitTime')
        object = globVal.driver.find_element_by_id('webtable')
        globVal.stepDiscription = 'CherCherTech - WebTable'
        GF_Obj.verifyWebObjDisplayed(object, 'Passed', 'Failed', reportStep,
                                     waitTime, dontExitTestOnStepFail)
        GF_Obj.verifyWebObjDisplayed('CherCherTech_Table_WebElement', 'Passed',
                                     'Failed', reportStep, waitTime,
                                     exitTestOnStepFail)

        GF_Obj.verifyWebObjEnabled('CherCherTech_JIRA_Link', 'passed',
                                   'failed', reportStep, waitTime,
                                   dontExitTestOnStepFail)
        #GF_Obj.clickOnWebObj('CherCherTech_JIRA_Link','','passed','failed',reportStep,waitTime,dontExitTestOnStepFail)
        GF_Obj.clickOnWebObj('CherCherTech_JIRA_Link',
                             'CherCherTech_JIRA_Page', 'passed', 'failed',
                             reportStep, waitTime, exitTestOnStepFail)
        globVal.driver.back()

        Result = GF_Obj.getRowCountOfWebTable('CherCherTech_Table_WebElement',
                                              'passed', 'failed', reportStep,
                                              dontExitTestOnStepFail, waitTime)
        print('Total Rows', Result)
        Result = GF_Obj.getColumnCountOfWebTable(
            'CherCherTech_Table_WebElement', 'passed', 'failed', reportStep,
            dontExitTestOnStepFail, waitTime)
        print('Total Columns', Result)
        Result = GF_Obj.getCellDataFromWebTable(
            'CherCherTech_Table_WebElement', 2, 3, 'passed', 'failed',
            reportStep, dontExitTestOnStepFail, waitTime)
        print('Cell value', Result)
        Result = GF_Obj.verifyWebTableCellExist(
            'CherCherTech_Table_WebElement', 2, 3, 'passed', 'failed',
            reportStep, waitTime, dontExitTestOnStepFail)
        print('Cell Present', Result)
        Result = GF_Obj.getCellDataFromWebTable(
            'CherCherTech_Table_WebElement', 2, 3, 'passed', 'failed',
            reportStep, dontExitTestOnStepFail, waitTime)
        print('Cell value', Result)
        Result = GF_Obj.getTotalDataOfWebTable('CherCherTech_Table_WebElement',
                                               'passed', 'failed', reportStep,
                                               dontExitTestOnStepFail,
                                               waitTime)
        print('Total value', Result)
        Result = GF_Obj.verifyWebObjEnabled('CherCherTech_Link1_Link',
                                            'passed', 'failed', reportStep,
                                            dontExitTestOnStepFail, waitTime)
        print('Is Enabled', Result)
        Result = GF_Obj.verifyWebObjDisplayed('CherCherTech_Link2_Link',
                                              'passed', 'failed', reportStep,
                                              dontExitTestOnStepFail, waitTime)
        print('Is Displayed', Result)
        GF_Obj.closeAllBrowser(False)

        globVal.testURL = 'https://www.thetestingworld.com/testings/'
        # Step 2
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Open the browser and Navigate to ' + globVal.testURL
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        GF_Obj.launchApplication(globVal.testBrowser, globVal.testURL,
                                 waitTime)

        # Step 3
        # ====================================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Login to the application'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ===================================================================
        GF_Obj.clickOnWebObj('SignUp_Login_Link', '', 'Passed', 'Failed',
                             'Click on Login link in SignUp page', waitTime,
                             dontExitTestOnStepFail)
        testData = GF_Obj.getDataFromDataSheet(
            '', globVal.testData_Credentials_SheetName, 'TestingWorld',
            'UserName', 'Passed', 'Failed', reportStep, dontExitTestOnStepFail,
            1)
        GF_Obj.setDataToWebObj('Login_UserID_TextBox', testData, 'Passed',
                               'Failed', 'Enter value into user id textbox',
                               waitTime, dontExitTestOnStepFail)
        testData = GF_Obj.getDataFromDataSheet(
            '', globVal.testData_Credentials_SheetName, 'TestingWorld',
            'Password', 'Passed', 'Failed', reportStep, dontExitTestOnStepFail,
            1)
        GF_Obj.setDataToWebObj('Login_Password_TextBox', testData, 'Passed',
                               'Failed', 'Enter value into password textbox',
                               waitTime, dontExitTestOnStepFail)
        GF_Obj.clickOnWebObj('Login_Login_Btn', '', 'Passed', 'Failed',
                             'Click on Login button', waitTime,
                             dontExitTestOnStepFail)

        # Step 4
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Select "Female" from sex dropdown in homepage'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        # GF_Obj.selectDropdownWebObjValByName('HomePage_Sex_Dropdown', 'Female', 'Passed', 'Failed', reportStep,
        #                                      waitTime, dontExitTestOnStepFail)
        GF_Obj.selectDropdownWebObjValByIndex('HomePage_Sex_Dropdown', 2,
                                              'Passed', 'Failed', reportStep,
                                              waitTime, dontExitTestOnStepFail)
        GF_Obj.closeAllBrowser('Yes')
    # Catch if Exception is occurred
    except Exception as e:
        exceptionType = str(type(e).__name__)
        if exceptionType.lower() != 'exception':
            # Report Step as 'Failed'
            stepName = 'Exception occurred in test execution. (ExceptionType: <' + exceptionType + '>)'
            stepDetail = 'Description: <' + str(e) + '>'
            Report.customReport(stepName, stepDetail, 'Failed')
            # Save HTML Report
            GF_Obj.saveHTMLReport()
        else:
            pass
Exemple #4
0
def TC_005_WindowHandles():
    try:
        ###########################################################
        reportStep = ''
        waitTime = ''
        exitTestOnStepFail = True
        dontExitTestOnStepFail = False
        passed = 'passed'
        failed = 'failed'
        globVal.testCaseName = 'TC_005_WindowHandles'
        globVal.testType = 'Regression'
        globVal.testBrowserName = 'Chrome'

        # Creating object to global function
        GF_Obj = GlobalFunction()
        ############################################################

        # Step 1
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Open the browser and Navigate to Application'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        #globVal.testURL = 'https://www.thetestingworld.com/testings/'
        globVal.testURL = GF_Obj.getDataFromDataSheet(
            globVal.testData_ExcelPath, globVal.testData_URLs_SheetName,
            'TestingWorld', 'ApplicationURL', passed, failed, reportStep,
            exitTestOnStepFail, 1)
        GF_Obj.launchApplication('ie', globVal.testURL, waitTime)

        # Step 2
        # ====================================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Login to the application'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ===================================================================
        GF_Obj.clickOnWebObj('SignUp_Login_Link', '', 'Passed', 'Failed',
                             'Click on Login link in SignUp page', waitTime,
                             exitTestOnStepFail)
        testData = GF_Obj.getDataFromDataSheet(
            '', globVal.testData_Credentials_SheetName, 'TestingWorld',
            'UserName', 'Passed', 'Failed', reportStep, exitTestOnStepFail, 1)
        GF_Obj.setDataToWebObj('Login_UserID_TextBox', testData, 'Passed',
                               'Failed', 'Enter value into user id textbox',
                               waitTime, dontExitTestOnStepFail)
        testData = GF_Obj.getDataFromDataSheet(
            '', globVal.testData_Credentials_SheetName, 'TestingWorld',
            'Password', 'Passed', 'Failed', reportStep, dontExitTestOnStepFail,
            1)
        GF_Obj.setDataToWebObj('Login_Password_TextBox', testData, 'Passed',
                               'Failed', 'Enter value into password textbox',
                               waitTime, dontExitTestOnStepFail)
        GF_Obj.clickOnWebObj('Login_Login_Btn', '', 'Passed', 'Failed',
                             'Click on Login button', waitTime,
                             dontExitTestOnStepFail)

        # Step 4
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Select "Female" from sex dropdown in homepage'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================

        GF_Obj.switchToSimpleAlert(True, True, passed, failed, reportStep,
                                   waitTime, dontExitTestOnStepFail)
        GF_Obj.switchToSimpleAlert(True, False, passed, failed, reportStep,
                                   waitTime, dontExitTestOnStepFail)
        GF_Obj.switchToSimpleAlert(False, True, passed, failed, reportStep,
                                   waitTime, dontExitTestOnStepFail)
        GF_Obj.switchToSimpleAlert(False, False, passed, failed, reportStep,
                                   waitTime, dontExitTestOnStepFail)
        GF_Obj.switchToSimpleAlert(True, True, passed, failed, reportStep,
                                   waitTime, dontExitTestOnStepFail)

        GF_Obj.clickOnWebObj('HomePage_TestingProdSite_Link', '', passed,
                             failed, reportStep, waitTime,
                             dontExitTestOnStepFail)

        print('window size: ', globVal.driver.get_window_size())
        print('current window: ', globVal.driver.current_window_handle)
        obj1 = globVal.driver.window_handles[0]

        print('window 1', globVal.driver.title)

        obj2 = globVal.driver.window_handles[1]
        globVal.driver.switch_to.window(obj2)
        print('window 2', globVal.driver.title)
        globVal.driver.switch_to.window(obj1)
        print('window 1', globVal.driver.title)

        GF_Obj.switchWindowByIndex('1', passed, failed, reportStep,
                                   dontExitTestOnStepFail)
        print('window 2 function', globVal.driver.title)
        GF_Obj.switchWindowByIndex(' 0', passed, failed, reportStep,
                                   dontExitTestOnStepFail)
        print('window 1 function', globVal.driver.title)
        GF_Obj.switchWindowByIndex(3, passed, failed, reportStep,
                                   exitTestOnStepFail)
        print('window 3 function', globVal.driver.title)
        GF_Obj.switchWindowByIndex(4, passed, failed, reportStep,
                                   dontExitTestOnStepFail)
        print('window 4 function', globVal.driver.title)
        GF_Obj.switchWindowByIndex('jk', passed, failed, reportStep,
                                   dontExitTestOnStepFail)
        print('window 1 function', globVal.driver.title)
        GF_Obj.closeAllBrowser('Yes')

    # Catch if Exception is occurred
    except Exception as e:
        exceptionType = str(type(e).__name__)
        if exceptionType.lower() != 'exception':
            # Report Step as 'Failed'
            stepName = 'Exception occurred in test execution. (ExceptionType: <' + exceptionType + '>)'
            stepDetail = 'Description: <' + str(e) + '>'
            Report.customReport(stepName, stepDetail, 'Failed')
            # Save HTML Report
            GF_Obj.saveHTMLReport()
        else:
            pass
def TC_006_MouseHover():
    try:
        reportStep = ''
        waitTime = ''
        exitTestOnStepFail = True
        dontExitTestOnStepFail = False
        passed = 'passed'
        failed = 'failed'
        globVal.testCaseName = 'TC_006_MouseHover'
        globVal.testType = 'Regression'
        #globVal.testBrowser = 'chrome'
        globVal.testURL = 'https://facebook.com'

        # Creating object to global function
        GF_Obj = GlobalFunction()
        globVal.testURL = GF_Obj.getDataFromDataSheet(
            globVal.testData_ExcelPath, 'URLs', 'TestingWorld',
            'ApplicationURL', 'information', 'warning', reportStep,
            exitTestOnStepFail, 1)
        # Step 1
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Open the browser and Navigate to ' + globVal.testURL
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        GF_Obj.launchApplication('Chrome', globVal.testURL, waitTime)

        # Step 2
        # ====================================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Login to the application'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ===================================================================
        GF_Obj.clickOnWebObj('SignUp_Login_Link', '', 'Passed', 'Failed',
                             'Click on Login link in SignUp page', waitTime,
                             dontExitTestOnStepFail)
        testData = GF_Obj.getDataFromDataSheet(
            '', globVal.testData_Credentials_SheetName, 'TestingWorld',
            'UserName', 'Passed', 'Failed', reportStep, dontExitTestOnStepFail,
            1)
        GF_Obj.setDataToWebObj('Login_UserID_TextBox', testData, 'Passed',
                               'Failed', 'Enter value into user id textbox',
                               waitTime, dontExitTestOnStepFail)
        testData = GF_Obj.getDataFromDataSheet(
            '', globVal.testData_Credentials_SheetName, 'TestingWorld',
            'Password', 'Passed', 'Failed', reportStep, dontExitTestOnStepFail,
            1)
        GF_Obj.setDataToWebObj('Login_Password_TextBox', testData, 'Passed',
                               'Failed', 'Enter value into password textbox',
                               waitTime, dontExitTestOnStepFail)
        GF_Obj.clickOnWebObj('Login_Login_Btn', '', 'Passed', 'Failed',
                             'Click on Login button', waitTime,
                             dontExitTestOnStepFail)

        # Step 4
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Hover the mouse on Hover button and click on Manage Customer link'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        globVal.driver.find_element_by_xpath(
            '//input[@id="file" and @name="file"]').send_keys(
                '‪C:\\Users\\Dell\\Desktop\\5b2e72383d53d.png')
        globVal.driver.find_element_by_id(
            '//input[@type="submit" and @value="Upload"]').click()

        Object = globVal.driver.find_element_by_xpath('//a[text()="Hover "]')
        globVal.stepDiscription = 'Homepage Header - Hover Button'
        GF_Obj.mouseHoverOnWebObj('HomePage_Hover_Link', passed, failed,
                                  reportStep, waitTime, dontExitTestOnStepFail)
        time.sleep(5)
        Object = globVal.driver.find_element_by_xpath(
            '(//a[text()="Manage Customer"])[2]')
        globVal.stepDiscription = 'Homepage Header - Manage Customer Link'
        GF_Obj.clickOnWebObj('HomePage_ManageCustomer_Link', '', passed,
                             failed, reportStep, waitTime,
                             dontExitTestOnStepFail)
        time.sleep(5)

        GF_Obj.saveHTMLReport()
    # Catch if Exception is occurred
    except Exception as e:
        exceptionType = str(type(e).__name__)
        if exceptionType.lower() != 'exception':
            # Report Step as 'Failed'
            stepName = 'Exception occurred in test execution. (ExceptionType: <' + exceptionType + '>)'
            stepDetail = 'Description: <' + str(e) + '>'
            Report.customReport(stepName, stepDetail, 'Failed')
            # Save HTML Report
            GF_Obj.saveHTMLReport()
        else:
            pass
def TC_001_Login():
    try:
        reportStep = ''
        waitTime = ''
        exitTestOnStepFail = True
        dontExitTestOnStepFail = False
        passed = 'passed'
        failed = 'failed'
        globVal.testCaseName = 'TC_001_Login'
        globVal.testType = 'Regression'

        #Creating object to global function
        GF_Obj = GlobalFunction()

        #Step 1
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Open the browser and Navigate to Testing World Signup page'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        globVal.testURL = GF_Obj.getDataFromDataSheet(
            globVal.testData_ExcelPath, 'URLs', 'TestingWorld',
            'ApplicationURL', 'information', 'warning', reportStep,
            exitTestOnStepFail, 1)
        GF_Obj.launchApplication('Chrome', globVal.testURL, 20)
        GF_Obj.verifyNavigation('SignUpPage', passed, failed, reportStep,
                                waitTime, dontExitTestOnStepFail)

        # Step 2
        # ====================================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Login to the application'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ===================================================================
        GF_Obj.clickOnWebObj('SignUp_Login_Link', 'LoginPage', passed, failed,
                             reportStep, waitTime, exitTestOnStepFail)
        GF_Obj.clickOnWebObj('SignUp_Login_L ink', 'LoginPage', passed, failed,
                             reportStep, waitTime, dontExitTestOnStepFail)

        testData = GF_Obj.getDataFromDataSheet(
            globVal.testData_ExcelPath, globVal.testData_Credentials_SheetName,
            'TestingWorld', 'UserName', passed, failed, reportStep,
            exitTestOnStepFail, 1)
        GF_Obj.setDataToWebObj('Login_UserID_TextBox', testData, passed,
                               failed, reportStep, waitTime,
                               exitTestOnStepFail)
        testData = GF_Obj.getDataFromDataSheet(
            globVal.testData_ExcelPath, globVal.testData_Credentials_SheetName,
            'TestingWorld', 'Password', passed, failed, reportStep,
            exitTestOnStepFail, 1)
        GF_Obj.setDataToWebObj('Login_Password_TextBox', testData, passed,
                               failed, reportStep, waitTime,
                               exitTestOnStepFail)
        GF_Obj.clickOnWebObj('Login_Logi n_Btn', 'HomePage', passed, failed,
                             reportStep, waitTime, dontExitTestOnStepFail)
        GF_Obj.clickOnWebObj('Login_Login_Btn', 'HomePage', passed, failed,
                             reportStep, waitTime, exitTestOnStepFail)

        # ---------------
        # globVal.driver.switch_to_frame(0)
        # GF_Obj.setDataToWebObj('HomePage_ViewLarge_ChooseFile','C://Users/Dell/Desktop/5b2e72383d53d.png',passed,failed,reportStep,waitTime,dontExitTestOnStepFail)
        # GF_Obj.clickOnWebObj('HomePage_ViewLarge_Upload','',passed,failed,reportStep,waitTime,dontExitTestOnStepFail)
        filePath = 'C://Users/Dell/Desktop/5b2e72383d53d.png'
        GF_Obj.uploadFile('HomePage_ViewLarge_ChooseFile',
                          'HomePage_ViewLarge_Upload', filePath, passed,
                          failed, reportStep, waitTime, dontExitTestOnStepFail)
        # ---------------

        # Step 3
        # ==============================================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Logout from the application and close all the browsers'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ===============================================================================
        GF_Obj.clickOnWebObj('HomePage_Logout_Btn', 'SignUpPage', passed,
                             failed, reportStep, waitTime, exitTestOnStepFail)
        GF_Obj.closeAllBrowser('Yes')

    # Catch if Exception is occurred
    except Exception as e:
        exceptionType = str(type(e).__name__)
        if exceptionType.lower() != 'exception':
            # Report Step as 'Failed'
            stepName = 'Exception occurred in test execution. (ExceptionType: <' + exceptionType + '>)'
            stepDetail = 'Description: <' + str(e) + '>'
            Report.customReport(stepName, stepDetail, 'Failed')
            # Save HTML Report
            GF_Obj.saveHTMLReport()
        else:
            pass
def TC_002_Signup():
    try:
        globVal.testCaseName = 'TC_002_Signup'
        globVal.testType = 'Regression'

        #Creating object to global function
        GF_Obj = GlobalFunction()

        #Step 1
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Open the browser and Navigate to ' + globVal.testURL
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        GF_Obj.launchApplication()
        GF_Obj.verifyWebObjDisplayed('SignUp_page', 'Passed', 'Failed',
                                     'StepName', 'ExitTest', 'WaitTime')

        # Step 2
        # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Signup with valid details'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        testData = GF_Obj.getDataFromDataSheet(
            'filepath', globVal.testData_TestData_SheetName,
            globVal.testCaseName, 'UserName', 'Passed', 'Failed', 'StepName',
            'ExitTest')
        GF_Obj.setDataToWebObj('SignUp_UserName_TextBox', testData, 'Passed',
                               'Failed', 'Enter User name into textbox',
                               'ExitTest', 'WaitTime')
        testData = GF_Obj.getDataFromDataSheet(
            'filepath', globVal.testData_TestData_SheetName,
            globVal.testCaseName, 'EmailId', 'Passed', 'Failed', 'StepName',
            'ExitTest')
        GF_Obj.setDataToWebObj('SignUp_MailId_TextBox', testData, 'Passed',
                               'Failed', 'Enter Maild id into textbox',
                               'ExitTest', 'WaitTime')
        testData = GF_Obj.getDataFromDataSheet(
            'filepath', globVal.testData_Credentials_SheetName, 'TestingWorld',
            'Password', 'Passed', 'Failed', 'StepName', 'ExitTest')
        GF_Obj.setDataToWebObj('SignUp_Password_TextBox', testData, 'Passed',
                               'Failed', 'Enter password into textbox',
                               'ExitTest', 'WaitTime')
        GF_Obj.setDataToWebObj('SignUp_CnfPassword_TextBox', testData,
                               'Passed', 'Failed',
                               'Enter confirm password into textbox',
                               'ExitTest', 'WaitTime')
        testData = GF_Obj.getDataFromDataSheet(
            'filepath', globVal.testData_TestData_SheetName,
            globVal.testCaseName, 'DateOfBirth', 'Passed', 'Failed',
            'StepName', 'ExitTest')
        GF_Obj.setDataToWebObj('SignUp_DateOfBirth_TextBox', testData,
                               'Passed', 'Failed',
                               'Enter Date of birth into textbox', 'ExitTest',
                               'WaitTime')
        testData = GF_Obj.getDataFromDataSheet(
            'filepath', globVal.testData_TestData_SheetName,
            globVal.testCaseName, 'PhoneNumber', 'Passed', 'Failed',
            'StepName', 'ExitTest')
        GF_Obj.setDataToWebObj('SignUp_PhoneNumber_TextBox', testData,
                               'Passed', 'Failed',
                               'Enter Phone Number into textbox', 'ExitTest',
                               'WaitTime')
        testData = GF_Obj.getDataFromDataSheet(
            'filepath', globVal.testData_TestData_SheetName,
            globVal.testCaseName, 'Address', 'Passed', 'Failed', 'StepName',
            'ExitTest')
        GF_Obj.setDataToWebObj('SignUp_Address_TextBox', testData, 'Passed',
                               'Failed', 'Enter Address into textbox',
                               'ExitTest', 'WaitTime')
        testData = GF_Obj.getDataFromDataSheet(
            'filepath', globVal.testData_TestData_SheetName,
            globVal.testCaseName, 'AddressType', 'Passed', 'Failed',
            'StepName', 'ExitTest')
        if str(testData).lower() == 'home':
            obj = 'SignUp_Home_RadioBtn'
        elif str(testData).lower() == 'office':
            obj = 'SignUp_Office_RadioBtn'
        else:
            obj = None
            Report.customReport(
                'Select address type',
                'Entered address type in "TestData.xlsx" is invalid', 'Failed')
            GF_Obj.stopExecution()
        GF_Obj.clickOnWebObj(obj, '', 'Passed', 'Failed',
                             'Select Address type in SignUp page', 'ExitTest',
                             'WaitTime')
        GF_Obj.selectDropdownWebObjValByName('SignUp_Gender_DropDown', 'Male',
                                             'Passed', 'Failed',
                                             'Select Gender from dropdown',
                                             'ExitTest', 'WaitTime')
        GF_Obj.selectDropdownWebObjValByName('SignUp_Country_DropDown',
                                             'India', 'Passed', 'Failed',
                                             'Select Country from dropdown',
                                             'ExitTest', 'WaitTime')
        GF_Obj.selectDropdownWebObjValByName('SignUp_State_DropDown',
                                             'Andhra Pradesh', 'Passed',
                                             'Failed',
                                             'Select State from dropdown',
                                             'ExitTest', 'WaitTime')
        GF_Obj.selectDropdownWebObjValByName('SignUp_City_DropDown',
                                             'Anantapur', 'Passed', 'Failed',
                                             'Select City from dropdown',
                                             'ExitTest', 'WaitTime')
        testData = GF_Obj.getDataFromDataSheet(
            'filepath', globVal.testData_TestData_SheetName,
            globVal.testCaseName, 'Zipcode', 'Passed', 'Failed', 'StepName',
            'ExitTest')
        GF_Obj.setDataToWebObj('SignUp_ZipCode_TextBox', testData, 'Passed',
                               'Failed', 'Enter Zipcode into textbox',
                               'ExitTest', 'WaitTime')
        GF_Obj.clickOnWebObj('SignUp_Terms_CheckBox', '', 'Passed', 'Failed',
                             'StepName', 'ExitTest', 'WaitTime')

        GF_Obj.clickOnWebObj('SignUp_SignUp_Btn', '', 'Passed', 'Failed',
                             'StepName', 'ExitTest', 'WaitTime')
        # GF_Obj.verifyWebObj('HomePage_Logout_Btn','Passed','Failed','Verify Home page is displayed','ExitTest','WaitTime')
        try:
            message = globVal.driver.find_element_by_xpath(
                '//div[@id="tab-content1"]/div').text
            if 'User is successfully Register. Now You can Login' in message:
                Report.customReport('Verify user successfully signed up',
                                    'User successfully signed up', 'Passed')
            else:
                Report.customReport(
                    'Verify user successfully signed up',
                    'User is not successfully signed up Error is : "' +
                    str(message) + '"', 'Failed')
        except Exception as error:
            Report.customReport(
                'Verify user successfully signed up',
                'User is not successfully signed up. Error is : "' +
                str(error) + '"', 'Failed')

        # Step 3
    # ==============================================================
        globVal.stepNumber = globVal.stepNumber + 1
        globVal.stepName = 'Close all the browsers'
        Report.customReportStepNum(globVal.stepNumber, globVal.stepName)
        # ==============================================================
        GF_Obj.closeAllBrowser('Yes')
    except Exception as e:
        pass