views:

3666

answers:

3

I am trying to learn how to best use Cucumber + Selenium. For the most part it seems to be very straight forward but I would like to get some guidance on how to test dialogs. Basically I need to implement: assert !60.times{ break if ("Other Income" == @selenium.get_text("//form[@id='new_account']/h3") rescue false); sleep 1 }

A standard wait for form. How do I accomplish this in a Cucumber spec?

+1  A: 

Look at http://wiki.github.com/aslakhellesoy/cucumber/setting-up-selenium for a pretty thorough walkthrough, plus the examples which come with Cucumber (native examples and selenium through webrat).

Matt Patterson
+1  A: 

This guide is out of date, a fix is upcoming but in the meantime you do not need the Selenium gem. Also, you must use selenium-client -v=1.2.14. You do not need to overwrite any jars. Make sure all selenium processes are stopped and the correct versions are installed and it should run. The information about multiple environments for selenium/non-selenium tests is still valid and useful.

kostia
A: 

To update this answer a bit, I'd highly reccomend using Capybara:

http://github.com/jnicklas/capybara

Being able to use javascript is just a gem install away!

Steve Klabnik
Much agreed. Days of fighting with Selenium RC (1.0) versus instant-on with Capybara (Selenium 2.0).
Rob S.