Class: Dressing::Configuration
- Inherits:
-
Object
- Object
- Dressing::Configuration
- Defined in:
- lib/dressing/configuration.rb
Constant Summary collapse
- POTENTIAL_PORTS =
[ 3000, 3001, 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 5000, 5001, 5050, 5555, 5432, 6000, 6001, 6060, 6666, 6543, 7000, 7070, 7774, 7777, 8000, 8001, 8003, 8031, 8080, 8081, 8765, 8888, 9000, 9001, 9080, 9090, 9876, 9999, 49221, 55001, 80, 443, 888, 2000, 2001, 2020, 2109, 2222, 2310 ]
- SAUCE_OPTIONS =
%w(record-video record-screenshots capture-html tags sauce-advisor single-window user-extensions-url firefox-profile-url max-duration idle-timeout build custom-data tunnel-identifier selenium-version command-timeout prerun prerun-args screen-resolution disable-popup-handler avoid-proxy public name)
Instance Attribute Summary collapse
-
#access_key ⇒ Object
Returns the value of attribute access_key.
-
#browser ⇒ Object
Returns the value of attribute browser.
-
#os ⇒ Object
Returns the value of attribute os.
-
#username ⇒ Object
Returns the value of attribute username.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #http_timeout ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #remote_url ⇒ Object
- #to_capabilities ⇒ Object
- #travis_tags ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/dressing/configuration.rb', line 28 def initialize self.browser = ENV['SAUCE_BROWSER'] || 'Chrome' self.os = ENV['SAUCE_OS'] || 'Windows 7' self.version = ENV['SAUCE_VERSION'] self.username = ENV['SAUCE_USERNAME'] self.access_key = ENV['SAUCE_ACCESS_KEY'] self.tunnel_identifier = ENV['SAUCE_TUNNEL_IDENTIFIER'] || ENV['TRAVIS_JOB_NUMBER'] self.build = ENV['SAUCE_BUILD'] || ENV['TRAVIS_BUILD_NUMBER'] self. = ENV['SAUCE_TAGS'] || end |
Instance Attribute Details
#access_key ⇒ Object
Returns the value of attribute access_key.
8 9 10 |
# File 'lib/dressing/configuration.rb', line 8 def access_key @access_key end |
#browser ⇒ Object
Returns the value of attribute browser.
3 4 5 |
# File 'lib/dressing/configuration.rb', line 3 def browser @browser end |
#os ⇒ Object
Returns the value of attribute os.
4 5 6 |
# File 'lib/dressing/configuration.rb', line 4 def os @os end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/dressing/configuration.rb', line 7 def username @username end |
#version ⇒ Object
Returns the value of attribute version.
5 6 7 |
# File 'lib/dressing/configuration.rb', line 5 def version @version end |
Instance Method Details
#http_timeout ⇒ Object
46 47 48 |
# File 'lib/dressing/configuration.rb', line 46 def http_timeout 300 end |
#remote_url ⇒ Object
42 43 44 |
# File 'lib/dressing/configuration.rb', line 42 def remote_url "http://#{username}:#{access_key}@ondemand.saucelabs.com/wd/hub" end |
#to_capabilities ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/dressing/configuration.rb', line 50 def to_capabilities { 'browserName' => browser, 'platform' => os, 'version' => version }.merge( Hash[SAUCE_OPTIONS.map { |option| [option, __send__(:"#{option.gsub('-', '_')}")] }] ).keep_if { |key, value| !value.nil? } end |
#travis_tags ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'lib/dressing/configuration.rb', line 58 def return nil unless ENV['TRAVIS'] = ['travis'] << "branch:#{ENV['TRAVIS_BRANCH']}" << "repo:#{ENV['TRAVIS_REPO_SLUG']}" << "commit:#{ENV['TRAVIS_COMMIT']}" end |