]
Chris Jones updated ARQGRA-446:
-------------------------------
Attachment: graphene-groovy-test.zip
Attaching a test case
Add support for Groovy page objects
-----------------------------------
Key: ARQGRA-446
URL:
https://issues.jboss.org/browse/ARQGRA-446
Project: Arquillian Graphene
Issue Type: Enhancement
Components: configuration, core
Affects Versions: 2.0.2.Final
Reporter: Chris Jones
Attachments: graphene-groovy-test.zip
Page objects written in groovy throw a StackOverflowError. There seems to be a recursive
issue when proxying groovy's metaclass property.
{code:title=GoogleGroovy.groovy|borderStyle=solid}
package test
import org.jboss.arquillian.graphene.page.Location
import org.openqa.selenium.WebElement
import org.openqa.selenium.support.FindBy
@Location("https://www.google.com/")
public class GoogleGroovy {
@FindBy
WebElement q
def search(String query){
q.sendKeys(query)
sleep(5000)
}
}
{code}
{code:title=GoogleJava.java|borderStyle=solid}
package test;
import org.jboss.arquillian.graphene.page.Location;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@Location("https://www.google.com/")
public class GoogleJava {
@FindBy
WebElement q;
public void search(String query) throws Exception {
q.sendKeys(query);
Thread.sleep(5000);
}
}
{code}
{code:title=GoogleTestCase.groovy|borderStyle=solid}
package test
import org.jboss.arquillian.drone.api.annotation.Drone
import org.jboss.arquillian.graphene.Graphene
import org.jboss.arquillian.junit.Arquillian
import org.junit.Test
import org.junit.runner.RunWith
import org.openqa.selenium.firefox.FirefoxDriver
@RunWith(Arquillian.class)
class GoogleTestCase {
@Drone
FirefoxDriver driver
@Test
def void testUsingJava(){
def googleJava = Graphene.goTo(GoogleJava)
googleJava.search("hello world")
}
@Test
def void testUsingGroovy(){
def googleGroovy = Graphene.goTo(GoogleGroovy)
googleGroovy.search("jello world")
}
}
{code}
{code:title=Stacktrace|borderStyle=solid}
Jun 01, 2014 12:47:08 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Public field '__$stMC' found in test.GoogleTestCase. Direct access to
fields outside of the declaring class is not allowed.
Jun 01, 2014 12:47:08 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Public field '__timeStamp' found in test.GoogleTestCase. Direct access
to fields outside of the declaring class is not allowed.
Jun 01, 2014 12:47:08 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Public field '__timeStamp__239_neverHappen1401597979243' found in
test.GoogleTestCase. Direct access to fields outside of the declaring class is not
allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Public field '__$stMC' found in test.GoogleGroovy. Direct access to
fields outside of the declaring class is not allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Package-friendly field '__$stMC' found in test.GoogleGroovy. Direct
access to fields outside of the declaring class is not allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Public field '__timeStamp' found in test.GoogleGroovy. Direct access to
fields outside of the declaring class is not allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Package-friendly field '__timeStamp' found in test.GoogleGroovy. Direct
access to fields outside of the declaring class is not allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Public field '__timeStamp__239_neverHappen1401597978002' found in
test.GoogleGroovy. Direct access to fields outside of the declaring class is not allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Package-friendly field '__timeStamp__239_neverHappen1401597978002' found
in test.GoogleGroovy. Direct access to fields outside of the declaring class is not
allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Public field '__$stMC' found in
test.GoogleGroovy$$EnhancerByGraphene$$2eb2d5f8. Direct access to fields outside of the
declaring class is not allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Package-friendly field '__$stMC' found in
test.GoogleGroovy$$EnhancerByGraphene$$2eb2d5f8. Direct access to fields outside of the
declaring class is not allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Public field '__timeStamp' found in
test.GoogleGroovy$$EnhancerByGraphene$$2eb2d5f8. Direct access to fields outside of the
declaring class is not allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Package-friendly field '__timeStamp' found in
test.GoogleGroovy$$EnhancerByGraphene$$2eb2d5f8. Direct access to fields outside of the
declaring class is not allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Public field '__timeStamp__239_neverHappen1401597978002' found in
test.GoogleGroovy$$EnhancerByGraphene$$2eb2d5f8. Direct access to fields outside of the
declaring class is not allowed.
Jun 01, 2014 12:47:12 AM
org.jboss.arquillian.graphene.enricher.FieldAccessValidatorEnricher checkFieldValidity
WARNING: Package-friendly field '__timeStamp__239_neverHappen1401597978002' found
in test.GoogleGroovy$$EnhancerByGraphene$$2eb2d5f8. Direct access to fields outside of the
declaring class is not allowed.
java.lang.StackOverflowError
at
org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.invoke(GrapheneContextualHandler.java:205)
at
org.jboss.arquillian.graphene.proxy.GrapheneContextualHandler.intercept(GrapheneContextualHandler.java:229)
at test.GoogleGroovy$$EnhancerByGraphene$$2eb2d5f8.getMetaClass(<generated>)
at
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.checkCall(PogoMetaClassSite.java:59)
at
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:36)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
.....
{code}