eyes_core 3.17.17 → 3.17.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- 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
- data/lib/eyes_consts.rb +4 -0
- data/lib/eyes_core.rb +1 -0
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c2f68b068dd48b9cdae7e9cfc0e46431595ea08f
|
4
|
+
data.tar.gz: ee8077e2cbc57fd1f613b74726af18a4088b23b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca66f4e8f3f6743671732d3a7aa5de14c6aa3ce49a2145556ed8c6be925f3365359d7daa9bffeeca4993297459b53cf978b0594ec86102038d5258cfcbb4e2f8
|
7
|
+
data.tar.gz: 7f8464d5f9b98458d5cc99eacf76eeae3c26f73fb22d4ad5b5fac7ceaafc23beb2c8e3c39a163e6919814a51a1e61e9dcfaf9690af2ddaad3fc84d4990c932e9
|
@@ -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
data/lib/eyes_consts.rb
ADDED
data/lib/eyes_core.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.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Applitools Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-13 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
|
@@ -362,6 +364,7 @@ files:
|
|
362
364
|
- lib/applitools/utils/image_utils.rb
|
363
365
|
- lib/applitools/utils/utils.rb
|
364
366
|
- lib/applitools/version.rb
|
367
|
+
- lib/eyes_consts.rb
|
365
368
|
- lib/eyes_core.rb
|
366
369
|
- lib/eyes_rspec.rb
|
367
370
|
- lib/require_utils.rb
|
@@ -370,7 +373,7 @@ licenses:
|
|
370
373
|
- Applitools
|
371
374
|
metadata:
|
372
375
|
yard.run: yri
|
373
|
-
post_install_message:
|
376
|
+
post_install_message:
|
374
377
|
rdoc_options: []
|
375
378
|
require_paths:
|
376
379
|
- lib
|
@@ -386,8 +389,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
386
389
|
- !ruby/object:Gem::Version
|
387
390
|
version: '0'
|
388
391
|
requirements: []
|
389
|
-
|
390
|
-
|
392
|
+
rubyforge_project:
|
393
|
+
rubygems_version: 2.6.14.3
|
394
|
+
signing_key:
|
391
395
|
specification_version: 4
|
392
396
|
summary: Core of the Applitools Ruby SDK
|
393
397
|
test_files: []
|