webrat

Rails + cucumber + webrat + selnium : Periodic error on first scenario in feature

I have setup cucumber+webrat+selenium to test my rails app. This works well locally, and works about 50% of the time on my build (CI) server. The other 50% of the time, the first scenario in each feature fails with this error: Failed to start new browser session, shutdown browser and clear all session data Back trace starts with: or...

Undefined webrat methods in cucumber step_definitions

Hi there, When i run my features i get this error: undefined method `visit' for #<Cucumber::Rails::World:0x81b17ac0> (NoMethodError) This is the relevant part of my Gemfile. group :development, :test do gem "rspec-rails", ">= 2.0.0.beta.19" gem "cucumber" gem "cucumber-rails", ">= 0.3.2" gem 'webrat', ">= 0.7.2.beta.1" end ...

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 check that the unselected options are present? And how do I check the number of options avail...

How can I test streamed data with Webrat?

I have code for streaming a CSV similar to the following in a controller: def download filename = 'data.csv' headers.merge!( 'Content-Type' => 'text/csv', 'Content-Disposition' => "attachment; filename=\"#{filename}\"", 'Content-Transfer-Encoding' => 'binary') render :status => 200, :text => Proc.new { |response, outp...

Cucumber/Webrat not following the redirect_to

I am running rails 3.0.0, rspec-rails 2.0.0.beta.20, webrat 0.7.2.beta.1, cucumber-rails 0.3.2 I have this scenario: Scenario: Given I am on the new account page And I fill in "Name" with "John Doe" When I press "Create" Then I should be on the access page When I run it I get: expected: "/access", got: "/accounts" Like its ...

Cucumber & webrat, selecting from a radio button list

I'm trying to get webrat to select a radio button from a list, using cucumber. I have this scenario: Scenario: Update an existing article Given I have an article with title Big Bananas and body text Big yellow bananas are good for you And I am on the list of articles When I choose "Big Bananas" And press "Update article...

webrat + nokogiri + css selectors + whitespaces = Nightmare

I need to test with Cucumber/Webrat the presence of this button: <%=submit_tag 'Get it'%> But when I use this custom step: And I should see a button with a value of "Get it" that is: Then /^I should see a button with a value of "([^\"]*)"$/ do |value| response.should have_selector("form input[value=#{value}]") end I get: ...

Cannot click a submit button with webrat

Hi, using Ruby and webrat, I've got difficulties to click the OK button in the following HTML form : <form name="frmLogin" id="frmLogin" action="logininstit.do" method="post" validation="N" onkeydown="performDefaultButton(event, this, 'valider', false);" onkeypress="performDefaultButton(event, this, 'valider', true);" onsubmit="return ...

Routes are not available in RSpec integration test

I am following the examples in the Rails Tutorial website and I'm having issues getting the integration tests to work. Specifically the example at listing 8.20 in section 8.4.2 in the tutorial. At the visit signup_path line of code below I get the following error: "undefined local variable or method `signup_path'" require 'spec_helper'...

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 running. Our Cucumber looks similar to this: Given I start my long running task And I navigate to...

How do I test DelayedJob with Cucumber?

We use DelayedJob to run some of our long running processes and would like to test with Cucumber/Webrat. Currently, we are calling Delayed::Job.work_off in a Ruby thread to get work done in the background, but are looking for a more robust solution What is the best approach for this? Thanks. ...

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

Hello, 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 : visit my_path, method => :delete) On my pages I delete some links so the soluti...

Using rspec with Webrat instead of Capybara

Hello everyone, I have been using rspec with webrat and decided to add cucumber for high level tests. After installing cucumber with capybara, for some reason rspec also switched to using it. Is there a way to tell rspec to continue using webrat ? ...

How to click button outside the form?

As it stays in documentation for click_button: "Verifies that a submit button exists for the form, then submits the form, follows any redirects, and verifies the final page was successful." But how can I click a button outside the form? ...

Matching input tag with Cucumber/Webrat

I'm learning Cucumber, but I can't make a step for just matching input tags. What I have in the view is <input type="submit" value="Press!" /> And what I tried in Cucumber are Then the "input" field should contain "Press!" Then the "type" field should contain "submit" I just wanna confirm the existence for the input tags with cert...