I'm trying to use capybara+rspec and get this error: Unable to find field "Name" (Capybara::ElementNotFound)
Here is my form:
%h2 Sign up
= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => 'form-vertical' }) do |f|
= f.error_notification
= display_base_errors resource
= f.input :name, :autofocus => true
= f.button :submit, 'Sign up', :class => 'btn-primary'
= render "devise/shared/links"
Here is my user_steps.rb
When /^I sign up with valid user data$/ do
create_visitor
sign_up
end
def create_visitor
@visitor ||= { :name => "Test visitor"}
end
def sign_up
visit '/users/sign_up'
fill_in "Name", :with => @visitor[:name]
click_button "Sign up"
end
What's wrong????
/users/sign_up
to see if you matched the appropriate name or id to your test. If that's right, then I would check to see if there are any obstructions the test might have when reaching/users/sign_up
. – thank_yousave_and_open_page
just after yourfill_in
and you will be able to see what Capybara actually thinks is on the page. – nmottsave_and_open_page
@nmott but should point out that you need the launchy gem in your Gemfile. – SteveTurczyn