appium_lib_core 3.6.1 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1011b8828b2d0dca338df3813ecb9f4b5e43464cff713c23b5a3c144a6ccdeba
4
- data.tar.gz: b120ea9cae3e309ea11b00f9a87861db272aa4c3bd422e184f9b7ac4e01c84d3
3
+ metadata.gz: 16c3547b36730999941512edcad25073f99425d0312d71fa5fa6e487e3790cd3
4
+ data.tar.gz: b65e1f458ff358048c71772478e328afe6b1b88fba047928e78b98463be1eaad
5
5
  SHA512:
6
- metadata.gz: 7c0abe1f60c93f5c32d3ed9597180c863e52dc3ddc3b1277ddcec37e07b872f679cd7f4f6f7cd14c16724f4664e38ca2d18ac598c9773241bcd3cbf83ffe33b5
7
- data.tar.gz: 19d0aa306e8a1956365cda6fe589a2d3e4ebca3a5fe62b69c1fa9702d85b7389dacaadb26d24500b73c00d1462bf46a0eff53aa853621221dacf814862810e2c
6
+ metadata.gz: ab6ec325103678537790277605a17796adf96469223057f2ca7444a1335155d7c09b68a6dc4a78e5c326d28564cc5e212363e7099a6f40604cbe64e82528bf84
7
+ data.tar.gz: 8bf9ea9236f5de5b6cd8c0d5a432f49a31a54b44c408d48a9eaca2e28f1347f47f0e6bcf927ef3085d8f8c4775d7e0077d11d68775ae221d729ab20f7ec6be12
@@ -10,6 +10,18 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
+ ## [3.7.0] - 2020-04-18
14
+
15
+ ### Enhancements
16
+ - Add `x-idempotency-key` header support (https://github.com/appium/appium-base-driver/pull/400)
17
+ - Can disable the header with `enable_idempotency_header: false` in `appium_lib` capability. Defaults to `true`.
18
+ - Add chrome devtools endpoint which is available chrome module in Selenium Ruby binding
19
+ - https://github.com/appium/appium-base-driver/pull/405
20
+
21
+ ### Bug fixes
22
+
23
+ ### Deprecations
24
+
13
25
  ## [3.6.1, 3.6.0] - 2020-03-15
14
26
 
15
27
  ### Enhancements
@@ -18,7 +18,7 @@ echo ${ANDROID_HOME}/emulator/emulator -list-avds
18
18
  echo "Starting emulator"
19
19
 
20
20
  # Start emulator in background
21
- nohup ${ANDROID_HOME}/emulator/emulator -avd testemulator -no-boot-anim -no-snapshot > /dev/null 2>&1 &
21
+ nohup ${ANDROID_HOME}/emulator/emulator -avd testemulator -accel auto -no-boot-anim -no-snapshot > /dev/null 2>&1 &
22
22
  ${ANDROID_HOME}/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 1; done; input keyevent 82'
23
23
 
24
24
  ${ANDROID_HOME}/platform-tools/adb devices
@@ -2,8 +2,8 @@
2
2
  parameters:
3
3
  vmImage: 'macOS-10.15'
4
4
  vmImageForIOS: 'macOS-10.15' # Not sure the reason, but macOS 10.14 instance raises no info.plist error
5
- xcodeForIOS: 11.3
6
- xcodeForTVOS: 11.3
5
+ xcodeForIOS: 11.4
6
+ xcodeForTVOS: 11.4
7
7
  androidSDK: 29
8
8
  appiumVersion: 'beta'
9
9
  ignoreVersionSkip: true
@@ -285,6 +285,19 @@ module Appium
285
285
  # @driver.finger_print 1
286
286
  #
287
287
 
288
+ # @!method execute_cdp(cmd, params)
289
+ # Execute Chrome Devtools protocol commands
290
+ # https://chromedevtools.github.io/devtools-protocol
291
+ #
292
+ # @param [String] cmd The name of command
293
+ # @param [Hash] params The parameter for the command as hash.
294
+ #
295
+ # @example
296
+ #
297
+ # @driver.execute_cdp 'Page.captureScreenshot', { quality: 50, format: 'jpeg' }
298
+ # @driver.execute_cdp 'Page.getResourceTree'
299
+ #
300
+
288
301
  ####
289
302
  ## class << self
290
303
  ####
@@ -393,6 +406,12 @@ module Appium
393
406
  end
394
407
  end
395
408
 
409
+ ::Appium::Core::Device.add_endpoint_method(:execute_cdp) do
410
+ def execute_cdp(cmd, **params)
411
+ execute :chrome_send_command, {}, { cmd: cmd, params: params }
412
+ end
413
+ end
414
+
396
415
  Screen.add_methods
397
416
  Performance.add_methods
398
417
  Network.add_methods
@@ -12,12 +12,20 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ require 'securerandom'
16
+
15
17
  require_relative '../../version'
16
18
 
17
19
  module Appium
18
20
  module Core
19
21
  class Base
20
22
  module Http
23
+ module RequestHeaders
24
+ KEYS = {
25
+ idempotency: 'X-Idempotency-Key'
26
+ }.freeze
27
+ end
28
+
21
29
  class Default < Selenium::WebDriver::Remote::Http::Default
22
30
  DEFAULT_HEADERS = {
23
31
  'Accept' => CONTENT_TYPE,
@@ -26,6 +34,19 @@ module Appium
26
34
  "appium/ruby_lib_core/#{VERSION} (#{::Selenium::WebDriver::Remote::Http::Common::DEFAULT_HEADERS['User-Agent']})"
27
35
  }.freeze
28
36
 
37
+ attr_accessor :additional_headers
38
+
39
+ def initialize(open_timeout: nil, read_timeout: nil, enable_idempotency_header: true)
40
+ @open_timeout = open_timeout
41
+ @read_timeout = read_timeout
42
+
43
+ @additional_headers = if enable_idempotency_header
44
+ { RequestHeaders::KEYS[:idempotency] => SecureRandom.uuid }
45
+ else
46
+ {}
47
+ end
48
+ end
49
+
29
50
  # Update <code>server_url</code> provided when ruby_lib _core created a default http client.
30
51
  # Set <code>@http</code> as nil to re-create http client for the <code>server_url</code>
31
52
  #
@@ -65,19 +86,20 @@ module Appium
65
86
  def call(verb, url, command_hash)
66
87
  url = server_url.merge(url) unless url.is_a?(URI)
67
88
  headers = DEFAULT_HEADERS.dup
89
+ headers = headers.merge @additional_headers unless @additional_headers.empty?
68
90
  headers['Cache-Control'] = 'no-cache' if verb == :get
69
91
 
70
92
  if command_hash
71
93
  payload = JSON.generate(command_hash)
72
94
  headers['Content-Length'] = payload.bytesize.to_s if [:post, :put].include?(verb)
73
-
74
- ::Appium::Logger.info(" >>> #{url} | #{payload}")
75
- ::Appium::Logger.debug(" > #{headers.inspect}")
76
95
  elsif verb == :post
77
96
  payload = '{}'
78
97
  headers['Content-Length'] = '2'
79
98
  end
80
99
 
100
+ ::Appium::Logger.info(" >>> #{url} | #{payload}")
101
+ ::Appium::Logger.info(" > #{headers.inspect}")
102
+
81
103
  request verb, url, headers, payload
82
104
  end
83
105
  end
@@ -94,7 +94,10 @@ module Appium
94
94
  gsm_voice: [:post, 'session/:session_id/appium/device/gsm_voice'],
95
95
  set_network_speed: [:post, 'session/:session_id/appium/device/network_speed'],
96
96
  set_power_capacity: [:post, 'session/:session_id/appium/device/power_capacity'],
97
- set_power_ac: [:post, 'session/:session_id/appium/device/power_ac']
97
+ set_power_ac: [:post, 'session/:session_id/appium/device/power_ac'],
98
+
99
+ # For chromium: https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/server/http_handler.cc
100
+ chrome_send_command: [:post, 'session/:session_id/goog/cdp/execute']
98
101
  }.freeze
99
102
 
100
103
  COMMAND_IOS = {
@@ -40,7 +40,7 @@ module Appium
40
40
  :stop_recording_screen, :stop_and_save_recording_screen,
41
41
  :shake, :device_time,
42
42
  :touch_actions, :multi_touch,
43
- :execute_driver
43
+ :execute_driver, :execute_cdp
44
44
  ].each(&method(:delegate_from_appium_driver))
45
45
  end
46
46
 
@@ -34,11 +34,12 @@ module Appium
34
34
  class Options
35
35
  attr_reader :custom_url, :default_wait, :export_session, :export_session_path,
36
36
  :port, :wait_timeout, :wait_interval, :listener,
37
- :direct_connect
37
+ :direct_connect, :enable_idempotency_header
38
38
 
39
39
  def initialize(appium_lib_opts)
40
40
  @custom_url = appium_lib_opts.fetch :server_url, nil
41
41
  @default_wait = appium_lib_opts.fetch :wait, Driver::DEFAULT_IMPLICIT_WAIT
42
+ @enable_idempotency_header = appium_lib_opts.fetch :enable_idempotency_header, true
42
43
 
43
44
  # bump current session id into a particular file
44
45
  @export_session = appium_lib_opts.fetch :export_session, false
@@ -104,6 +105,12 @@ module Appium
104
105
  # @return [Appium::Core::Base::Http::Default] the http client
105
106
  attr_reader :http_client
106
107
 
108
+ # Return if adding 'x-idempotency-key' header is each request.
109
+ # The key is unique for each http client instance. Defaults to <code>true</code>
110
+ # https://github.com/appium/appium-base-driver/pull/400
111
+ # @return [Bool]
112
+ attr_reader :enable_idempotency_header
113
+
107
114
  # Device type to request from the appium server
108
115
  # @return [Symbol] :android and :ios, for example
109
116
  attr_reader :device
@@ -114,11 +121,11 @@ module Appium
114
121
  attr_reader :automation_name
115
122
 
116
123
  # Custom URL for the selenium server. If set this attribute, ruby_lib_core try to handshake to the custom url.<br>
117
- # Defaults to false. Then try to connect to <code>http://127.0.0.1:#{port}/wd/hub<code>.
124
+ # Defaults to false. Then try to connect to <code>http://127.0.0.1:#{port}/wd/hub</code>.
118
125
  # @return [String]
119
126
  attr_reader :custom_url
120
127
 
121
- # Export session id to textfile in /tmp for 3rd party tools. False bu default.
128
+ # Export session id to textfile in /tmp for 3rd party tools. False by default.
122
129
  # @return [Boolean]
123
130
  attr_reader :export_session
124
131
  # @return [String] By default, session id is exported in '/tmp/appium_lib_session'
@@ -376,7 +383,9 @@ module Appium
376
383
  private
377
384
 
378
385
  def create_http_client(http_client: nil, open_timeout: nil, read_timeout: nil)
379
- @http_client = http_client || Appium::Core::Base::Http::Default.new
386
+ @http_client = http_client || Appium::Core::Base::Http::Default.new(
387
+ enable_idempotency_header: @enable_idempotency_header
388
+ )
380
389
 
381
390
  # open_timeout and read_timeout are explicit wait.
382
391
  @http_client.open_timeout = open_timeout if open_timeout
@@ -570,6 +579,7 @@ module Appium
570
579
  opts = Options.new appium_lib_opts
571
580
 
572
581
  @custom_url ||= opts.custom_url # Keep existence capability if it's already provided
582
+ @enable_idempotency_header = opts.enable_idempotency_header
573
583
 
574
584
  @default_wait = opts.default_wait
575
585
 
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '3.6.1' unless defined? ::Appium::Core::VERSION
18
- DATE = '2020-03-16' unless defined? ::Appium::Core::DATE
17
+ VERSION = '3.7.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2020-04-18' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -1,3 +1,14 @@
1
+ #### v3.7.0 2020-04-18
2
+
3
+ - [5ffe630](https://github.com/appium/ruby_lib_core/commit/5ffe630e670943c6f6f60c0e331cdab4685e31c7) Release 3.7.0
4
+ - [e561c8d](https://github.com/appium/ruby_lib_core/commit/e561c8db5b00f1132391f8ea79133c295d39a90b) feat: Add chrome devtools endpoints (#260)
5
+ - [73cf85f](https://github.com/appium/ruby_lib_core/commit/73cf85fd6ab5bdfb9df7833a713b8d4df3e51a70) test: add w3c send_keys action
6
+ - [b1c36fa](https://github.com/appium/ruby_lib_core/commit/b1c36fa538c145326dc50f49ab4d738478e5e0ac) fix typo
7
+ - [350ba7b](https://github.com/appium/ruby_lib_core/commit/350ba7bdafd567dabc9bd54ab1476740c6f54a20) feat: Add x idempotency header (#259)
8
+ - [94f16d8](https://github.com/appium/ruby_lib_core/commit/94f16d83909a2fb6111d281a00c0b911a00bb23c) ci: bump to Xcode 11.4 and iOS 13.4 (#257)
9
+ - [53b7191](https://github.com/appium/ruby_lib_core/commit/53b7191b89e61d11b06628d710a13dac5ca9dfaf) ci: add -accel auto
10
+
11
+
1
12
  #### v3.6.1 2020-03-16
2
13
 
3
14
  - [46a2277](https://github.com/appium/ruby_lib_core/commit/46a2277e792cc583c9978db3ebd548bfee343942) Release 3.6.1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_lib_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.1
4
+ version: 3.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-16 00:00:00.000000000 Z
11
+ date: 2020-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -339,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
339
339
  - !ruby/object:Gem::Version
340
340
  version: '0'
341
341
  requirements: []
342
- rubygems_version: 3.0.3
342
+ rubygems_version: 3.0.1
343
343
  signing_key:
344
344
  specification_version: 4
345
345
  summary: Minimal Ruby library for Appium.