Is it possible to use navigators in Spock's where block? What I am trying to accomplish is to use one Unroll method to perform a test but the only thing that will change on the tests is the input field. Whenever I try to run the test I get a NullPointerException. Something like this.
@Unroll
def "#field character limit"(){
given:
page = at ApplicantInformationPage
when:
input << text
then:
input.size() == limit
where:
field | text | limit | input
"first name" | exceeds256limit | 256 | page.firstNameField
"phone" | exceeds10limit | 10 | page.phoneNumberField
"zip" | exceeds5limit | 5 | page.zipcodeField
Error I am getting:
java.lang.NullPointerException: Cannot get property 'firstNameField' on null object
at geb.tests.ApplicantInformationPageTest.#field character limit(ApplicantInformationPageTest.groovy)
Can anyone enlighten me as to what I may be doing wrong?