[
https://issues.jboss.org/browse/ARQGRA-377?page=com.atlassian.jira.plugin...
]
Lukáš Fryč commented on ARQGRA-377:
-----------------------------------
Few points:
1. for determining whether an element is enabled, you should use the simplest API
possible:
{code}
WebElement#isEnabled()
{code}
http://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebE...
2. (y) +1 for being able to build assertions and waiting conditions in unified manner (if
statements doesn't apply afaik)
----
3. we could leverage interceptors to wrap instances and wait on conditions specified in
closing word (method), e.g.:
{code}
element.isEnabled();
waitGui().until().element(element).isEnabled();
assertThat(element, isEnabled());
{code}
the problem is that {{WebElement#isEnabled}} returns false, but it should return
{{FluentBase<?>}} otherwise.
One of the solutions comes from extending capabilities of {{WebElement}} interface and
transform it to fluent API, consumed later by e.g. {{GrapheneElement}}. Say we have
interface:
{code}
public interface ElementOperation<B, T> {
B isEnabled();
T getText();
...
}
{code}
then we can:
{code}
public class GrapheneElement implements WebElement, ElementOperation<Boolean,
String> {
Boolean isEnabled();
String getText();
...
}
{code}
Based on a returned type, you could leverage that same API in assetions/waiting
conditions:
{code}
public class FluentElement implements ElementOperation<FluentBoolean, FluentString>
{
FluentBoolean isEnabled();
FluentString getText();
}
{code}
----
Do you have another ideas?
I think re-implementation is not possible at this stage, as we are approaching 2.0 Final
release.
I would rather take it as suggestions for improvement in 3.0 or alternative API in
2.Future.
Improve the conditions API
--------------------------
Key: ARQGRA-377
URL:
https://issues.jboss.org/browse/ARQGRA-377
Project: Arquillian Graphene
Issue Type: Enhancement
Components: core
Affects Versions: 2.0.0.Beta1
Reporter: Juraj Húska
Currently the conditions API looks like:
{code}
new WebElementConditionFactory(webElement).isEnabled().apply(webDriverInstance);{code}
It should be improved to be more concise.
Consider inspiring with *hamcrest* library ([
link|https://code.google.com/p/hamcrest/]),
which should allow to have conditions API like:
{code}
import static foo.bar.Matchers.*;
public void testEquals() {
WebElement element = browser.findBy(By.tagName("body"));
assertThat(element, isDisplayed());
}
{code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:
http://www.atlassian.com/software/jira