-
1. Re: Graphene: proposal of API change from FindBy to FindByJQuery to achieve extensibility
lfryc Sep 2, 2013 9:29 AM (in response to lfryc)I have two proposals:
1. re-define @FindBy(how = How) where how should be Class<? extends How> instead of enum.
@FindBy(how = JQuery.class, using=".class:visible") for jQuery
@FindBy(how = JSF.class, using="component-id") for JSF
locating <h:commandButton id="component-id" />
@FindBy(how = NG.class, using="modelProperty") for AngularJS
locating <input ng-model="modelProperty" />
Additionally, one could change the default location strategy for whole project, so that one could use just:
@FindBy("component-id")
when arquillian.xml will specify <property name="defaultLocationStrategy">org.jboss.arquillian.graphene.by.ByJSF</property>
Sample:
@FindBy(how = JSF.class, using = "due")
private Calendar dueDate;
@FindBy(how = JSF.class, using = "edit")
private Button editButton;
@FindBy(how = JSF.class, using = "delete")
private Button deleteButton;
----
2. allow to extend a syntax with own annotations:
@FindByJQuery(".class:visible")
@FindByJSF("component-id")
@FindByNg("modelProperty")
where
@ElementLocationStrategy(resolver = ByJSF.class)
public @interfaces FindByJSF {
String value();
}
@FindByJSF("due")
private Calendar dueDate;
@FindByJSF("edit")
private Button edit;
@FindByJSF("delete")
private Button delete;
-
2. Re: Graphene: proposal of API change of FindBy to achieve extensibility
lfryc Sep 2, 2013 9:01 AM (in response to lfryc)Another aspect of this API which is in question is re-definition of WebDriver's @FindBy.
I don't really like there is a duplicity on classpath, since it makes a life with IDEs harder:
you get two FindBy implementations in type search, so you need to mind the package name.
-
3. Re: Graphene: proposal of API change of FindBy to achieve extensibility
kpiwko Sep 2, 2013 10:17 AM (in response to lfryc)Lukas,
I really hate having own @FindBy annotation. Therefore, I'd definitely prefer having a bunch of @FindByXYZ annotations with some "SPI" that allows user to register their own annotation - e.g. all @FindByXYZ annotations are marked with a meta annotation.
Something like: https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/src/main/java/org/jboss/aerogear/unifiedpush/annotations/PATCH.java
Karel
-
4. Re: Graphene: proposal of API change of FindBy to achieve extensibility
jhuska Sep 3, 2013 2:30 AM (in response to lfryc)I am voting for the second option as well. It gives us less verbose syntax, without need (but with possibility) to setup something on the global level.