From 882c5a7dca76a8747776efe1f7cfea51b0c36c79 Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Tue, 12 Jan 2016 20:04:24 +0100 Subject: [PATCH] no-jira: fix selenium tests on form with file upload --- src/test/java/org/olat/selenium/CourseTest.java | 14 +++++++++----- .../org/olat/selenium/page/forum/ForumPage.java | 9 +++++---- .../page/portfolio/ArtefactWizardPage.java | 4 ++-- .../selenium/page/repository/CatalogAdminPage.java | 5 +++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/test/java/org/olat/selenium/CourseTest.java b/src/test/java/org/olat/selenium/CourseTest.java index 1aaf15f41d6..5283966b942 100644 --- a/src/test/java/org/olat/selenium/CourseTest.java +++ b/src/test/java/org/olat/selenium/CourseTest.java @@ -585,14 +585,14 @@ public class CourseTest { loginPage.loginAs(author.getLogin(), author.getPassword()); //create a course - String courseTitle = "Course-With-Podcast-" + UUID.randomUUID().toString(); + String courseTitle = "Course-With-Podcast-" + UUID.randomUUID(); navBar .openAuthoringEnvironment() .createCourse(courseTitle) .clickToolbarBack(); String podcastNodeTitle = "Podcats-1"; - String podcastTitle = "Podcast - " + UUID.randomUUID().toString(); + String podcastTitle = "Podcast - " + UUID.randomUUID(); //create a course element of type CP with the CP that we create above CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser) @@ -622,8 +622,10 @@ public class CourseTest { FeedPage feed = FeedPage.getFeedPage(browser); feed.newExternalPodcast("http://pod.drs.ch/rock_special_mpx.xml"); - //check only that the "episodes" title is visibel - WebElement episodeH4 = browser.findElement(By.cssSelector("div.o_podcast_episodes>h4.o_title")); + //check only that the "episodes" title is visible + By episodeTitleby = By.cssSelector("div.o_podcast_episodes>h4.o_title"); + OOGraphene.waitElement(episodeTitleby, 5, browser); + WebElement episodeH4 = browser.findElement(episodeTitleby); Assert.assertNotNull(episodeH4); } @@ -675,7 +677,9 @@ public class CourseTest { feed.newExternalBlog("http://www.openolat.com/feed/"); //check only that the subscription link is visible - WebElement subscriptionLink = browser.findElement(By.cssSelector("div.o_subscription>a")); + By subscriptionBy = By.cssSelector("div.o_subscription>a"); + OOGraphene.waitElement(subscriptionBy, 10, browser); + WebElement subscriptionLink = browser.findElement(subscriptionBy); Assert.assertTrue(subscriptionLink.isDisplayed()); } diff --git a/src/test/java/org/olat/selenium/page/forum/ForumPage.java b/src/test/java/org/olat/selenium/page/forum/ForumPage.java index ec0d4d88666..eb5df89d787 100644 --- a/src/test/java/org/olat/selenium/page/forum/ForumPage.java +++ b/src/test/java/org/olat/selenium/page/forum/ForumPage.java @@ -117,9 +117,10 @@ public class ForumPage { //save By saveBy = By.cssSelector("div.modal-content form button.btn-primary"); - WebElement saveButton = browser.findElement(saveBy); - saveButton.click(); + browser.findElement(saveBy).click(); OOGraphene.waitBusy(browser); + By messageTitleBy = By.xpath("//div[contains(@class,'o_forum_message')][//h4[contains(text(),'" + title + "')]]"); + OOGraphene.waitElement(messageTitleBy, 5, browser); return this; } @@ -220,8 +221,8 @@ public class ForumPage { */ public ArtefactWizardPage addAsArtfeact() { By addAsArtefactBy = By.className("o_eportfolio_add"); - WebElement addAsArtefactButton = browser.findElement(addAsArtefactBy); - addAsArtefactButton.click(); + OOGraphene.waitElement(addAsArtefactBy, 5, browser); + browser.findElement(addAsArtefactBy).click(); OOGraphene.waitBusy(browser); return ArtefactWizardPage.getWizard(browser); } 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 2e6b5644c4f..84913a153a6 100644 --- a/src/test/java/org/olat/selenium/page/portfolio/ArtefactWizardPage.java +++ b/src/test/java/org/olat/selenium/page/portfolio/ArtefactWizardPage.java @@ -93,8 +93,8 @@ public class ArtefactWizardPage { public ArtefactWizardPage fillArtefactMetadatas(String title, String description) { By titleBy = By.cssSelector(".o_sel_ep_artefact_metadata_title input"); - WebElement titleEl = browser.findElement(titleBy); - titleEl.sendKeys(title); + OOGraphene.waitElement(titleBy, 10, browser); + browser.findElement(titleBy).sendKeys(title); OOGraphene.tinymce(description, browser); return this; diff --git a/src/test/java/org/olat/selenium/page/repository/CatalogAdminPage.java b/src/test/java/org/olat/selenium/page/repository/CatalogAdminPage.java index bd1f79c0ddd..379aa130604 100644 --- a/src/test/java/org/olat/selenium/page/repository/CatalogAdminPage.java +++ b/src/test/java/org/olat/selenium/page/repository/CatalogAdminPage.java @@ -72,9 +72,10 @@ public class CatalogAdminPage { //save By saveBy = By.cssSelector(".o_sel_catalog_add_category_popup .o_sel_catalog_entry_form_buttons button.btn-primary"); - WebElement saveButton = browser.findElement(saveBy); - saveButton.click(); + browser.findElement(saveBy).click(); OOGraphene.waitBusy(browser); + By nodeTitleBy = By.xpath("//div[contains(@class,'o_meta')]//h4[contains(@class,'o_title')]//a/span[contains(text(),'" + title + "')]"); + OOGraphene.waitElement(nodeTitleBy, 5, browser); return this; } -- GitLab