Пример #1
0
  /**
   * Check visibility of goal templates
   *
   * @param driver
   */
  public void runCheckGoalTemplateVisibility(WebDriver driver) {
    String[] visibilities = this.getExpectedResult().split("\n");
    for (String visibility : visibilities) {
      String[] str_tmp = visibility.split(":");
      String criteria = str_tmp[0];

      String[] goals = str_tmp[1].split(";");
      By by = null;
      // 1. Create goals
      if (criteria.contains("PG")) {
        // check performance goal template
        Navigator.navigate(
            driver,
            Navigator.xmlWebElmtMgr.getNavigationPathList("LearningCenter", "BtnCreatePerfGoal"));

        //				by = By.xpath("//button[descendant::span[text()='"+Labels.Btn_Perf_Goal+"']]");
        ////				Navigator.waitForAjaxElementLoad(driver, by);
        //				//Navigator.explicitWait(1000);
        //				Navigator.waitForAjax(driver, by);
        //				WebDriverUtils.clickButton(driver, by);

      } else if (criteria.contains("DG")) {
        // check development goal template
        Navigator.navigate(
            driver,
            Navigator.xmlWebElmtMgr.getNavigationPathList("LearningCenter", "BtnCreateDevGoal"));
        //				by = By.xpath("//button[descendant::span[text()='"+Labels.Btn_Dev_Goal+"']]");
        ////				Navigator.waitForAjaxElementLoad(driver, by);
        //				//Navigator.explicitWait(1000);
        //				Navigator.waitForAjax(driver, by);
        //				WebDriverUtils.clickButton(driver, by);
      }

      // 2.check goal template visibility
      for (String goal : goals) {
        // 1. Select template
        by = By.xpath("//select[@id='template-name']/option[text()='" + goal + "']");
        // int size = WebDriverUtils.getHowManyByPresntInPage(by);
        if (criteria.contains("invisible")) {
          JUnitAssert.assertTrue(
              WebDriverUtils.getHowManyByPresntInPage(driver, by, false) == 0,
              "Goal is visible:" + goal);
        } else if (criteria.contains("visible")) {
          JUnitAssert.assertTrue(
              WebDriverUtils.getHowManyByPresntInPage(driver, by, true) > 0,
              "Goal is invisible:" + goal);
        }
      }

      // 3. Cancel
      by = By.xpath("//span[text()='" + Labels.Btn_Cancel + "']");
      WebDriverUtils.clickButton(driver, by);
    }
  }
Пример #2
0
  /**
   * Add goal progress tracks
   *
   * @param driver
   * @param objs: a set of GoalProgress
   */
  public void runAddTrack(WebDriver driver, ArrayList<TestObject> objs) {
    Navigator.navigate(
        driver, Navigator.xmlWebElmtMgr.getNavigationPathList("LearningCenter", "MyGoals"));

    By by = By.xpath("//a[descendant::span[text()='" + Labels.Link_My_Perf_Goal + "']]");
    if (this instanceof DevelopmentGoal) {
      by = By.xpath("//a[descendant::span[text()='" + Labels.Link_My_Dev_Goal + "']]");
    }
    // Navigator.explicitWait(1000);
    Navigator.waitForAjax(driver, by);
    //		Navigator.waitForAjaxElementLoad(driver, by);
    WebDriverUtils.clickButton(driver, by);
    by = By.linkText(this.getGoalTitle());
    WebDriverUtils.clickLink(driver, by);

    by = By.id("open-progress-dialog");
    WebDriverUtils.clickLink(driver, by);

    for (TestObject obj : objs) {
      ((GoalProgress) obj).create(driver);
    }

    by = By.xpath("//span[text()='Save']");
    WebDriverUtils.clickButton(driver, by);
  }
Пример #3
0
  /**
   * Create goal program
   *
   * @param driver
   */
  public void runCreateGoalProgram(WebDriver driver) {
    // Navigator.navigate(driver, Navigator.URL.GoalManager);
    Navigator.navigate(
        driver, Navigator.xmlWebElmtMgr.getNavigationPathList("ManageCenter", "GoalProg"), this);
    By by = By.id("addButton");
    WebDriverUtils.clickButton(driver, by);

    this.setProgramName_UI(driver, this.getProgramName());
    this.setProgramDesc_UI(driver, this.getProgramDesc());
    FunctionUI.setDates_UI(driver, this.getStartDate(), "startdatedatebox");
    // this.setStartDate_UI(driver, this.getStartDate());
    FunctionUI.setDates_UI(driver, this.getTargetDate(), "targetdatedatebox");
    // this.setTargetDate_UI(driver, this.getTargetDate());

    by = By.id("saveButton");
    WebDriverUtils.clickButton(driver, by);
  }