Uploaded image for project: 'Arquillian Graphene'
  1. Arquillian Graphene
  2. ARQGRA-190

Support initializing Page Objects declared with generic types

    Details

    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 2.0.0.Alpha2
    • Fix Version/s: 2.0.0.Alpha3
    • Component/s: core
    • Labels:
      None

      Description

      When using @Page annotation to initialize Page Object in this way:

      public abstract class AbstractWebDriverTest<P extends AbstractPage> extends Arquillian {
          @Page
          public P page;
      }
      

      I am getting this:

      java.lang.RuntimeException: Can not initialise Page Object!
      	at org.jboss.arquillian.graphene.enricher.ComponentObjectsEnricher.initializePageObjectFields(ComponentObjectsEnricher.java:106)
      	at org.jboss.arquillian.graphene.enricher.ComponentObjectsEnricher.enrich(ComponentObjectsEnricher.java:64)
      	at org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:52)
      	at org.jboss.arquillian.container.test.impl.ClientTestInstanceEnricher.enrich(ClientTestInstanceEnricher.java:51)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
      	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createContext(ContainerEventController.java:142)
      	at org.jboss.arquillian.container.test.impl.client.ContainerEventController.createBeforeContext(ContainerEventController.java:124)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createTestContext(TestContextHandler.java:89)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createClassContext(TestContextHandler.java:75)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
      	at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
      	at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
      	at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
      	at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.before(EventTestRunnerAdaptor.java:95)
      	at org.jboss.arquillian.testng.Arquillian.arquillianBeforeTest(Arquillian.java:130)
      	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:178)
      	at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
      	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:96)
      	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
      	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
      	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
      	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:113)
      	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
      

      It is caused with this line in PageFragmentEnricher:

      Class declaredClass = Class.forName(i.getGenericType().toString().split(" ")[1]);
      

      I need support for Page Objects declared with generic type.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jhuska Juraj Húska
                Reporter:
                jhuska Juraj Húska
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: