3 Replies Latest reply on Mar 12, 2014 4:44 AM by Juraj Húska

    Graphene. Not valid URI and no contextRoot was discovered to treat it as relative URL

    yersan Newbie

      Hi all,


      I'm in the following environment:

      1. I'm using Graphene to test an already deployed application, so I'm not using @Deployment method in my Test.

      2. I have a Graphene page abstraction annotated with @Location(value="/faces/login.xhtml")



      When I run my test I received the following error trace:


      java.lang.IllegalStateException: The location @org.jboss.arquillian.graphene.page.Location(value=/faces/login.xhtml) is not valid URI and no contextRoot was discovered to treat it as relative URL

          at org.jboss.arquillian.graphene.location.LocationEnricher.getURLFromLocationWithRoot(LocationEnricher.java:110)

          at org.jboss.arquillian.graphene.location.LocationEnricher.getURLFromLocation(LocationEnricher.java:121)

          at org.jboss.arquillian.graphene.location.LocationEnricher.handleLocationOf(LocationEnricher.java:95)

          at org.jboss.arquillian.graphene.location.LocationEnricher.goTo(LocationEnricher.java:80)

          at org.jboss.arquillian.graphene.DefaultGrapheneRuntime.goTo(DefaultGrapheneRuntime.java:125)

          at org.jboss.arquillian.graphene.DefaultGrapheneRuntime.goTo(DefaultGrapheneRuntime.java:120)

          at org.jboss.arquillian.graphene.Graphene.goTo(Graphene.java:291)

          at com.lht.rdri.test.functional.LoginPageTest.before(LoginPageTest.java:62)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)


      I suppose that the error is due to I'm not using @Deployment method and without it, the test is not able to discover what is the contextRoot to append to my current @Location.
      I can change the location to use the full URL: @Location(value="http://my.server.com/myapp/faces/login.xhtml")

      With this change my test run without problems but I don't want a hardcode value since the test will be executed on different environments and the context root could change. Also, I would like to reuse my page abstraction.

      So the questions are:

      1. Is the contextRoot unknown due to I'm not using a @Deployment method?

      2. How can I initialize the contextRoot to do the @Location(value="/faces/login.xhtml") work in this environment?

      3. It is possible use dynamic URLs in the @Location?

      Thank you very much in advance.