appium_lib 9.3.0 → 9.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/ios_tests/appium.txt CHANGED
@@ -4,6 +4,7 @@ platformVersion = "10.2"
4
4
  deviceName ="iPhone Simulator"
5
5
  automationName = 'XCUITest'
6
6
  app = "./UICatalog.app"
7
+ some_capability = "some_capability"
7
8
 
8
9
  [appium_lib]
9
10
  sauce_username = ""
@@ -30,18 +30,37 @@ describe 'driver' do
30
30
  assert_equal expected, actual
31
31
  end
32
32
 
33
+ t 'verify Appium::Driver::Capabilities.init_caps_for_appium' do
34
+ expected_app = File.absolute_path('UICatalog.app')
35
+ caps = ::Appium::Driver::Capabilities.init_caps_for_appium(platformName: 'ios',
36
+ platformVersion: '10.2',
37
+ automationName: 'XCUITest',
38
+ deviceName: 'iPhone Simulator',
39
+ app: expected_app,
40
+ some_capability: 'some_capability')
41
+ caps_with_json = JSON.parse(caps.to_json)
42
+ caps_with_json['platformName'].must_equal 'ios'
43
+ caps_with_json['platformVersion'].must_equal '10.2'
44
+ caps_with_json['app'].must_equal expected_app
45
+ caps_with_json['automationName'].must_equal 'XCUITest'
46
+ caps_with_json['deviceName'].must_equal 'iPhone Simulator'
47
+ caps_with_json['someCapability'].must_equal 'some_capability'
48
+
49
+ caps[:platformName].must_equal 'ios'
50
+ caps[:platformVersion].must_equal '10.2'
51
+ caps[:app].must_equal expected_app
52
+ caps[:automationName].must_equal 'XCUITest'
53
+ caps[:deviceName].must_equal 'iPhone Simulator'
54
+ caps[:some_capability].must_equal 'some_capability'
55
+ end
56
+
33
57
  describe 'Appium::Driver attributes' do
34
58
  t 'verify all attributes' do
35
59
  actual = driver_attributes
36
60
  caps_app_for_teardown = actual[:caps][:app]
37
61
  expected_app = File.absolute_path('UICatalog.app')
38
- expected_caps = ::Appium::Driver::Capabilities.init_caps_for_appium(platformName: 'ios',
39
- platformVersion: '10.1',
40
- automationName: 'XCUITest',
41
- deviceName: 'iPhone Simulator',
42
- app: expected_app)
43
- expected = { caps: expected_caps,
44
- automation_name: 'XCUITest',
62
+
63
+ expected = { automation_name: 'XCUITest',
45
64
  custom_url: false,
46
65
  export_session: false,
47
66
  default_wait: 30,
@@ -54,7 +73,26 @@ describe 'driver' do
54
73
  wait_timeout: 20, # defined in appium.txt
55
74
  wait_interval: 1 } # defined in appium.txt
56
75
 
57
- if actual != expected
76
+ # actual[:caps].to_json send to Appium server
77
+ caps_with_json = JSON.parse(actual[:caps].to_json)
78
+ caps_with_json['platformName'].must_equal 'ios'
79
+ caps_with_json['platformVersion'].must_equal '10.2'
80
+ caps_with_json['app'].must_equal expected_app
81
+ caps_with_json['automationName'].must_equal 'XCUITest'
82
+ caps_with_json['deviceName'].must_equal 'iPhone Simulator'
83
+ caps_with_json['someCapability'].must_equal 'some_capability'
84
+
85
+ actual[:caps][:platformName].must_equal 'ios'
86
+ actual[:caps][:platformVersion].must_equal '10.2'
87
+ actual[:caps][:app].must_equal expected_app
88
+ actual[:caps][:automationName].must_equal 'XCUITest'
89
+ actual[:caps][:deviceName].must_equal 'iPhone Simulator'
90
+ actual[:caps][:some_capability].must_equal 'some_capability'
91
+
92
+ dup_actual = actual.dup
93
+ dup_actual.delete(:caps)
94
+
95
+ if dup_actual != expected
58
96
  diff = HashDiff.diff expected, actual
59
97
  diff = "diff (expected, actual):\n#{diff}"
60
98
 
@@ -3,52 +3,54 @@ module Appium
3
3
  module Commands
4
4
  COMMAND_NO_ARG = {
5
5
  # common
6
- shake: [:post, 'session/:session_id/appium/device/shake'.freeze],
7
- launch_app: [:post, 'session/:session_id/appium/app/launch'.freeze],
8
- close_app: [:post, 'session/:session_id/appium/app/close'.freeze],
9
- reset: [:post, 'session/:session_id/appium/app/reset'.freeze],
10
- device_locked?: [:post, 'session/:session_id/appium/device/is_locked'.freeze],
6
+ shake: [:post, 'session/:session_id/appium/device/shake'.freeze],
7
+ launch_app: [:post, 'session/:session_id/appium/app/launch'.freeze],
8
+ close_app: [:post, 'session/:session_id/appium/app/close'.freeze],
9
+ reset: [:post, 'session/:session_id/appium/app/reset'.freeze],
10
+ device_locked?: [:post, 'session/:session_id/appium/device/is_locked'.freeze],
11
11
 
12
12
  # Android
13
- open_notifications: [:post, 'session/:session_id/appium/device/open_notifications'.freeze],
14
- toggle_airplane_mode: [:post, 'session/:session_id/appium/device/toggle_airplane_mode'.freeze],
15
- current_activity: [:get, 'session/:session_id/appium/device/current_activity'.freeze],
16
- get_network_connection: [:get, 'session/:session_id/network_connection'.freeze],
13
+ open_notifications: [:post, 'session/:session_id/appium/device/open_notifications'.freeze],
14
+ toggle_airplane_mode: [:post, 'session/:session_id/appium/device/toggle_airplane_mode'.freeze],
15
+ current_activity: [:get, 'session/:session_id/appium/device/current_activity'.freeze],
16
+ get_network_connection: [:get, 'session/:session_id/network_connection'.freeze],
17
+ get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'.freeze],
17
18
 
18
19
  # iOS
19
- device_time: [:get, 'session/:session_id/appium/device/system_time'.freeze],
20
- current_context: [:get, 'session/:session_id/context'.freeze]
20
+ device_time: [:get, 'session/:session_id/appium/device/system_time'.freeze],
21
+ current_context: [:get, 'session/:session_id/context'.freeze]
21
22
  }.freeze
22
23
 
23
24
  COMMAND = {
24
25
  # common
25
- available_contexts: [:get, 'session/:session_id/contexts'.freeze],
26
- set_context: [:post, 'session/:session_id/context'.freeze],
27
- app_strings: [:post, 'session/:session_id/appium/app/strings'.freeze],
28
- lock: [:post, 'session/:session_id/appium/device/lock'.freeze],
29
- install_app: [:post, 'session/:session_id/appium/device/install_app'.freeze],
30
- remove_app: [:post, 'session/:session_id/appium/device/remove_app'.freeze],
31
- app_installed?: [:post, 'session/:session_id/appium/device/app_installed'.freeze],
32
- background_app: [:post, 'session/:session_id/appium/app/background'.freeze],
33
- hide_keyboard: [:post, 'session/:session_id/appium/device/hide_keyboard'.freeze],
34
- press_keycode: [:post, 'session/:session_id/appium/device/press_keycode'.freeze],
35
- long_press_keycode: [:post, 'session/:session_id/appium/device/long_press_keycode'.freeze],
36
- set_immediate_value: [:post, 'session/:session_id/appium/element/:id/value'.freeze],
37
- push_file: [:post, 'session/:session_id/appium/device/push_file'.freeze],
38
- pull_file: [:post, 'session/:session_id/appium/device/pull_file'.freeze],
39
- pull_folder: [:post, 'session/:session_id/appium/device/pull_folder'.freeze],
40
- get_settings: [:get, 'session/:session_id/appium/settings'.freeze],
41
- update_settings: [:post, 'session/:session_id/appium/settings'.freeze],
42
- touch_actions: [:post, 'session/:session_id/touch/perform'.freeze],
43
- multi_touch: [:post, 'session/:session_id/touch/multi/perform'.freeze],
26
+ available_contexts: [:get, 'session/:session_id/contexts'.freeze],
27
+ set_context: [:post, 'session/:session_id/context'.freeze],
28
+ app_strings: [:post, 'session/:session_id/appium/app/strings'.freeze],
29
+ lock: [:post, 'session/:session_id/appium/device/lock'.freeze],
30
+ install_app: [:post, 'session/:session_id/appium/device/install_app'.freeze],
31
+ remove_app: [:post, 'session/:session_id/appium/device/remove_app'.freeze],
32
+ app_installed?: [:post, 'session/:session_id/appium/device/app_installed'.freeze],
33
+ background_app: [:post, 'session/:session_id/appium/app/background'.freeze],
34
+ hide_keyboard: [:post, 'session/:session_id/appium/device/hide_keyboard'.freeze],
35
+ press_keycode: [:post, 'session/:session_id/appium/device/press_keycode'.freeze],
36
+ long_press_keycode: [:post, 'session/:session_id/appium/device/long_press_keycode'.freeze],
37
+ set_immediate_value: [:post, 'session/:session_id/appium/element/:id/value'.freeze],
38
+ push_file: [:post, 'session/:session_id/appium/device/push_file'.freeze],
39
+ pull_file: [:post, 'session/:session_id/appium/device/pull_file'.freeze],
40
+ pull_folder: [:post, 'session/:session_id/appium/device/pull_folder'.freeze],
41
+ get_settings: [:get, 'session/:session_id/appium/settings'.freeze],
42
+ update_settings: [:post, 'session/:session_id/appium/settings'.freeze],
43
+ touch_actions: [:post, 'session/:session_id/touch/perform'.freeze],
44
+ multi_touch: [:post, 'session/:session_id/touch/multi/perform'.freeze],
44
45
 
45
46
  # Android
46
- start_activity: [:post, 'session/:session_id/appium/device/start_activity'.freeze],
47
- end_coverage: [:post, 'session/:session_id/appium/app/end_test_coverage'.freeze],
48
- set_network_connection: [:post, 'session/:session_id/network_connection'.freeze],
47
+ start_activity: [:post, 'session/:session_id/appium/device/start_activity'.freeze],
48
+ end_coverage: [:post, 'session/:session_id/appium/app/end_test_coverage'.freeze],
49
+ set_network_connection: [:post, 'session/:session_id/network_connection'.freeze],
50
+ get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'.freeze],
49
51
 
50
52
  # iOS
51
- touch_id: [:post, 'session/:session_id/appium/simulator/touch_id'.freeze]
53
+ touch_id: [:post, 'session/:session_id/appium/simulator/touch_id'.freeze]
52
54
  }.merge(COMMAND_NO_ARG).merge(::Selenium::WebDriver::Remote::Bridge::COMMANDS).freeze
53
55
  end
54
56
  end
@@ -1,5 +1,5 @@
1
1
  module Appium
2
2
  # Version and Date are defined on the 'Appium' module, not 'Appium::Common'
3
- VERSION = '9.3.0'.freeze unless defined? ::Appium::VERSION
4
- DATE = '2017-01-22'.freeze unless defined? ::Appium::DATE
3
+ VERSION = '9.3.1'.freeze unless defined? ::Appium::VERSION
4
+ DATE = '2017-02-05'.freeze unless defined? ::Appium::DATE
5
5
  end
@@ -135,6 +135,26 @@ module Appium
135
135
  # ```ruby
136
136
  # set_immediate_value element, 'hello'
137
137
  # ```
138
+
139
+ # @!method get_performance_data_types
140
+ # Get the information type of the system state which is supported to read such as
141
+ # cpu, memory, network, battery via adb commands.
142
+ # https://github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L300
143
+ #
144
+ # ```ruby
145
+ # get_performance_data_types #=> ["cpuinfo", "batteryinfo", "networkinfo", "memoryinfo"]
146
+ # ```
147
+
148
+ # @!method get_performance_data
149
+ # Get the resource usage information of the application.
150
+ # https://github.com/appium/appium-base-driver/blob/be29aec2318316d12b5c3295e924a5ba8f09b0fb/lib/mjsonwp/routes.js#L303
151
+ # @param [String] package_name Package name
152
+ # @param [String] data_type Data type get with `get_performance_data_types`
153
+ # @param [String] data_read_timeout Command timeout. Default is 2.
154
+ #
155
+ # ```ruby
156
+ # get_performance_data package_name: package_name, data_type: data_type, data_read_timeout: 2
157
+ # ```
138
158
  class << self
139
159
  def extended(_mod)
140
160
  extend_webdriver_with_forwardable
@@ -308,6 +328,14 @@ module Appium
308
328
  end
309
329
  end
310
330
 
331
+ add_endpoint_method(:get_performance_data) do
332
+ def get_performance_data(package_name:, data_type:, data_read_timeout: 1000)
333
+ execute :get_performance_data, {}, packageName: package_name,
334
+ dataType: data_type,
335
+ dataReadTimeout: data_read_timeout
336
+ end
337
+ end
338
+
311
339
  add_touch_actions
312
340
  add_ime_actions
313
341
  extend_search_contexts
@@ -55,7 +55,8 @@ end
55
55
  module Appium
56
56
  REQUIRED_VERSION_XCUITEST = '1.6.0'.freeze
57
57
 
58
- # Load arbitrary text (toml format)
58
+ # Load arbitrary text ([toml format](https://github.com/toml-lang/toml))
59
+ # The toml is parsed by https://github.com/fbernier/tomlrb .
59
60
  #
60
61
  # ```
61
62
  # [caps]
@@ -76,7 +77,7 @@ module Appium
76
77
  raise 'opts must not be empty' if opts.empty?
77
78
 
78
79
  toml = opts[:file]
79
- raise 'Must pass file' unless toml
80
+ raise 'Must pass a capability file which has [caps] and [appium_lib]' unless toml
80
81
  verbose = opts.fetch :verbose, false
81
82
 
82
83
  Appium::Logger.info "appium settings path: #{toml}" if verbose
@@ -121,7 +122,7 @@ module Appium
121
122
 
122
123
  File.exist?(file) ? file : nil
123
124
  end
124
- r.compact! # remove nils
125
+ file_paths.compact! # remove nils
125
126
 
126
127
  files = []
127
128
 
@@ -251,6 +252,9 @@ module Appium
251
252
  # except for browser_name, default capability is equal to ::Selenium::WebDriver::Remote::Capabilities.firefox
252
253
  # Because Selenium::WebDriver::Remote::Bridge uses Capabilities.firefox by default
253
254
  # https://github.com/SeleniumHQ/selenium/blob/selenium-3.0.1/rb/lib/selenium/webdriver/remote/bridge.rb#L67
255
+ # @param [Hash] opts_caps Capabilities for Appium server. All capability keys are converted to lowerCamelCase when
256
+ # this client sends capabilities to Appium server as JSON format.
257
+ # @return [Selenium::WebDriver::Remote::Capabilities] Return instance of Selenium::WebDriver::Remote::Capabilities
254
258
  def self.init_caps_for_appium(opts_caps = {})
255
259
  default_caps_opts_firefox = {
256
260
  javascript_enabled: true,
@@ -281,9 +285,9 @@ module Appium
281
285
  # This value is independent of what the server is using
282
286
  # @return [Integer]
283
287
  attr_reader :default_wait
284
- # Username for use on Sauce Labs
288
+ # Username for use on Sauce Labs. Set `false` to disable Sauce, even when SAUCE_USERNAME is in ENV.
285
289
  attr_accessor :sauce_username
286
- # Access Key for use on Sauce Labs
290
+ # Access Key for use on Sauce Labs. Set `false` to disable Sauce, even when SAUCE_ACCESS_KEY is in ENV.
287
291
  attr_accessor :sauce_access_key
288
292
  # Appium's server port
289
293
  attr_accessor :appium_port
data/readme.md CHANGED
@@ -45,6 +45,8 @@ gem install --no-rdoc --no-ri appium_lib
45
45
  - `SAUCE_USERNAME` Sauce username
46
46
  - `SAUCE_ACCESS_KEY` Sauce API key
47
47
 
48
+ (Note: If these variables are set, all tests will use Sauce Labs unless over-ridden in configuration.)
49
+
48
50
  #### Troubleshooting
49
51
 
50
52
  1. Does `adb kill-server; adb devices` list an active Android device?
data/release_notes.md CHANGED
@@ -1,3 +1,15 @@
1
+ #### v9.3.0 2017-01-22
2
+
3
+ - [a1c2872](https://github.com/appium/ruby_lib/commit/a1c287296c9eace08ef19449998fba7229b65697) Release 9 3 0 (#474)
4
+ - [23d937a](https://github.com/appium/ruby_lib/commit/23d937a60da55c2d95ccbbda07ad23bda1b53a7b) update changelogs for v9.3.0 (#472)
5
+ - [34803ef](https://github.com/appium/ruby_lib/commit/34803ef6b7b94df9ef4e147ba8fec5c1d2cfaada) arrange docs (#470)
6
+ - [c1106aa](https://github.com/appium/ruby_lib/commit/c1106aaa6f48a4ed22dc1a7e55c9c4119cdef15c) fix returning only visible elements (#465)
7
+ - [0104a87](https://github.com/appium/ruby_lib/commit/0104a87fad933598bb2b8ac1174319857494ba21) add capability to be able to set default timeout/interval for wait/wait_true (#468)
8
+ - [1372e64](https://github.com/appium/ruby_lib/commit/1372e6453536eb64829825b5bf405ad0f11a9a46) fix typo (#467)
9
+ - [a5ddd4a](https://github.com/appium/ruby_lib/commit/a5ddd4aa1d5f009b9024ee5aa5434805ba73895c) fix swipe, pinch, zoom (#466)
10
+ - [a1c2e9e](https://github.com/appium/ruby_lib/commit/a1c2e9e815e9f85c929da857e26f419629d760df) fix appium server's version check (#464)
11
+
12
+
1
13
  #### v9.2.0 2017-01-09
2
14
 
3
15
  - [958ae3e](https://github.com/appium/ruby_lib/commit/958ae3e2fc84b78191baf22e967c8a2fb7eded22) Release 9 2 0 (#460)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.3.0
4
+ version: 9.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - code@bootstraponline.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-22 00:00:00.000000000 Z
11
+ date: 2017-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -216,6 +216,20 @@ dependencies:
216
216
  - - "<"
217
217
  - !ruby/object:Gem::Version
218
218
  version: 2.2.0
219
+ - !ruby/object:Gem::Dependency
220
+ name: pry
221
+ requirement: !ruby/object:Gem::Requirement
222
+ requirements:
223
+ - - ">="
224
+ - !ruby/object:Gem::Version
225
+ version: '0'
226
+ type: :development
227
+ prerelease: false
228
+ version_requirements: !ruby/object:Gem::Requirement
229
+ requirements:
230
+ - - ">="
231
+ - !ruby/object:Gem::Version
232
+ version: '0'
219
233
  description: Ruby library for Appium.
220
234
  email:
221
235
  - code@bootstraponline.com
@@ -396,7 +410,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
396
410
  version: '0'
397
411
  requirements: []
398
412
  rubyforge_project:
399
- rubygems_version: 2.6.6
413
+ rubygems_version: 2.6.8
400
414
  signing_key:
401
415
  specification_version: 4
402
416
  summary: Ruby library for Appium