Questions tagged [webrat]

Webrat is an acceptance testing library for Web applications written in Ruby.

Webrat is an acceptance testing tool for Ruby, which simulates a browser without JavaScript support. But it can also be combined with a web automation framework like Watir to implement browser based web automation tests.

183 questions
45
votes
7 answers

How can I see what capybara found in a failing cucumber step?

I started migrating from cucumber + webrat to cucumber + capybara. Now the behavior of "I should see " seems to be somewhat different. Most of these fail now, although I didn't change anything on the page. I replaced the snippet that should be found…
ajmurmann
  • 1,605
  • 3
  • 16
  • 24
37
votes
8 answers

How do you POST to a URL in Capybara?

Just switched from Cucumber+Webrat to Cucumber+Capybara and I am wondering how you can POST content to a URL in Capybara. In Cucumber+Webrat I was able to have a step: When /^I send "([^\"]*)" to "([^\"]*)"$/ do |file, project| proj =…
Clinton
  • 3,638
  • 3
  • 26
  • 33
34
votes
6 answers

HTTP basic auth for Capybara

I'm writing some RSpec tests for my Rails 3 application and trying to switch from Webrat to Capybara. So far so good but the application uses HTTP basic auth to authorize my admin user, any idea how I can test that with Capybara? Here is my current…
Cimm
  • 4,653
  • 8
  • 40
  • 66
17
votes
3 answers

Setting http headers RSpec 2.4 / Rails 3

I am getting started with RSpec. I have a new rails 3 app which uses the HTTP_ACCEPT_HEADER or the request 2 letter subdomain to set the application language and redirect accordingly. I am successfully testing my redirection code using Cucumber. Now…
gdelfino
  • 11,053
  • 6
  • 44
  • 48
16
votes
11 answers

Session variables with Cucumber Stories

I am working on some Cucumber stories for a 'sign up' application which has a number of steps. Rather then writing a Huuuuuuuge story to cover all the steps at once, which would be bad, I'd rather work through each action in the controller like a…
Matthew Savage
  • 3,794
  • 10
  • 43
  • 53
14
votes
5 answers

Cucumber/Webrat: follow link by CSS class?

is it possible to follow a link by it's class name instead of the id, text or title? Given I have (haha, cucumber insider he?) the following html code:
xijo
  • 4,366
  • 4
  • 23
  • 30
12
votes
3 answers

Rspec integration tests without cucumber?

Is there a way to do integration tests with Rspec without using Cucumber? I prefer using just plain old Webrat. Thanks.
gsmendoza
  • 1,394
  • 1
  • 13
  • 31
12
votes
1 answer

Cucumber + Webrat + Selenium guide

I have been using Cucumber and Webrat for a while. I now need to start writing behaviour that involve AJAX interactions so I was thinking to use the Selenium adapter for Webrat. Can anyone point out a easy and updated step-by-step guide for…
soulnafein
  • 1,058
  • 1
  • 10
  • 20
12
votes
8 answers

How can I determine if a radio button is checked already?

I'm using webrat with cucumber and I would like to test if a radio button is checked already when I am on a page. How can I do that ? I didn't find any step in webrat which can do that.
Olivier
11
votes
2 answers

Cucumber and webrat - How to handle dynamic URLs in the paths.rb?

I am using Cucumber for BDD development in my Ruby on Rails project and I'm running into some confusion on how the path.rb handles paths used in rails applications. Given I have: class Parent < ActiveRecord::Base has_many :children end class…
y0mbo
  • 4,582
  • 6
  • 41
  • 45
10
votes
2 answers

Using both webrat and capybara together

I've been using Capybara for integration/request testing, but have only just realised I can't do view testing with it. This SO answer suggests Webrat and Capybara can be used in tandem; but the RSpec docs suggest one must choose between the two. …
Rob d'Apice
  • 2,416
  • 1
  • 19
  • 29
10
votes
3 answers

webrat autofilling form fields

I am learning how to write tests with cucumber/webrat. One of my test scenarios is set to test form validation (leaving field(s) empty). Strangely enough, fields that I do not fill-in with fill_in are set to the field's name attribute. This only…
dmondark
  • 1,677
  • 1
  • 12
  • 19
10
votes
1 answer

How do I check that a form is pre-populated with values using Cucumber and Webrat?

I am learning Cucumber and Webrat with Rails and would like some advice on the best way to test an "edit" form. When I browse to a user's profile I am presented with an edit form with the user's information pre-populated in the form fields. I would…
SingleShot
  • 18,821
  • 13
  • 71
  • 101
9
votes
3 answers

Undefined webrat methods in cucumber step_definitions

When i run my features i get this error: undefined method `visit' for # (NoMethodError) This is the relevant part of my Gemfile. group :development, :test do gem "rspec-rails", ">= 2.0.0.beta.19" gem…
nocksock
  • 5,369
  • 6
  • 38
  • 63
8
votes
4 answers

Webrat and Rails: Using assert_contain after click_button gives me "You are being redirected"

I'm writing an integration test for a rails application using webrat. After filling out a form, the user presses submit and an account is created. click_button "Submit" assert_contain "Your Account Has Been Created" However, the test fails:…
deb
  • 12,326
  • 21
  • 67
  • 86
1
2 3
12 13