|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.test.selenium.waiting.Wait
public class Wait
Implementation of waiting to satisfy condition.
This class constructs instances of Waiting by factory methods but provides its functionality (defaulted waiting) by static method until.
Other factories (getDefault(), timeout(long), interval(long)) serves as simplified way to build new configured instance, which can simple run waiting loop.
Class is intended to be used like these:
Wait.until(new Condition()) {
public boolean isTrue() {
return ...;
}
}
Wait.interval(100).timeout(3000).until(new Not()) {
public boolean not() {
return ...;
}
}
final String locator1 = "...";
final String locator2 = "...";
...
Condition locatorsEqual = new Condition() {
public boolean isTrue() {
return selenium.equals(locator1, locator2);
}
};
Waiting waitResponse = Wait.interval(1000).timeout(30000);
...
waitResponse.until(locatorsEqual); // some usage
...
waitResponse.until(locatorsEqual); // other usage
| Nested Class Summary | |
|---|---|
static class |
Wait.Waiting
Class intented to construct by factories in Wait class. |
| Field Summary | |
|---|---|
static long |
DEFAULT_INTERVAL
Default waiting interval |
static long |
DEFAULT_TIMEOUT
Default timeout of waiting |
| Method Summary | ||
|---|---|---|
static Wait.Waiting |
dontFail()
Constructs preset instance of waiting (@see Waiting) with no failure. |
|
static Wait.Waiting |
failWith(java.lang.CharSequence failureMessage,
java.lang.Object... args)
Constructs preset instance of waiting (@see Waiting) with given failure message parametrized by given objects If failure is set to null, timeout will not result to failure! |
|
static Wait.Waiting |
failWith(java.lang.Object failureSubject)
Constructs preset instance of waiting (@see Waiting) with given subject of failure. |
|
static Wait.Waiting |
getDefault()
Constructs default preset instance of waiting (@see Waiting). |
|
static Wait.Waiting |
interval(long interval)
Constructs preset instance of waiting (@see Waiting) with given interval. |
|
static Wait.Waiting |
noDelay()
Constructs preset instance of waiting (@see Waiting) with no delay by interval between start waiting and first test for conditions. |
|
static Wait.Waiting |
timeout(long timeout)
Constructs preset instance of waiting (@see Waiting) with given timeout. |
|
static void |
until(Condition condition)
Stars loop waiting to satisfy condition with default timeout and interval. |
|
static void |
waitFor(long timeoutInMilis)
Will wait for specified amount of time. |
|
static
|
waitForChange(T oldValue,
Retrieve<T> retrieve)
Waits until Retrieve's implementation doesn't retrieve value other than oldValue. |
|
static
|
waitForChangeAndReturn(T oldValue,
Retrieve<T> retrieve)
Waits until Retrieve's implementation doesn't retrieve value other than oldValue and this new value returns. |
|
static void |
waitForTimeout()
Will wait for default amount of time. |
|
static Wait.Waiting |
withDelay(boolean isDelayed)
Constructs preset instance of waiting (@see Waiting) and set that testing condition should or shouldn't be delayed of one interval after the start of waiting. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long DEFAULT_INTERVAL
public static final long DEFAULT_TIMEOUT
| Method Detail |
|---|
public static Wait.Waiting getDefault()
public static Wait.Waiting interval(long interval)
interval - in miliseconds that will be preset to Waiting
public static Wait.Waiting timeout(long timeout)
timeout - in miliseconds that will be preset to Waiting
public static Wait.Waiting failWith(java.lang.Object failureSubject)
failureSubject - Throwable (used in cause) or any other object (will be
converted to expection message by its string value)
public static Wait.Waiting failWith(java.lang.CharSequence failureMessage,
java.lang.Object... args)
failureMessage - character sequence that will be used as message of exception
thrown in case of waiting timeout or null if waiting timeout
shouldn't result to failureargs - arguments to failureMessage which will be use to
parametrization of failureMessage
public static Wait.Waiting dontFail()
public static Wait.Waiting noDelay()
public static Wait.Waiting withDelay(boolean isDelayed)
isDelayed - true if condition testing should be delayed; false otherwise
public static void waitForTimeout()
public static <T> void waitForChange(T oldValue,
Retrieve<T> retrieve)
T - type of value what we are waiting for changeoldValue - value that we are waiting for changeretrieve - implementation of retrieving actual value
public static <T> T waitForChangeAndReturn(T oldValue,
Retrieve<T> retrieve)
T - type of value what we are waiting for changeoldValue - value that we are waiting for changeretrieve - implementation of retrieving actual value
public static void waitFor(long timeoutInMilis)
timeoutInMilis - time to wait in milisecondspublic static void until(Condition condition)
condition - what wait for to be satisfied
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||