eyes_core 3.17.17 → 3.17.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/applitools/appium/android_region_provider.rb +24 -0
- data/lib/applitools/appium/eyes.rb +16 -6
- data/lib/applitools/appium/ios_region_provider.rb +25 -0
- data/lib/applitools/appium/region_provider.rb +35 -10
- data/lib/applitools/appium/utils.rb +12 -1
- data/lib/applitools/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61272f8c794f0a12c2eb824d096987716ddfbc0e4a7fd9346687a4ebc71cc95f
|
4
|
+
data.tar.gz: 22a3c71582d53d02dc6bfd0911c094830483f8fe9738ed445e7636304ab96752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b46455cced31d0443c153654f657087ae06c37501d62de78a1cddaac33a4e81045f5876c24e4c11bd91a4b252de546c09c5a65c9c1c47907b59b94a7b76c9975
|
7
|
+
data.tar.gz: 46d878ddb0273372f69d835127dc86becbd190cbe34e77fc838b1e66c8d00f28838540ae226175f1395385ff334afa2af398de55d21ff2ec087b83dcc135c217
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'region_provider'
|
4
|
+
module Applitools
|
5
|
+
module Appium
|
6
|
+
class AndroidRegionProvider < ::Applitools::Appium::RegionProvider
|
7
|
+
private
|
8
|
+
|
9
|
+
def convert_element_coordinates
|
10
|
+
Applitools::Region.from_location_size(eye_region.location, eye_region.size)
|
11
|
+
end
|
12
|
+
|
13
|
+
def convert_viewport_rect_coordinates
|
14
|
+
region = viewport_rect
|
15
|
+
Applitools::Region.new(
|
16
|
+
region['left'],
|
17
|
+
region['top'],
|
18
|
+
region['width'],
|
19
|
+
region['height']
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
|
4
4
|
attr_accessor :status_bar_height
|
5
|
+
|
5
6
|
def perform_driver_settings_for_appium_driver
|
6
7
|
self.region_visibility_strategy = Applitools::Selenium::NopRegionVisibilityStrategy.new
|
7
8
|
self.force_driver_resolution_as_viewport_size = true
|
@@ -51,7 +52,7 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
|
|
51
52
|
|
52
53
|
eyes_element = target_to_check.region_to_check.call(driver)
|
53
54
|
self.eyes_element_to_check = eyes_element
|
54
|
-
region_provider =
|
55
|
+
region_provider = region_provider_class.new(driver, eyes_element)
|
55
56
|
match_data.read_target(target_to_check, driver)
|
56
57
|
|
57
58
|
check_window_base(
|
@@ -119,16 +120,19 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
|
|
119
120
|
|
120
121
|
def viewport_screenshot
|
121
122
|
logger.info 'Viewport screenshot requested...'
|
122
|
-
|
123
|
-
self.screenshot = screenshot_class.new(
|
124
|
-
Applitools::Screenshot.from_datastream(driver.screenshot_as(:png))
|
125
|
-
)
|
123
|
+
obtain_viewport_screenshot
|
126
124
|
end
|
127
125
|
|
128
126
|
def element_screenshot
|
129
127
|
logger.info 'Element screenshot requested...'
|
128
|
+
obtain_viewport_screenshot
|
129
|
+
end
|
130
|
+
|
131
|
+
def obtain_viewport_screenshot
|
130
132
|
self.screenshot = screenshot_class.new(
|
131
|
-
|
133
|
+
Applitools::Screenshot.from_datastream(driver.screenshot_as(:png)),
|
134
|
+
status_bar_height: Applitools::Utils::EyesSeleniumUtils.status_bar_height(driver),
|
135
|
+
device_pixel_ratio: Applitools::Utils::EyesSeleniumUtils.device_pixel_ratio(driver)
|
132
136
|
)
|
133
137
|
end
|
134
138
|
|
@@ -137,4 +141,10 @@ class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
|
|
137
141
|
return Applitools::Appium::AndroidScreenshot if Applitools::Utils::EyesSeleniumUtils.android?(Applitools::Appium::Driver::AppiumLib)
|
138
142
|
raise Applitools::EyesError, 'Unknown device type'
|
139
143
|
end
|
144
|
+
|
145
|
+
def region_provider_class
|
146
|
+
return Applitools::Appium::IosRegionProvider if Applitools::Utils::EyesSeleniumUtils.ios?(Applitools::Appium::Driver::AppiumLib)
|
147
|
+
return Applitools::Appium::AndroidRegionProvider if Applitools::Utils::EyesSeleniumUtils.android?(Applitools::Appium::Driver::AppiumLib)
|
148
|
+
raise Applitools::EyesError, 'Unknown device type'
|
149
|
+
end
|
140
150
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
require_relative 'region_provider'
|
4
|
+
module Applitools
|
5
|
+
module Appium
|
6
|
+
class IosRegionProvider < ::Applitools::Appium::RegionProvider
|
7
|
+
private
|
8
|
+
|
9
|
+
def convert_element_coordinates
|
10
|
+
Applitools::Region.from_location_size(eye_region.location, eye_region.size).
|
11
|
+
scale_it!(scale_factor)
|
12
|
+
end
|
13
|
+
|
14
|
+
def convert_viewport_rect_coordinates
|
15
|
+
region = viewport_rect
|
16
|
+
Applitools::Region.new(
|
17
|
+
region['left'],
|
18
|
+
region['top'],
|
19
|
+
region['width'],
|
20
|
+
region['height']
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -3,23 +3,48 @@
|
|
3
3
|
module Applitools
|
4
4
|
module Appium
|
5
5
|
class RegionProvider
|
6
|
-
attr_accessor :driver, :eye_region, :
|
6
|
+
attr_accessor :driver, :eye_region, :region_to_check
|
7
7
|
|
8
8
|
def initialize(driver, eye_region)
|
9
9
|
self.driver = driver
|
10
10
|
self.eye_region = eye_region
|
11
|
+
self.region_to_check = Applitools::Region::EMPTY
|
12
|
+
convert_region_coordinates
|
11
13
|
end
|
12
14
|
|
13
15
|
def region
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
region_to_check
|
17
|
+
end
|
18
|
+
|
19
|
+
def coordinate_type
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def viewport_rect
|
26
|
+
Applitools::Utils::EyesSeleniumUtils.viewport_rect(driver)
|
27
|
+
end
|
28
|
+
|
29
|
+
def convert_region_coordinates
|
30
|
+
self.region_to_check = case eye_region
|
31
|
+
when ::Selenium::WebDriver::Element, Applitools::Selenium::Element
|
32
|
+
convert_element_coordinates
|
33
|
+
else
|
34
|
+
convert_viewport_rect_coordinates
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def convert_element_coordinates
|
39
|
+
raise Applitools::AbstractMethodCalled.new(:convert_region_coordinates, 'Applitools::Appium::RegionProvider')
|
40
|
+
end
|
41
|
+
|
42
|
+
def convert_viewport_rect_coordinates
|
43
|
+
raise Applitools::AbstractMethodCalled.new(:convert_viewport_rect_coordinates, 'Applitools::Appium::RegionProvider')
|
44
|
+
end
|
45
|
+
|
46
|
+
def scale_factor
|
47
|
+
Applitools::Utils::EyesSeleniumUtils.device_pixel_ratio(driver)
|
23
48
|
end
|
24
49
|
end
|
25
50
|
end
|
@@ -28,7 +28,7 @@ module Applitools::Appium
|
|
28
28
|
def device_pixel_ratio(executor)
|
29
29
|
session_info = session_capabilities(executor)
|
30
30
|
return session_info['pixelRatio'].to_f if session_info['pixelRatio']
|
31
|
-
|
31
|
+
1
|
32
32
|
end
|
33
33
|
|
34
34
|
def status_bar_height(executor)
|
@@ -37,6 +37,17 @@ module Applitools::Appium
|
|
37
37
|
0
|
38
38
|
end
|
39
39
|
|
40
|
+
def viewport_rect(executor)
|
41
|
+
session_info = session_capabilities(executor)
|
42
|
+
return session_info['viewportRect'] if session_info['viewportRect']
|
43
|
+
{
|
44
|
+
'left' => 0,
|
45
|
+
'top' => 0,
|
46
|
+
'width' => 0,
|
47
|
+
'height' => 0
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
40
51
|
def session_capabilities(executor)
|
41
52
|
executor.session_capabilities if executor.respond_to? :session_capabilities
|
42
53
|
end
|
data/lib/applitools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eyes_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.17.
|
4
|
+
version: 3.17.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Applitools Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oily_png
|
@@ -260,11 +260,13 @@ files:
|
|
260
260
|
- ext/eyes_core/extconf.rb
|
261
261
|
- ext/eyes_core/eyes_core.c
|
262
262
|
- ext/eyes_core/eyes_core.h
|
263
|
+
- lib/applitools/appium/android_region_provider.rb
|
263
264
|
- lib/applitools/appium/android_screenshot.rb
|
264
265
|
- lib/applitools/appium/driver.rb
|
265
266
|
- lib/applitools/appium/eyes.rb
|
266
267
|
- lib/applitools/appium/initialize_1.9.rb
|
267
268
|
- lib/applitools/appium/initialize_2.0.rb
|
269
|
+
- lib/applitools/appium/ios_region_provider.rb
|
268
270
|
- lib/applitools/appium/ios_screenshot.rb
|
269
271
|
- lib/applitools/appium/region_provider.rb
|
270
272
|
- lib/applitools/appium/screenshot.rb
|