GithubHelp home page GithubHelp logo

isabella232 / jasmine_selenium_runner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jasmine/jasmine_selenium_runner

0.0 0.0 0.0 1.17 MB

Runner for building Jasmine builds in Selenium

License: MIT License

Ruby 100.00%

jasmine_selenium_runner's Introduction

Jasmine Selenium Runner Build Status

Runner for building Jasmine builds in Selenium (permitting automatic cross-browser testing). After require-ing, jasmine_selenium_runner automatically sets itself up as the jasmine:ci runner.

Discontinued

The jasmine_selenium_runner gem is discontinued. There will be no further releases. We recommend migrating to the jasmine-browser-runner npm package.

Installation

Add this line to your application's Gemfile (to test & dev groups):

gem 'jasmine_selenium_runner'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jasmine_selenium_runner

Basic Usage:

  • In rails, simply run rake jasmine:ci, tests should run in firefox.
  • Outside of rails, you may need to add require 'jasmine_selenium_runner' to your Rakefile after jasmine is required.

Using w/ Travis (with xvfb):

You'll want your .travis.yml file to look like the following:

before_script:
- sh -e /etc/init.d/xvfb start
script: DISPLAY=:99.0 bundle exec rake jasmine:ci
env:
  global:
  - JASMINE_BROWSER=firefox

Using SauceLabs w/ Travis to run in multiple browsers:

Create a jasmine_selenium_runner.yml in spec/javascripts/support/ with the following content:

---
use_sauce: <%= ENV['USE_SAUCE'] %>
browser: <%= ENV['JASMINE_BROWSER'] %>
sauce:
  name: some-project-name <%= Time.now.to_s %>
  username: <%= ENV['SAUCE_USERNAME'] %>
  access_key: <%= ENV['SAUCE_ACCESS_KEY'] %>
  build: <%= ENV['TRAVIS_BUILD_NUMBER'] || 'Ran locally' %>
  tags:
    - <%= ENV['TRAVIS_RUBY_VERSION'] || RUBY_VERSION %>
    - CI
  tunnel_identifier: <%= ENV['TRAVIS_JOB_NUMBER'] ? "'#{ENV['TRAVIS_JOB_NUMBER']}'" : nil %>
  os: <%= ENV['SAUCE_OS'] %>
  browser_version: <%= ENV['SAUCE_BROWSER_VERSION'] %>

Here's a compatible .travis.yml example (Travis has instructions for secure environment variables which you'll want for SAUCE_USERNAME and SAUCE_ACCESS_KEY):

before_script:
- curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash
script: bundle exec rake jasmine:ci
rvm:
- 2.0.0
env:
  global:
  - USE_SAUCE=true
  - secure: some-secure-env-var
  - secure: some-other-secure-env-var
matrix:
  include:
  - env:
    - JASMINE_BROWSER="firefox"
    - SAUCE_OS="Linux"
    - SAUCE_BROWSER_VERSION=''
  - env:
    - JASMINE_BROWSER="safari"
    - SAUCE_OS="OS X 10.8"
    - SAUCE_BROWSER_VERSION=6
  - env:
    - JASMINE_BROWSER="internet explorer"
    - SAUCE_OS="Windows 8"
    - SAUCE_BROWSER_VERSION=10
  - env:
  - env:
    - JASMINE_BROWSER="chrome"
    - SAUCE_OS="Linux"
    - SAUCE_BROWSER_VERSION=''

Using with sauce connect locally

Sauce connect 4 now requires a path to the sc executable, so that needs to be provided if you want to use SauceLabs without a pre-existing tunnel. In your jasmine_selenium_runner.yml, in the sauce section, you need to provide a sauce_connect_path.

---
use_sauce: true
sauce:
  sauce_connect_path: /my/path/to/sc

This configuration will only be used if no tunnel_identifier is provided.

Using with a custom selenium server

Create a jasmine_selenium_runner.yml in spec/javascripts/support/ with the following content:

---
selenium_server: <full url to selenium server>
browser: <%= ENV['JASMINE_BROWSER'] %>

Customizing the browser profile

Make a class that extends JasmineSeleniumRunner::ConfigureJasmine and override the selenium_options method

class MyConfigurer < JasmineSeleniumRunner::ConfigureJasmine
  def selenium_options
    options = super
    if browser =~ /^firefox/
      options = super
      options[:profile] ||= Selenium::WebDriver::Firefox::Profile.new
      options[:profile]['dom.max_chrome_script_run_time'] = 20
      options[:profile]['dom.max_script_run_time'] = 20
    end
    options
  end
end

Create a jasmine_selenium_runner.yml in spec/javascripts/support/ with the following content:

---
configuration_class: MyConfigurer

Contributing

  1. Fork it
  2. Install geckodriver from https://github.com/mozilla/geckodriver/releases
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Make sure the tests pass: rake
  5. Commit your changes (git commit -am 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create new Pull Request

jasmine_selenium_runner's People

Contributors

benzimmer avatar myers avatar olleolleolle avatar ragaskar avatar sgravrock avatar sheelc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.