Пример #1
0
def cronjob3_run(common, driver, home_lnk_page, Admin_lnk, cron2_lnk, view_lnk,
                 run):
    """This Function helps to run from the Cron tab 3"""
    print "Returning Home page"
    common.gotoPage(home_lnk_page, driver)
    common.pageLoadTime(10, driver)
    print "Clicking on Admin page"
    common.gotoPage(Admin_lnk, driver)
    common.pageLoadTime(10, driver)
    print "Clicking on View page"
    common.gotoPage(view_lnk, driver)
    common.pageLoadTime(10, driver)
    print "Clicking on Cron3 Tab"
    common.gotoPage(cron2_lnk, driver)
    print "Running Cron"
    job_id = int(common.find_element(By.XPATH, "//tr[1]/td[1]", driver).text)
    common.gotoPage(run, driver)
    common.pageLoadTime(10, driver)
    alert_msg = common.alert_present(driver)
    print "New JoB Id has been created"
    job_id_new = job_id + 1
    print "After Running cron looks for the text"
    cron3_txt = common.find_element(By.XPATH, "//tr[1]/td[2]", driver).text

    print "After CronRun looks for the message"
    afterrun_message_txt = common.find_element(By.XPATH, "//tr[1]/td[5]",
                                               driver).text

    if (job_id != job_id_new
            and cron3_txt == "AUP Upgrade Site Creation ('Job 3')"
            and "Total Sites forecasted on" in afterrun_message_txt):
        return "Finished"

    else:
        return "Failed"
Пример #2
0
def cronjob2_run(common, driver, home_lnk_page, Admin_lnk, cron2_lnk, view_lnk,
                 run):

    print "Returning Home page"
    common.gotoPage(home_lnk_page, driver)
    common.pageLoadTime(10, driver)
    print "Clicking on Admin page"
    common.gotoPage(Admin_lnk, driver)
    common.pageLoadTime(10, driver)
    print "Clicking on View page"
    common.gotoPage(view_lnk, driver)
    common.pageLoadTime(10, driver)
    print "Clicking on Cron2 Tab"
    common.gotoPage(cron2_lnk, driver)
    time.sleep(10)

    print "Running Cron"
    job_id = int(common.find_element(By.XPATH, "//tr[1]/td[1]", driver).text)
    common.gotoPage(run, driver)
    time.sleep(10)
    alert_msg = common.alert_present(driver)
    time.sleep(10)

    print "JoB Id"
    job_id_new = job_id + 1
    time.sleep(10)
    print job_id_new
    print "After Running cron looks for the text"
    time.sleep(10)
    cron2_txt = common.find_element(By.XPATH, "//tr[1]/td[2]", driver).text
    print cron2_txt
    print "After CronRun looks for the message"
    afterrun_message_txt = common.find_element(By.XPATH, "//tr[1]/td[5]",
                                               driver).text
    #         print afterrun_message_txt
    #         print cron2_txt
    time.sleep(10)

    if (job_id != job_id_new
            and cron2_txt == "AUP Forecast Date Generation('Job 2')"
            and "Forecast Date generated for sites:" in afterrun_message_txt):
        return "Finished"

    else:
        return "Failed"
def cronjob4_run(common, driver, home_lnk_page, Admin_lnk, cron4_lnk, view_lnk,
                 run):
    """This Function helps to run from the Cron tab 4"""

    print "Clicking on Admin page"
    common.gotoPage(Admin_lnk, driver)
    common.pageLoadTime(10, driver)
    print "Clicking on View page"
    common.gotoPage(view_lnk, driver)
    common.pageLoadTime(10, driver)
    print "Clicking on Cron4 Tab"
    common.gotoPage(cron4_lnk, driver)
    print "Running Cron"
    job_id = int(common.find_element(By.XPATH, "//tr[1]/td[1]", driver).text)
    common.gotoPage(run, driver)
    common.pageLoadTime(10, driver)
    alert_msg = common.alert_present(driver)
    print "New JoB Id has been created"
    job_id_new = job_id + 1
    print job_id
    print "After Running cron looks for the text"

    cron4_txt = common.find_element(By.XPATH, "//tr[1]/td[2]", driver).text
    print job_id_new
    print "After CronRun looks for the message"
    afterrun_message_txt = common.find_element(By.XPATH, "//tr[1]/td[5]",
                                               driver).text
    print afterrun_message_txt
    if (job_id != job_id_new
            and cron4_txt == "Crux CX Rest Integration ('Job 4')"
            and afterrun_message_txt
            == "There were no forecast dates to be synched to CX"):
        return "Finished"

    else:
        return "Failed"