Skip to content
Snippets Groups Projects
Commit 98510ba0 authored by srosse's avatar srosse
Browse files

OO-1635: try to harden selenium tests against info blue box

parent c8507f20
No related branches found
No related tags found
No related merge requests found
Showing with 13 additions and 17 deletions
......@@ -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);
......
......@@ -497,7 +497,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);
}
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -88,7 +88,7 @@ public class PublisherPageFragment {
Assert.assertTrue(finish.isEnabled());
finish.click();
OOGraphene.waitBusy(browser);
OOGraphene.closeBlueMessageWindow(browser);
OOGraphene.waitAndCloseBlueMessageWindow(browser);
return this;
}
......
......@@ -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 {
......
......@@ -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);
......
......@@ -86,6 +86,7 @@ public class RepositoryEditDescriptionPage {
}
public void clickToolbarBack() {
OOGraphene.closeBlueMessageWindow(browser);
browser.findElement(NavigationPage.toolbarBackBy).click();
OOGraphene.waitBusy(browser);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment