public interface ExpectationBuilder extends TimeoutRelated<ExpectationBuilder>
TimeoutRelated.withTimeout(Enum) and TimeoutRelated.withTimeout(String).expect(Browser), expect(WebElement),
expect(List).assume(Browser), assume(WebElement),
assume(List).all(Runnable) and any(Runnable).
About the ibello expectation engine, see hu.ibello.expect.
| Modifier and Type | Method and Description |
|---|---|
void |
all(Runnable expectations)
Executes a complex expectation.
|
void |
any(Runnable expectations)
Executes a complex expectation.
|
BrowserExpectationBuilder |
assume(Browser browser)
Starts to build a simple expectation about the browser.
|
WebElementsExpectationBuilder |
assume(List<WebElement> elements)
Starts to build a simple expectation about the given elements.
|
WebElementExpectationBuilder |
assume(WebElement element)
Starts to build a simple expectation about the given element.
|
BrowserExpectationBuilder |
expect(Browser browser)
Starts to build a simple expectation about the browser.
|
WebElementsExpectationBuilder |
expect(List<WebElement> elements)
Starts to build a simple expectation about the given elements.
|
WebElementExpectationBuilder |
expect(WebElement element)
Starts to build a simple expectation about the given element.
|
default void |
expectAll(Runnable expectations)
Deprecated.
|
default void |
expectAny(Runnable expectations)
Deprecated.
|
withTimeout, withTimeoutWebElementExpectationBuilder expect(WebElement element)
The expectation provided by this method is a "hard" one. If it fails, the execution of the
current test will be terminated. This is the difference between assume(WebElement)
and expect(WebElement).
element - a WebElementWebElementExpectationBuilder instance to continue the expectationWebElementsExpectationBuilder expect(List<WebElement> elements)
The expectation provided by this method is a "hard" one. If it fails, the execution of the
current test will be terminated. This is the difference between assume(List)
and expect(List).
elements - collection of WebElement objects - it can be WebElementsWebElementsExpectationBuilder instance to continue the expectationBrowserExpectationBuilder expect(Browser browser)
The expectation provided by this method is a "hard" one. If it fails, the execution of the
current test will be terminated. This is the difference between assume(Browser)
and expect(Browser).
browser - the browser object, PageObject.browser()BrowserExpectationBuilder instance to continue the expectationWebElementExpectationBuilder assume(WebElement element)
The expectation provided by this method is a "soft" one. If it fails, the execution of the
test code will not be stopped. This is the difference between expect(WebElement)
and assume(WebElement).
element - a WebElementWebElementExpectationBuilder instance to continue the expectationWebElementsExpectationBuilder assume(List<WebElement> elements)
The expectation provided by this method is a "soft" one. If it fails, the execution of the
test code will not be stopped. This is the difference between expect(List)
and assume(List).
elements - collection of WebElement objects - it can be WebElementsWebElementsExpectationBuilder instance to continue the expectationBrowserExpectationBuilder assume(Browser browser)
The expectation provided by this method is a "soft" one. If it fails, the execution of the
test code will not be stopped. This is the difference between expect(Browser)
and assume(Browser).
browser - the browser object, PageObject.browser()BrowserExpectationBuilder instance to continue the expectation@Deprecated default void expectAll(Runnable expectations)
all(Runnable).expectations - a Runnable instance which calls the child expectationsvoid all(Runnable expectations)
Runnable instance, in which we can call
multiple expectations (even another complex ones). As result, all expectations will be executed
in arbitrary order. The complex expectation will fail if any of the child expectations fails.
(So all of them should be successful.)
Example (in a page object):
expectations().all(() -> {
expectations().expect(browser()).toHave().url("https://ibello.eu");
expectations().expect(registerButton).toBe().clickable();
});
In the complex expectation we can use "hard" and "soft" child expectations. If the complex expectation fails because a "hard" child failed, then the execution of the current test will be terminated instantly. If the reason of the failure was a "soft" expectation, then the test will continue with the next step. In both cases, at the end the test will be marked as failed.
expectations - a Runnable instance which calls the child expectations@Deprecated default void expectAny(Runnable expectations)
any(Runnable).expectations - a Runnable instance which calls the child expectationsvoid any(Runnable expectations)
Runnable instance, in which we can call
multiple expectations (even another complex ones). As result, all expectations will be executed
in arbitrary order. The complex expectation will fail if all of the child expectations fail.
(So at least one should be successful.) After the first successful child expectation the
execution of the children will stop.
Example (in a page object):
expectations().any(() -> {
expectations().expect(loginButton).toBe().clickable();
expectations().expect(registerButton).toBe().clickable();
});
In the complex expectation we can use "hard" and "soft" child expectations. If we use at least one "hard" expectation, and the complex expectation fails, then the test run will be instantly terminated (because that "hard" one failed). If the complex expectation contains only "soft" children, then the test execution will continue even if the expectation fails. In both cases, at the end the test will be marked as failed.
expectations - a Runnable instance which calls the child expectationsCreated by Kornél Simon, 2022