I am performing a simple GUI test using Geb/Spock and Selenium.
My Spec :
class MySpecSpec extends LoggedInSpec {
def "My criteria here"() {
given: "Starting at the unit search entry page"
to MyHomePage
when:
def result = statusSelection("DEALER_STOCK")
then: "The status selection should be set to dealer stock"
result
}}
And My Page Object:
class MyHomePage extends MyContextPage {
@Override
String getPageUrl() {
return super.getPageUrl() + "/unt/overviewMenu.html"
}
//check if csv button exist
static at = { $('.buttons-csv').text() != '' }
static content = {
statusSelection { value -> $("select[id=searchSelection] option[value='${value}']") }
filterButton(to: UnitSearchHomePage) { $('a[id=searchMy]') }
resetButton { $('a[id=resetStock]') }
addUnitToStockButton { $('a[id=addUnitBtn]') }
}}
When I run MySpec,using driver = {new HtmlUnitDriver(javascriptEnabled: true)}
I get
geb.error.RequiredPageContentNotPresent: The required page content 'model.unt.MyHomePage -> statusSelection(DEALER_STOCK): geb.navigator.EmptyNavigator' is not present
Although using firefox driver works fine. driver = { new FirefoxDriver() }
Below is the pom.xml excerpt for versions:
<gebVersion>1.0</gebVersion>
<seleniumVersion>2.53.1</seleniumVersion>
<seleniumHtmlUnitVersion>2.52.0</seleniumHtmlUnitVersion>
<org.codehaus.groovy-all.version>2.4.3</org.codehaus.groovy-all.version>
<org.codehaus.gmaven.version>1.5</org.codehaus.gmaven.version>
Thanks in advance.