Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cucumber + Selenium on javascript apps

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?

like image 830
Rick Martin Avatar asked Feb 06 '09 08:02

Rick Martin


People also ask

Can we use Cucumber with JavaScript?

Cucumber. js is available as an npm module. It works with both Node. js and browsers.

Can I use Selenium with JavaScript?

Selenium is an open-source automation testing tool that supports a number of scripting languages like C#, Java, Perl, Ruby, JavaScript, etc. Depending on the application to be tested, one can choose the script accordingly.

Can we integrate Cucumber with Selenium?

On using Cucumber, you can write your test scripts in multiple languages such as Java, Ruby, . NET, Python, etc. It also integrates with Selenium, Ruby on Rails, Watir and other web-based testing tools. Cucumber is one of the most widely used BDD tools.

Which is better Selenium or Cucumber?

Selenium supports conditional statements but Cucumber does not. Test Scripts are written based on requirements in Selenium but with Cucumber, you start with scenarios first. Selenium scripts are hard to develop whereas Cucumber was easier to develop.


1 Answers

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

http://github.com/jnicklas/capybara

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

like image 178
Steve Klabnik Avatar answered Sep 21 '22 17:09

Steve Klabnik