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/myApachehttps://mycompany/myApache:1000https://mycompany/myApache:2000https://mycompany/myAppServer:1111https://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