From 8d64248e223716669cda4febc944a203f1f4a7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Kr=C3=A4hemann?= <joel.kraehemann@frentix.com> Date: Tue, 16 Oct 2012 15:01:58 +0200 Subject: [PATCH] non-jira: Revised all methods especially in utility classes to use idle() from FunctionalUtil.java --- .../olat/portal/FunctionalSettingsTest.java | 75 ++++++++--- .../org/olat/util/FunctionalCourseUtil.java | 87 +++++++++++- .../olat/util/FunctionalEPortfolioUtil.java | 52 +++++++- .../org/olat/util/FunctionalHomeSiteUtil.java | 126 ++++++++++++++---- .../util/FunctionalRepositorySiteUtil.java | 40 +++++- .../java/org/olat/util/FunctionalUtil.java | 34 +++++ 6 files changed, 364 insertions(+), 50 deletions(-) diff --git a/src/test/java/org/olat/portal/FunctionalSettingsTest.java b/src/test/java/org/olat/portal/FunctionalSettingsTest.java index 9f3bac87004..8500a60f16b 100644 --- a/src/test/java/org/olat/portal/FunctionalSettingsTest.java +++ b/src/test/java/org/olat/portal/FunctionalSettingsTest.java @@ -144,19 +144,38 @@ public class FunctionalSettingsTest { /* move portlets */ int oldPositionDyk[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletDykCss(), portalColumnCount); - if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletDykCss(), FunctionalHomeSiteUtil.Direction.UP)){ - browser.refresh(); - int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletDykCss(), portalColumnCount); - - Assert.assertEquals(oldPositionDyk[1], newPosition[1] + 1); + if(oldPositionDyk[1] != 0){ + if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletDykCss(), FunctionalHomeSiteUtil.Direction.UP)){ + functionalUtil.idle(browser); + int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletDykCss(), portalColumnCount); + + Assert.assertEquals(oldPositionDyk[1], newPosition[1] + 1); + } + }else{ + if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletDykCss(), FunctionalHomeSiteUtil.Direction.DOWN)){ + functionalUtil.idle(browser); + int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletDykCss(), portalColumnCount); + + Assert.assertEquals(oldPositionDyk[1], newPosition[1] - 1); + } } int oldPositionNoti[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletNotiCss(), portalColumnCount); - if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletNotiCss(), FunctionalHomeSiteUtil.Direction.LEFT)){ - int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletNotiCss(), portalColumnCount); + if(oldPositionNoti[0] != 0){ + if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletNotiCss(), FunctionalHomeSiteUtil.Direction.LEFT)){ + functionalUtil.idle(browser); + int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletNotiCss(), portalColumnCount); - Assert.assertEquals(oldPositionNoti[0] - 1, newPosition[0]); + Assert.assertEquals(oldPositionNoti[0] - 1, newPosition[0]); + } + }else{ + if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletNotiCss(), FunctionalHomeSiteUtil.Direction.RIGHT)){ + functionalUtil.idle(browser); + int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletNotiCss(), portalColumnCount); + + Assert.assertEquals(oldPositionNoti[0] + 1, newPosition[0]); + } } /* end editing portal */ @@ -194,6 +213,7 @@ public class FunctionalSettingsTest { int i; for(i = 0; i < pages.size(); i++){ + functionalUtil.idle(browser); browser.click(keys[i]); functionalUtil.waitForPageToLoad(browser); @@ -208,6 +228,7 @@ public class FunctionalSettingsTest { i--; for(; i >= 0; i--){ + functionalUtil.idle(browser); browser.goBack(); functionalUtil.waitForPageToLoad(browser); @@ -238,6 +259,7 @@ public class FunctionalSettingsTest { String newPassword = ("passwd_" + 0 + "_" + UUID.randomUUID().toString()).substring(0, 24); functionalUtil.openContentTab(browser, SettingsTab.PASSWORD.ordinal()); + functionalUtil.typePassword(browser, functionalHomeSiteUtil.getOldPasswordCss(), current.getPassword()); functionalUtil.typePassword(browser, functionalHomeSiteUtil.getNewPasswordCss(), newPassword); functionalUtil.typePassword(browser, functionalHomeSiteUtil.getConfirmPasswordCss(), newPassword); @@ -286,22 +308,42 @@ public class FunctionalSettingsTest { Assert.assertTrue(functionalHomeSiteUtil.checkPortletActive(browser, functionalHomeSiteUtil.getPortletNotesCss())); } + /* move portlets */ /* move portlets */ int oldPositionDyk[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletDykCss(), portalColumnCount); - if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletDykCss(), FunctionalHomeSiteUtil.Direction.UP)){ - browser.refresh(); - int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletDykCss(), portalColumnCount); - - Assert.assertEquals(oldPositionDyk[1], newPosition[1] + 1); + if(oldPositionDyk[1] != 0){ + if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletDykCss(), FunctionalHomeSiteUtil.Direction.UP)){ + functionalUtil.idle(browser); + int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletDykCss(), portalColumnCount); + + Assert.assertEquals(oldPositionDyk[1], newPosition[1] + 1); + } + }else{ + if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletDykCss(), FunctionalHomeSiteUtil.Direction.DOWN)){ + functionalUtil.idle(browser); + int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletDykCss(), portalColumnCount); + + Assert.assertEquals(oldPositionDyk[1], newPosition[1] - 1); + } } int oldPositionNoti[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletNotiCss(), portalColumnCount); - if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletNotiCss(), FunctionalHomeSiteUtil.Direction.LEFT)){ - int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletNotiCss(), portalColumnCount); + if(oldPositionNoti[0] != 0){ + if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletNotiCss(), FunctionalHomeSiteUtil.Direction.LEFT)){ + functionalUtil.idle(browser); + int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletNotiCss(), portalColumnCount); + + Assert.assertEquals(oldPositionNoti[0] - 1, newPosition[0]); + } + }else{ + if(functionalHomeSiteUtil.movePortlet(browser, functionalHomeSiteUtil.getPortletNotiCss(), FunctionalHomeSiteUtil.Direction.RIGHT)){ + functionalUtil.idle(browser); + int newPosition[] = functionalHomeSiteUtil.findPortletPosition(browser, functionalHomeSiteUtil.getPortletNotiCss(), portalColumnCount); - Assert.assertEquals(oldPositionNoti[0] - 1, newPosition[0]); + Assert.assertEquals(oldPositionNoti[0] + 1, newPosition[0]); + } } /* end editing portal */ @@ -339,6 +381,7 @@ public class FunctionalSettingsTest { int i; for(i = 0; i < pages.size(); i++){ + functionalUtil.idle(browser); browser.click(keys[i]); functionalUtil.waitForPageToLoad(browser); diff --git a/src/test/java/org/olat/util/FunctionalCourseUtil.java b/src/test/java/org/olat/util/FunctionalCourseUtil.java index 11a0beb58af..b384b2e4888 100644 --- a/src/test/java/org/olat/util/FunctionalCourseUtil.java +++ b/src/test/java/org/olat/util/FunctionalCourseUtil.java @@ -432,6 +432,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean open(Selenium browser, int nth){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=(//ul[contains(@class, 'b_tree_l1')]//li)[") @@ -453,6 +455,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean open(Selenium browser, CourseNodeAlias alias, int nth){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=(//ul[contains(@class, 'b_tree_l1')]//li]//a[contains(@class, '") @@ -481,6 +485,8 @@ public class FunctionalCourseUtil { public boolean openWithoutBusinessPath(Selenium browser, long courseId, int nth){ if(!functionalRepositorySiteUtil.openCourseWithoutBusinessPath(browser, courseId)) return(false); + + functionalUtil.idle(browser); StringBuffer selectorBuffer = new StringBuffer(); @@ -501,6 +507,8 @@ public class FunctionalCourseUtil { * @return */ public boolean closeTab(Selenium browser, String title){ + functionalUtil.idle(browser); + StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("xpath=//li//div//a[@title='") @@ -524,6 +532,8 @@ public class FunctionalCourseUtil { * @return */ public boolean closeActiveTab(Selenium browser){ + functionalUtil.idle(browser); + StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("xpath=//li[contains(@class, '") @@ -547,6 +557,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean openCourseEditor(Selenium browser){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//a[contains(@class, '") @@ -571,6 +583,8 @@ public class FunctionalCourseUtil { if(!functionalUtil.openContentTab(browser, 0)){ return(null); } + + functionalUtil.idle(browser); StringBuffer selectorBuffer = new StringBuffer(); @@ -591,6 +605,8 @@ public class FunctionalCourseUtil { if(!functionalUtil.openContentTab(browser, 0)){ return(null); } + + functionalUtil.idle(browser); StringBuffer selectorBuffer = new StringBuffer(); @@ -647,6 +663,8 @@ public class FunctionalCourseUtil { return(false); } + functionalUtil.idle(browser); + /* click "select or create page" */ StringBuffer selectorBuffer = new StringBuffer(); @@ -731,6 +749,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean publishEntireCourse(Selenium browser, AccessSettings access, String catalog){ + functionalUtil.idle(browser); + /* click publish */ StringBuffer selectorBuffer = new StringBuffer(); @@ -826,6 +846,8 @@ public class FunctionalCourseUtil { * @return true on success otherwise false */ public boolean createCourseNode(Selenium browser, CourseNodeAlias node, String shortTitle, String longTitle, String description, int position){ + functionalUtil.idle(browser); + /* click on the appropriate link to create node */ StringBuffer selectorBuffer = new StringBuffer(); @@ -842,6 +864,8 @@ public class FunctionalCourseUtil { functionalUtil.waitForPageToLoad(browser); /* choose insertion point */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=(//div[contains(@class, 'b_window')]//form[@name='seltree']//div[contains(@class, '") @@ -861,6 +885,8 @@ public class FunctionalCourseUtil { functionalUtil.waitForPageToUnloadElement(browser, selectorBuffer.toString()); /* fill in short title */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=(//div[contains(@class, 'o_editor')]//form//input[@type='text'])[1]"); @@ -897,6 +923,8 @@ public class FunctionalCourseUtil { public boolean addToEportfolio(Selenium browser, String binder, String page, String structure, String title, String description, String[] tags, FunctionalEPortfolioUtil functionalEPortfolioUtil){ + + functionalUtil.idle(browser); /* open wizard */ StringBuffer selectorBuffer = new StringBuffer(); @@ -939,6 +967,8 @@ public class FunctionalCourseUtil { public boolean openForum(Selenium browser, long courseId, int nth){ if(!functionalRepositorySiteUtil.openCourse(browser, courseId)) return(false); + + functionalUtil.idle(browser); StringBuffer selectorBuffer = new StringBuffer(); @@ -970,6 +1000,8 @@ public class FunctionalCourseUtil { public boolean postForumMessage(Selenium browser, long courseId, int nthForum, String title, String message){ if(!openForum(browser, courseId, nthForum)) return(false); + + functionalUtil.idle(browser); StringBuffer selectorBuffer = new StringBuffer(); @@ -984,6 +1016,8 @@ public class FunctionalCourseUtil { functionalUtil.waitForPageToLoad(browser); /* fill in form - title */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") @@ -1036,6 +1070,8 @@ public class FunctionalCourseUtil { public boolean createWikiArticle(Selenium browser, long wikiId, String pagename, String content){ if(!openWiki(browser, wikiId)) return(false); + + functionalUtil.idle(browser); /* type pagename */ StringBuffer selectorBuffer = new StringBuffer(); @@ -1060,6 +1096,8 @@ public class FunctionalCourseUtil { functionalUtil.waitForPageToLoad(browser); /* edit content */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") @@ -1119,6 +1157,8 @@ public class FunctionalCourseUtil { public boolean openBlogWithoutBusinessPath(Selenium browser, long courseId, int nth){ if(!functionalRepositorySiteUtil.openCourse(browser, courseId)) return(false); + + functionalUtil.idle(browser); StringBuffer selectorBuffer = new StringBuffer(); @@ -1144,6 +1184,9 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean importBlogFeed(Selenium browser, String url){ + + functionalUtil.idle(browser); + /* open popup to enter url */ StringBuffer selectorBuffer = new StringBuffer(); @@ -1155,6 +1198,8 @@ public class FunctionalCourseUtil { browser.click(selectorBuffer.toString()); /* enter url */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=(//div[contains(@class, 'b_window_content')]//form//input[@type='text'])[2]"); @@ -1186,7 +1231,10 @@ public class FunctionalCourseUtil { String title, String description, String content){ if(!openBlogWithoutBusinessPath(browser, courseId, nth)) return(false); + + functionalUtil.idle(browser); + /* click create */ StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//a[contains(@class, '") @@ -1196,6 +1244,8 @@ public class FunctionalCourseUtil { browser.click(selectorBuffer.toString()); /* fill in form - title */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=(//form//div[contains(@class, '") @@ -1236,6 +1286,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean importPodcastFeed(Selenium browser, String url){ + functionalUtil.idle(browser); + /* open popup to enter url */ StringBuffer selectorBuffer = new StringBuffer(); @@ -1247,6 +1299,8 @@ public class FunctionalCourseUtil { browser.click(selectorBuffer.toString()); /* enter url */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=(//div[contains(@class, 'b_window_content')]//form//input[@type='text'])[2]"); @@ -1272,6 +1326,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean openCourseEditorCourseTab(Selenium browser, CourseEditorCourseTab tab){ + functionalUtil.idle(browser); + return(functionalUtil.openContentTab(browser, tab.ordinal())); } @@ -1283,6 +1339,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean openCourseEditorIQTestTab(Selenium browser, CourseEditorIQTestTab tab){ + functionalUtil.idle(browser); + return(functionalUtil.openContentTab(browser, tab.ordinal())); } @@ -1294,6 +1352,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean openCourseEditorCpTab(Selenium browser, CourseEditorCpTab tab){ + functionalUtil.idle(browser); + return(functionalUtil.openContentTab(browser, tab.ordinal())); } @@ -1305,6 +1365,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean openCourseEditorWikiTab(Selenium browser, CourseEditorWikiTab tab){ + functionalUtil.idle(browser); + return(functionalUtil.openContentTab(browser, tab.ordinal())); } @@ -1316,6 +1378,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean openCourseEditorBlogTab(Selenium browser, CourseEditorBlogTab tab){ + functionalUtil.idle(browser); + return(functionalUtil.openContentTab(browser, tab.ordinal())); } @@ -1327,6 +1391,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean openCourseEditorPodcastTab(Selenium browser, CourseEditorPodcastTab tab){ + functionalUtil.idle(browser); + return(functionalUtil.openContentTab(browser, tab.ordinal())); } @@ -1338,6 +1404,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean openCourseEditorPortfolioTaskTab(Selenium browser, CourseEditorPortfolioTaskTab tab){ + functionalUtil.idle(browser); + return(functionalUtil.openContentTab(browser, tab.ordinal())); } @@ -1349,6 +1417,8 @@ public class FunctionalCourseUtil { * @return */ private boolean chooseRepositoryResource(Selenium browser, String chooseRepositoryCss, long key){ + functionalUtil.idle(browser); + /* click on "choose, create or import file" button */ StringBuffer selectorBuffer = new StringBuffer(); @@ -1362,6 +1432,8 @@ public class FunctionalCourseUtil { functionalUtil.waitForPageToLoad(browser); /* click search link */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//a[contains(@class, '") @@ -1372,6 +1444,8 @@ public class FunctionalCourseUtil { browser.click(selectorBuffer.toString()); /* type key and search */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") @@ -1393,6 +1467,8 @@ public class FunctionalCourseUtil { browser.click(selectorBuffer.toString()); /* choose resource */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") @@ -1423,6 +1499,8 @@ public class FunctionalCourseUtil { * @return true on success */ private boolean createRepositoryResource(Selenium browser, String chooseRepositoryCss, String title, String description){ + functionalUtil.idle(browser); + /* click on "choose, create or import file" button */ StringBuffer selectorBuffer = new StringBuffer(); @@ -1436,6 +1514,8 @@ public class FunctionalCourseUtil { functionalUtil.waitForPageToLoad(browser); /* click create button */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//a[contains(@class, '") @@ -1446,7 +1526,8 @@ public class FunctionalCourseUtil { browser.click(selectorBuffer.toString()); functionalUtil.waitForPageToLoad(browser); - + + functionalUtil.idle(browser); /* */ return(functionalRepositorySiteUtil.fillInRepositoryEntryPopup(browser, title, description)); } @@ -1462,7 +1543,7 @@ public class FunctionalCourseUtil { public boolean createQTITest(Selenium browser, String title, String description){ if(!openCourseEditorIQTestTab(browser, CourseEditorIQTestTab.TEST_CONFIGURATION)) return(false); - + if(!createRepositoryResource(browser, getTestChooseRepositoryFileCss(), title, description)){ return(false); } @@ -1590,6 +1671,8 @@ public class FunctionalCourseUtil { * @return true on success */ public boolean openPortfolioTemplateEditor(Selenium browser){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//a[contains(@class, '") diff --git a/src/test/java/org/olat/util/FunctionalEPortfolioUtil.java b/src/test/java/org/olat/util/FunctionalEPortfolioUtil.java index bcb42aff473..6586e92d933 100644 --- a/src/test/java/org/olat/util/FunctionalEPortfolioUtil.java +++ b/src/test/java/org/olat/util/FunctionalEPortfolioUtil.java @@ -334,6 +334,8 @@ public class FunctionalEPortfolioUtil { if(!functionalHomeSiteUtil.openActionByMenuTree(browser, EPortfolioAction.MY_BINDERS)) return(false); + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//h4[text()='") @@ -363,6 +365,8 @@ public class FunctionalEPortfolioUtil { if(!functionalHomeSiteUtil.openActionByMenuTree(browser, EPortfolioAction.MY_BINDERS, false)) return(false); + functionalUtil.idle(browser); + /* wait until tree has loaded */ StringBuffer locatorBuffer = new StringBuffer(); @@ -397,6 +401,8 @@ public class FunctionalEPortfolioUtil { * @return true on success */ public boolean openEditor(Selenium browser){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") @@ -426,6 +432,8 @@ public class FunctionalEPortfolioUtil { if(!functionalHomeSiteUtil.openActionByMenuTree(browser, EPortfolioAction.MY_BINDERS)) return(false); + functionalUtil.idle(browser); + /* open add binder dialog */ StringBuffer selectorBuffer = new StringBuffer(); @@ -449,6 +457,8 @@ public class FunctionalEPortfolioUtil { functionalUtil.waitForPageToLoad(browser); /* fill in dialog - title */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[@id='") @@ -486,7 +496,9 @@ public class FunctionalEPortfolioUtil { public boolean pageExists(Selenium browser, String binder, String title){ if(!openBinder(browser, binder)) return(false); - + + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") @@ -516,6 +528,8 @@ public class FunctionalEPortfolioUtil { if(!openBinder(browser, binder)) return(false); + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") @@ -566,6 +580,8 @@ public class FunctionalEPortfolioUtil { return(false); } + functionalUtil.idle(browser); + /* wait until tree has loaded */ StringBuffer locatorBuffer = new StringBuffer(); @@ -653,6 +669,8 @@ public class FunctionalEPortfolioUtil { * @return */ public boolean renamePage(Selenium browser, String binder, String oldName, String newName){ + functionalUtil.idle(browser); + /* wait until tree has loaded */ StringBuffer locatorBuffer = new StringBuffer(); @@ -707,6 +725,8 @@ public class FunctionalEPortfolioUtil { if(!openBinder(browser, binder)) return(false); + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("//div[contains(@class, '") @@ -780,6 +800,8 @@ public class FunctionalEPortfolioUtil { openEditor(browser); /* wait until tree has loaded */ + functionalUtil.idle(browser); + StringBuffer locatorBuffer = new StringBuffer(); locatorBuffer.append("xpath=//li[contains(@class, '") @@ -823,6 +845,8 @@ public class FunctionalEPortfolioUtil { functionalUtil.waitForPageToLoad(browser); /* title */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") @@ -867,6 +891,8 @@ public class FunctionalEPortfolioUtil { return(false); } + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") @@ -920,6 +946,8 @@ public class FunctionalEPortfolioUtil { if(!openPage(browser, binder, page)) return(false); + functionalUtil.idle(browser); + /* */ StringBuffer selectorBuffer = new StringBuffer(); @@ -956,6 +984,8 @@ public class FunctionalEPortfolioUtil { * @return */ public boolean closeArtefact(Selenium browser){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, 'x-tool-close')]"); @@ -974,6 +1004,8 @@ public class FunctionalEPortfolioUtil { * @return */ private boolean openEditLink(Selenium browser){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//a[contains(@class, '") @@ -998,6 +1030,8 @@ public class FunctionalEPortfolioUtil { * @return true on success */ protected boolean fillInTitleAndDescription(Selenium browser, String title, String description){ + functionalUtil.idle(browser); + StringBuffer locatorBuffer = new StringBuffer(); locatorBuffer.append("xpath=//form//div[contains(@class, '") @@ -1037,6 +1071,8 @@ public class FunctionalEPortfolioUtil { */ //TODO:JK: implement type in tags switch protected boolean fillInTags(Selenium browser, String[] tags, boolean typeTags){ + functionalUtil.idle(browser); + int i = 1; for(String tag: tags){ @@ -1085,6 +1121,8 @@ public class FunctionalEPortfolioUtil { * @return */ protected boolean selectTree(Selenium browser, String binder, String page, String structure){ + functionalUtil.idle(browser); + String selector = createSelector(binder, page, structure); /* wait until tree has loaded */ @@ -1172,6 +1210,8 @@ public class FunctionalEPortfolioUtil { if(!functionalHomeSiteUtil.openActionByMenuTree(browser, EPortfolioAction.MY_ARTIFACTS)) return(false); + functionalUtil.idle(browser); + /* open wizard */ openEditLink(browser); @@ -1207,6 +1247,8 @@ public class FunctionalEPortfolioUtil { */ private boolean uploadFileArtefactFillInWizard(Selenium browser, String binder, String page, String structure, URI file, String title, String description, String[] tags, boolean typeTags, boolean treeSelect) throws MalformedURLException{ + functionalUtil.idle(browser); + /* fill in wizard - file */ StringBuffer selectorBuffer = new StringBuffer(); @@ -1271,6 +1313,8 @@ public class FunctionalEPortfolioUtil { /* open wizard */ openEditLink(browser); + functionalUtil.idle(browser); + StringBuffer locatorBuffer = new StringBuffer(); locatorBuffer.append("xpath=//a[contains(@class, '") @@ -1341,6 +1385,8 @@ public class FunctionalEPortfolioUtil { /* open wizard */ openEditLink(browser); + functionalUtil.idle(browser); + StringBuffer locatorBuffer = new StringBuffer(); locatorBuffer.append("xpath=//a[contains(@class, '") @@ -1379,6 +1425,8 @@ public class FunctionalEPortfolioUtil { openEditor(browser); + functionalUtil.idle(browser); + /* select page or structure */ StringBuffer selectorBuffer = new StringBuffer(); @@ -1405,6 +1453,8 @@ public class FunctionalEPortfolioUtil { /* click add artefact */ openEditLink(browser); + functionalUtil.idle(browser); + /* click appropriate artefact type */ selectorBuffer = new StringBuffer(); diff --git a/src/test/java/org/olat/util/FunctionalHomeSiteUtil.java b/src/test/java/org/olat/util/FunctionalHomeSiteUtil.java index a856b2a181f..7be4e4789ee 100644 --- a/src/test/java/org/olat/util/FunctionalHomeSiteUtil.java +++ b/src/test/java/org/olat/util/FunctionalHomeSiteUtil.java @@ -505,7 +505,7 @@ public class FunctionalHomeSiteUtil { .append(selectedCss) .append('.') .append(getHomeActionNavigationSelectedCss()) - .append(" * a"); + .append(" a"); long timeElapsed = 0; long startTime = Calendar.getInstance().getTimeInMillis(); @@ -556,7 +556,6 @@ public class FunctionalHomeSiteUtil { return(false); } - //FIXME:JK: this is a known bottleneck, but can't be set to -1 until info messages will be clicked away! if(!checkCurrentAction || !checkCurrentAction(browser, action, Long.parseLong(functionalUtil.getWaitLimit()))){ StringBuffer selectorBuffer = new StringBuffer(); @@ -594,15 +593,18 @@ public class FunctionalHomeSiteUtil { } /* goto home site */ + //TODO:JK: ugly Assert.assertTrue(openActionByMenuTree(browser, HomeSiteAction.PORTAL)); Assert.assertTrue(checkCurrentAction(browser, HomeSiteAction.PORTAL)); + functionalUtil.idle(browser); + /* begin editing */ StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("css=.") .append(PORTAL_EDIT_LINK_CSS) - .append(" * a"); + .append(" a"); browser.click(selectorBuffer.toString()); } @@ -618,15 +620,18 @@ public class FunctionalHomeSiteUtil { } /* goto home site */ + //TODO:JK: ugly Assert.assertTrue(openActionByMenuTree(browser, HomeSiteAction.PORTAL)); Assert.assertTrue(checkCurrentAction(browser, HomeSiteAction.PORTAL)); /* end editing */ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("css=.") .append(PORTAL_EDIT_LINK_CSS) - .append(" * a"); + .append(" a"); browser.click(selectorBuffer.toString()); } @@ -639,17 +644,19 @@ public class FunctionalHomeSiteUtil { * @return true if portlet active otherwise false */ public boolean checkPortletActive(Selenium browser, String portletCss){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); - selectorBuffer.append("xpath=//div[@class='") + selectorBuffer.append("xpath=//div[contains(@class, '") .append(getPortalCss()) - .append(' ') + .append("') and contains(@class, '") .append(getPortalSubcolumnsCss()) - .append("']//div[@class='") + .append("')]//div[contains(@class, '") .append(getPortletCss()) - .append(' ') + .append("') and contains(@class, '") .append(portletCss) - .append("']"); + .append("')]"); if(browser.isElementPresent(selectorBuffer.toString())){ return(true); @@ -657,17 +664,17 @@ public class FunctionalHomeSiteUtil { /* selector of editing portlets */ selectorBuffer = new StringBuffer(); - selectorBuffer.append("xpath=//div[@class='") + selectorBuffer.append("xpath=//div[contains(@class, '") .append(getPortalCss()) - .append(' ') + .append("') and contains(@class, '") .append(getPortalSubcolumnsCss()) - .append("']//div[@class='") + .append("')]//div[contains(@class, '") .append(getPortletCss()) - .append(' ') + .append("') contains(@class, '") .append(getPortletEditCss()) - .append(' ') + .append("') and contains(@class, '") .append(portletCss) - .append("']"); + .append("')]"); if(browser.isElementPresent(selectorBuffer.toString())){ return(true); @@ -687,6 +694,8 @@ public class FunctionalHomeSiteUtil { * the portlet is inactive or doesn't exists. */ public int[] findPortletPosition(Selenium browser, String portletCss, int columnCount){ + functionalUtil.idle(browser); + for(int i = 0; i < columnCount; i++){ StringBuffer selectorBuffer = new StringBuffer(); @@ -775,20 +784,28 @@ public class FunctionalHomeSiteUtil { * otherwise false. */ public boolean activatePortlet(Selenium browser, String portletCss){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("css=.") .append(getPortletCss()) .append('.') + .append(portletCss); + + functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString()); + + /* */ + StringBuffer activateBuffer = new StringBuffer(selectorBuffer); + + activateBuffer.append('.') .append(getPortletInactiveCss()) - .append('.') - .append(portletCss) .append(" .") .append(getPortletActivateCss()) - .append(" * a"); + .append(" a"); - if(browser.isElementPresent(selectorBuffer.toString())){ - browser.click(selectorBuffer.toString()); + if(browser.isElementPresent(activateBuffer.toString())){ + browser.click(activateBuffer.toString()); return(true); }else{ @@ -805,19 +822,28 @@ public class FunctionalHomeSiteUtil { * otherwise false. */ public boolean deactivatePortlet(Selenium browser, String portletCss){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("css=.") .append(getPortletCss()) .append('.') + .append(portletCss); + + functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString()); + + /* */ + StringBuffer inactivateBuffer = new StringBuffer(selectorBuffer); + + inactivateBuffer.append('.') .append(getPortletEditCss()) - .append('.') - .append(portletCss) - .append(" * .") - .append(getPortletInactivateCss()); + .append(" .") + .append(getPortletInactivateCss()) + .append(" a"); - if(browser.isElementPresent(selectorBuffer.toString())){ - browser.click(selectorBuffer.toString()); + if(browser.isElementPresent(inactivateBuffer.toString())){ + browser.click(inactivateBuffer.toString()); return(true); }else{ @@ -834,15 +860,28 @@ public class FunctionalHomeSiteUtil { * @return true if portlet was moved otherwise false */ public boolean movePortlet(Selenium browser, String portletCss, Direction direction){ + functionalUtil.idle(browser); + + /* wait till portlet gets loaded */ StringBuffer selectorBuffer = new StringBuffer(); + selectorBuffer.append("css=.") + .append(getPortletCss()) + .append('.') + .append(portletCss); + + functionalUtil.waitForPageToLoadElement(browser, selectorBuffer.toString()); + + /* */ + selectorBuffer = new StringBuffer(); + selectorBuffer.append("css=.") .append(getPortletCss()) .append('.') .append(getPortletEditCss()) .append('.') .append(portletCss) - .append(" * ."); + .append(" ."); switch(direction){ case LEFT: @@ -892,14 +931,18 @@ public class FunctionalHomeSiteUtil { functionalUtil.openSite(browser, OlatSite.HOME); /* goto home site */ + //TODO:JK: ugly Assert.assertTrue(openActionByMenuTree(browser, HomeSiteAction.SETTINGS)); /* open System tab */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.openContentTab(browser, SettingsTab.SYSTEM.ordinal())); /* select language */ functionalUtil.selectOption(browser, LANGUAGE_OPTIONS_ID, language); + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form//div[contains(@class, '"); @@ -921,17 +964,22 @@ public class FunctionalHomeSiteUtil { functionalUtil.openSite(browser, OlatSite.HOME); /* goto home site */ + //TODO:JK: ugly Assert.assertTrue(openActionByMenuTree(browser, HomeSiteAction.SETTINGS)); Assert.assertTrue(checkCurrentAction(browser, HomeSiteAction.SETTINGS)); /* open System tab */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.openContentTab(browser, SettingsTab.SYSTEM.ordinal())); /* enable resume */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.clickRadio(browser, FunctionalHomeSiteUtil.PortalSettingsForms.SpecificSystemSettingsRadios.RESUME_LAST_SESSION.getGroupCss(), FunctionalHomeSiteUtil.PortalSettingsForms.SpecificSystemSettingsRadios.ResumeLastSession.YES_AUTOMATICALLY.getValueAttribute())); + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form//div[contains(@class, '"); @@ -953,17 +1001,22 @@ public class FunctionalHomeSiteUtil { functionalUtil.openSite(browser, OlatSite.HOME); /* goto home site */ + //TODO:JK: ugly Assert.assertTrue(openActionByMenuTree(browser, HomeSiteAction.SETTINGS)); Assert.assertTrue(checkCurrentAction(browser, HomeSiteAction.SETTINGS)); /* open system tab */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.openContentTab(browser, SettingsTab.SYSTEM.ordinal())); /* enable resume */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.clickRadio(browser, FunctionalHomeSiteUtil.PortalSettingsForms.SpecificSystemSettingsRadios.RESUME_LAST_SESSION.getGroupCss(), FunctionalHomeSiteUtil.PortalSettingsForms.SpecificSystemSettingsRadios.ResumeLastSession.YES_ON_REQUEST.getValueAttribute())); + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form//div[contains(@class, '"); @@ -985,17 +1038,22 @@ public class FunctionalHomeSiteUtil { functionalUtil.openSite(browser, OlatSite.HOME); /* goto home site */ + //TODO:JK: ugly Assert.assertTrue(openActionByMenuTree(browser, HomeSiteAction.SETTINGS)); //Assert.assertTrue(checkCurrentAction(browser, HomeSiteAction.SETTINGS)); /* open system tab */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.openContentTab(browser, SettingsTab.SYSTEM.ordinal())); /* disable resume */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.clickRadio(browser, FunctionalHomeSiteUtil.PortalSettingsForms.SpecificSystemSettingsRadios.RESUME_LAST_SESSION.getGroupCss(), FunctionalHomeSiteUtil.PortalSettingsForms.SpecificSystemSettingsRadios.ResumeLastSession.NO.getValueAttribute())); + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form//div[contains(@class, '"); @@ -1019,17 +1077,22 @@ public class FunctionalHomeSiteUtil { functionalUtil.openSite(browser, OlatSite.HOME); /* goto home site */ + //TODO:JK: ugly Assert.assertTrue(openActionByMenuTree(browser, HomeSiteAction.SETTINGS)); Assert.assertTrue(checkCurrentAction(browser, HomeSiteAction.SETTINGS)); /* open system tab */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.openContentTab(browser, SettingsTab.SYSTEM.ordinal())); /* enable resume */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.clickRadio(browser, FunctionalHomeSiteUtil.PortalSettingsForms.SpecificSystemSettingsRadios.SUPPORT_FOR_BROWSER_BACK.getGroupCss(), FunctionalHomeSiteUtil.PortalSettingsForms.SpecificSystemSettingsRadios.SupportForBrowserBack.ON.getValueAttribute())); + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form//div[contains(@class, '"); @@ -1050,20 +1113,26 @@ public class FunctionalHomeSiteUtil { * @return */ public boolean disableBack(Selenium browser){ + //TODO:JK: ugly functionalUtil.openSite(browser, OlatSite.HOME); /* goto home site */ + //TODO:JK: ugly Assert.assertTrue(openActionByMenuTree(browser, HomeSiteAction.SETTINGS)); Assert.assertTrue(checkCurrentAction(browser, HomeSiteAction.SETTINGS)); /* open system tab */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.openContentTab(browser, SettingsTab.SYSTEM.ordinal())); /* enable resume */ + //TODO:JK: ugly Assert.assertTrue(functionalUtil.clickRadio(browser, FunctionalHomeSiteUtil.PortalSettingsForms.SpecificSystemSettingsRadios.SUPPORT_FOR_BROWSER_BACK.getGroupCss(), FunctionalHomeSiteUtil.PortalSettingsForms.SpecificSystemSettingsRadios.SupportForBrowserBack.OFF.getValueAttribute())); + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form//div[contains(@class, '"); @@ -1086,6 +1155,7 @@ public class FunctionalHomeSiteUtil { */ public boolean resetSettings(Selenium browser){ log.info("open portal"); + //TODO:JK: ugly functionalUtil.openSite(browser, OlatSite.HOME); /* open settings page */ @@ -1108,6 +1178,8 @@ public class FunctionalHomeSiteUtil { functionalUtil.clickCheckbox(browser, CONFIGURATIONS_CSS, RESUME_VALUE); /* click Reset */ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form//div[contains(@class, '"); diff --git a/src/test/java/org/olat/util/FunctionalRepositorySiteUtil.java b/src/test/java/org/olat/util/FunctionalRepositorySiteUtil.java index 21c55bb8ee1..669dac4bb53 100644 --- a/src/test/java/org/olat/util/FunctionalRepositorySiteUtil.java +++ b/src/test/java/org/olat/util/FunctionalRepositorySiteUtil.java @@ -464,14 +464,14 @@ public class FunctionalRepositorySiteUtil { } /* click on catalog root */ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") .append(getCatalogNavigationCss()) .append("')]//a"); - functionalUtil.idle(browser); - if(browser.isElementPresent(selectorBuffer.toString())){ browser.click(selectorBuffer.toString()); } @@ -489,10 +489,10 @@ public class FunctionalRepositorySiteUtil { } /* check if catalog already exists */ - String selector = createCatalogSelector(name); - functionalUtil.idle(browser); + String selector = createCatalogSelector(name); + if(browser.isElementPresent(selector)){ return(true); } @@ -507,6 +507,8 @@ public class FunctionalRepositorySiteUtil { browser.click(selectorBuffer.toString()); /* fill in name */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form//div[contains(@class, '") @@ -660,6 +662,8 @@ public class FunctionalRepositorySiteUtil { * @return true if match otherwise false */ public boolean checkCurrentPage(Selenium browser, Object action){ + functionalUtil.idle(browser); + String selectedCss = findCssClassOfAction(action); if(selectedCss == null) @@ -688,6 +692,8 @@ public class FunctionalRepositorySiteUtil { * @return true on success otherwise false */ public boolean openActionByMenuTree(Selenium browser, Object action){ //activateMenuTreeAction(browser, action) + functionalUtil.idle(browser); + String selectedCss = findCssClassOfAction(action); if(selectedCss == null){ @@ -755,6 +761,8 @@ public class FunctionalRepositorySiteUtil { if(!openActionByMenuTree(browser, RepositorySiteAction.SEARCH_FORM)) return(false); + functionalUtil.idle(browser); + //FIXME:JK: use CSS classes instead of ordinal int searchFormIndex = 0; @@ -774,6 +782,8 @@ public class FunctionalRepositorySiteUtil { functionalUtil.waitForPageToLoad(browser); /* click course */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("//form") @@ -846,6 +856,8 @@ public class FunctionalRepositorySiteUtil { * @return */ private boolean clickCreate(Selenium browser, String nodeCss){ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, '") @@ -871,6 +883,8 @@ public class FunctionalRepositorySiteUtil { public boolean openDetailView(Selenium browser, String title, int nth){ if(!functionalUtil.openSite(browser, OlatSite.LEARNING_RESOURCES)) return(false); + + functionalUtil.idle(browser); //FIXME:JK: use CSS classes instead of ordinal int searchFormIndex = 0; @@ -891,6 +905,8 @@ public class FunctionalRepositorySiteUtil { functionalUtil.waitForPageToLoad(browser); /* click course */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("//form") @@ -930,6 +946,8 @@ public class FunctionalRepositorySiteUtil { * @return true on success */ private boolean fillInTitleAndDescription(Selenium browser, String title, String description){ + functionalUtil.idle(browser); + /* fill in wizard - title */ StringBuffer locatorBuffer = new StringBuffer(); @@ -997,6 +1015,8 @@ public class FunctionalRepositorySiteUtil { * @return */ public boolean fillInRepositoryEntryPopup(Selenium browser, String title, String description){ + functionalUtil.idle(browser); + /* fill in title */ StringBuffer selectorBuffer = new StringBuffer(); @@ -1024,6 +1044,8 @@ public class FunctionalRepositorySiteUtil { browser.click(selectorBuffer.toString()); /* click next */ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, 'b_window')]//a[contains(@class, '") @@ -1060,6 +1082,8 @@ public class FunctionalRepositorySiteUtil { functionalUtil.clickRadio(browser, null, NextSteps.COURSE_EDITOR.getValue()); /* click next */ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=(//div[contains(@class, '") @@ -1102,6 +1126,8 @@ public class FunctionalRepositorySiteUtil { functionalUtil.clickRadio(browser, null, NextSteps.WIZARD.getValue()); /* click next */ + functionalUtil.idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=(//div[contains(@class, '") @@ -1118,6 +1144,8 @@ public class FunctionalRepositorySiteUtil { for(CourseWizardElement current: element){ functionalUtil.clickCheckbox(browser, null, current.getValue()); } + + functionalUtil.idle(browser); functionalUtil.clickWizardNext(browser); functionalUtil.waitForPageToUnloadElement(browser, "//div[contains(@class, 'b_wizard')]//input[@type='checkbox']"); @@ -1127,6 +1155,8 @@ public class FunctionalRepositorySiteUtil { String[] catalogSelectors = functionalCourseUtil.createCatalogSelectors(catalog); for(String catalogSelector: catalogSelectors){ + functionalUtil.idle(browser); + functionalUtil.waitForPageToLoadElement(browser, catalogSelector); if(browser.isElementPresent(catalogSelector + "/../img[contains(@class, 'x-tree-elbow-end-plus')]")){ @@ -1142,6 +1172,8 @@ public class FunctionalRepositorySiteUtil { /* publish */ if(!publish){ + functionalUtil.idle(browser); + selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//div[contains(@class, 'b_wizard')]//input[@type='checkbox' and @name='") diff --git a/src/test/java/org/olat/util/FunctionalUtil.java b/src/test/java/org/olat/util/FunctionalUtil.java index 75b7ec252bd..fc8c68d88ae 100644 --- a/src/test/java/org/olat/util/FunctionalUtil.java +++ b/src/test/java/org/olat/util/FunctionalUtil.java @@ -748,6 +748,8 @@ public class FunctionalUtil { } /* open the appropriate site */ + idle(browser); + StringBuilder selectorBuffer = new StringBuilder(); selectorBuffer.append("css=.") @@ -844,6 +846,8 @@ public class FunctionalUtil { * @return */ public boolean logout(Selenium browser){ + idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("css=#") @@ -863,6 +867,8 @@ public class FunctionalUtil { * @return true on success otherwise false */ public boolean openContentTab(Selenium browser, int tabIndex){ + idle(browser); + StringBuffer activeTabSelectorBuffer = new StringBuffer(); activeTabSelectorBuffer.append("css=#") @@ -911,6 +917,8 @@ public class FunctionalUtil { * @return */ public boolean saveForm(Selenium browser, int formIndex, String waitLimit){ + idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form[") @@ -934,6 +942,8 @@ public class FunctionalUtil { * @return true on success */ public boolean clickCheckbox(Selenium browser, String groupCss, String value){ + idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form") @@ -959,6 +969,8 @@ public class FunctionalUtil { */ @Deprecated public boolean clickRadio(Selenium browser, int formIndex, int radioGroupIndex, int radioIndex){ + idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form[") @@ -987,6 +999,8 @@ public class FunctionalUtil { * @return true on success */ public boolean clickRadio(Selenium browser, String groupCss, String value){ + idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("//form") @@ -1013,6 +1027,8 @@ public class FunctionalUtil { */ @Deprecated public boolean typeText(Selenium browser, int formIndex, int textIndex, String text){ + idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form[") @@ -1036,6 +1052,8 @@ public class FunctionalUtil { * @return true on success */ public boolean typeText(Selenium browser, String entryCss, String text){ + idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form") @@ -1061,6 +1079,8 @@ public class FunctionalUtil { if(content == null) return(true); + idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("dom=document.getElementsByClassName('") @@ -1093,6 +1113,8 @@ public class FunctionalUtil { if(content == null) return(true); + idle(browser); + StringBuffer iframeSelectorBuffer = new StringBuffer(); iframeSelectorBuffer.append("dom=document.getElementsByClassName('") @@ -1127,6 +1149,8 @@ public class FunctionalUtil { * @return true on success */ public boolean typePassword(Selenium browser, String entryCss, String text){ + idle(browser); + StringBuffer selectorBuffer = new StringBuffer(); selectorBuffer.append("xpath=//form") @@ -1149,6 +1173,8 @@ public class FunctionalUtil { * @return */ public boolean selectOption(Selenium browser, String id, String value){ + idle(browser); + StringBuffer selectLocatorBuffer = new StringBuffer(); selectLocatorBuffer.append("xpath=//form") @@ -1174,6 +1200,8 @@ public class FunctionalUtil { * @return */ public boolean clickWizardNext(Selenium browser){ + idle(browser); + StringBuffer locatorBuffer = new StringBuffer(); locatorBuffer.append("xpath=//form//a[contains(@class, '") @@ -1187,6 +1215,8 @@ public class FunctionalUtil { } public boolean clickWizardNext(Selenium browser, String cssClass){ + idle(browser); + StringBuffer locatorBuffer = new StringBuffer(); locatorBuffer.append("xpath=//div[contains(@class, '") @@ -1208,6 +1238,8 @@ public class FunctionalUtil { * @return */ public boolean clickWizardFinish(Selenium browser){ + idle(browser); + StringBuffer locatorBuffer = new StringBuffer(); locatorBuffer.append("xpath=//form//a[contains(@class, '") @@ -1224,6 +1256,8 @@ public class FunctionalUtil { } public boolean clickWizardFinish(Selenium browser, String cssClass){ + idle(browser); + StringBuffer locatorBuffer = new StringBuffer(); locatorBuffer.append("xpath=//div[contains(@class, '") -- GitLab