appium_lib_core 3.7.0 → 3.8.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: 16c3547b36730999941512edcad25073f99425d0312d71fa5fa6e487e3790cd3
4
- data.tar.gz: b65e1f458ff358048c71772478e328afe6b1b88fba047928e78b98463be1eaad
3
+ metadata.gz: b87c76f4273480fb8a37f7e16f739dced62732a86b673c4ae36fed4f38035329
4
+ data.tar.gz: 421040d807e1d4cd33b12d0a42ccb7ab905643a9dcd4ccb67706d8386e52b337
5
5
  SHA512:
6
- metadata.gz: ab6ec325103678537790277605a17796adf96469223057f2ca7444a1335155d7c09b68a6dc4a78e5c326d28564cc5e212363e7099a6f40604cbe64e82528bf84
7
- data.tar.gz: 8bf9ea9236f5de5b6cd8c0d5a432f49a31a54b44c408d48a9eaca2e28f1347f47f0e6bcf927ef3085d8f8c4775d7e0077d11d68775ae221d729ab20f7ec6be12
6
+ metadata.gz: 892368e156ca5145207d9c01bedb55355df22e22d6a653fb0a646b3b357c0677008c8d897bfe5775b725ce89a71b4ae29ec53d93827001b75451a0239a9761c6
7
+ data.tar.gz: 3736d593e1b450530f269b15c74d9e22730c0ce69a99c40f4df243d87591ba724efa42262b03012cd67f70174e9e621b483f0f0539c228849d080fc68b925af5
@@ -15,7 +15,7 @@ Metrics/CyclomaticComplexity:
15
15
  Metrics/PerceivedComplexity:
16
16
  Max: 13
17
17
  Metrics/ParameterLists:
18
- Max: 6
18
+ Enabled: false
19
19
  Lint/NestedMethodDefinition:
20
20
  Enabled: false
21
21
  # TODO: Replace <<- with <<~ after dropping Ruby 2.2
@@ -10,6 +10,17 @@ Read `release_notes.md` for commit level details.
10
10
 
11
11
  ### Deprecations
12
12
 
13
+ ## [3.8.0] - 2020-05-17
14
+
15
+ ### Enhancements
16
+ - Add options for `start_recording_screen`
17
+ - `file_field_name`, `form_fields` and `headers` are available since Appium 1.18.0
18
+
19
+ ### Bug fixes
20
+ - Fix `x-idempotency-key` header to add it only in new session request (https://github.com/appium/ruby_lib_core/issues/262)
21
+
22
+ ### Deprecations
23
+
13
24
  ## [3.7.0] - 2020-04-18
14
25
 
15
26
  ### Enhancements
@@ -213,7 +213,7 @@ module Appium
213
213
  # @driver.get_performance_data package_name: package_name, data_type: data_type, data_read_timeout: 2
214
214
  #
215
215
 
216
- # @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil, video_size: nil, time_limit: '180', bit_rate: '4000000', bug_report: nil)
216
+ # @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil, video_size: nil, time_limit: '180', bit_rate: '4000000', bug_report: nil)
217
217
  # @param [String] remote_path The path to the remote location, where the resulting video should be uploaded.
218
218
  # The following protocols are supported: http/https, ftp.
219
219
  # Null or empty string value (the default setting) means the content of resulting
@@ -225,6 +225,11 @@ module Appium
225
225
  # @param [String] user The name of the user for the remote authentication.
226
226
  # @param [String] pass The password for the remote authentication.
227
227
  # @param [String] method The http multipart upload method name. The 'PUT' one is used by default.
228
+ # @param [String] file_field_name The name of the form field containing the binary payload in multipart/form-data
229
+ # requests since Appium 1.18.0. Defaults to 'file'.
230
+ # @param [Array<Hash, Array<String>>] form_fields The form fields mapping in multipart/form-data requests since Appium 1.18.0.
231
+ # If any entry has the same key in this mapping, then it is going to be ignored.
232
+ # @param [Hash] headers The additional headers in multipart/form-data requests since Appium 1.18.0.
228
233
  # @param [Boolean] force_restart Whether to try to catch and upload/return the currently running screen recording
229
234
  # (+false+, the default setting on server) or ignore the result of it
230
235
  # and start a new recording immediately (+true+).
@@ -25,11 +25,13 @@ module Appium
25
25
  end
26
26
 
27
27
  ::Appium::Core::Device.add_endpoint_method(:start_recording_screen) do
28
- # rubocop:disable Metrics/ParameterLists
29
- def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil,
28
+ def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT',
29
+ file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil,
30
30
  video_size: nil, time_limit: '180', bit_rate: nil, bug_report: nil)
31
31
  option = ::Appium::Core::Base::Device::ScreenRecord.new(
32
- remote_path: remote_path, user: user, pass: pass, method: method, force_restart: force_restart
32
+ remote_path: remote_path, user: user, pass: pass, method: method,
33
+ file_field_name: file_field_name, form_fields: form_fields, headers: headers,
34
+ force_restart: force_restart
33
35
  ).upload_option
34
36
 
35
37
  option[:videoSize] = video_size unless video_size.nil?
@@ -44,7 +46,6 @@ module Appium
44
46
 
45
47
  execute(:start_recording_screen, {}, { options: option })
46
48
  end
47
- # rubocop:enable Metrics/ParameterLists
48
49
  end
49
50
  end
50
51
  end # module Screen
@@ -34,17 +34,12 @@ module Appium
34
34
  "appium/ruby_lib_core/#{VERSION} (#{::Selenium::WebDriver::Remote::Http::Common::DEFAULT_HEADERS['User-Agent']})"
35
35
  }.freeze
36
36
 
37
- attr_accessor :additional_headers
37
+ attr_reader :additional_headers
38
38
 
39
- def initialize(open_timeout: nil, read_timeout: nil, enable_idempotency_header: true)
39
+ def initialize(open_timeout: nil, read_timeout: nil)
40
40
  @open_timeout = open_timeout
41
41
  @read_timeout = read_timeout
42
-
43
- @additional_headers = if enable_idempotency_header
44
- { RequestHeaders::KEYS[:idempotency] => SecureRandom.uuid }
45
- else
46
- {}
47
- end
42
+ @additional_headers = {}
48
43
  end
49
44
 
50
45
  # Update <code>server_url</code> provided when ruby_lib _core created a default http client.
@@ -25,7 +25,8 @@ module Appium
25
25
 
26
26
  METHOD = %w(POST PUT).freeze
27
27
 
28
- def initialize(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil)
28
+ def initialize(remote_path: nil, user: nil, pass: nil, method: 'PUT',
29
+ file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil)
29
30
  @upload_option = if remote_path.nil?
30
31
  {}
31
32
  else
@@ -36,6 +37,9 @@ module Appium
36
37
  option[:user] = user unless user.nil?
37
38
  option[:pass] = pass unless pass.nil?
38
39
  option[:method] = method
40
+ option[:fileFieldName] = file_field_name unless file_field_name.nil?
41
+ option[:formFields] = form_fields unless form_fields.nil?
42
+ option[:headers] = headers unless headers.nil?
39
43
  option
40
44
  end
41
45
 
@@ -47,9 +51,11 @@ module Appium
47
51
  end
48
52
 
49
53
  module Command
50
- def stop_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT')
54
+ def stop_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT',
55
+ file_field_name: nil, form_fields: nil, headers: nil)
51
56
  option = ::Appium::Core::Base::Device::ScreenRecord.new(
52
- remote_path: remote_path, user: user, pass: pass, method: method
57
+ remote_path: remote_path, user: user, pass: pass, method: method,
58
+ file_field_name: file_field_name, form_fields: form_fields, headers: headers
53
59
  ).upload_option
54
60
 
55
61
  params = option.empty? ? {} : { options: option }
@@ -105,7 +105,8 @@ module Appium
105
105
  # @return [Appium::Core::Base::Http::Default] the http client
106
106
  attr_reader :http_client
107
107
 
108
- # Return if adding 'x-idempotency-key' header is each request.
108
+ # Return if adding 'x-idempotency-key' header is enabled for each new session request.
109
+ # Following commands should not have the key.
109
110
  # The key is unique for each http client instance. Defaults to <code>true</code>
110
111
  # https://github.com/appium/appium-base-driver/pull/400
111
112
  # @return [Bool]
@@ -349,9 +350,17 @@ module Appium
349
350
  http_client_ops: { http_client: nil, open_timeout: 999_999, read_timeout: 999_999 })
350
351
  @custom_url ||= server_url || "http://127.0.0.1:#{@port}/wd/hub"
351
352
 
352
- create_http_client http_client: http_client_ops.delete(:http_client),
353
- open_timeout: http_client_ops.delete(:open_timeout),
354
- read_timeout: http_client_ops.delete(:read_timeout)
353
+ @http_client = get_http_client http_client: http_client_ops.delete(:http_client),
354
+ open_timeout: http_client_ops.delete(:open_timeout),
355
+ read_timeout: http_client_ops.delete(:read_timeout)
356
+
357
+ if @enable_idempotency_header
358
+ if @http_client.instance_variable_defined? :@additional_headers
359
+ @http_client.additional_headers[Appium::Core::Base::Http::RequestHeaders::KEYS[:idempotency]] = SecureRandom.uuid
360
+ else
361
+ ::Appium::Logger.warn 'No additional_headers attribute in this http client instance'
362
+ end
363
+ end
355
364
 
356
365
  begin
357
366
  # included https://github.com/SeleniumHQ/selenium/blob/43f8b3f66e7e01124eff6a5805269ee441f65707/rb/lib/selenium/webdriver/remote/driver.rb#L29
@@ -371,6 +380,11 @@ module Appium
371
380
  raise "ERROR: Unable to connect to Appium. Is the server running on #{@custom_url}?"
372
381
  end
373
382
 
383
+ if @http_client.instance_variable_defined? :@additional_headers
384
+ # We only need the key for a new session request. Should remove it for other following commands.
385
+ @http_client.additional_headers.delete Appium::Core::Base::Http::RequestHeaders::KEYS[:idempotency]
386
+ end
387
+
374
388
  # If "automationName" is set only server side, this method set "automationName" attribute into @automation_name.
375
389
  # Since @automation_name is set only client side before start_driver is called.
376
390
  set_automation_name_if_nil
@@ -382,14 +396,14 @@ module Appium
382
396
 
383
397
  private
384
398
 
385
- def create_http_client(http_client: nil, open_timeout: nil, read_timeout: nil)
386
- @http_client = http_client || Appium::Core::Base::Http::Default.new(
387
- enable_idempotency_header: @enable_idempotency_header
388
- )
399
+ def get_http_client(http_client: nil, open_timeout: nil, read_timeout: nil)
400
+ client = http_client || Appium::Core::Base::Http::Default.new
389
401
 
390
402
  # open_timeout and read_timeout are explicit wait.
391
- @http_client.open_timeout = open_timeout if open_timeout
392
- @http_client.read_timeout = read_timeout if read_timeout
403
+ client.open_timeout = open_timeout if open_timeout
404
+ client.read_timeout = read_timeout if read_timeout
405
+
406
+ client
393
407
  end
394
408
 
395
409
  # Ignore setting default wait if the target driver has no implementation
@@ -51,7 +51,7 @@ module Appium
51
51
  #
52
52
 
53
53
  # @since Appium 1.9.1
54
- # @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: nil, force_restart: nil, video_type: 'mjpeg', video_fps: nil, time_limit: '180', video_quality: 'medium', video_scale: nil, video_filters: nil, pixel_format: nil)
54
+ # @!method start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil, video_type: 'mjpeg', video_fps: nil, time_limit: '180', video_quality: nil, video_scale: nil, video_filters: nil, pixel_format: nil)
55
55
  #
56
56
  # Record the display of devices running iOS Simulator since Xcode 9 or real devices since iOS 11
57
57
  # (ffmpeg utility is required: 'brew install ffmpeg').
@@ -68,6 +68,11 @@ module Appium
68
68
  # @param [String] user The name of the user for the remote authentication.
69
69
  # @param [String] pass The password for the remote authentication.
70
70
  # @param [String] method The http multipart upload method name. The 'PUT' one is used by default.
71
+ # @param [String] file_field_name The name of the form field containing the binary payload in multipart/form-data
72
+ # requests since Appium 1.18.0. Defaults to 'file'.
73
+ # @param [Array<Hash, Array<String>>] form_fields The form fields mapping in multipart/form-data requests since Appium 1.18.0.
74
+ # If any entry has the same key in this mapping, then it is going to be ignored.
75
+ # @param [Hash] headers The additional headers in multipart/form-data requests since Appium 1.18.0.
71
76
  # @param [Boolean] force_restart Whether to try to catch and upload/return the currently running screen recording
72
77
  # (+false+, the default setting on server) or ignore the result of it
73
78
  # and start a new recording immediately (+true+).
@@ -32,9 +32,11 @@ module Appium
32
32
 
33
33
  ::Appium::Core::Device.add_endpoint_method(:get_performance_record) do
34
34
  def get_performance_record(save_file_path: './performance', profile_name: 'Activity Monitor',
35
- remote_path: nil, user: nil, pass: nil, method: 'PUT')
35
+ remote_path: nil, user: nil, pass: nil, method: 'PUT',
36
+ file_field_name: nil, form_fields: nil, headers: nil)
36
37
  option = ::Appium::Core::Base::Device::ScreenRecord.new(
37
- remote_path: remote_path, user: user, pass: pass, method: method
38
+ remote_path: remote_path, user: user, pass: pass, method: method,
39
+ file_field_name: file_field_name, form_fields: form_fields, headers: headers
38
40
  ).upload_option
39
41
 
40
42
  option[:profileName] = profile_name
@@ -20,18 +20,20 @@ module Appium
20
20
  module Screen
21
21
  def self.add_methods
22
22
  ::Appium::Core::Device.add_endpoint_method(:start_recording_screen) do
23
- # rubocop:disable Metrics/ParameterLists
24
- def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil,
25
- video_type: 'mjpeg', time_limit: '180', video_quality: 'medium',
23
+ def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT',
24
+ file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil,
25
+ video_type: 'mjpeg', time_limit: '180', video_quality: nil,
26
26
  video_fps: nil, video_scale: nil, video_filters: nil, pixel_format: nil)
27
27
  option = ::Appium::Core::Base::Device::ScreenRecord.new(
28
- remote_path: remote_path, user: user, pass: pass, method: method, force_restart: force_restart
28
+ remote_path: remote_path, user: user, pass: pass, method: method,
29
+ file_field_name: file_field_name, form_fields: form_fields, headers: headers,
30
+ force_restart: force_restart
29
31
  ).upload_option
30
32
 
31
33
  option[:videoType] = video_type
32
34
  option[:timeLimit] = time_limit
33
- option[:videoQuality] = video_quality
34
35
 
36
+ option[:videoQuality] = video_quality unless video_quality.nil?
35
37
  option[:videoFps] = video_fps unless video_fps.nil?
36
38
  option[:videoScale] = video_scale unless video_scale.nil?
37
39
  option[:videoFilters] = video_filters unless video_filters.nil?
@@ -39,7 +41,6 @@ module Appium
39
41
 
40
42
  execute(:start_recording_screen, {}, { options: option })
41
43
  end
42
- # rubocop:enable Metrics/ParameterLists
43
44
  end
44
45
  end
45
46
  end # module Screen
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '3.7.0' unless defined? ::Appium::Core::VERSION
18
- DATE = '2020-04-18' unless defined? ::Appium::Core::DATE
17
+ VERSION = '3.8.0' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2020-05-17' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
@@ -19,7 +19,6 @@ module Appium
19
19
  module Screen
20
20
  def self.add_methods
21
21
  ::Appium::Core::Device.add_endpoint_method(:start_recording_screen) do
22
- # rubocop:disable Metrics/ParameterLists
23
22
  def start_recording_screen(force_restart: nil, time_limit: nil,
24
23
  fps: nil, preset: nil, video_filter: nil,
25
24
  capture_clicks: nil, capture_cursor: nil, audio_input: nil)
@@ -35,7 +34,6 @@ module Appium
35
34
 
36
35
  execute(:start_recording_screen, {}, { options: option })
37
36
  end
38
- # rubocop:enable Metrics/ParameterLists
39
37
  end
40
38
  end
41
39
  end # module Screen
@@ -1,3 +1,15 @@
1
+ #### v3.8.0 2020-05-17
2
+
3
+ - [8986a54](https://github.com/appium/ruby_lib_core/commit/8986a5400d6a3575b7413f15bb61de09af2ec789) Release 3.8.0
4
+ - [2379f9a](https://github.com/appium/ruby_lib_core/commit/2379f9a69b43e8c2d2b584ac1e56d3a1aea5e85b) refactor: move idempotency in driver (#264)
5
+ - [8103619](https://github.com/appium/ruby_lib_core/commit/8103619313328064df516e7094e2c8a6e1e9719c) fix: x-idempotency-key only for a new session (#263)
6
+ - [971f912](https://github.com/appium/ruby_lib_core/commit/971f912a6b4d8e28896d146939c9e5b86dd4b1e0) feat: Add options for start_recording_screen (#261)
7
+ - [11f840a](https://github.com/appium/ruby_lib_core/commit/11f840a2945b0376bb3ad762e9b2eefd0aace3b4) ci: add wait
8
+ - [4931f4e](https://github.com/appium/ruby_lib_core/commit/4931f4e318e94f9253edd649757f5c774c3404a7) ci: tweak flaky case
9
+ - [cb6ef1a](https://github.com/appium/ruby_lib_core/commit/cb6ef1a74dae7200952630076dd58af6bb9500ec) Merge branch 'master' of github.com:appium/ruby_lib_core
10
+ - [9117de2](https://github.com/appium/ruby_lib_core/commit/9117de2674f018cfe8e10d9dadc188af846e6be4) ci: relax tests for uia2
11
+
12
+
1
13
  #### v3.7.0 2020-04-18
2
14
 
3
15
  - [5ffe630](https://github.com/appium/ruby_lib_core/commit/5ffe630e670943c6f6f60c0e331cdab4685e31c7) Release 3.7.0
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.7.0
4
+ version: 3.8.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-04-18 00:00:00.000000000 Z
11
+ date: 2020-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver