capybara

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

Where to find documentation for Capybara? [Rails]

I am working with Cucumber and Capybara and am looking to test a basic javascript confirmation box. I am aware Capybara uses Selenium 2.0 (not RC) for its javascript testing. Where can I find the documentation for testing a simple confirm js dialog and other features of capybara + selenium? Thanks! ...

How to test a confirm dialog with Cucumber?

I am using Ruby on Rails with Cucumber and Capybara. How would I go about testing a simple confirm command ("Are you sure?")? Also, where could I find further documentation on this issue? Thank you! ...

Cucumber Record ID

Given the following in Cucumber: Given a car exists with title: "Toyota" And I go to path "/cars" And I follow "Toyota Page" And I should be on path "/cars/CAR_ID" Where CAR_ID is the ID of the car titled "Toyota". How do I figure out that ID? Thanks! ...

Testing for javascript alerts with Capybara

I'm using Cumcumber + capybara + selenium to run automated testing, but I'm having trouble finding a way to assert that a javascript alert is displayed. This question seems has a solution with selenium, but I can't figure out how to call the selenium object using Capybara. Is there a simple way to test for alerts using Capybara? Or i...

Cucumber, capybara and selenium - Submiting a form without a button

I have a test using Cucumber, capybara and selenium driver. This test should go to a form and submit it. The normal text would be Scenario: Fill form Given I am on the Form page When I fill in "field1" with "value1" And I fill in "field2" with "value2" And I press "OK" Then I should see "Form submited" The probl...

capybara selenium and JavaScript Destroy

I am using rails 2.3.5 and this is what I did. I have latest cucumber, cucumber-rails and capybara installed. rails demo cd demo ruby script/generate cucumber --rspec --capybara ruby script/generate feature post title:string body:text published:boolean ruby script/generate scaffold post title:string body:text published:boolean rake db:m...

How do I test an image alt value using capybara?

I'm trying to define a step to test the value of alt text of an image using capybara and the css selectors. I wrote one for input values based on the readme examples: Then /^I should see a value of "([^\"])" within the "([^\"])" input$/ do |input_value, input_id| element_value = locate("input##{input_id}").value element_value.s...

Alternative for assigns() in Cucumber with Capybara?

I'm trying out capybara with cucumber to get some better javascript test coverage. I have a lot of steps that check or use things from the Rails integration test helpers, for instance: assigns(:current_user).should_not be_nil No matter how I call assigns, even if I say something like p assigns it errors with: undefined method `templa...

cucumber, capybara & selenium works randomly

Setup with cucumber, capybara and selenium but some scenarios works only randomly. Running ruby 1.8.6 on rvm rails 2.3.8 selenium pops open firefox 3.6 I have tried to add this with no luck: with_scope(selector) do click_button(button) selenium.wait_for_page_to_load end The error output is sometimes: > Given I am logged in an...

How to assert on number of html table rows in ruby using capybara + cucumber

I am trying to get to grips with BDD web development in Ruby using cucumber + capybara and I am stuck at what should be an easy task - just to check the number of rows in a table. The intention of what I'm trying to achieve is something along the lines of: page.should have_xpath("//table[@id='myTable']") find("//table[@id='myTable']/tr"...

How do I mock an IP address in cucumber/capybara?

I'm using Cucumber and Capybara and I'd like a way to simulate the request IP address, like this: Given the request ip address is "10.1.2.3" ...

Using custom Selenium server on capybara

I'm trying to use capybara and Selenium but with custom server for Selenium, for example I want to route the server to saucelabs.com, is anyone here are have try it before? Thanks b4 ...

Is it possible to test Java application with Capybara?

Hi I like the overall idea of Capybara, but i can't run it against the Java application for some reason. Is that possible at all? Thank you ...

Login using headers in cucumber

I'm new at cucumber and capybara so maybe this is easy. I'm using headers to check if a user is logged in or not and i'm having a problem when doing cucumber testing. I use Capybara and Cucumber and a "add headers hack": http://aflatter.de/2010/06/testing-headers-and-ssl-with-cucumber-and-capybara/ The problem I have is that it only ...

Cucumber, Capybara validating HTML and testing JavaScript together fails

I've recently added html validation to my cucumber features. I'm using the gem be_valid_asset which works really well until Cucumber hits a @javascript flagged feature. This kicks in culerity (I've tried selenium for this as well) and then the html validation fails. The reason the validation fails is that both culerity and selenium ap...

How to follow a redirect after click_link/button with cucumber and capybara in rails?

I'm currently trying to set up integration/acceptance testing for a new rails 3 application with cucumber and capybara. (I initially planed to use webrat, but it seems that it does not support rails 3, so I ended up with capybara) I'm trying to get a basic login test working: Feature: Login user In order to access the non-public part...

Rails Cucumber access to controller variables

Hi, I've a controller that defines the @projects variables to be displayed in the view. There is any way to access to that projects in the cucumber step? Note that this variables contains the paginated results, the idea is to test if the values are being displayed in the page. I've tried to access the variable through assigns and cont...

Error at the end of a capybara autotest... every time...

With autospec / cucumber / capybara running my feature tests I get this line even after going green: (eval):1:in `initialize': can't convert String into Integer (TypeError) Anyone know what this is? I thought it was me, then heard another dev was seeing it to, and when googling I see it in the screen logs on various issues at the capy...

Using Cucumber/Capybara in Rails 3, how do I set a custom User-Agent string?

In my Rails 3 app, I have different layouts for iPhone vs desktop browsers. I'm trying to test the iPhone layout using Cucumber/Capybara. So far, all my attempts at setting an iPhone User-Agent string in the request's HTTP header have failed. I have followed the Testing custom headers and ssl with Cucumber and Capybara tutorial but it d...