appium_lib_core 4.1.0 → 4.3.1

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.
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Appium
16
+ module Core
17
+ module Mac2
18
+ module Device
19
+ module Screen
20
+ def self.add_methods
21
+ ::Appium::Core::Device.add_endpoint_method(:start_recording_screen) do
22
+ def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT',
23
+ file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil,
24
+ fps: nil, preset: nil, video_filter: nil, time_limit: nil,
25
+ enable_capture_clicks: nil, enable_cursor_capture: nil, device_id: nil)
26
+ option = ::Appium::Core::Base::Device::ScreenRecord.new(
27
+ remote_path: remote_path, user: user, pass: pass, method: method,
28
+ file_field_name: file_field_name, form_fields: form_fields, headers: headers,
29
+ force_restart: force_restart
30
+ ).upload_option
31
+
32
+ option[:fps] = fps unless fps.nil?
33
+ option[:preset] = preset unless preset.nil?
34
+ option[:videoFilter] = video_filter unless video_filter.nil?
35
+ option[:captureClicks] = enable_capture_clicks unless enable_capture_clicks.nil?
36
+ option[:captureCursor] = enable_cursor_capture unless enable_cursor_capture.nil?
37
+ option[:deviceId] = device_id unless device_id.nil?
38
+ option[:timeLimit] = time_limit unless time_limit.nil?
39
+
40
+ execute(:start_recording_screen, {}, { options: option })
41
+ end
42
+ end
43
+ end
44
+ end # module Screen
45
+ end # module Device
46
+ end # module Mac2
47
+ end # module Core
48
+ end # module Appium
@@ -21,6 +21,9 @@ module Appium
21
21
  # To extend Appium related SearchContext into ::Selenium::WebDriver::Element
22
22
  include ::Appium::Core::Base::SearchContext
23
23
 
24
+ # TODO: Probably can remove own TakesScreenshot since Selenium 4
25
+ include ::Appium::Core::Base::TakesScreenshot
26
+
24
27
  # Returns the value of attributes like below. Read each platform to know more details.
25
28
  #
26
29
  # uiautomator2: https://github.com/appium/appium-uiautomator2-server/blob/203cc7e57ce477f3cff5d95b135d1b3450a6033a/app/src/main/java/io/appium/uiautomator2/utils/Attribute.java#L19
@@ -99,6 +102,56 @@ module Appium
99
102
  w = driver.window_size
100
103
  ::Selenium::WebDriver::Point.new "#{center_x} / #{w.width.to_f}", "#{center_y} / #{w.height.to_f}"
101
104
  end
105
+
106
+ # Return an element screenshot as base64
107
+ #
108
+ # @return String Base 64 encoded string
109
+ #
110
+ # @example
111
+ #
112
+ # element.screenshot #=> "iVBORw0KGgoAAAANSUhEUgAABDgAAAB+CAIAAABOPDa6AAAAAX"
113
+ #
114
+ def screenshot
115
+ bridge.take_element_screenshot(self)
116
+ end
117
+
118
+ # Return an element screenshot in the given format
119
+ #
120
+ # @param [:base64, :png] format
121
+ # @return String screenshot
122
+ #
123
+ # @example
124
+ #
125
+ # element.screenshot_as :base64 #=> "iVBORw0KGgoAAAANSUhEUgAABDgAAAB+CAIAAABOPDa6AAAAAX"
126
+ #
127
+ def screenshot_as(format)
128
+ case format
129
+ when :base64
130
+ bridge.take_element_screenshot(self)
131
+ when :png
132
+ bridge.take_element_screenshot(self).unpack('m')[0]
133
+ else
134
+ raise Core::Error::UnsupportedOperationError, "unsupported format: #{format.inspect}"
135
+ end
136
+ end
137
+
138
+ # Save an element screenshot to the given path
139
+ #
140
+ # @param [String] png_path A path to save the screenshot
141
+ # @return [File] Path to the element screenshot.
142
+ #
143
+ # @example
144
+ #
145
+ # element.save_screenshot("fine_name.png")
146
+ #
147
+ def save_screenshot(png_path)
148
+ extension = File.extname(png_path).downcase
149
+ if extension != '.png'
150
+ ::Appium::Logger.warn 'name used for saved screenshot does not match file type. '\
151
+ 'It should end with .png extension'
152
+ end
153
+ File.open(png_path, 'wb') { |f| f << screenshot_as(:png) }
154
+ end
102
155
  end
103
156
  end # module Core
104
157
  end # module Appium
@@ -14,7 +14,7 @@
14
14
 
15
15
  module Appium
16
16
  module Core
17
- VERSION = '4.1.0' unless defined? ::Appium::Core::VERSION
18
- DATE = '2020-12-25' unless defined? ::Appium::Core::DATE
17
+ VERSION = '4.3.1' unless defined? ::Appium::Core::VERSION
18
+ DATE = '2021-02-07' unless defined? ::Appium::Core::DATE
19
19
  end
20
20
  end
data/release_notes.md CHANGED
@@ -1,3 +1,42 @@
1
+ #### v4.3.1 2021-02-07
2
+
3
+ - [1f4d52c](https://github.com/appium/ruby_lib_core/commit/1f4d52cc915783cf89cf4b8ca5a21bd1af5403e0) Release 4.3.1
4
+ - [fb41014](https://github.com/appium/ruby_lib_core/commit/fb410146567ed03902b602813881fd3abc3a3d28) chore: change log level
5
+ - [1e54662](https://github.com/appium/ruby_lib_core/commit/1e546628c871e4ed9c8aa038a455d03e4e2e6c4e) chore : Create Dependabot config file (#309)
6
+
7
+
8
+ #### v4.3.0 2021-02-05
9
+
10
+ - [6e85426](https://github.com/appium/ruby_lib_core/commit/6e85426c1ff8f3e4b90d3da5305d493500539467) Release 4.3.0
11
+ - [405b3d8](https://github.com/appium/ruby_lib_core/commit/405b3d8e627323376dbf74a4423d0ebce5ca0cad) feat: Add mac2 module and screen recording option (#308)
12
+ - [876d254](https://github.com/appium/ruby_lib_core/commit/876d25494c76c31ad5c26900d6e30e30ecd8d20c) chore: teak types in yardoc (#307)
13
+ - [7548ea9](https://github.com/appium/ruby_lib_core/commit/7548ea9cb7e031a3689a63e75d32da82d317488a) test: add wait
14
+ - [9d6fef4](https://github.com/appium/ruby_lib_core/commit/9d6fef469fad8bccf61ee6565f2e30095f4e2a6a) feat: makes direct_connect true by default (#303)
15
+ - [761067e](https://github.com/appium/ruby_lib_core/commit/761067e5c42cfb3e4c1e5c5a377dbeb3c903eb7b) test: add location test (#302)
16
+ - [bd33397](https://github.com/appium/ruby_lib_core/commit/bd3339791552d2eb5181ca4475c9ebc90644a456) chore(deps-dev): update rubocop requirement from = 1.8.0 to = 1.8.1 (#301)
17
+
18
+
19
+ #### v4.2.1 2021-01-10
20
+
21
+ - [23e944e](https://github.com/appium/ruby_lib_core/commit/23e944ed72c6ea861532f5acc1381af4441705e6) Release 4.2.1
22
+ - [1a416b1](https://github.com/appium/ruby_lib_core/commit/1a416b136beb2b9115d3eb6637b22817f0e55601) chore: move rotable for w3c (#300)
23
+ - [95821c6](https://github.com/appium/ruby_lib_core/commit/95821c6f1a4ebc785e2dc3e6e16c1705521237e8) ci: bump android app (#299)
24
+ - [4e1770e](https://github.com/appium/ruby_lib_core/commit/4e1770e3b9d6995b1d5430b9033097609edca1c8) chore(deps-dev): update rubocop requirement from = 1.7.0 to = 1.8.0 (#298)
25
+ - [b230512](https://github.com/appium/ruby_lib_core/commit/b230512c52875ea70545d3d2262c306640f87f7d) chore: fix rubocop
26
+
27
+
28
+ #### v4.2.0 2021-01-02
29
+
30
+ - [e55b2b6](https://github.com/appium/ruby_lib_core/commit/e55b2b6f7fe293091be0d3835075e66c74f3b9dd) Release 4.2.0
31
+ - [b0cd235](https://github.com/appium/ruby_lib_core/commit/b0cd235a7fb6e5a8957871650bf86962cf0e0368) feat: append screenshot in element module as well (#297)
32
+
33
+
34
+ #### v4.1.1 2020-12-25
35
+
36
+ - [3a4cf56](https://github.com/appium/ruby_lib_core/commit/3a4cf56c73a64fb10ca0b7fecc5800719838095c) Release 4.1.1
37
+ - [6b2d7dd](https://github.com/appium/ruby_lib_core/commit/6b2d7ddf027b5a9f49cbe9a7f5622eb345e2c076) fix: keyword argument in Ruby 3
38
+
39
+
1
40
  #### v4.1.0 2020-12-25
2
41
 
3
42
  - [89110a9](https://github.com/appium/ruby_lib_core/commit/89110a995b869471a134f8c45ebe8dfbaabfba63) Release 4.1.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: 4.1.0
4
+ version: 4.3.1
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-12-26 00:00:00.000000000 Z
11
+ date: 2021-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -134,14 +134,14 @@ dependencies:
134
134
  requirements:
135
135
  - - '='
136
136
  - !ruby/object:Gem::Version
137
- version: 1.7.0
137
+ version: 1.8.1
138
138
  type: :development
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - '='
143
143
  - !ruby/object:Gem::Version
144
- version: 1.7.0
144
+ version: 1.8.1
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: appium_thor
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -221,6 +221,7 @@ extra_rdoc_files: []
221
221
  files:
222
222
  - ".github/ISSUE_TEMPLATE/issue-report.md"
223
223
  - ".github/contributing.md"
224
+ - ".github/dependabot.yml"
224
225
  - ".github/issue_template.md"
225
226
  - ".github/workflows/unittest.yml"
226
227
  - ".gitignore"
@@ -268,6 +269,7 @@ files:
268
269
  - lib/appium_lib_core/common/base/driver.rb
269
270
  - lib/appium_lib_core/common/base/http_default.rb
270
271
  - lib/appium_lib_core/common/base/platform.rb
272
+ - lib/appium_lib_core/common/base/rotable.rb
271
273
  - lib/appium_lib_core/common/base/screenshot.rb
272
274
  - lib/appium_lib_core/common/base/search_context.rb
273
275
  - lib/appium_lib_core/common/command.rb
@@ -287,6 +289,7 @@ files:
287
289
  - lib/appium_lib_core/common/device/ime_actions.rb
288
290
  - lib/appium_lib_core/common/device/keyboard.rb
289
291
  - lib/appium_lib_core/common/device/keyevent.rb
292
+ - lib/appium_lib_core/common/device/orientation.rb
290
293
  - lib/appium_lib_core/common/device/screen_record.rb
291
294
  - lib/appium_lib_core/common/device/setting.rb
292
295
  - lib/appium_lib_core/common/device/touch_actions.rb
@@ -313,6 +316,10 @@ files:
313
316
  - lib/appium_lib_core/ios/xcuitest/device/performance.rb
314
317
  - lib/appium_lib_core/ios/xcuitest/device/screen.rb
315
318
  - lib/appium_lib_core/ios_xcuitest.rb
319
+ - lib/appium_lib_core/mac2.rb
320
+ - lib/appium_lib_core/mac2/bridge.rb
321
+ - lib/appium_lib_core/mac2/device.rb
322
+ - lib/appium_lib_core/mac2/device/screen.rb
316
323
  - lib/appium_lib_core/patch.rb
317
324
  - lib/appium_lib_core/version.rb
318
325
  - lib/appium_lib_core/windows.rb