appium_lib_core 4.1.1 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/appium_lib_core/common/base/driver.rb +1 -1
- data/lib/appium_lib_core/common/base/screenshot.rb +1 -1
- data/lib/appium_lib_core/patch.rb +53 -0
- data/lib/appium_lib_core/version.rb +2 -2
- data/release_notes.md +6 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9668fe14e164d0c0c79f9d651fbc1452b0ec736965bc6da01791ea47153bc1b0
|
4
|
+
data.tar.gz: 141ee5425f08eef464d40b6fef0c1a396a5d382576100718f6d3efee1842fac0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bda31b12a734ce4d95d4f13517f50e3fe69deb34596a7d3cba326191325c9e42825e9dafd65975ba6a6bf65f45432698e370aa1f848f37507c15ff7a2d5237c8
|
7
|
+
data.tar.gz: e69702c72a42d84ca442294afb91087e195fb8f326a051a2796d3b829c6dd5ba143d51574ed3d14caae0f3fe2a318c86db80b23d484343bee930104ef9986742
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,17 @@ Read `release_notes.md` for commit level details.
|
|
10
10
|
|
11
11
|
### Deprecations
|
12
12
|
|
13
|
+
## [4.2.0] - 2021-01-02
|
14
|
+
|
15
|
+
### Enhancements
|
16
|
+
- Add `Element#screenshot`, `Element#screenshot_as` and `Element#save_screenshot` in Element module
|
17
|
+
- `Element#screenshot_as` and `Element#save_screenshot` are same as `Driver#element_screenshot_as` and `Driver#save_element_screenshot`
|
18
|
+
- `Element#screenshot` is same as `Element#screenshot_as(:base64)`
|
19
|
+
|
20
|
+
### Bug fixes
|
21
|
+
|
22
|
+
### Deprecations
|
23
|
+
|
13
24
|
## [4.1.1] - 2020-12-25
|
14
25
|
|
15
26
|
### Enhancements
|
@@ -27,7 +27,7 @@ module Appium
|
|
27
27
|
include ::Selenium::WebDriver::DriverExtensions::HasWebStorage
|
28
28
|
|
29
29
|
include ::Appium::Core::Base::SearchContext
|
30
|
-
include ::Appium::Core::Base::
|
30
|
+
include ::Appium::Core::Base::TakesScreenshot
|
31
31
|
|
32
32
|
# Private API.
|
33
33
|
# Do not use this for general use. Used by flutter driver to get bridge for creating a new element
|
@@ -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.
|
18
|
-
DATE = '
|
17
|
+
VERSION = '4.2.0' unless defined? ::Appium::Core::VERSION
|
18
|
+
DATE = '2021-01-02' unless defined? ::Appium::Core::DATE
|
19
19
|
end
|
20
20
|
end
|
data/release_notes.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
#### v4.2.0 2021-01-02
|
2
|
+
|
3
|
+
- [e55b2b6](https://github.com/appium/ruby_lib_core/commit/e55b2b6f7fe293091be0d3835075e66c74f3b9dd) Release 4.2.0
|
4
|
+
- [b0cd235](https://github.com/appium/ruby_lib_core/commit/b0cd235a7fb6e5a8957871650bf86962cf0e0368) feat: append screenshot in element module as well (#297)
|
5
|
+
|
6
|
+
|
1
7
|
#### v4.1.1 2020-12-25
|
2
8
|
|
3
9
|
- [3a4cf56](https://github.com/appium/ruby_lib_core/commit/3a4cf56c73a64fb10ca0b7fecc5800719838095c) Release 4.1.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: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuaki MATSUO
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|
@@ -325,7 +325,7 @@ homepage: https://github.com/appium/ruby_lib_core/
|
|
325
325
|
licenses:
|
326
326
|
- Apache-2.0
|
327
327
|
metadata: {}
|
328
|
-
post_install_message:
|
328
|
+
post_install_message:
|
329
329
|
rdoc_options: []
|
330
330
|
require_paths:
|
331
331
|
- lib
|
@@ -340,8 +340,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
340
340
|
- !ruby/object:Gem::Version
|
341
341
|
version: '0'
|
342
342
|
requirements: []
|
343
|
-
rubygems_version: 3.2
|
344
|
-
signing_key:
|
343
|
+
rubygems_version: 3.1.2
|
344
|
+
signing_key:
|
345
345
|
specification_version: 4
|
346
346
|
summary: Minimal Ruby library for Appium.
|
347
347
|
test_files: []
|