8 Jul 2011

"warning: regexp match /.../n against to UTF-8 string" when running Cucumber

You probably have updated your environment lately and now getting the error "warning: regexp match /.../n against to UTF-8 string" when running Cucumber.

This is an encoding problem in the rack gem. This problem has already been fixed in version 1.3.0 but some of us are not able to update due dependencies issues e.g. rails. A simple monkey-patch based on pull request can solve the issue.

Create the file "config/initializers/rack_hotfix.rb" with the following content:

6 Jul 2011

Run Cucumber with Selenium RC and a custom Firefox profile

Proxy, proxy, proxy ... My head is spinning and it took me quite a while to figure out how to get Firefox and Selenium working behind a proxy. Guess what, it's quite simple.

Global environment configuration

First i tried the unix environment variable http_proxy and no_proxy but it seems Firefox doesn't respect those (Issue, Addon).

Use a firefox profile

Second i tried to create a Firefox profile with the correct proxy settings and started Selenium RC with the parameter "webdriver.firefox.profile" and the name of the created profile. The problem here is that the Selenium Webdriver for Ruby always creates an anonymous profile for Firefox.

I've created an issue for that.

The workaround

At the moment Selenium RC and the tests for our Ruby on Rails project are running on the same machine and the Selenium configuration for Capybara is flexible enough to apply a workaround for our problem.

Open features/support/env.rb in your Ruby on Rails project and add the following:

This snippet will configure Capybara based on the Firefox profile "default" but you could use any profile you want. The environment variable SELENIUM_REMOTE ensures that this configuration will not apply for any of your team members.

You can enable the configuration by running cucumber like this: SELENIUM_REMOTE=1 bundle exec cucumber

1 Jul 2011

Headless Testing for Continuous Integration with Ruby and Selenium

A headless system is a computer system or device that has been configured to operate without a monitor (the missing "head"), keyboard and mouse.

This is something you probably want when you're running a continuous integration server and having a bunch of integration tests for your website / application.

Using Firefox on Debian

Web Links

1 Dec 2009

Comparison: Symfony vs Ruby on Rails