Manual test works Cucumber test fails

I am using Cucumber, Capybara and Selenium

If I test User Signup using the browser it works fine.

When I run the automated test it Fails "Age certification must be
The Checkbox for "Age certification..." is properly selected during
the test
however the test still fails.

Feature: Signup
  In order to use this sites cool functionality
  As a user
  I want to be able to sign up

  Scenario: Signing up
    Given I am on the home page
    When I follow "Signup"
    And I choose "Developer"
    And I fill in "username" with "testuser"
    And I fill in "Email" with ""
    And I fill in "Password" with "password"
    And I fill in "Password confirmation" with "password"
    And I check "I am over the age of 13"
    And I press "Signup"
    Then I should see "signed up successfully"

<%= simple_form_for(resource, :as => resource_name, :url =>
registration_path(resource_name)) do |f| %>
          <%= devise_error_messages! %>

            <%= f.association :role, :collection =>
Role.find(2,3), :label => "Choose a Role", :as => :radio %>
            <%= f.input :name, :label => "username" %>
            <%= f.input :email, :placeholder =>
'', :required => true %>
            <%= f.input :password, :required => true %>
            <%= f.input :password_confirmation, :required =>
true, :hint =>'confirmation must match the password' %>
            <%= f.input :age_certification, :label => "I am over the
age of 13", :as => :boolean %>
            <%= f.button :submit, "Signup" %>
        <% end %>

I have also been struggling with inconsistent test results with capybara and the selenium JavaScript driver with rspec. After checking github capybara/ issues it would appear that there is a bug in the selenium driver that can cause race conditions and inconsistent test results, there are some suggested monkey patches detailed on github if you browse the issues thread.

My solution was to switch to using capybara-webkit driver for JavaScript testing. Which resulted in faster JavaScript testing and consistent results.

Hope the above info is useful as I wasted a lot of time trying to debug this.


David Krett

hi i read your post seems you are already working on Selenium. can you help me what exactly selenium does or can you send me any link to learn selenium and how does it works. plz…

Thanks in advance