-
15. Re: AspectJ with Arquillian testing - ideas
jhuska Jul 26, 2013 9:16 AM (in response to smikloso)(1) Your enhancer should have lesser precedence that GrapheneEhancer (-100), than it will be called after all fields are properly initialized and you will be able to cast it.
(2) Please keep in mind that the reference on interesting actions was with Graphene 1, where Selenium 1 was used. Similar approach will be used for Graphene 2 with WebDriver support.
-
16. Re: AspectJ with Arquillian testing - ideas
smikloso Jul 29, 2013 7:07 AM (in response to jhuska)Regarding of 1) it really helps and I am able to register it, however even if I register some dummy interceptor, it seems one interceptor is calling another one in the neverending loop and stackoverflow is all I get.
Interceptor is registered like this: https://github.com/smiklosovic/arquillian-droidium-screenshooter/blob/master/arquillian-droidium-screenshooter-impl/src/main/java/org/arquillian/droidium/screenshooter/impl/DroidiumScreenshooterEnhancer.java#L85
Regarding of errors, it all starts with this:
java.lang.IllegalStateException: Can't invoke method findElement.
at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler$2.call(GrapheneProxyHandler.java:221)
at org.jboss.arquillian.graphene.BrowserActions.performAction(BrowserActions.java:62)
at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.invoke(GrapheneProxyHandler.java:212)
at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.intercept(GrapheneProxyHandler.java:236)
at org.openqa.selenium.android.AndroidDriver$$EnhancerByGraphene$$cb9c6cd9.findElement(<generated>)
at org.arquillian.droidium.showcase.native_.test01.SelendroidTestAppTestCase.test01(SelendroidTestAppTestCase.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
which is
Caused by: java.lang.StackOverflowError
at java.lang.reflect.AccessibleObject.<init>(AccessibleObject.java:158)
at java.lang.reflect.Method.<init>(Method.java:124)
at java.lang.reflect.Method.copy(Method.java:151)
at java.lang.reflect.ReflectAccess.copyMethod(ReflectAccess.java:136)
at sun.reflect.ReflectionFactory.copyMethod(ReflectionFactory.java:300)
at java.lang.Class.searchMethods(Class.java:2750)
at java.lang.Class.getMethod0(Class.java:2764)
at java.lang.Class.getMethod(Class.java:1653)
at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.invoke(GrapheneProxyHandler.java:115)
at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.intercept(GrapheneProxyHandler.java:236)
at org.openqa.selenium.android.AndroidDriver$$EnhancerByGraphene$$c07b8e78.unwrap(<generated>)
at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.invoke(GrapheneProxyHandler.java:118)
at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.intercept(GrapheneProxyHandler.java:236)
at org.openqa.selenium.android.AndroidDriver$$EnhancerByGraphene$$c07b8e78.unwrap(<generated>)
at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.invoke(GrapheneProxyHandler.java:118)
... repeating infinitely
After the talk with Juraj, it seems that something is calling itself in a loop or one interceptor is calling another one and that one is calling the first one again but we do not know where it actually happens.
Regarding of 2), I understand now, but it means that since click() is invoked on WebElement-s instead of WebDriver itself and interceptor is registered on an object, it would be needed to register interceptor on every WebElement in a test dynamically, right? Juraj showed me that something like this is possible, I would like to know about it more in general.