コード例 #1
0
ファイル: Goal.java プロジェクト: martinwanghuai/Selenium
  /**
   * Can delete the goal if the user is the creator and the goal is not included in the appraisal
   *
   * @param driver
   */
  public void checkCanDelete(WebDriver driver) {
    String row_goal = "//tr[descendant::td/a[text()='" + this.getGoalTitle() + "']]";
    By by = By.xpath(row_goal + "/td[2]/div/div/button");
    // Navigator.explicitWait();
    Navigator.waitForAjax(driver, by);
    //		Navigator.waitForAjaxElementLoad(driver, by);
    WebDriverUtils.mouseOver(driver, by);

    by = By.linkText("Delete");
    // Navigator.explicitWait();
    Navigator.waitForAjax(driver, by);
    //		Navigator.waitForAjaxElementLoad(driver, by);
    int size = WebDriverUtils.getHowManyByPresntInPage(driver, by, true);
    JUnitAssert.assertTrue(size > 0, "Cannot delete" + this.getGoalTitle());

    WebDriverUtils.clickLink(driver, by);
    String delMsg = Labels.Msg_Delete_Dev_Goal.toString();
    if (this instanceof PerformanceGoal) {
      delMsg = Labels.Msg_Delete_Perf_Goal.toString();
    }
    by =
        By.xpath(
            "//div[descendant::div[@id='jMessage' and text()='"
                + delMsg
                + "']]/div/div/button[descendant::span[text()='OK']]");
    WebDriverUtils.clickButton(driver, by);
  }
コード例 #2
0
ファイル: Goal.java プロジェクト: martinwanghuai/Selenium
  /**
   * 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
ファイル: Goal.java プロジェクト: martinwanghuai/Selenium
 public void setGoalTitle_UI(WebDriver driver, String str) {
   if (!str.equals("")) {
     By by = By.id("title");
     //			Navigator.waitForAjaxElementLoad(driver, by);
     // Navigator.explicitWait();
     Navigator.waitForAjax(driver, by);
     WebDriverUtils.fillin_textbox(driver, by, str);
   }
 }
コード例 #4
0
ファイル: Goal.java プロジェクト: martinwanghuai/Selenium
  /**
   * Cannot delete the goal if the user is NOT the creator or the goal is included in the appraisal
   *
   * @param driver
   */
  public void checkCannotDelete(WebDriver driver) {
    String row_goal = "//tr[descendant::td/a[text()='" + this.getGoalTitle() + "']]";
    By by = By.xpath(row_goal + "/td[2]/div/div/button");
    // Navigator.explicitWait();
    Navigator.waitForAjax(driver, by);
    //		Navigator.waitForAjaxElementLoad(driver, by);
    WebDriverUtils.mouseOver(driver, by);

    by = By.linkText("Delete");
    int size = WebDriverUtils.getHowManyByPresntInPage(driver, by, false);
    JUnitAssert.assertTrue(size == 0, "Can delete " + this.getGoalTitle());
  }