I have tried that too but did not get it to run, instead I kept going with:
I took the provided selenium example packaged with cucumber, something like this
class YourPage < Selenium::WebPage
def initialize(browser)
@browser = browser
end
def goto(page)
@browser.open page
end
end
Before do
# you need to start the server with:
# $ selenium
# is it slow too start the server everytime?
# server = Selenium::SeleniumServer.new(BuildMaster::Cotta.new, 4444)
# server.start
#TODO move this to some configuration yml?
# if you note you need to change it, please do so
@browser = Selenium::SeleniumDriver.new("localhost", 4444,
"*chrome /usr/lib/firefox-3.0.7/firefox-3.0",
"
http://localhost",
15000)
@browser.start
# you need a server running right?
# $ script/server -e test --port 4000
@host ||= '
http://localhost:4000'
@page = YourPage.new(@browser)
end
After do
@browser.stop
@page.close
# if you started the server here, stop it!
# server.stop
end
then I start my test server and selenium per hand, I know it is possible to start them both inside cucumber hooks but haven tried yet.
also to keep on using my webrat steps I simply construct a response open struct so that asserting steps still work,
def response
OpenStruct.new :body => @page.html
end
also defined fill_in, click and so on...
def visit(path)
@page.goto full_url(path)
end
# selenium have no text locator?
def click_button(button)
@page.button(:id, button).click
end
def click_button_and_wait(button)
@page.button(:id, button).click_wait
end
I know there must be better ways, but this worked for me
hth
joaquin