diff --git a/src/test/java/org/olat/util/FunctionalCourseUtil.java b/src/test/java/org/olat/util/FunctionalCourseUtil.java index 2be6cdc2315deb08faa81d0b67f8a5c3f7ab4b68..11a0beb58aff8b7469047a60ab0af85796a0aa66 100644 --- a/src/test/java/org/olat/util/FunctionalCourseUtil.java +++ b/src/test/java/org/olat/util/FunctionalCourseUtil.java @@ -918,19 +918,7 @@ public class FunctionalCourseUtil { functionalEPortfolioUtil.fillInTags(browser, tags); /* fill in wizard - destination */ - String selector = functionalEPortfolioUtil.createSelector(binder, page, structure); - - functionalUtil.waitForPageToLoadElement(browser, selector); - - browser.click(selector); - - selectorBuffer = new StringBuffer(); - - selectorBuffer.append("xpath=//li[contains(@class, 'x-tree-node')]//a//span[contains(text(), '") - .append((structure != null) ? structure: page) - .append("')]"); - - functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString()); + functionalEPortfolioUtil.selectTree(browser, binder, page, structure); } /* click finish */ diff --git a/src/test/java/org/olat/util/FunctionalEPortfolioUtil.java b/src/test/java/org/olat/util/FunctionalEPortfolioUtil.java index 99454273ee9cd7f48b321296d6f5a94dcf2ff9f2..bcb42aff47358676c93507c9b2f5d57ef5035048 100644 --- a/src/test/java/org/olat/util/FunctionalEPortfolioUtil.java +++ b/src/test/java/org/olat/util/FunctionalEPortfolioUtil.java @@ -586,6 +586,8 @@ public class FunctionalEPortfolioUtil { functionalUtil.waitForPageToLoad(browser); + boolean modified = false; + /* fill in wizard - title */ if(title != null){ selectorBuffer = new StringBuffer(); @@ -596,6 +598,8 @@ public class FunctionalEPortfolioUtil { functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString()); browser.type(selectorBuffer.toString(), title); + + modified = true; } /* fill in wizard - display */ @@ -610,24 +614,32 @@ public class FunctionalEPortfolioUtil { functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString()); browser.click(selectorBuffer.toString()); + + modified = true; } /* fill in wizard - description */ - functionalUtil.typeMCE(browser, description); + if(description != null){ + functionalUtil.typeMCE(browser, description); + + modified = true; + } /* fill in wizard - save */ - selectorBuffer = new StringBuffer(); + if(modified){ + selectorBuffer = new StringBuffer(); - selectorBuffer.append("xpath=//div[contains(@class, '") - .append(getEPortfolioMapCss()) - .append("')]//form//button[last() and contains(@class, '") - .append(functionalUtil.getButtonDirtyCss()) - .append("')]"); - - functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString()); - browser.click(selectorBuffer.toString()); - - functionalUtil.waitForPageToLoad(browser); + selectorBuffer.append("xpath=//div[contains(@class, '") + .append(getEPortfolioMapCss()) + .append("')]//form//button[last() and contains(@class, '") + .append(functionalUtil.getButtonDirtyCss()) + .append("')]"); + + functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString()); + browser.click(selectorBuffer.toString()); + + functionalUtil.waitForPageToLoad(browser); + } return(true); } @@ -641,6 +653,15 @@ public class FunctionalEPortfolioUtil { * @return */ public boolean renamePage(Selenium browser, String binder, String oldName, String newName){ + /* wait until tree has loaded */ + StringBuffer locatorBuffer = new StringBuffer(); + + locatorBuffer.append("xpath=//li[contains(@class, '") + .append(functionalUtil.getTreeNodeLoadingCss()) + .append("')]"); + functionalUtil.waitForPageToUnloadElement(browser, locatorBuffer.toString()); + + /* select page */ String selector = createSelector(binder, oldName, null); functionalUtil.waitForPageToLoadElement(browser, selector); @@ -826,6 +847,7 @@ public class FunctionalEPortfolioUtil { functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString()); browser.click(selectorBuffer.toString()); + /* */ functionalUtil.waitForPageToLoadElement(browser, createSelector(binder, page, title)); return(true); @@ -1006,33 +1028,6 @@ public class FunctionalEPortfolioUtil { return(fillInTags(browser, tags, true)); } - protected boolean selectTree(Selenium browser, String binder, String page, String structure){ - String selector = createSelector(binder, page, structure); - - /* wait until tree has loaded */ - StringBuffer locatorBuffer = new StringBuffer(); - - locatorBuffer.append("xpath=//li[contains(@class, '") - .append(functionalUtil.getTreeNodeLoadingCss()) - .append("')]"); - functionalUtil.waitForPageToUnloadElement(browser, locatorBuffer.toString()); - - /* click selector */ - functionalUtil.waitForPageToLoadElement(browser, selector); - - browser.click(selector); - - locatorBuffer = new StringBuffer(); - - locatorBuffer.append("xpath=//li[contains(@class, 'x-tree-node')]//a//span[contains(text(), '") - .append((structure != null) ? structure: page) - .append("')]"); - - functionalUtil.waitForPageToLoadElement(browser, locatorBuffer.toString()); - - return(true); - } - /** * Fills in the open wizard's tags. * @@ -1080,6 +1075,42 @@ public class FunctionalEPortfolioUtil { return(true); } + /** + * Selects a tree node. + * + * @param browser + * @param binder + * @param page + * @param structure + * @return + */ + protected boolean selectTree(Selenium browser, String binder, String page, String structure){ + String selector = createSelector(binder, page, structure); + + /* wait until tree has loaded */ + StringBuffer locatorBuffer = new StringBuffer(); + + locatorBuffer.append("xpath=//li[contains(@class, '") + .append(functionalUtil.getTreeNodeLoadingCss()) + .append("')]"); + functionalUtil.waitForPageToUnloadElement(browser, locatorBuffer.toString()); + + /* click selector */ + functionalUtil.waitForPageToLoadElement(browser, selector); + + browser.click(selector); + + locatorBuffer = new StringBuffer(); + + locatorBuffer.append("xpath=//li[contains(@class, 'x-tree-node')]//a//span[contains(text(), '") + .append((structure != null) ? structure: page) + .append("')]"); + + functionalUtil.waitForPageToLoadElement(browser, locatorBuffer.toString()); + + return(true); + } + /** * * @param browser