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
2
votes
1 answer

My own DSL on top of rspec, cucumber

I'm interested in applying another layer of abstraction on my cucumber webrat BDD suite that knows about the DOM I am working with. Currently I am writing step definitions something like this example: response_body.should have_selector("div", :id =>…
Rimian
  • 36,864
  • 16
  • 117
  • 117
2
votes
2 answers

RoR, RSpec: want to verify that each link on a page can be serviced

I'm beefing up RSpec tests on my RoR app. I'd like a simple way to verify that clicking on each link on a page is properly handled, i.e. generates a recognized route to a controller, and has a method in the controller to service it. I can write…
fearless_fool
  • 33,645
  • 23
  • 135
  • 217
2
votes
0 answers

Select multiple checkboxes for a Cucumber test

Working on a big project using cucumber for our frontend tests. My question about this, that i have a search page with a group of checkboxes, like "select your sites:", with fieldname like "sites[]" When I click "Submit" Cucumber default submits the…
Winfred
  • 21
  • 2
2
votes
4 answers

The have_selector fails in an RSpec test but page renders correctly and the tag is present

I'm working my way through the Rails Tutorial book by Hartl and I'm completely stuck on one of the tests. The test (right from the book) is very simple: require 'spec_helper' describe UsersController do render_views describe "GET 'show'" do …
Steve T
  • 31
  • 1
  • 1
  • 5
2
votes
1 answer

Integration tests with webrat and Rails3

I'm upgrading a Rails 2.3.5 app to Rails 3.0.3. But my integration tests aren't working. I'm getting this error: NoMethodError: undefined method `content_type' for nil:NilClass The line to blame is assert_select "input#artist.title.unsolved", 1 My…
23tux
  • 14,104
  • 15
  • 88
  • 187
2
votes
1 answer

How to check for multiple occurrences of a word using Capybara (or Webrat, I guess) and Cucumber?

I know that /Interface \d/ occurs three times on the page. But I don't know how to test for this with Capybara in Cucumber. Here was my first attempt: Then /^(?:|I )should see \/([^\/]*)\/ (\d+)(?:x|X| times?)?$/ do |regexp, count| regexp =…
chadoh
  • 4,343
  • 6
  • 39
  • 64
2
votes
2 answers

How can i unit test a "Delete link" with Ror, cucumber - webrat?

I am currently developing a Rails application, I'm trying to units test it. I chose Cucumber + WebRater. I'd like to test in my backend all delete link. I tried to go to visit a second argument (the method: delete) without success. (something like :…
GaetanJUVIN
  • 119
  • 3
  • 7
2
votes
1 answer

How do I run Cucumber steps concurrently in Ruby?

In our Cucumber steps, we would like to start a long running task in one step and check that the task is running and that it set up the UI for the task correctly, in another step. Checking the UI must be done while the first step is still…
Sean
  • 1,502
  • 3
  • 12
  • 20
2
votes
1 answer

How do I catch redirections to other domains when testing with Webrat?

In my Rails app, I have a form which redirects through a foreign service, Amazon FPS. The form POSTs to an action in my app which redirects to Amazon, who collect information and then redirect back to my app. I'm testing this workflow with Webrat. …
Peeja
  • 13,683
  • 11
  • 58
  • 77
2
votes
1 answer

Check select box has certain options with Webrat

How do I use Webrat to check that a select box has certain values listed as options? I currently have field_named(field).value.should contain(value) but that only passes for the first selected value and not for the unselected values. How do I…
WheresAlice
  • 188
  • 8
2
votes
1 answer

Using Rails with Webrat + Selenium or only Selenium?

I'm reading The Rspec Book, and in that book they are using Webrat with Selenium. Is it possible to use Selenium directly for integration tests in Rails instead of using it through Webrat? What are the pros and cons with each way?
never_had_a_name
  • 90,630
  • 105
  • 267
  • 383
2
votes
2 answers

How to use Page Object pattern with Cucumber and Webrat / Selenium?

I'm looking at a cucumber test suite that is somewhat brittle right now; many small steps, and no knowledge of the page itself. I'd like to factor out the logic involved in the step definitions inside a series of Selenium PageObjects. As seen…
Will Sargent
  • 4,346
  • 1
  • 31
  • 53
2
votes
1 answer

Webrat Mechanize outside of Rails

I'm trying to use Webrat in a standalone script to automate some web browsing. How do I get the assert_contain method to work? require 'rubygems' require 'webrat' include Webrat::Methods include Webrat::Matchers Webrat.configure do |config| …
ejunker
  • 10,816
  • 11
  • 41
  • 41
2
votes
4 answers

Cucumber Table Diff and colspan

I love cucumber, and its table diff feature. But I, often use a td colspan to display the title of the table. And I can't seem to get the table diff to work when I use colspan. (Table diff expects a 2d array, and the colspan breaks it) Has anyone…
Jonathan
  • 16,077
  • 12
  • 67
  • 106
2
votes
3 answers

Practicing BDD with integration tests -- do I need unit tests too?

At present, my development process flows like this: I describe the expected behaviour as an integration test using using WebRat I write the Ruby on Rails code to provide that behaviour, so passing the test I refactor, ensuring the tests still pass…
steven_noble
  • 4,133
  • 10
  • 44
  • 77