lib/appium_lib/driver.rb in appium_lib-9.3.1 vs lib/appium_lib/driver.rb in appium_lib-9.3.2

- old
+ new

@@ -287,10 +287,12 @@ attr_reader :default_wait # Username for use on Sauce Labs. Set `false` to disable Sauce, even when SAUCE_USERNAME is in ENV. attr_accessor :sauce_username # Access Key for use on Sauce Labs. Set `false` to disable Sauce, even when SAUCE_ACCESS_KEY is in ENV. attr_accessor :sauce_access_key + # Override the Sauce Appium endpoint to allow e.g. TestObject tests + attr_accessor :sauce_endpoint # Appium's server port attr_accessor :appium_port # Device type to request from the appium server attr_accessor :appium_device # Automation name sent to appium server or received from server @@ -374,10 +376,13 @@ @default_wait = appium_lib_opts.fetch :wait, 0 @sauce_username = appium_lib_opts.fetch :sauce_username, ENV['SAUCE_USERNAME'] @sauce_username = nil if !@sauce_username || (@sauce_username.is_a?(String) && @sauce_username.empty?) @sauce_access_key = appium_lib_opts.fetch :sauce_access_key, ENV['SAUCE_ACCESS_KEY'] @sauce_access_key = nil if !@sauce_access_key || (@sauce_access_key.is_a?(String) && @sauce_access_key.empty?) + @sauce_endpoint = appium_lib_opts.fetch :sauce_endpoint, ENV['SAUCE_ENDPOINT'] + @sauce_endpoint = 'ondemand.saucelabs.com:443/wd/hub' if + !@sauce_endpoint || (@sauce_endpoint.is_a?(String) && @sauce_endpoint.empty?) @appium_port = appium_lib_opts.fetch :port, 4723 # timeout and interval used in ::Appium::Comm.wait/wait_true @appium_wait_timeout = appium_lib_opts.fetch :wait_timeout, 30 @appium_wait_interval = appium_lib_opts.fetch :wait_interval, 0.5 @@ -439,10 +444,11 @@ custom_url: @custom_url, export_session: @export_session, default_wait: @default_wait, sauce_username: @sauce_username, sauce_access_key: @sauce_access_key, + sauce_endpoint: @sauce_endpoint, port: @appium_port, device: @appium_device, debug: @appium_debug, listener: @listener, wait_timeout: @appium_wait_timeout, @@ -547,10 +553,10 @@ # Get the server url # @return [String] the server url def server_url return @custom_url if @custom_url if !@sauce_username.nil? && !@sauce_access_key.nil? - "https://#{@sauce_username}:#{@sauce_access_key}@ondemand.saucelabs.com:443/wd/hub" + "https://#{@sauce_username}:#{@sauce_access_key}@#{@sauce_endpoint}" else "http://127.0.0.1:#{@appium_port}/wd/hub" end end