Topic: BDD novice

I recently read "The Rspec Book". But in it described Webrat.

Internet says me that capybara better then webrat in BDD because it accepts cookies and js testings better. But I have some questions about capybara:

1) How I can check user cookies? I.E. I write a step Given /^I am guest$/ and how I can check that's user haven't cookies from my site?
2) Where is Selenium documentation, that can novice understands?
3) Why I need selenium? Why Capybara creaters can't insert js implementation in they gem?

Regards, Alex

Last edited by awhiteland (2011-11-21 12:39:52)

Re: BDD novice

So, I solved the issue, but have now:

I have a cucumber + capybara.

My step definition is:

When /^puts signup info$/ do
  page.fill_in :username, :with => "frankpopp"
  page.fill_in :first, :with => "Frank"
  page.fill_in :second, :with => "Popp"
  page.fill_in :password, :with => "123456"
  page.fill_in :password_confirmation, :with => "123456"
  page.click_button "Sign up!"
end

My views/users/new is:

<%= form_for(@user) do |f| %>
<%= f.text_field :username %>
<%= f.text_field :first %>
<%= f.text_field :second %>
<%= f.password_field :password %>
<%= f.password_field :password_confirmation %>
<%= f.submit "Sign up!" %>
<% end %>

But I catch exception:

And puts signup info            # features/step_definitions/users/add_user.rb:9
      cannot fill in, no text field, text area or password field with id, name, or label 'username' found (Capybara::ElementNotFound)
      (eval):2:in `fill_in'
      ./features/step_definitions/users/add_user.rb:10:in `/^puts signup info$/'
      features/users/add_user.feature:11:in `And puts signup info'

Re: BDD novice

Problem was solved, I puts fill_in "user_username", but I think there is more convenient way. Which?