Class: Appium::SauceLabs
- Inherits:
-
Object
- Object
- Appium::SauceLabs
- Defined in:
- lib/appium_lib/sauce_labs.rb
Instance Attribute Summary collapse
-
#access_key ⇒ Object
readonly
Access Key for use on Sauce Labs.
-
#endpoint ⇒ Object
readonly
Override the Sauce Appium endpoint to allow e.g.
-
#username ⇒ Object
readonly
Username for use on Sauce Labs.
Instance Method Summary collapse
-
#initialize(appium_lib_opts) ⇒ Appium::SauceLabs
constructor
Create a SauceLabs instance to manage sauce labs related attributes.
-
#sauce_server_url? ⇒ Boolean
Return true if an instance of Appium::SauceLabs has sauce_username and sauce_access_key.
-
#server_url ⇒ String
Return a particular server url to access to.
Constructor Details
#initialize(appium_lib_opts) ⇒ Appium::SauceLabs
Create a SauceLabs instance to manage sauce labs related attributes.
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/appium_lib/sauce_labs.rb', line 47 def initialize(appium_lib_opts) @username = appium_lib_opts.fetch :sauce_username, ENV.fetch('SAUCE_USERNAME', nil) @username = nil if !@username || (@username.is_a?(String) && @username.empty?) @access_key = appium_lib_opts.fetch :sauce_access_key, ENV.fetch('SAUCE_ACCESS_KEY', nil) @access_key = nil if !@access_key || (@access_key.is_a?(String) && @access_key.empty?) @endpoint = appium_lib_opts.fetch :sauce_endpoint, ENV.fetch('SAUCE_ENDPOINT', nil) @endpoint = 'ondemand.saucelabs.com:443/wd/hub' if !@endpoint || (@endpoint.is_a?(String) && @endpoint.empty?) end |
Instance Attribute Details
#access_key ⇒ Object (readonly)
Access Key for use on Sauce Labs. Set ‘false` to disable Sauce, even when SAUCE_ACCESS_KEY is in ENV.
20 21 22 |
# File 'lib/appium_lib/sauce_labs.rb', line 20 def access_key @access_key end |
#endpoint ⇒ Object (readonly)
Override the Sauce Appium endpoint to allow e.g. TestObject tests. Default is ‘ondemand.saucelabs.com:443/wd/hub’.
22 23 24 |
# File 'lib/appium_lib/sauce_labs.rb', line 22 def endpoint @endpoint end |
#username ⇒ Object (readonly)
Username for use on Sauce Labs. Set ‘false` to disable Sauce, even when SAUCE_USERNAME is in ENV.
18 19 20 |
# File 'lib/appium_lib/sauce_labs.rb', line 18 def username @username end |
Instance Method Details
#sauce_server_url? ⇒ Boolean
Return true if an instance of Appium::SauceLabs has sauce_username and sauce_access_key.
67 68 69 |
# File 'lib/appium_lib/sauce_labs.rb', line 67 def sauce_server_url? !username.nil? && !access_key.nil? end |
#server_url ⇒ String
Return a particular server url to access to. Default is the local address.
80 81 82 |
# File 'lib/appium_lib/sauce_labs.rb', line 80 def server_url sauce_server_url? ? "https://#{username}:#{access_key}@#{endpoint}" : 'http://127.0.0.1:4723/wd/hub' end |