/** * 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); }
/** * 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); }