eyes_appium 3.17.17 → 3.17.18
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.
- 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 +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d548d80f8f62f27431cf406721de70b14ba54e21f4262513ab46b7ecf7f25fd1
|
4
|
+
data.tar.gz: 36c8f0d24954f3894690944df1124832399e333369d26d6970c008cca7a08d3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e374bc938d297ead0eda2e20bc4798eaea2c882e0b46eabdc95d84e16046f0ce5ce869b1d2f5895f027256137cb21339fbdce447471625b2969afc1b6507b8e8
|
7
|
+
data.tar.gz: 78c9a400553dd78b3fc9d3dd3e58fe77dec6b31dc03a7acde34a8609a87cab23aea532608ed4bde03f0a41d242eb1813c9ca30076206f680c154161f1be236f5
|
@@ -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_appium
|
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: eyes_selenium
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.17.
|
19
|
+
version: 3.17.18
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.17.
|
26
|
+
version: 3.17.18
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: appium_lib
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,11 +45,13 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- lib/applitools/appium/android_region_provider.rb
|
48
49
|
- lib/applitools/appium/android_screenshot.rb
|
49
50
|
- lib/applitools/appium/driver.rb
|
50
51
|
- lib/applitools/appium/eyes.rb
|
51
52
|
- lib/applitools/appium/initialize_1.9.rb
|
52
53
|
- lib/applitools/appium/initialize_2.0.rb
|
54
|
+
- lib/applitools/appium/ios_region_provider.rb
|
53
55
|
- lib/applitools/appium/ios_screenshot.rb
|
54
56
|
- lib/applitools/appium/region_provider.rb
|
55
57
|
- lib/applitools/appium/screenshot.rb
|