appium_lib_core 1.2.7 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97e009bff9dd6292e1a2628aede232c17410d775
4
- data.tar.gz: 50c61ce75653198f2a07a1241771ac757b0d2aca
3
+ metadata.gz: beb4e9d4de4aee51d10e20d5928b5643eb11718e
4
+ data.tar.gz: 8b84e2bf079a746c6dcfe8fda67ae20043c0abd5
5
5
  SHA512:
6
- metadata.gz: c542eff950fb4ef3b69c018eb560a2b4aa06b26896f92bccd0f2c0d1f4409b7aba82f9f3f9d3f8abc84a7c0613929996a401bbb862f168c11d4586f3b98defef
7
- data.tar.gz: ce4db6a5dfb62b3efe19fc639282a84c85acc38f68e9ad956a3407ed8f4a8f5c8704578efe304685a18e830f53d7198b53630be34b09495c9657849dc3091e12
6
+ metadata.gz: 46386acb4309665c91025d6e3dff55d91eed8a453d31deac7a018bd55d66148f7218189323fab82fb40938206b1195736bd19af0678985cc1a72e20ced113e1d
7
+ data.tar.gz: 431ad7793eb318ffff75fb8d97862977a16c0cfa55ddc4db9d2c3143f24a085563baa72eecf27a16cf8c2ac86fddc793835a77fa0591109097efdcf8cf808ab6
@@ -3,11 +3,29 @@ All notable changes to this project will be documented in this file.
3
3
 
4
4
  ## [Unreleased]
5
5
  ### Enhancements
6
+
7
+ ### Bug fixes
8
+
9
+ ### Deprecations
10
+
11
+ ## [1.3.0] - 2018-01-28
12
+ ### Enhancements
13
+ - `start_recording_screen`/`stop_recording_screen` support iOS from `Appium 1.8.0` [#48](https://github.com/appium/ruby_lib_core/issues/48)
14
+ - **Breaking Changes**
15
+ - `start_recording_screen`
16
+ - The argument, `file_path`, was removed.
17
+
18
+ ### Bug fixes
19
+
20
+ ### Deprecations
21
+
22
+ ## [1.2.7] - 2018-01-25
23
+ ### Enhancements
6
24
  - Print warning messages to use camelCase if capability key names are snake_case
7
25
  - For W3C adaption for Appium Server
8
26
 
9
27
  ### Bug fixes
10
- - make `@driver.automation_name` downcase
28
+ - Make `@driver.automation_name` downcase [#50](https://github.com/appium/ruby_lib_core/issues/50)
11
29
 
12
30
  ### Deprecations
13
31
 
@@ -16,7 +34,7 @@ All notable changes to this project will be documented in this file.
16
34
  - Add `window_rect`
17
35
 
18
36
  ### Bug fixes
19
- - Make `@driver.automation_name` symbol when someone define the `automationName` with the server argument.
37
+ - Make `@driver.automation_name` symbol when someone define the `automationName` with the server argument. [#50](https://github.com/appium/ruby_lib_core/issues/50)
20
38
 
21
39
  ### Deprecations
22
40
 
@@ -8,6 +8,7 @@ require_relative 'appium_lib_core/driver'
8
8
  # for multi touch related methods
9
9
  require_relative 'appium_lib_core/device/touch_actions'
10
10
  require_relative 'appium_lib_core/device/multi_touch'
11
+ require_relative 'appium_lib_core/device/screen_record'
11
12
 
12
13
  require_relative 'appium_lib_core/android'
13
14
  require_relative 'appium_lib_core/android_uiautomator2'
@@ -78,26 +78,36 @@ module Appium
78
78
  # @driver.get_performance_data package_name: package_name, data_type: data_type, data_read_timeout: 2
79
79
  #
80
80
 
81
- # @!method start_recording_screen(package_name:, data_type:, data_read_timeout: 1000)
82
- # Record the display of devices running Android 4.4 (API level 19) and higher.
83
- # It records screen activity to an MPEG-4 file. Audio is not recorded with the video file.
84
- # @param [String] file_path A path to save the video. `/sdcard/default.mp4` is by default.
85
- # @param [String] video_size A video size. '1280x720' is by default.
86
- # @param [String] time_limit Recording time. 180 second is by default.
87
- # @param [String] bit_rate The video bit rate for the video, in megabits per second. 3000000(3Mbps) is by default.
81
+ # @!method start_recording_screen(remote_path:, user:, pass:, method:, force_restart:,
82
+ # video_size:, time_limit:, bit_rate:)
83
+ #
84
+ # @option [String] remote_path The path to the remote location, where the resulting video should be uploaded.
85
+ # The following protocols are supported: http/https, ftp.
86
+ # Null or empty string value (the default setting) means the content of resulting
87
+ # file should be encoded as Base64 and passed as the endpoint response value.
88
+ # An exception will be thrown if the generated media file is too big to
89
+ # fit into the available process memory.
90
+ # This option only has an effect if there is screen recording process in progress
91
+ # and `forceRestart` parameter is not set to `true`.
92
+ # @option [String] user The name of the user for the remote authentication.
93
+ # @option [String] pass The password for the remote authentication.
94
+ # @option [String] method The http multipart upload method name. The 'PUT' one is used by default.
95
+ # @option [Boolean] force_restart Whether to try to catch and upload/return the currently running screen recording
96
+ # (`false`, the default setting on server) or ignore the result of it
97
+ # and start a new recording immediately (`true`).
98
+ #
99
+ # @option [String] video_size The format is widthxheight.
100
+ # The default value is the device's native display resolution (if supported),
101
+ # 1280x720 if not. For best results,
102
+ # use a size supported by your device's Advanced Video Coding (AVC) encoder.
103
+ # For example, "1280x720"
104
+ # @param [String] time_limit Recording time. 180 seconds is by default.
105
+ # @param [String] bit_rate The video bit rate for the video, in megabits per second. 4 Mbps(4000000) is by default.
88
106
  #
89
107
  # @example
90
108
  #
91
- # @driver.start_recording_screen(file_path: '/sdcard/default.mp4', video_size: '1280x720',
92
- # time_limit: '180', bit_rate: '3000000')
93
- #
94
-
95
- # @!method stop_recording_screen
96
- # Stop recording the screen.
97
- #
98
- # @example
99
- #
100
- # @driver.stop_recording_screen
109
+ # @driver.start_recording_screen
110
+ # @driver.start_recording_screen video_size: '1280x720', time_limit: '180', bit_rate: '5000000'
101
111
  #
102
112
 
103
113
  ####
@@ -161,12 +171,27 @@ module Appium
161
171
  end
162
172
  end
163
173
 
174
+ add_screen_recording
175
+ end
176
+
177
+ private
178
+
179
+ def add_screen_recording
164
180
  Appium::Core::Device.add_endpoint_method(:start_recording_screen) do
165
- def start_recording_screen(file_path: '/sdcard/default.mp4', video_size: '1280x720',
166
- time_limit: '180', bit_rate: '3000000')
167
- execute(:start_recording_screen, {},
168
- filePath: file_path, videoSize: video_size, timeLimit: time_limit, bitRate: bit_rate)
181
+ # rubocop:disable Metrics/ParameterLists
182
+ def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil,
183
+ video_size: nil, time_limit: '180', bit_rate: '4000000')
184
+ option = ::Appium::Core::Device::ScreenRecord.new(
185
+ remote_path: remote_path, user: user, pass: pass, method: method, force_restart: force_restart
186
+ ).upload_option
187
+
188
+ option[:videoSize] = video_size unless video_size.nil?
189
+ option[:timeLimit] = time_limit
190
+ option[:bitRate] = bit_rate
191
+
192
+ execute(:start_recording_screen, {}, { options: option })
169
193
  end
194
+ # rubocop:enable Metrics/ParameterLists
170
195
  end
171
196
  end
172
197
  end
@@ -24,8 +24,7 @@ module Appium
24
24
  get_display_density: [:get, 'session/:session_id/appium/device/display_density'.freeze],
25
25
  is_keyboard_shown: [:get, 'session/:session_id/appium/device/is_keyboard_shown'.freeze],
26
26
  get_network_connection: [:get, 'session/:session_id/network_connection'.freeze], # defined also in OSS
27
- get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'.freeze],
28
- stop_recording_screen: [:post, 'session/:session_id/appium/stop_recording_screen'.freeze]
27
+ get_performance_data_types: [:post, 'session/:session_id/appium/performanceData/types'.freeze]
29
28
  # iOS
30
29
  }.freeze
31
30
 
@@ -53,15 +52,16 @@ module Appium
53
52
  get_settings: [:get, 'session/:session_id/appium/settings'.freeze],
54
53
  update_settings: [:post, 'session/:session_id/appium/settings'.freeze],
55
54
  touch_actions: [:post, 'session/:session_id/touch/perform'.freeze],
56
- multi_touch: [:post, 'session/:session_id/touch/multi/perform'.freeze]
55
+ multi_touch: [:post, 'session/:session_id/touch/multi/perform'.freeze],
56
+ stop_recording_screen: [:post, 'session/:session_id/appium/stop_recording_screen'.freeze],
57
+ start_recording_screen: [:post, 'session/:session_id/appium/start_recording_screen'.freeze]
57
58
  }.freeze
58
59
 
59
60
  COMMAND_ANDROID = {
60
61
  start_activity: [:post, 'session/:session_id/appium/device/start_activity'.freeze],
61
62
  end_coverage: [:post, 'session/:session_id/appium/app/end_test_coverage'.freeze],
62
63
  set_network_connection: [:post, 'session/:session_id/network_connection'.freeze], # defined also in OSS
63
- get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'.freeze],
64
- start_recording_screen: [:post, 'session/:session_id/appium/start_recording_screen'.freeze]
64
+ get_performance_data: [:post, 'session/:session_id/appium/getPerformanceData'.freeze]
65
65
  }.freeze
66
66
 
67
67
  COMMAND_IOS = {
@@ -402,6 +402,33 @@ module Appium
402
402
  # @driver.take_element_screenshot(element, "fine_name.png")
403
403
  #
404
404
 
405
+ # @!method stop_recording_screen(remote_path:, user:, pass:, method:)
406
+ #
407
+ # @option [String] remote_path The path to the remote location, where the resulting video should be uploaded.
408
+ # The following protocols are supported: http/https, ftp.
409
+ # Null or empty string value (the default setting) means the content of resulting
410
+ # file should be encoded as Base64 and passed as the endpoint response value.
411
+ # An exception will be thrown if the generated media file is too big to
412
+ # fit into the available process memory.
413
+ # @option [String] user The name of the user for the remote authentication.
414
+ # @option [String] pass The password for the remote authentication.
415
+ # @option [String] method The http multipart upload method name. The 'PUT' one is used by default.
416
+ #
417
+ # @example
418
+ #
419
+ # @driver.stop_recording_screen
420
+ # @driver.stop_recording_screen remote_path: 'https://example.com', user: 'example', pass: 'pass', method: 'POST'
421
+ #
422
+
423
+ # @!method stop_and_save_recording_screen(file_path)
424
+ #
425
+ # @option [String] file_path The path to save video decoded from base64 from Appium server.
426
+ #
427
+ # @example
428
+ #
429
+ # @driver.stop_and_save_recording_screen 'example.mp4'
430
+ #
431
+
405
432
  ####
406
433
  ## class << self
407
434
  ####
@@ -540,6 +567,7 @@ module Appium
540
567
  add_touch_actions
541
568
  add_ime_actions
542
569
  add_handling_context
570
+ add_screen_recording
543
571
  end
544
572
 
545
573
  # def extended
@@ -680,6 +708,27 @@ module Appium
680
708
  end
681
709
  end
682
710
  end
711
+
712
+ def add_screen_recording
713
+ add_endpoint_method(:stop_recording_screen) do
714
+ def stop_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT')
715
+ option = ::Appium::Core::Device::ScreenRecord.new(
716
+ remote_path: remote_path, user: user, pass: pass, method: method
717
+ ).upload_option
718
+
719
+ params = option.empty? ? {} : { options: option }
720
+
721
+ execute(:stop_recording_screen, {}, params)
722
+ end
723
+ end
724
+
725
+ add_endpoint_method(:stop_and_save_recording_screen) do
726
+ def stop_and_save_recording_screen(file_path)
727
+ base64data = execute(:stop_recording_screen, {}, {})
728
+ File.open(file_path, 'wb') { |f| f << Base64.decode64(base64data) }
729
+ end
730
+ end
731
+ end
683
732
  end # class << self
684
733
  end # module Device
685
734
  end # module Core
@@ -0,0 +1,35 @@
1
+ module Appium
2
+ module Core
3
+ module Device
4
+ class ScreenRecord
5
+ #
6
+ # @api private
7
+ #
8
+
9
+ attr_reader :upload_option
10
+
11
+ METHOD = %w(POST PUT).freeze
12
+
13
+ def initialize(remote_path: nil, user: nil, pass: nil, method: 'PUT', force_restart: nil)
14
+ @upload_option = if remote_path.nil?
15
+ {}
16
+ else
17
+ raise 'method should be POST or PUT' unless METHOD.member?(method.to_s.upcase)
18
+
19
+ option = {}
20
+ option[:remotePath] = remote_path
21
+ option[:user] = user unless user.nil?
22
+ option[:pass] = pass unless pass.nil?
23
+ option[:method] = method
24
+ option
25
+ end
26
+
27
+ return if force_restart.nil?
28
+
29
+ raise 'force_restart should be true or false' unless [true, false].member?(force_restart)
30
+ @upload_option[:forceRestart] = force_restart
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -30,7 +30,7 @@ module Appium
30
30
  attr_reader :export_session_path
31
31
 
32
32
  # Default wait time for elements to appear
33
- # Returns the default client side wait. 20 second is by default.
33
+ # Returns the default client side wait. 20 seconds is by default.
34
34
  # Provide Appium::Drive like { appium_lib: { wait: 30 } }
35
35
  # @return [Integer]
36
36
  attr_reader :default_wait
@@ -40,13 +40,13 @@ module Appium
40
40
  # @return [Integer]
41
41
  attr_reader :port
42
42
 
43
- # Return a time wait timeout. 30 second is by default.
43
+ # Return a time wait timeout. 30 seconds is by default.
44
44
  # Wait time for ::Appium::Core::Base::Wait, wait and wait_true
45
45
  # Provide Appium::Drive like { appium_lib: { wait_timeout: 20 } }
46
46
  # @return [Integer]
47
47
  attr_reader :wait_timeout
48
48
 
49
- # Return a time to wait interval. 0.5 second is by default.
49
+ # Return a time to wait interval. 0.5 seconds is by default.
50
50
  # Wait interval time for ::Appium::Core::Base::Wait, wait and wait_true
51
51
  # Provide Appium::Drive like { appium_lib: { wait_interval: 0.1 } }
52
52
  # @return [Integer]
@@ -29,6 +29,37 @@ module Appium
29
29
  # @driver.background_app(-1) #=> the app never come back. https://github.com/appium/appium/issues/7741
30
30
  #
31
31
 
32
+ # @!method start_recording_screen(remote_path:, user:, pass:, method:, force_restart:,
33
+ # video_type:, time_limit:, video_quality:)
34
+ #
35
+ # @option [String] remote_path The path to the remote location, where the resulting video should be uploaded.
36
+ # The following protocols are supported: http/https, ftp.
37
+ # Null or empty string value (the default setting) means the content of resulting
38
+ # file should be encoded as Base64 and passed as the endpount response value.
39
+ # An exception will be thrown if the generated media file is too big to
40
+ # fit into the available process memory.
41
+ # This option only has an effect if there is screen recording process in progreess
42
+ # and `forceRestart` parameter is not set to `true`.
43
+ # @option [String] user The name of the user for the remote authentication.
44
+ # @option [String] pass The password for the remote authentication.
45
+ # @option [String] method The http multipart upload method name. The 'PUT' one is used by default.
46
+ # @option [Boolean] force_restart Whether to try to catch and upload/return the currently running screen recording
47
+ # (`false`, the default setting on server) or ignore the result of it
48
+ # and start a new recording immediately (`true`).
49
+ #
50
+ # @param [String] video_type The format of the screen capture to be recorded.
51
+ # Available formats: "h264", "mp4" or "fmp4". Default is "mp4".
52
+ # Only works for Simulator.
53
+ # @param [String] time_limit Recording time. 180 seconds is by default.
54
+ # @param [String] video_quality The video encoding quality (low, medium, high, photo - defaults to medium).
55
+ # Only works for real devices.
56
+ #
57
+ # @example
58
+ #
59
+ # @driver.start_recording_screen
60
+ # @driver.start_recording_screen video_type: 'h264', time_limit: '260'
61
+ #
62
+
32
63
  ####
33
64
  ## class << self
34
65
  ####
@@ -58,6 +89,29 @@ module Appium
58
89
  execute :background_app, {}, seconds: { timeout: duration_milli_sec }
59
90
  end
60
91
  end
92
+
93
+ add_screen_recording
94
+ end
95
+
96
+ private
97
+
98
+ def add_screen_recording
99
+ Appium::Core::Device.add_endpoint_method(:start_recording_screen) do
100
+ # rubocop:disable Metrics/ParameterLists
101
+ def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: nil, force_restart: nil,
102
+ video_type: 'mp4', time_limit: '180', video_quality: 'medium')
103
+ option = ::Appium::Core::Device::ScreenRecord.new(
104
+ remote_path: remote_path, user: user, pass: pass, method: method, force_restart: force_restart
105
+ ).upload_option
106
+
107
+ option[:videoType] = video_type
108
+ option[:timeLimit] = time_limit
109
+ option[:videoQuality] = video_quality
110
+
111
+ execute(:start_recording_screen, {}, { options: option })
112
+ end
113
+ # rubocop:enable Metrics/ParameterLists
114
+ end
61
115
  end
62
116
  end # class << self
63
117
  end # module Device
@@ -1,6 +1,6 @@
1
1
  module Appium
2
2
  module Core
3
- VERSION = '1.2.7'.freeze unless defined? ::Appium::Core::VERSION
4
- DATE = '2018-01-25'.freeze unless defined? ::Appium::Core::DATE
3
+ VERSION = '1.3.0'.freeze unless defined? ::Appium::Core::VERSION
4
+ DATE = '2018-01-28'.freeze unless defined? ::Appium::Core::DATE
5
5
  end
6
6
  end
@@ -1,3 +1,11 @@
1
+ #### v1.3.0 2018-01-28
2
+
3
+ - [b7a994b](https://github.com/appium/ruby_lib_core/commit/b7a994ba29b3870257cf7e8af602deb147afd791) Release 1.3.0
4
+ - [f421cad](https://github.com/appium/ruby_lib_core/commit/f421cad6a1941eb51837a8a2e5b4c403ae2aba42) add error message assertion
5
+ - [9864037](https://github.com/appium/ruby_lib_core/commit/9864037619e102decdf5e8f888352eb355193f65) move screen recording command to common (#55)
6
+ - [8cffce7](https://github.com/appium/ruby_lib_core/commit/8cffce73ec45443dcc037b9b440de44e946ba13a) Update CHANGELOG.md
7
+
8
+
1
9
  #### v1.2.7 2018-01-25
2
10
 
3
11
  - [02b3845](https://github.com/appium/ruby_lib_core/commit/02b3845a58afb349f62e5d699cfcccee20810665) Release 1.2.7
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: 1.2.7
4
+ version: 1.3.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: 2018-01-24 00:00:00.000000000 Z
11
+ date: 2018-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -218,6 +218,7 @@ files:
218
218
  - lib/appium_lib_core/common/log.rb
219
219
  - lib/appium_lib_core/common/logger.rb
220
220
  - lib/appium_lib_core/device/multi_touch.rb
221
+ - lib/appium_lib_core/device/screen_record.rb
221
222
  - lib/appium_lib_core/device/touch_actions.rb
222
223
  - lib/appium_lib_core/driver.rb
223
224
  - lib/appium_lib_core/ios.rb