Build Status

Jasmine::Sauce::Ci

Rake tasks for running your Jasmine suite via a local browser or through SauceLabs using the Selenium Webdriver.

Can be used in your CI builds to enable running Jasmine suites. The Jasmine results are reported using RSpec to make parsing easy.

Requirements

Only requires that you have Jasmine available as a route in your application for testing. Recommend using Jasminerice

Installation

Add this line to your application's Gemfile:

gem 'jasmine-selenium-sauce'

Running Jasmine via SauceLabs

Server with Public IP

When you want to run a Jasmine suite hosted on a publicly available host. Uses Selenium to connect to SauceLabs, and requests a browser instance to run your suite.

rake jasmine:sauce

Required Environment Variables

Requires the following environment variables to be set:

SAUCELABS_URL=http://username:password@ondemand.saucelabs.com:80/wd/hub
  • URL for Saucelabs with your credentials included
JASMINE_URL=http://my.server.com/jasmine
  • Where your Jasmine tests are hosted
SAUCE_BROWSER=chrome
  • Which browser SauceLabs should use to run your tests

Server behind a Firewall

This when you want to run a Jasmine suite hosted on an internal host. It will use LocalTunnel to make your system available through a public tunnel to a specific port. Selenium is then used to connect to SauceLabs, and request a browser instance to run your suite. The tunnel is then closed down.

rake jasmine:local_sauce

Required Environment Variables

Requires the following environment variables to be set:

SAUCELABS_URL=http://username:password@ondemand.saucelabs.com:80/wd/hub
  • URL for Saucelabs with your credentials included
JASMINE_PORT=3000
  • Port on localhost where jasmine tests are located
SAUCE_BROWSER=chrome
  • Which browser SauceLabs should use to run your tests

Optional Configuration

Localtunnel

SSH_KEY_PATH=~/home/me/id_rsa.pub
  • Path to a public key to be used by LocalTunnel

RSpec

JASMINE_SPEC_FORMAT=documentation
  • Allows you to control the format of the RSpec report

Additional Sauce Labs Configuration

See sauce_config.rb

Running Jasmine via local browser

This task is used when you want to run Jasmine using a local browser such as Firefox, Chrome, etc.

rake jasmine:browser

Required Environment Variables

Requires the following environment variables to be set:

JASMINE_URL=http://my.server.com/jasmine
  • Where your Jasmine tests are hosted
LOCAL_BROWSER=firefox
  • Which browser that will be used to run your tests. Selenium may require a driver be installed depending the driver. See the Selenium documentation for more details See Which browsers does WebDriver support?.

Optional Configuration

RSpec

JASMINE_SPEC_FORMAT=documentation
  • Allows you to control the format of the RSpec report

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request