You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2015/06/05 11:55:38 UTC
svn commit: r1683694 -
/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java
Author: deki
Date: Fri Jun 5 09:55:37 2015
New Revision: 1683694
URL: http://svn.apache.org/r1683694
Log:
TOBAGO-1369: Migrate to Selenium WebDriver - added missing WaitForAttribute implementation
Modified:
myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java
Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java?rev=1683694&r1=1683693&r2=1683694&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/test/java/org/apache/myfaces/tobago/example/test/TobagoSelenium.java Fri Jun 5 09:55:37 2015
@@ -68,6 +68,7 @@ public class TobagoSelenium extends WebD
webDriverCommandProcessor.addMethod("assertElementHeight", new AssertElementHeight(elementFinder));
webDriverCommandProcessor.addMethod("assertElementPositionLeft", new AssertElementPositionLeft(elementFinder));
webDriverCommandProcessor.addMethod("assertElementPositionTop", new AssertElementPositionTop(elementFinder));
+ webDriverCommandProcessor.addMethod("waitForAttribute", new WaitForAttribute(javascriptLibrary, elementFinder));
}
}
@@ -297,4 +298,24 @@ public class TobagoSelenium extends WebD
return attributeValue;
}
}
+
+ class WaitForAttribute extends GetAttribute {
+ public WaitForAttribute(final JavascriptLibrary library, final ElementFinder finder) {
+ super(library, finder);
+ }
+
+ @Override
+ protected String handleSeleneseCommand(final WebDriver driver, final String attributeLocator,
+ final String expectedValue) {
+ long timeout = getTimeout("");
+ new Wait() {
+ @Override
+ public boolean until() {
+ String attributeValue = WaitForAttribute.super.handleSeleneseCommand(driver, attributeLocator, expectedValue);
+ return expectedValue.equals(attributeValue);
+ }
+ }.wait(String.format("Timed out waiting for %s. Waited %s", attributeLocator, timeout), timeout);
+ return null;
+ }
+ }
}