It is common to write Geb specs directly referencing page elements like:
to LoginPage
loginField << login
passwordField << password
loginButton.click()
But if you try doing same with
Cucumber step files, you will get exception, like:
No such property: loginField for class: steps.Login_steps
groovy.lang.MissingPropertyException: No such property: loginField for class: steps.Login_steps
at steps.Login_steps$_run_closure2.doCall(Login_steps.groovy:42)
at ✽.When user enters login and password(Login.feature:7)
This is because page object is not bound and you should reference it explicitly, like:
to LoginPage
page.loginField << login
page.passwordField << password
page.loginButton.click()