lib/appium_lib/driver.rb in appium_lib-0.17.0 vs lib/appium_lib/driver.rb in appium_lib-0.18.0
- old
+ new
@@ -18,11 +18,10 @@
def awesome_openstruct target
awesome_hash target.marshal_dump
end
end
-
# Load appium.txt (toml format) into system ENV
# the basedir of this file + appium.txt is what's used
# @param opts [Hash] file: '/path/to/appium.txt', verbose: true
# @return [Array<String>] the require files. nil if require doesn't exist
def load_appium_txt opts
@@ -296,16 +295,26 @@
# 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
+ @device_cap = opts.fetch :device_cap, 'iPhone Simulator'
# :ios, :android, :selendroid
@device = opts.fetch :device, ENV['DEVICE'] || :ios
@device = @device.to_s.downcase.intern # device must be a symbol
+ @version = opts[:version]
+ if @device == :android || @device == :selendroid
+ @version = '4.3' unless @version # default android to 4.3
+ else
+ @version = '7' unless @version # default ios to 7
+ end
+
+ @device_type = opts.fetch :device_type, 'tablet'
+ @device_orientation = opts.fetch :device_orientation, 'portrait'
+
# load common methods
extend Appium::Common
if @device == :android
raise 'APP_ACTIVITY must be set.' if @app_activity.nil?
@@ -374,13 +383,15 @@
# WebDriver capabilities. Must be valid for Sauce to work.
# https://github.com/jlipps/appium/blob/master/app/android.js
def android_capabilities
{
compressXml: @compress_xml,
- platform: 'LINUX',
- version: '4.2',
+ platform: 'Linux',
+ version: @version,
device: @device == :android ? 'Android' : 'selendroid',
+ :'device-type' => @device_type,
+ :'device-orientation' => @device_orientation,
name: @app_name || 'Ruby Console Android Appium',
:'app-package' => @app_package,
:'app-activity' => @app_activity,
:'app-wait-activity' => @app_wait_activity || @app_activity,
fastClear: @fast_clear
@@ -390,12 +401,13 @@
# @private
# WebDriver capabilities. Must be valid for Sauce to work.
def ios_capabilities
{
platform: 'OS X 10.9',
- version: '7',
- device: @device_cap || 'iPhone Simulator',
- name: @app_name || 'Ruby Console iOS Appium'
+ version: @version,
+ device: @device_cap,
+ name: @app_name || 'Ruby Console iOS Appium',
+ :'device-orientation' => @device_orientation
}
end
# @private
def capabilities
\ No newline at end of file