I've found the solution!
I followed Richard suggestion and it worked except for one thing: I
didn't have an instance of Browser driven to my localhost site. So
instead of creating an Object instance, I created a Browser instance
and mixed the Searcher methods into Browser, like this:
import geb.Browser
import org.openqa.selenium.firefox.FirefoxDriver
this.metaClass.mixin(cuke4duke.GroovyDsl)
class Searcher {
def lookFor(what, where) {
go('/')
$('form')[0].looking_for = what
$('form')[0].location = where
$('input', value: "Search")[0].click()
}
}
World() {
def world = new Browser("
http://localhost:8080/myApp")
world.metaClass.mixin Searcher
return world // added return for clarifcation
}
Anyway, I think my problem is about grouping concepts in the same step
definition files.
The concept of looking for someone once or searching 11 times is
essentially the same concept but written in a different way.
I am inclined to put both steps in the same file "search_steps".
This makes me think that it might be a good idea to write step
definition files corresponding to feature files. It's better to wrap
them in concepts. This can fix the problem of having "common step"
files.
Let me know your thoughts.
Cheers,
Alex
On Apr 12, 10:47 pm, Alejandro Cuesta <
alejandro.cue...@gmail.com>
wrote: