lib/appium_lib/driver.rb in appium_lib-0.6.6 vs lib/appium_lib/driver.rb in appium_lib-0.6.7
- old
+ new
@@ -192,11 +192,11 @@
@@loaded = false
attr_reader :default_wait, :app_path, :app_name, :device,
:app_package, :app_activity, :app_wait_activity,
:sauce_username, :sauce_access_key, :port, :debug,
- :export_session
+ :export_session, :device_cap
# The amount to sleep in seconds before every webdriver http call.
attr_accessor :global_webdriver_http_sleep
# Creates a new driver.
# :device is :android, :ios, or :selendroid
@@ -261,10 +261,17 @@
# Sauce Key
@sauce_access_key = opts.fetch :sauce_access_key, ENV['SAUCE_ACCESS_KEY']
@port = opts.fetch :port, ENV['PORT'] || 4723
+ # device as used in device capabilities.
+ # iOS only.
+ #
+ # Android is always Android or Selendroid so there's no
+ # override required.
+ @device_cap = opts.fetch :device_cap, false
+
# :ios, :android, :selendroid
@device = opts.fetch :device, ENV['DEVICE'] || :ios
@device = @device.intern # device must be a symbol
# load common methods
@@ -354,11 +361,11 @@
def ios_capabilities
{
browserName: 'iOS 6.0',
platform: 'Mac 10.8',
version: '6.0',
- device: 'iPhone Simulator',
+ device: @device_cap || 'iPhone Simulator',
name: @app_name || 'Ruby Console iOS Appium'
}
end
# @private
@@ -377,9 +384,13 @@
return @app_path if @app_path.match(/^http/) # public URL for Sauce
if @app_path.match(/^\//) # absolute file path
raise "App doesn't exist. #{@app_path}" unless File.exist? @app_path
return @app_path
end
+
+ # if it doesn't contain a slash then it's a bundle id
+ return @app_path unless @app_path.match(/[\/\\]/)
+
file = File.join(File.dirname(__FILE__), @app_path)
raise "App doesn't exist #{file}" unless File.exist? file
file
end
\ No newline at end of file