webrat

assert_response doesn't work with webrat in selenium mode

Anyone know how to get assert_response to work with webrat using selenium? I keep getting NoMethodError: undefined method `response_code' for nil:NilClass Here's my test: def test_basic_page_load visit root_path click_link "register" assert_response 200 end Here's the error: ==> Waiting for Selenium RC server on port 4444.....

Ruby assertions and disabled inputs

Does anyone know how to assert that a checkbox or input is disabled? I can't find anything to indicated that this is supported I'm writing cucumber tests with webrat and test/unit. I'd like to have a step that is able to assert_disabled :some_checkbox || assert_disabled :some_input. Or some way that I can check a property of the che...

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 Child < ActiveRecord::Base belongs_to :parent end and I have the following Cucumber feat...

webrat, rspec, nokogiri segfault

I'm getting a segfault in nokogiri (1.4.1) run (under cucumber 0.6.1/webrat 0.7.0/rspec 1.3.x) response.should have_selector("div", :class => "fieldWithErrors") and the div in the page is actually <div class="fieldWithErrors validation_error"> stuff </div> Everything runs fine if I just test nokogiri against a test document >> req...

How rspec works with rails3 for integration-tests?

What I'm trying to ahieve is to do integration tests with webrat in rails3 like Yehuda does with test-unit in http://pivotallabs.com/talks/76-extending-rails-3 minute 34. an example: describe SomeApp it "should show the index page" visit "/" body.should =~ /hello world/ end end Does someone knows a way to do it? ...

rails image_submit_tag with cucumber/webrat

I've the following search form with image_submit_tag instead of submit_tag. Now I get the obvious fail when cucumber runs: When I fill in "q" with "sachin" # features/step_definitions/web_steps.rb:33 And I press "submit" # features/s...

Rails/Cucumber/Webrat: redirect_to, flash[:notice] not working

Hello, I'm new to Cucumber and have been stepping through a railscast by Ryan Bates. http://railscasts.com/episodes/155-beginning-with-cucumber Unfortunately my scenario is failing where the railscast passes. Specifically it is failing on the step: Then I should see "New Article Created." I suspect it may have something to do with t...

WebRat+Selenium WebDriver: wait for ajax to be completed

We are running Webrat with Selenium2.0 aka WebDriver in our application. WebDriver handles page reloading very well and do not start next steps if the browser is reloading entire page. The problem is that this mechanism doesn't work with Ajax requests. WebDriver doesn't do any idle when there some after click() or change(). Can anyone ...

Can webrat browser-automation tests be parallelised?

Is there a facility similar to SeleniumGrid that I can use to run webrat (or other, similar framework) browser automation tests in parallel across a farm of coordinated agents? Coordinated via TeamCity with rake? Edit: We're looking at using cucumber+webrat to do functional and acceptance testing as described in Testing ASP.NET Web App...

Testing HABTM associations with rails/cucumber.

How am I supposed to test the typical User <-habtm-> Groups story. My Users and groups are created with factory_girl, it means I don't know the group id so I cannot ask webrat to check the checkbox. Thank you for any webrat steps hints ...

How can I check with cucumber & webrat & selenium that a selector/tag exists exactly two times in a response?

I used following step-definition with cucumber and webrat and everything worked fine: Then /^I should see "([^\"]*)" worker in the workerlist/ do |number| response.should have_selector("td.worker_name", :count=>number) end I have moved now to selenium and "somehow" the have_selector doesn't take a :count parameter anymore. I get fo...

Cucumber and WebRat in Selenium mode: Can't start mongrel_rails when using gem bundle

I'm using gem bundler (v.0.9.6) and Rails 2.3.5, rubygems 1.3.6 and ruby 1.8.7 (On Snow Leopard). My Gemfile looks like this: source :rubyforge source "http://gems.github.com" gem "rails", "2.3.5" gem "ruby-debug" gem "activemerchant", :require => 'active_merchant' gem "hpricot" gem "nokogiri" gem "state_machine" gem "fastercsv" gem "y...

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 with some stuff that is on every page and for some text it works and for other text it do...

Record id with cucumber and pickle [Rails]

I am using Cucumber, Webrat, and Pickle in conjunction. When I write a scenario, I can do something like this: Given a product exists with title: "Bread" When I go to the edit page for that product And I fill in "Title" with "Milk" And I press "Save changes" Then I should see "Successfully edited product." And I should be on that car's ...

Running Webrat with Selenium

I set up Cucumber+Webrat+Selenium according to this article. Whenever I run my server, though, I keep getting: ERROR Server Exception: sessionId should not be null; has this session been started yet? (Selenium::CommandError) Two hours on Google haven't done much for me. Could you please help out? Thanks! I am working on Ruby 1.8.7 and R...

Rails form.text_field getting undefined method while rendering view

Hi there I'm trying to run the following code: <% form_for :user, :url => {:action => :welcome} do |f| %> <table> <tr> <td align="right"><%= f.label :name %></td> <td><%= f.text_field :name %></td> But I'm getting "undefined method" when I try to run it using cucumber/webrat, while rendering the page. Running on the web brow...

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 here. However, because I'm using Webrat and not Selenium, everything has to go through the We...

Logging in with webrat, celerity doesn't recognize that.

I'm using cucumber with webrat, and I am just starting to integrate culerity/celerity. My webrat login steps have been working great, and I have them as a Background for many of my scenarios. The problem is that although I can log in successfully via webrat, my celerity specific step definitions don't seem to recognize that. I can check ...

Webrat says it can't find some text, but the text is actually there

I have a webpage that has a form button on it called "delete", and a cuke scenario that has the line: And I should see "delete" When I run the scenario, I get this error: expected the following element's content to include "delete" ...and it dumps the webrat page to stdout and the "delete" is, in fact, not there. So far so good. Ho...

selenium cannot find element with class in IE

I'm using selenium_client with cucumber, webrat + IE As you'd expect, Firefox works fine. I've tried the following: selenium.is_visible("css=#flash .flash_notice") selenium.is_visible("xpath=//*[@id='flash']/*[@class='flash_notice]") selenium.is_visible("xpath=//*[@id='flash']/*[contains(@class,'flash_notice]')") both cannot find the ...