Then(~'I should be redirected to the "([^"].*)" page'){ String desiredPage ->
//assert driver.currentUrl == ChangeExpPassword.url
at desiredPage
}
Geb page:
class ChangeExpPassword extends Page{
static url = environment + "something.php"
static at = { customFind("input[name='ChangePass']")}
static content = {
//Add old/new password and Login
oldPass { customFind("input[name='oldpass']").value('oldPassword') }
newPass { customFind("input[name='newpass1']").value('newpassowrd#') }
confirmPass { customFind("input[name='newpass2']").value('confirmpassword') }
changePassButton { $('input', type: 'submit') }
wrongUserPass { $("div.error").text()}
}
If I let the desiredPage as a String in the Groovy step I get: No signature of method: com.payu.test.pages.gap.AdminPage$__clinit__closure1.customFind() is applicable for argument types: (java.lang.String) values: [input[name='Login']]
If I change the Groovy to:
Then(~'I should be redirected to the "([^"].*)" page'){ Page desiredPage ->
//assert driver.currentUrl == ChangeExpPassword.url
at desiredPage
}
I will get the error: cucumber.runtime.CucumberException: Don't know how to convert "ChangeExpPassword" into com.payu.test.pages.Page.
Thanks,
Alex