Interrupting a cucumber test

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

When you interrupt a cucumber test, usualy by presssing Ctrl+C twice, the database tables are not truncated, so you consequently could have a problem with duplicates records.

Solution

To make sure that the database is clear before running the test again run the following tasks to clear the database and clone it again:

Element is not currently visible and so may not be interacted with (Selenium::WebDriver::Error::ElementNotVisibleError)

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

Trying to run your cucumber tests and interact with links,buttons in a page you have the following error page:

Solution

Try to use the :visible => true in your matchers, finders like:

Firefox 19 and unable to obtain stable firefox connection in 60 seconds

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
You have just upgraded your Firefox to the latest release (currently 19) and when running your javascript cucumber tests you get the following error:

Solution
Add the latest selenium-webdriver to your Gemfile and run bundle update:

javascript runtime gem required for cucumber tests with rails

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

According to the ‘Cucumber book’ the gems required to start using cucumber with a rails application are the following:

On the most recent rails version (currently 3.2.9) the gems need to be updated and also include the javascript runtime gem ‘therubyracer’

Solution

The following gems are working with Rails 3.2.9

You can then run the

command to generate the files and folders necessary for cucumber.

Cucumber step to select auto suggested google map search result

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You have a location search in your application that uses google maps auto suggest, and you want to be able to select the first item, so that it can be used in your cucumber tests.

Solution

You can create a step as in the code below, and put it in one of your cucumber step definitions:

and then you can call this step from any other step in your cucumber tests by:

Cucumber testing and ssl

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

Your application is ussing force_ssl to redirect all calls to ‘https’, but when you try to use your cucumber tests they fail.

Solution

By using the suggestion here, you can add a file in your initializers to bypass the ssl in development and test environment as follows:

Pausing between steps in cucumber

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You want to be able to go through a scenario step by step when you are testing with a browser as sometimes can be very fast.

 

Solution

By following the suggestion here you would only need to add the following to your features/support/hooks.rb file

and then you should be able to use it in your scenario by adding the @pause tag.
Then you would have to press continue in your terminal to go step by step

Cucumber – Carrierwave – ImageUploader – Variable class

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
You would like to test the carrierwave imageuploader with a cucumber test, but you would also like to use a generic step that can be used with different classes and different image file column names.

Solution
Use the following and perhaps put it a file named features/common_steps.rb

The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. (Errno::ENOSPC)

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

When using the guard gem together with spork and cucumber and rspec to automate testing in your rails app, you get the following error:

which also causes the guard to stop running.

Solution

Looking at the directory where the error takes place it appears there are a lot of temp files in the public/uploads/tmp directory that are not cleared up (using carrierwave for image uploading).
Maybe adding an initializer as suggested here would solve the clearing up of the files.
Otherwise by manually deleting the files and running guard again, it should work as expected.