Пример #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 add_details(driver, product_addnew):
    """To Add details in the Site"""
    common.gotoPage(product_addnew, driver)
    common.pageLoadTime(10, driver)
    print "Current month"
    currentmonth = common.timestampMonth()
    print currentmonth
    print "Current Year"
    currentyear = common.timestampYear()
    print "Release date"
    release = datecalculation(driver, common, currentmonth)
    print release
    print "Form String"
    form_string = formstring(driver, release, currentyear)
    print form_string
    return form_string
Пример #3
0
def prodcut_release_info(driver, common, prod_release_date, patch_date,
                         addbutton, siteSearchText, form_string):
    print "Select Current Date"
    cdate = common.currentdate()
    time.sleep(10)
    print cdate
    common.find_element(By.XPATH, prod_release_date, driver).send_keys(cdate)
    common.pageLoadTime(10, driver)
    common.find_element(By.XPATH, prod_release_date,
                        driver).send_keys(Keys.ENTER)
    time.sleep(10)
    print "Select Next Date"
    patchdate = common.nextdate()
    time.sleep(10)
    print patchdate
    #         patch_xpath="//a[text()='"+patch+"']"
    #         print patch_xpath
    common.pageLoadTime(10, driver)
    common.find_element(By.XPATH, patch_date, driver).send_keys(patchdate)
    #         common.find_element(By.XPATH,patch_date, driver).send_keys(Keys.ENTER)
    common.pageLoadTime(10, driver)
    print "Clicking on the Add Date"
    common.find_element(By.XPATH, addbutton, driver).click()
    print "searching for the Product release Version"
    common.find_element(By.XPATH, siteSearchText,
                        driver).send_keys(form_string)
    common.find_element(By.XPATH, siteSearchText, driver).send_keys(Keys.ENTER)
    text_td = "//td[text()='" + form_string + "']"
    Actual_prod = common.find_element(By.XPATH, text_td, driver).text
    return Actual_prod
Пример #4
0
def customTestFunctions(driver):
    """To Run the Cron2 Job"""

    try:
        common.loginToCrux(userName, passWord, usname_Value, password_Value,
                           driver)
        #             gotoPreferencesview(common,home_lnk,product_release_info,driver)
        print "Clicking scheduler menu in the home page "
        common.gotoPage(home_lnk, driver)
        common.pageLoadTime(10, driver)
        print "Clicking Product Release Information menu Scheduler Page "
        common.gotoPage(product_release_info, driver)
        print "Deleting entire Product release Details"
        bool_Delete = common.delete_table(driver)
        print "If the Forecast date exists Delete"
        if (bool_Delete):
            form_string = add_details(driver, product_release_Addnew)
            bool_value = common.select_by_text(driver, dropdown, form_string)
            common.pageLoadTime(10, driver)
            if (bool_value):
                actual_info = prodcut_release_info(driver, common,
                                                   prod_release_date,
                                                   patch_date, addbutton,
                                                   siteSearchText, form_string)
                alert_mes = cronjob2_run(common, driver, home_lnk_page,
                                         Admin_lnk, cron2_lnk, view_lnk, run)
                assert alert_mes == "Finished"
                return True

        else:
            print "If Forecast date Not exists Create New one"
            form_string = add_details(driver, product_release_Addnew)
            common.pageLoadTime(10, driver)
            bool_value = common.select_by_text(driver, dropdown, form_string)
            prodcut_release_info(driver, common, prod_release_date, patch_date,
                                 addbutton, siteSearchText, form_string)
            alert_mes = cronjob2_run(common, driver, home_lnk_page, Admin_lnk,
                                     cron2_lnk, view_lnk, run)
            assert alert_mes == "Finished"
            return True

    except NoSuchElementException:
        print(" Tese Case Failed ")
        raise NoSuchElementException
        return False

    except AssertionError:
        print(" Tese Case Failed ")
        raise AssertionError
        return False
Пример #5
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"