webrat

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. Obviously I can't test Amazon, so I want to check that the redirection to Amazon happens...

How to handle cookies when testing with Webrat?

Hi! I'm writing Cucumber tests for a Sinatra based application using Webrat. For some tests I need to implement a scenario like Given I am logged in as admin When I am visiting "/" Then I should see "Settings" I define steps like this: Given /^I am logged in as "(.+)"$/ do |user| visit "/login" fill_in "login", :with => user...

Installing hpricot for JRuby

I'm trying to look at cucumber for Jruby on Rails. One of the pre-requesites is webrat which has as pre-requisite hpricot. I've installed the gem with hpricot using: gem install hpricot --source http://code.whytheluckystiff.net --version 0.6.1 --platform java This installs the java version of hpricot. I add the hpricot_scan.jar to the...

Rails: Integration testing thinking_sphinx with cucumber and webrat - how do I index transactional fixtures?

I'd like to have some Cucumber/webrat integration tests of my search features that use thinking_sphinx & sphinx but the problem is that the data is loaded and then rolled back in a transaction during a typical cucumber test so there is no way for thinking_sphinx to index it. Alternatively, is there a way to turn transactions off for jus...

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. ...

Rails, RSpec and Webrat: Expected output matches rendered output but still getting error in view spec

Hello all, I've just gotten started using BDD with RSpec/Cucumber/Webrat and Rails and I've run into some frustration trying to get my view spec to pass. First of all, I am running Ruby 1.9.1p129 with Rails 2.3.2, RSpec and RSpec-Rails 1.2.6, Cucumber 0.3.11, and Webrat 0.4.4. Here is the code relevant to my question config/routes.rb...

ActiveRecord dependency with Ruby, Rails, Cucumber, & RSpec

We are writing a Rails application that is using CouchDB as its data store. We're BDD/TDD'ing with RSpec and Cucumber, which is using WebRat for webpage testing I'm trying to remove ActiveRecord as one of the resources that is being loaded by rails but its causing the cucumber tests to fail. I've removed all references that I can find...

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. ...

RoutingError problems with Webrat

I'm currently rewriting a website in Rails. I've written a model that maps the old static URLs to the new ones and in the application controller I'm trapping RoutingErrors to call a method that looks for a new URL that maps to the old one. This works perfectly well in the applicaion itself; if I visit http://localhost:3000/home.htm it wi...

Regular expressions in cucumber steps

Cucumber generates out some neat webrat regex steps. I encountered a problem when I tried the this. In feature: And I fill in "Telephone (Home)" with "61234567" In webrat steps: When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value| fill_in(field, :with => value) end The error encountered: Could not find field: "Telep...

Can't build gem -- native extension build fails -- can you see why?

I can't figure out what is going wrong here -- any ideas?? I'm running on a Ubuntu 8.04 LTS, and have installed libxml2 and libxslt from these instructions: http://www.techsww.com/tutorials/libraries/libxml/installation/installing_libxml_on_ubuntu_linux.php http://www.techsww.com/tutorials/libraries/libxslt/installation/installing_lib...

File uploads using the selenium-client gem

I am using the selenium-client gem with Webrat and Cucumber to test a rails project. I have Cucumber set up pretty much as described here: http://wiki.github.com/aslakhellesoy/cucumber/setting-up-selenium My problem is that Selenium is prevented from performing file uploads. Ideally I'd like to be able to replicate webrat's 'attach_file...

Cucumber and/or Webrat hates  ?

I have a cucumber step that recently started failing when an   was added to my layout. If I take the   out, my tests all pass. When I put it back in, every test that uses the click_link method supplied by WebRat fails with the following message: And he follows 'Unsubscribe' incompatible encoding regexp match (UTF-8 regexp ...

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 regular user. My problem here is that I am storing the account ID which is created in the f...

How to test AJAX request with Merb and Webrat?

I am using merb with rspec and webrat. How to ensure that rjs template was successfully rendered? I cannot just write have_xpath because of ajax. ...

cucumber + webrat: checking text appearing twice

I am working on a rails app to self teach BDD and testing in general. Using cucumber + webrat + rspec, after railcasts video tuts. In this app a quiz has_many questions. The view I am testing should render the question twice and non contiguously. (not testing contiguity here) I have a cucumber scenario aimed at checking this Given quiz...

How do I get webrat / selenium to "wait for" the CSS of the page to load?

When I use webrat in selenium mode, visit returns quickly, as expected. No prob. I am trying to assert that my styles get applied correctly (by looking at background images on different elements). I am able to get this information via JS, but it seems like the stylesheets have not loaded and/or gotten applied during my test. I see that...

Cucumber + Webrat + Selenium guide

Hello, I have been using Cucumber and Webrat for a while. I know 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 installing and configuring selenium+webrat+cucumber? I would like to be able to mix javas...

How to mock/stub a model in Cucumber tests

The scenario is as follows. My Order model has an after_create that contacts a remote payment gateway to retrieve a payment URL. In my Cucumber tests I don't want to perform this action, but return an arbitrary URL. My current cucumber tests looks like this: Given there is a product "Product X" When I enter my credentials And I cl...

How to create integration level test for two user interaction?

How would you test multi user interaction with Cucumber/webrat? Meaning that there must be more than one user logged in. Good example would be simple chat application, where I want to send message from one user to another and check if the other user received the message. I'd like to test at integration level, without any stubbing or m...