Hi Torsten,

You should have a look at the Making Requests section of the manual (
http://www.gebish.org/manual/current/#making-requests) to understand what
base url is and how relative and absolute urls are resolved in GEB.

>From the example you posted I would expect that you're getting an exception
telling you that baseUrl has been requested but has not been set. Or you
set a baseUrl in the GebConfig.groovy file without telling us. Anyway,
given that your PayaraAdminPage has a relative url then you should be
setting the baseUrl property of browser to the result of adminInstanceURL()
and then navigating to that page:

given:
baseUrl = adminInstanceURL()

when:
to PayaraAdminPage

then:
at PayaraAdminPage


Cheers,
Marcin

On Mon, Jun 27, 2016 at 10:57 AM, Torsten Reinhard <[email protected]
> wrote:

> Hi,
>
> I´m trying to use Geb for automated infrastructure tests in multiple
> environments - and later on for regression tests.
> My Infrastructure has some Apache´s and Application Servers which are
> connected, each with a different baseURL:
>
> // DEV environment for example
> ..
> https://mycompany/myApache
> https://mycompany/myApache:1000
> https://mycompany/myApache:2000
> https://mycompany/myAppServer:1111
> https://mycompany/myAppServer:2222
> ....
>
> I´m executing all *Spec tests from Maven (3.3.3) , using the
> PhantomJsDriver (2.1.1), setup with the phantomjs-maven-plugin.
>
> For testing the global setup (proxy, network, ....) I´ve also created a
> simple InternetAccessSpec:
>
> class GoogleHomePage extends Page {
>   static url = "http://www.google.com";
>
>   static at = { title == "Google" }
> }
>
> class InternetAccessSpec extends GebReportingSpec {
>
>   def internetURLReachable() {
>
>     when:
>     browser.to GoogleHomePage
>
>     then:
>     browser.page.verifyAt()
>   }
> }
>
> This spec is running fine, but the next Specs - running on different
> baseUrls - are all failing - changing the baseUrl seems not to work:
>
> class PayaraAdminPage extends Page {
>   static url = "index.html"
>   static at = { title == "Login" }
> }
>
> class PayaraSpec extends GebReportingSpec {
>
>   def @Shared GPathResult adminServer
>
>   def setupSpec() {
>     ..
>     adminServer = readFromJSon()
>   }
>
>   def String adminInstanceURL() {
>     String hostname = adminServer.hostname
>     String port = adminServer.port
>
>     return "https://${hostname}:${port}/";
>   }
>
>   /**
>    * Test Login Page shows up.
>    */
>   def "admin console available"() {
>     given:
>     browser.go adminInstanceURL()
>
>     when:
>     browser.to PayaraAdminPage
>
>     then:
>     browser.page.verifyAt()
>   }
>
>   /**
>    * Test *'server running' is displayed
>    */
>   @Unroll
>   def "server running at #baseUrl"(String baseUrl) {
>
>     given:
>     browser.go baseUrl
>
>     when:
>     browser.to PayaraPage
>
>     then:
>     browser.page.verifyAt()
>
>     where:
>     baseUrl << myData.collect { "https://
> ${it.hostname.text()}:${it.sslport.text()}/" }
>   }
> }
>
> In the screenshots created by GebReportingSpec i still see "Google"
> displayed in the browser.
>
> What am I doing wrong here ?
>
> As far as I understood the docs, setting the baseUrl is possible at
> startup (GebConfig), as well as in the prepartion of a GebSpec.
>
> Thanx for any advice,
>
> Torsten
>
> --
> You received this message because you are subscribed to the Google Groups
> "Geb User Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/geb-user/d9a1bf89-f095-4034-aa54-6aff120e3993%40googlegroups.com
> <https://groups.google.com/d/msgid/geb-user/d9a1bf89-f095-4034-aa54-6aff120e3993%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Geb 
User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/geb-user/CA%2B52dQRFcET9r3XWwstzaZLhG9cZHwWCrbFzZiXkzeL8tLPz%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to