cucumber

redirect to a route alias on a form validation error

If I'm on a route alias such as /register and I have a form error and I render :new, is it possible for the path to be /register still? At the moment it is rendering /new I could do a redirect_to register_path but then I would lose the params? It's making the following test fail: Scenario: Try registering with a bad staff number Gi...

Regular expression too big error for cucumber pickle

I am getting below error when i am trying to run my cucumber features. Using the default profile... WARNING: Nokogiri was built against LibXML version 2.7.5, but has dynamically loaded 2.7.6 Strategy is : truncation and ORM is active_record regular expression too big: /^((?:(?:)|(?:(?:a|an|another|the|that) )?(?:(?:(?:(?:first|last|...

Rails 3 server won't start in cucumber environment

I'm trying to start my rails 3 app in the same environment that cucumber uses because this is necessary for a particular test. When I try to start the server via rails server -e cucumber I get this error: /home/james/rails-projs/fact/config/environments/cucumber.rb:7: undefined local variable or method `config' for main:Object (NameErro...

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

Click an edit link in a table with xpath and cucumber

How can I use cucumber to click an edit link in a list of items in a table using xpath? I've got a selector working that returns the link I need, but it's one of many results.... how can I return only 1 result? Here is my cucumber step When /^I click the "([^\"]*)" link for "([^\"]*)"$/ do |link, cell_value| within "//*[.//td[contai...

Specing remember_me feature in rails + restful_authentication

Hi there, I want to run a the following example in cucumber: Scenario: Anonymous user can log in and be remembered Given I am logged in with reminder When I navigate away And I go to the list of cornetas Then I should be logged in But I don't know how to write the "And I navigate away" step. I already tried to "visi...

Cucumber - How configure it to use "--format pretty" as default?

I'm starting learning rails, and having some troubles on configure cucumber to run my bdd tests. What I want is run cucumber features and this translate to cucumber features --format pretty I tried to do this editing the config/cucumber.yml file (on a rails project). Edited the line: default: <%= std_opts %> features r...

How can I test a form that requires the entry of two random characters from a security phrase?

I need to test a two-stage login system which first asks for your email address and password and then presents the user with two select lists containing [a-zA-Z0-9]. The labels beside the drop down's are of the form 'Select character X from your security phrase', where X is a random character index from a known security phrase. I'd rath...

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

Cucumber error under bundler

I've confirmed cucumber tests work fine without bundler, but with bundler it breaks. This is the error I get: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.each (NoMethodError) /home/senthil/rails/othersprograms/nmicho-teambox/vendor/plugins/cucumbe...

Watir and Cucumber unable to run on win xp

I just download an example of cucumber from http://github.com/aslakhellesoy/cucumber/downloads, and install ruby, watir and cucumber. but I dont know how to run it, I cant found any example for windows. thanks, Dani. ...

Webrat select_date selector failure.

Code in steps file: select_date user.date_of_birth, :from => "Date of birth" Selector fail When I register with valid user credentials # features/step_definitions/authentication_steps.rb:2 Could not find field: "user_date_of_birth_1i_1i" (Webrat::NotFoundError) ./features/step_definitions/authentication_steps.rb:9:in `/^I regis...

Getting spree cart to play nicely with rspec & cucumber

Just setting up spree and wondering how best to setup the project so I can use cucumber and rspec. Thanks evolve ...

Getting HTTP 406 when trying to test facebooker application with cucumber

I am trying to test facebook api calls with cucumber. Here is the code. # app/controller/facebook_users_controller.rb class FacebookUsersController < ApplicationController def create fb_user = facebook_session.user user = User.new(:facebook_uid => fb_user.uid, :facebook_session_key => facebook_session.session_key respond...

Cucumber : Size of features

Im new to testing with cucumber and have a question regarding the size of a 'Feature'. Assume you can add a collection of items to a list and do the usual CRUD , is it preferred to create one feature for this complete set of CRUD actions or a feature for each? What is the preferred/accepted method ? At what point does an action become...

In Ruby, using Cucumber, should I mock out calls to a webservice?

All, I'm using Cucumber for acceptance testing a Ruby command line utility. This utility pulls data in from a webservice. I understand Cucumber is for acceptance testing and tests the whole stack but I still need to provide consistant replies from the webservice. Should I mock the webservice? If yes, how? What's the best approach here...

What happens when you click a button using WebRat under cucumber

I am trying to login to a Java web application. The login page has the following html : <html> <head><title>Login Page</title></head> <body onload='document.f.j_username.focus();'> <h3>Login with Username and Password</h3> <form name='f' action='/ui/j_spring_security_check' method='POST'> <table> ...

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