Page MenuHomePhabricator

browsertests: figure out how to install qa/browsertests gems
Closed, ResolvedPublic

Description

We will need the ruby-bundler package to install the qa/browsertests repository

The following sequence seems to provide the desired effect:

sudo apt-get install ruby-bundler rubygems
git clone https://gerrit.wikimedia.org/r/qa/browsertests
cd browsertests
bundle install --path .

That needs to be done in the Jenkins jobs.


Version: wmf-deployment
Severity: normal

Details

Reference
bz54384

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:05 AM
bzimport set Reference to bz54384.
hashar created this task.Sep 20 2013, 4:45 PM

CCing Željko Filipin on any continuous bug related to browsertests. Main tracking bug is: bug 53697, see https://bugzilla.wikimedia.org/showdependencytree.cgi?id=53697&hide_resolved=0

When executing the browser tests, I end up with a syntax error:

$ bundle exec cucumber
/mnt/workspace/browsertests/features/support/env.rb:71: syntax error, unexpected ':', expecting ')'

http_client: Selenium::WebDriver::Remote::Http::Persistent.new,

$

This is because our implementations require ruby 1.9.x and Precise comes by default with ruby1.8. The bundle exec uses a /usr/bin/ruby shebang :/

According to https://devcenter.heroku.com/articles/ruby-versions , version 1.2.0 of bundle comes with a keyword to let us specify the version to use:

source "https://rubygems.org"
ruby "1.9.3"

  1. ...

So we should backport the Ubuntu package ruby-bundler from a more recent distribution.

Another way would be to install bundler from gem and provide it in qa/browsertests:

gem install --verbose bundler -i bundler

That install it under bundler/bundler-1.3.5/lib , I could not find out how to have ruby load the gems using that path though :/

Here is the trick:

Install the bundle gem locally:

gem install --verbose -i bundle bundle

Gem will need to lookup up the bundle gem in the bundle directory. To show the default gem search paths use:

ruby -r rubygems -e "p Gem.path"

Then tweak it with GEM_PATH:

GEM_PATH=pwd/bundle ./bundle/bin/bundle --version
Bundler version 1.3.5

This way we can add a dependency upon ruby: 1.9.3 in the gem file :-]

I also had to get a different shebang for bundle since it uses /usr/bin/ruby by default.

gem install --verbose --env-shebang -i bundle bundle

Ask bundle to install everything to vendor:

GEM_PATH=pwd/bundle ./bundle/bin/bundle install --path vendor

Append the vendor dir to GEM_PATH and exec cucumber:

GEM_PATH=`pwd`/bundle:`pwd`vendor ./bundle/bin/bundle  exec cucumber

Tada! Firefox launching :-]

I got it working on my laptop using phantomjs or firefox :-D The Jenkins job configuration is tracked by bug 54388.