diff --git a/src/test/java/org/olat/selenium/BusinessGroupTest.java b/src/test/java/org/olat/selenium/BusinessGroupTest.java index 92add67157d06f447f07373533fc03b935863361..f1344d294aea0d1d6592f52d8b14d5b9dc6e0672 100644 --- a/src/test/java/org/olat/selenium/BusinessGroupTest.java +++ b/src/test/java/org/olat/selenium/BusinessGroupTest.java @@ -52,7 +52,6 @@ import org.olat.selenium.page.course.PublisherPageFragment.Access; import org.olat.selenium.page.graphene.OOGraphene; import org.olat.selenium.page.group.GroupPage; import org.olat.selenium.page.group.MembersWizardPage; -import org.olat.selenium.page.user.UserToolsPage; import org.olat.test.ArquillianDeployments; import org.olat.test.rest.UserRestClient; import org.olat.user.restapi.UserVO; @@ -79,8 +78,6 @@ public class BusinessGroupTest { @ArquillianResource private URL deploymentUrl; - @Page - private UserToolsPage userTools; @Page private NavigationPage navBar; diff --git a/src/test/java/org/olat/selenium/CourseTest.java b/src/test/java/org/olat/selenium/CourseTest.java index ef7f32ba6a54fdadd38b2a7356726adb585dcfb9..38041c268daa79a453c969c256d220fbf2cbb03c 100644 --- a/src/test/java/org/olat/selenium/CourseTest.java +++ b/src/test/java/org/olat/selenium/CourseTest.java @@ -643,7 +643,7 @@ public class CourseTest { String post2Title = "Blog-RW-2-" + UUID.randomUUID(); String post2Summary = "Some explantations as teaser"; String post2Content = "Content of the post"; - feed.addPost() + feed.addBlogPost() .fillPostForm(post2Title, post2Summary, post2Content) .publishPost(); @@ -712,8 +712,6 @@ public class CourseTest { .next() // -> no problem found .finish(); - OOGraphene.closeBlueMessageWindow(browser); - //User logs in, go to "My courses", navigate the catalog and start //the course LoginPage userLogin = LoginPage.getLoginPage(userBrowser, deploymentUrl); diff --git a/src/test/java/org/olat/selenium/PortfolioTest.java b/src/test/java/org/olat/selenium/PortfolioTest.java index d765d4224921793ff0e114c407f209108783058b..5e05ac3641713069179bbfaf20772a76316fec53 100644 --- a/src/test/java/org/olat/selenium/PortfolioTest.java +++ b/src/test/java/org/olat/selenium/PortfolioTest.java @@ -153,8 +153,6 @@ public class PortfolioTest { .next() .selectMap(mapTitle, pageTitle, structureElementTitle) .finish(); - - OOGraphene.closeBlueMessageWindow(browser); //open the portfolio portfolio = userTools @@ -234,8 +232,6 @@ public class PortfolioTest { .next() .selectMap(mapTitle, pageTitle, structureElementTitle) .finish(); - - OOGraphene.waitAndCloseBlueMessageWindow(browser); //open the portfolio portfolio = userTools @@ -333,8 +329,6 @@ public class PortfolioTest { .next() .selectMap(mapTitle, pageTitle, structureElementTitle) .finish(); - - OOGraphene.closeBlueMessageWindow(browser); //open the portfolio portfolio = userTools @@ -403,8 +397,6 @@ public class PortfolioTest { .next() .selectMap(mapTitle, pageTitle, structureElementTitle) .finish(); - - OOGraphene.waitAndCloseBlueMessageWindow(browser); //open the portfolio portfolio = userTools @@ -468,8 +460,6 @@ public class PortfolioTest { .next() .selectMap(mapTitle, pageTitle, structureElementTitle) .finish(); - - OOGraphene.waitAndCloseBlueMessageWindow(browser); //reopen the portfolio portfolio = userTools @@ -534,8 +524,6 @@ public class PortfolioTest { .next() .selectMap(mapTitle, pageTitle, structureElementTitle) .finish(); - - OOGraphene.waitAndCloseBlueMessageWindow(browser); //open the portfolio portfolio = userTools @@ -612,8 +600,6 @@ public class PortfolioTest { .next() .selectMap(mapTitle, pageTitle, structureElementTitle) .finish(); - - OOGraphene.waitAndCloseBlueMessageWindow(browser); //open the portfolio portfolio = userTools @@ -699,8 +685,6 @@ public class PortfolioTest { .next() .selectMap(mapTitle, pageTitle, structureElementTitle) .finish(); - - OOGraphene.waitAndCloseBlueMessageWindow(browser); //open the portfolio portfolio = userTools @@ -773,8 +757,6 @@ public class PortfolioTest { .next() .selectMap(mapTitle, pageTitle, structureElementTitle) .finish(); - - OOGraphene.closeBlueMessageWindow(browser); //open the portfolio portfolio = userTools diff --git a/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java b/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java index 06f05d68bf8e537809240f2cf0e685bfabcf42e0..04c80c9b1c0f6ea6d4ea44cfbabf2002843fc9f0 100644 --- a/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java +++ b/src/test/java/org/olat/selenium/page/course/AssessmentToolPage.java @@ -151,6 +151,7 @@ public class AssessmentToolPage { By userLinksBy = By.className("o_sel_certificate_generate"); browser.findElement(userLinksBy).click(); OOGraphene.waitBusy(browser); + OOGraphene.waitAndCloseBlueMessageWindow(browser); boolean newCertificate = false; for(int i=0; i<50; i++) { diff --git a/src/test/java/org/olat/selenium/page/course/BulkAssessmentPage.java b/src/test/java/org/olat/selenium/page/course/BulkAssessmentPage.java index 726fe71d9956bb2b8b186f2f338af96031f74883..35d894571117a5f5bb5d3a8d3653d01b8968dd5a 100644 --- a/src/test/java/org/olat/selenium/page/course/BulkAssessmentPage.java +++ b/src/test/java/org/olat/selenium/page/course/BulkAssessmentPage.java @@ -83,7 +83,7 @@ public class BulkAssessmentPage { Assert.assertTrue(finish.isEnabled()); finish.click(); OOGraphene.waitBusy(browser); - OOGraphene.closeBlueMessageWindow(browser); + OOGraphene.waitAndCloseBlueMessageWindow(browser); return this; } diff --git a/src/test/java/org/olat/selenium/page/course/CourseEditorPageFragment.java b/src/test/java/org/olat/selenium/page/course/CourseEditorPageFragment.java index b45347717706bf103f4f06f008dffae1bb8daa7a..cd92186b6573b21e63993213a00b64cbc1542415 100644 --- a/src/test/java/org/olat/selenium/page/course/CourseEditorPageFragment.java +++ b/src/test/java/org/olat/selenium/page/course/CourseEditorPageFragment.java @@ -378,7 +378,9 @@ public class CourseEditorPageFragment { browser.findElement(chooseButton).click(); OOGraphene.waitBusy(browser); //popup - WebElement popup = browser.findElement(By.className("o_sel_search_referenceable_entries")); + By referenceableEntriesBy = By.className("o_sel_search_referenceable_entries"); + OOGraphene.waitElement(referenceableEntriesBy, 1, browser); + WebElement popup = browser.findElement(referenceableEntriesBy); popup.findElement(By.cssSelector("a.o_sel_repo_popup_my_resources")).click(); OOGraphene.waitBusy(browser); @@ -507,7 +509,7 @@ public class CourseEditorPageFragment { By autoPublishBy = By.cssSelector("div.modal a.o_sel_course_quickpublish_auto"); browser.findElement(autoPublishBy).click(); OOGraphene.waitBusy(browser); - + OOGraphene.waitAndCloseBlueMessageWindow(browser); return new CoursePageFragment(browser); } diff --git a/src/test/java/org/olat/selenium/page/course/CourseWizardPage.java b/src/test/java/org/olat/selenium/page/course/CourseWizardPage.java index 7d393fc72f86c0255e4131f363de6f32dacf27e7..e3c35c36ef5bbb7b47c93c98fecd7860d67edfa9 100644 --- a/src/test/java/org/olat/selenium/page/course/CourseWizardPage.java +++ b/src/test/java/org/olat/selenium/page/course/CourseWizardPage.java @@ -75,7 +75,7 @@ public class CourseWizardPage { Assert.assertTrue(finish.isEnabled()); finish.click(); OOGraphene.waitBusy(browser); - OOGraphene.closeBlueMessageWindow(browser); + OOGraphene.waitAndCloseBlueMessageWindow(browser); return this; } diff --git a/src/test/java/org/olat/selenium/page/course/EfficiencyStatementConfigurationPage.java b/src/test/java/org/olat/selenium/page/course/EfficiencyStatementConfigurationPage.java index ee3c3012572abe0632c48a458eefa7bf073178c4..183a6ec5e45c17917ef1a427f438ecd3ef13c635 100644 --- a/src/test/java/org/olat/selenium/page/course/EfficiencyStatementConfigurationPage.java +++ b/src/test/java/org/olat/selenium/page/course/EfficiencyStatementConfigurationPage.java @@ -75,6 +75,7 @@ public class EfficiencyStatementConfigurationPage { * @return */ public CoursePageFragment clickToolbarBack() { + OOGraphene.closeBlueMessageWindow(browser); By toolbarBackBy = By.cssSelector("li.o_breadcrumb_back>a"); browser.findElement(toolbarBackBy).click(); OOGraphene.waitBusy(browser); diff --git a/src/test/java/org/olat/selenium/page/course/MembersPage.java b/src/test/java/org/olat/selenium/page/course/MembersPage.java index e33dc2bcefe163390dc0665f32a162b2714aff1a..f20069a7c00cb0353d44c1d598a02dba8367b42a 100644 --- a/src/test/java/org/olat/selenium/page/course/MembersPage.java +++ b/src/test/java/org/olat/selenium/page/course/MembersPage.java @@ -154,6 +154,7 @@ public class MembersPage { * @return */ public CoursePageFragment clickToolbarBack() { + OOGraphene.closeBlueMessageWindow(browser); By toolbarBackBy = By.cssSelector("li.o_breadcrumb_back>a"); browser.findElement(toolbarBackBy).click(); OOGraphene.waitBusy(browser); diff --git a/src/test/java/org/olat/selenium/page/course/MyCoursesPage.java b/src/test/java/org/olat/selenium/page/course/MyCoursesPage.java index ba2b8c4786ae13da27b3ce8f65d683b63f1a5032..991b41e72d26c26d458b8c665ee367423df9ce18 100644 --- a/src/test/java/org/olat/selenium/page/course/MyCoursesPage.java +++ b/src/test/java/org/olat/selenium/page/course/MyCoursesPage.java @@ -123,17 +123,10 @@ public class MyCoursesPage { } public MyCoursesPage selectCatalogEntry(String title) { - By titleBy = By.cssSelector(".o_sublevel .o_meta h4.o_title a"); + By titleBy = By.xpath("//div[contains(@class,'o_sublevel')]//div[contains(@class,'o_meta')]//h4[contains(@class,'o_title')]//a[span[text()[contains(.,'" + title + "')]]]"); List<WebElement> titleLinks = browser.findElements(titleBy); Assert.assertFalse(titleLinks.isEmpty()); - WebElement selectCategory = null; - for(WebElement titleLink:titleLinks) { - if(titleLink.getText().contains(title)) { - selectCategory = titleLink; - } - } - Assert.assertNotNull(selectCategory); - selectCategory.click(); + titleLinks.get(0).click(); OOGraphene.waitBusy(browser); return this; } diff --git a/src/test/java/org/olat/selenium/page/course/PublisherPageFragment.java b/src/test/java/org/olat/selenium/page/course/PublisherPageFragment.java index 7381a3ce3bf527f5b58ec89f25bc88870dec5d95..45750dd021b062f73931e1dffe4c3d5e26060fa2 100644 --- a/src/test/java/org/olat/selenium/page/course/PublisherPageFragment.java +++ b/src/test/java/org/olat/selenium/page/course/PublisherPageFragment.java @@ -88,7 +88,7 @@ public class PublisherPageFragment { Assert.assertTrue(finish.isEnabled()); finish.click(); OOGraphene.waitBusy(browser); - OOGraphene.closeBlueMessageWindow(browser); + OOGraphene.waitAndCloseBlueMessageWindow(browser); return this; } diff --git a/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java b/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java index ea13a8d1b19cdfe4497822c9fe180312fe62bda1..a8b503a5a0081edfcc3368acd4c2b7da4004e665 100644 --- a/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java +++ b/src/test/java/org/olat/selenium/page/graphene/OOGraphene.java @@ -46,6 +46,8 @@ public class OOGraphene { private static final long poolingDuration = 25; + private static final By closeBlueBoxButtonBy = By.cssSelector("div.o_alert_info div.o_sel_info_message i.o_icon.o_icon_close"); + public static void waitBusy(WebDriver browser) { Graphene.waitModel(browser).pollingEvery(poolingDuration, TimeUnit.MILLISECONDS).until(new BusyPredicate()); } @@ -174,16 +176,15 @@ public class OOGraphene { public static final void waitAndCloseBlueMessageWindow(WebDriver browser) { try { - Thread.sleep(350); - } catch (InterruptedException e) { + OOGraphene.waitElement(closeBlueBoxButtonBy, 1, browser); + } catch (Exception e) { e.printStackTrace(); } closeBlueMessageWindow(browser); } public static final void closeBlueMessageWindow(WebDriver browser) { - By closeButtonBy = By.cssSelector("div.o_alert_info div.o_sel_info_message i.o_icon.o_icon_close"); - List<WebElement> closeButtons = browser.findElements(closeButtonBy); + List<WebElement> closeButtons = browser.findElements(closeBlueBoxButtonBy); for(WebElement closeButton:closeButtons) { if(closeButton.isDisplayed()) { try { diff --git a/src/test/java/org/olat/selenium/page/portfolio/ArtefactWizardPage.java b/src/test/java/org/olat/selenium/page/portfolio/ArtefactWizardPage.java index 63760039fa95ddcd1b35cdcd8d00f1c232e926de..2e6b5644c4f6a0ca1832b1261324fcb25a66d201 100644 --- a/src/test/java/org/olat/selenium/page/portfolio/ArtefactWizardPage.java +++ b/src/test/java/org/olat/selenium/page/portfolio/ArtefactWizardPage.java @@ -67,7 +67,7 @@ public class ArtefactWizardPage { } /** - * Finish the wizard + * Finish the wizard, wait and close the blue info box. * @return this */ public ArtefactWizardPage finish() { @@ -76,7 +76,7 @@ public class ArtefactWizardPage { Assert.assertTrue(finish.isEnabled()); finish.click(); OOGraphene.waitBusy(browser); - OOGraphene.closeBlueMessageWindow(browser); + OOGraphene.waitAndCloseBlueMessageWindow(browser); return this; } diff --git a/src/test/java/org/olat/selenium/page/portfolio/PortfolioPage.java b/src/test/java/org/olat/selenium/page/portfolio/PortfolioPage.java index 9b0e2ab195c1bd9a69c70dd2f3db1f59e673a574..5b3cb26325b18a48723b3f7436e7152adc1cc793 100644 --- a/src/test/java/org/olat/selenium/page/portfolio/PortfolioPage.java +++ b/src/test/java/org/olat/selenium/page/portfolio/PortfolioPage.java @@ -163,6 +163,7 @@ public class PortfolioPage { //title By titleBy = By.xpath("//div[contains(@class,'o_sel_add_map_window')]//form//input[@type='text']"); + OOGraphene.waitElement(titleBy, 1, browser); WebElement titleEl = browser.findElement(titleBy); titleEl.sendKeys(title); diff --git a/src/test/java/org/olat/selenium/page/repository/FeedPage.java b/src/test/java/org/olat/selenium/page/repository/FeedPage.java index a0a110c79e91904001cf07bd3f3072c5f96abf92..c45504f3837bc2c992a1540f6e3b2454d77bc12a 100644 --- a/src/test/java/org/olat/selenium/page/repository/FeedPage.java +++ b/src/test/java/org/olat/selenium/page/repository/FeedPage.java @@ -121,10 +121,12 @@ public class FeedPage { return this; } - public FeedPage addPost() { + public FeedPage addBlogPost() { By newItemButton = By.className("o_sel_feed_item_new"); browser.findElement(newItemButton).click(); OOGraphene.waitBusy(browser); + By postForm = By.className("o_sel_blog_form"); + OOGraphene.waitElement(postForm, 1, browser); return this; } diff --git a/src/test/java/org/olat/selenium/page/repository/RepositoryAccessPage.java b/src/test/java/org/olat/selenium/page/repository/RepositoryAccessPage.java index cc45565dea22e062bc9c89688875d1e1e9bfd514..f76fbe7610e6f769f27d18a680a9cff6aca5a08d 100644 --- a/src/test/java/org/olat/selenium/page/repository/RepositoryAccessPage.java +++ b/src/test/java/org/olat/selenium/page/repository/RepositoryAccessPage.java @@ -88,6 +88,7 @@ public class RepositoryAccessPage { * Click toolbar */ public void clickToolbarBack() { + OOGraphene.closeBlueMessageWindow(browser); By toolbarBackBy = By.cssSelector("li.o_breadcrumb_back>a"); browser.findElement(toolbarBackBy).click(); OOGraphene.waitBusy(browser); diff --git a/src/test/java/org/olat/selenium/page/repository/RepositoryEditDescriptionPage.java b/src/test/java/org/olat/selenium/page/repository/RepositoryEditDescriptionPage.java index 1ec9be60c0c998d3b9c2780749258aa3fc920d77..ad78d2c9d9cf349f7b337bae3069e05ca6595cae 100644 --- a/src/test/java/org/olat/selenium/page/repository/RepositoryEditDescriptionPage.java +++ b/src/test/java/org/olat/selenium/page/repository/RepositoryEditDescriptionPage.java @@ -86,6 +86,7 @@ public class RepositoryEditDescriptionPage { } public void clickToolbarBack() { + OOGraphene.closeBlueMessageWindow(browser); browser.findElement(NavigationPage.toolbarBackBy).click(); OOGraphene.waitBusy(browser);