Sha256: 8804efb3ed997f0d3939353265875dc487aa5d543ed46e811e9f9f6c50933423
Contents?: true
Size: 1.99 KB
Versions: 1
Compression:
Stored size: 1.99 KB
Contents
# WatirSession This gem leverages the Watir test library to allow for easy access to configurarion and session data so they do not need to be passed around as parameters throughout your tests. The intention is to provide a solution that is easy to use and maintain, while still providing power and flexibility. ## Installation Add this line to your application's Gemfile: ```ruby gem 'watir_session' ``` And then execute: $ bundle Or install it yourself as: $ gem install watir_session ## Usage The default WatirConfig class uses the recommended settings without needing any modifications. The hooks into the WatirSession class are designed to work with your test harness (RSpec, Cucumber, etc) for maximum flexibility. At a minimum, you'll need to call: ``` ruby WatirSession.start WatirSession.start_test WatirSession.end_test ``` ## Example Here's an example for how you can add a session for Saucelabs ```ruby class SauceSession def initialize @sauce_config = SuaceConfig.new end def create_browser) @browser = Watir::Browser.new(:remote, url: @sauce_config.endpoint) end end ``` ```ruby require 'model' class SauceConfig < Model key(:sauce_username) { ENV['SAUCE_USERNAME'] } key(:sauce_access_key) { ENV['SAUCE_ACCESS_KEY'] } key(:endpoint) {"http://#{sauce_username}:#{sauce_access_key}@ondemand.saucelabs.com:80/wd/hub"} end ``` ```ruby RSpec.configure do |config| WatirSession.start WatirSession.register_session(SauceSession.new) config.before(:each) do @browser = WatirSession.start_test end config.after(:each) do WatirSession.end_test end end ``` ## Development Run `rake spec` to run the tests To install this gem onto your local machine, run `bundle exec rake install`. ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/titusfortner/watir_session. ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
watir_session-0.1.0 | README.md |