From 7cf6591b0125807ee63fce3c5a7eb9e81935b41d Mon Sep 17 00:00:00 2001 From: anttil <anttil> Date: Tue, 2 Oct 2012 08:57:32 +0000 Subject: [PATCH] SWE-2 / SP-314 : Wait for paging toolbar to get enabled SVN: 26930 --- .../openbis/uitest/widget/PagingToolBar.java | 28 ++++++++++++++++--- .../openbis/uitest/widget/SettingsDialog.java | 4 +++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/PagingToolBar.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/PagingToolBar.java index 51da591a05e..0d6ba180be2 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/PagingToolBar.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/PagingToolBar.java @@ -16,6 +16,13 @@ package ch.systemsx.cisd.openbis.uitest.widget; +import java.util.concurrent.TimeUnit; + +import org.openqa.selenium.WebElement; +import org.openqa.selenium.support.ui.FluentWait; + +import com.google.common.base.Predicate; + import ch.systemsx.cisd.openbis.uitest.infra.webdriver.WidgetContext; /** @@ -38,10 +45,23 @@ public class PagingToolBar implements Widget, Refreshable public void settings() { Button b = context.find(".//button[text()='Settings']", Button.class); - if (!b.isPressed()) - { - b.click(); - } + + new FluentWait<WebElement>(context) + { + + }.withTimeout(30, TimeUnit.SECONDS).pollingEvery(100, TimeUnit.MILLISECONDS).until( + new Predicate<WebElement>() + { + + @Override + public boolean apply(WebElement element) + { + System.out.println("waiting for paging toolbar to get enabled"); + return !context.getAttribute("class").contains("x-item-disabled"); + } + }); + + b.click(); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/SettingsDialog.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/SettingsDialog.java index cb3532b4c4b..b0e59a2f2f0 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/SettingsDialog.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/widget/SettingsDialog.java @@ -45,6 +45,10 @@ public class SettingsDialog implements Widget if (l.size() > 0) { l.get(0).click(); + } else + { + throw new IllegalStateException("Could not find column " + name + + " from settings dialog!"); } } -- GitLab