Errors while trying to pass an object from the Cucumber feature

15 views
Skip to first unread message

Fodor Alexandru

unread,
Aug 11, 2016, 5:48:22 AM8/11/16
to Cukes
Hi,

I'm trying to pass an object from the Cucumber feature as below:

Cucumber step:

Then I should be redirected to the "<desiredPage>" page

| username | desiredPage       |
| mhanus | ChangeExpPassword |

Groovy glued step:

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


Reply all
Reply to author
Forward
0 new messages