eyes_selenium 3.17.4 → 3.17.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/applitools/selenium/target.rb +6 -1
- data/lib/applitools/selenium/visual_grid/chrome_emulation_info.rb +7 -4
- data/lib/applitools/selenium/visual_grid/desktop_browser_info.rb +3 -3
- data/lib/applitools/selenium/visual_grid/eyes_connector.rb +0 -1
- data/lib/applitools/selenium/visual_grid/i_render_browser_info.rb +6 -1
- data/lib/applitools/selenium/visual_grid/ios_device_info.rb +3 -3
- data/lib/applitools/selenium/visual_grid/ios_screen_orientation.rb +1 -1
- data/lib/applitools/selenium/visual_grid/render_browser_info.rb +2 -2
- data/lib/applitools/selenium/visual_grid/vg_match_window_data.rb +32 -1
- data/lib/applitools/selenium/visual_grid/visual_grid_eyes.rb +5 -0
- data/lib/applitools/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65a0bdc234bb2f3a65da2e815b70ed012b1ffd1d0cda9dfacbd020adb1fee174
|
4
|
+
data.tar.gz: a360ea896e3f78638056e97569da66709a1e6c8926187ffe81cf02f6ac253733
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4c40b1019cc770571e5df1c48aa361ee2cf382f7d91be6bcbb2c8f45308501d61f71b658246fbabf5d4fa2fc1f6334ff83265df94383510bec04827ed8c858a
|
7
|
+
data.tar.gz: ce0d13d3612172c78e4a59aedd7bae13d5328ec2e0eddaef21ff3d160bd517a92dcaba522691593dc9ef84f264b356c81c765f5ba68d923d6cb3c99812d80773
|
@@ -21,7 +21,7 @@ module Applitools
|
|
21
21
|
|
22
22
|
attr_accessor :element, :frames, :region_to_check, :coordinate_type, :options, :ignored_regions,
|
23
23
|
:floating_regions, :frame_or_element, :regions, :layout_regions, :content_regions,
|
24
|
-
:strict_regions, :accessibility_regions
|
24
|
+
:strict_regions, :accessibility_regions, :convert_coordinates_block
|
25
25
|
|
26
26
|
private :frame_or_element, :frame_or_element=
|
27
27
|
|
@@ -33,6 +33,7 @@ module Applitools
|
|
33
33
|
script_hooks: { beforeCaptureScreenshot: '' }
|
34
34
|
}
|
35
35
|
self.regions = {}
|
36
|
+
self.convert_coordinates_block = nil
|
36
37
|
reset_for_fullscreen
|
37
38
|
end
|
38
39
|
|
@@ -374,6 +375,10 @@ module Applitools
|
|
374
375
|
nil
|
375
376
|
end
|
376
377
|
|
378
|
+
def convert_coordinates(&block)
|
379
|
+
self.convert_coordinates_block = block
|
380
|
+
end
|
381
|
+
|
377
382
|
private
|
378
383
|
|
379
384
|
def reset_for_fullscreen
|
@@ -7,7 +7,7 @@ module Applitools
|
|
7
7
|
DEFAULT_CONFIG = proc do
|
8
8
|
{
|
9
9
|
platform: 'linux',
|
10
|
-
browser_type:
|
10
|
+
browser_type: BrowserType::CHROME,
|
11
11
|
# size_mode: 'full-page',
|
12
12
|
viewport_size: Applitools::RectangleSize.from_any_argument(width: 0, height: 0)
|
13
13
|
}
|
@@ -25,18 +25,21 @@ module Applitools
|
|
25
25
|
# end
|
26
26
|
#
|
27
27
|
def initialize(*args)
|
28
|
-
|
28
|
+
options = Applitools::Utils.extract_options!(args.dup)
|
29
|
+
super(options)
|
29
30
|
case args[0]
|
30
31
|
when String
|
31
32
|
self.emulation_info = EmulationInfo.new.tap do |ei|
|
32
33
|
ei.device_name = args[0]
|
33
|
-
ei.screen_orientation = args[1] ||
|
34
|
+
ei.screen_orientation = args[1] || Orientation::PORTRAIT
|
34
35
|
end
|
35
36
|
when Hash
|
36
37
|
self.emulation_info = EmulationInfo.new.tap do |ei|
|
37
38
|
ei.device_name = args[0][:device_name]
|
38
|
-
ei.screen_orientation = args[0][:screen_orientation] ||
|
39
|
+
ei.screen_orientation = args[0][:screen_orientation] || Orientation::PORTRAIT
|
39
40
|
end
|
41
|
+
else
|
42
|
+
raise Applitools::EyesIllegalArgument, 'You should pass :device_name and :screen_orientation'
|
40
43
|
end
|
41
44
|
end
|
42
45
|
|
@@ -7,7 +7,7 @@ module Applitools
|
|
7
7
|
DEFAULT_CONFIG = proc do
|
8
8
|
{
|
9
9
|
platform: 'linux',
|
10
|
-
browser_type:
|
10
|
+
browser_type: BrowserType::CHROME,
|
11
11
|
# size_mode: 'full-page',
|
12
12
|
viewport_size: Applitools::RectangleSize.from_any_argument(width: 0, height: 0)
|
13
13
|
}
|
@@ -20,7 +20,7 @@ module Applitools
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def initialize(options = {})
|
23
|
-
super
|
23
|
+
super
|
24
24
|
if options[:width] && options[:height]
|
25
25
|
self.viewport_size = Applitools::RectangleSize.from_any_argument(width: options[:width], height: options[:height])
|
26
26
|
end
|
@@ -29,7 +29,7 @@ module Applitools
|
|
29
29
|
|
30
30
|
def platform
|
31
31
|
case browser_type
|
32
|
-
when
|
32
|
+
when BrowserType::EDGE_LEGACY, BrowserType::EDGE_CHROMIUM, BrowserType::EDGE_CHROMIUM_ONE_VERSION_BACK
|
33
33
|
'windows'
|
34
34
|
else
|
35
35
|
'linux'
|
@@ -3,11 +3,16 @@ module Applitools
|
|
3
3
|
class IRenderBrowserInfo < ::Applitools::AbstractConfiguration
|
4
4
|
|
5
5
|
object_field :viewport_size, Applitools::RectangleSize
|
6
|
-
enum_field :browser_type,
|
6
|
+
enum_field :browser_type, BrowserType.enum_values
|
7
7
|
string_field :platform
|
8
8
|
string_field :size_mode
|
9
9
|
string_field :baseline_env_name
|
10
10
|
|
11
|
+
def initialize(options = {})
|
12
|
+
super()
|
13
|
+
self.baseline_env_name = options[:baseline_env_name] if options[:baseline_env_name]
|
14
|
+
end
|
15
|
+
|
11
16
|
def to_s
|
12
17
|
return "#{viewport_size} (#{browser_type})"
|
13
18
|
end
|
@@ -21,10 +21,10 @@ module Applitools
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def initialize(options = {})
|
24
|
-
super
|
24
|
+
super
|
25
25
|
self.ios_device_info = EmulationInfo.new.tap do |ei|
|
26
26
|
ei.device_name = options[:device_name]
|
27
|
-
ei.screen_orientation = options[:screen_orientation] || options[:orientation] ||
|
27
|
+
ei.screen_orientation = options[:screen_orientation] || options[:orientation] || IosScreenOrientation::PORTRAIT
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -40,7 +40,7 @@ module Applitools
|
|
40
40
|
|
41
41
|
class EmulationInfo < EmulationBaseInfo
|
42
42
|
enum_field :device_name, IosDeviceName.enum_values
|
43
|
-
enum_field :screen_orientation,
|
43
|
+
enum_field :screen_orientation, IosScreenOrientation.enum_values
|
44
44
|
|
45
45
|
def json_data
|
46
46
|
{
|
@@ -23,7 +23,7 @@ module Applitools
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def initialize(options = {})
|
26
|
-
super
|
26
|
+
super
|
27
27
|
if options[:width] && options[:height]
|
28
28
|
self.viewport_size = Applitools::RectangleSize.from_any_argument(width: options[:width], height: options[:height])
|
29
29
|
end
|
@@ -33,7 +33,7 @@ module Applitools
|
|
33
33
|
def platform
|
34
34
|
return 'ios' if ios_device_info
|
35
35
|
case browser_type
|
36
|
-
when
|
36
|
+
when BrowserType::EDGE_LEGACY, BrowserType::EDGE_CHROMIUM, BrowserType::EDGE_CHROMIUM_ONE_VERSION_BACK
|
37
37
|
'windows'
|
38
38
|
else
|
39
39
|
'linux'
|
@@ -3,6 +3,15 @@
|
|
3
3
|
module Applitools
|
4
4
|
module Selenium
|
5
5
|
class VgMatchWindowData < Applitools::MatchWindowData
|
6
|
+
CONVERT_COORDINATES = proc do |region, selector_regions|
|
7
|
+
begin
|
8
|
+
offset_region = selector_regions.last
|
9
|
+
new_location = region.location.offset_negative(Applitools::Location.new(offset_region['x'].to_i, offset_region['y'].to_i))
|
10
|
+
region.location = new_location
|
11
|
+
rescue
|
12
|
+
Applitools::EyesLogger.error("Failed to convert coordinates for #{region}")
|
13
|
+
end
|
14
|
+
end
|
6
15
|
class RegionCoordinatesError < ::Applitools::EyesError
|
7
16
|
attr_accessor :region
|
8
17
|
def initialize(region, message)
|
@@ -109,7 +118,11 @@ module Applitools
|
|
109
118
|
region = selector_regions[target.regions[region]]
|
110
119
|
raise RegionCoordinatesError.new(r, region['error']) if region['error']
|
111
120
|
retrieved_region = Applitools::Region.new(region['x'], region['y'], region['width'], region['height'])
|
112
|
-
result_region =
|
121
|
+
result_region = if r.padding_proc.is_a? Proc
|
122
|
+
r.padding_proc.call(retrieved_region)
|
123
|
+
else
|
124
|
+
retrieved_region
|
125
|
+
end
|
113
126
|
result << result_region
|
114
127
|
end
|
115
128
|
end
|
@@ -118,36 +131,54 @@ module Applitools
|
|
118
131
|
|
119
132
|
def convert_ignored_regions_coordinates
|
120
133
|
return unless @need_convert_ignored_regions_coordinates
|
134
|
+
if target.convert_coordinates_block.is_a?(Proc)
|
135
|
+
@ignored_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
|
136
|
+
end
|
121
137
|
self.ignored_regions = @ignored_regions.map(&:with_padding).map(&:to_hash)
|
122
138
|
@need_convert_ignored_regions_coordinates = false
|
123
139
|
end
|
124
140
|
|
125
141
|
def convert_floating_regions_coordinates
|
126
142
|
return unless @need_convert_floating_regions_coordinates
|
143
|
+
if target.convert_coordinates_block.is_a?(Proc)
|
144
|
+
@floating_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
|
145
|
+
end
|
127
146
|
self.floating_regions = @floating_regions
|
128
147
|
@need_convert_floating_regions_coordinates = false
|
129
148
|
end
|
130
149
|
|
131
150
|
def convert_layout_regions_coordinates
|
132
151
|
return unless @need_convert_layout_regions_coordinates
|
152
|
+
if target.convert_coordinates_block.is_a?(Proc)
|
153
|
+
@layout_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
|
154
|
+
end
|
133
155
|
self.layout_regions = @layout_regions
|
134
156
|
@need_convert_layout_regions_coordinates = false
|
135
157
|
end
|
136
158
|
|
137
159
|
def convert_strict_regions_coordinates
|
138
160
|
return unless @need_convert_strict_regions_coordinates
|
161
|
+
if target.convert_coordinates_block.is_a?(Proc)
|
162
|
+
@strict_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
|
163
|
+
end
|
139
164
|
self.strict_regions = @strict_regions
|
140
165
|
@need_convert_strict_regions_coordinates = false
|
141
166
|
end
|
142
167
|
|
143
168
|
def convert_content_regions_coordinates
|
144
169
|
return unless @need_convert_content_regions_coordinates
|
170
|
+
if target.convert_coordinates_block.is_a?(Proc)
|
171
|
+
@content_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
|
172
|
+
end
|
145
173
|
self.content_regions = @content_regions
|
146
174
|
@need_convert_content_regions_coordinates = false
|
147
175
|
end
|
148
176
|
|
149
177
|
def convert_accessibility_regions_coordinates
|
150
178
|
return unless @need_convert_accessibility_regions_coordinates
|
179
|
+
if target.convert_coordinates_block.is_a?(Proc)
|
180
|
+
@accessibility_regions.each { |r| target.convert_coordinates_block.call(r, selector_regions)}
|
181
|
+
end
|
151
182
|
self.accessibility_regions = @accessibility_regions
|
152
183
|
@need_convert_accessibility_regions_coordinates = false
|
153
184
|
end
|
@@ -154,6 +154,7 @@ module Applitools
|
|
154
154
|
mod = Digest::SHA2.hexdigest(script_thread_result[:script_result])
|
155
155
|
|
156
156
|
region_x_paths = get_regions_x_paths(target_to_check)
|
157
|
+
|
157
158
|
render_task = RenderTask.new(
|
158
159
|
"Render #{config.short_description} - #{tag}",
|
159
160
|
script_thread_result[:result]['value'],
|
@@ -169,6 +170,10 @@ module Applitools
|
|
169
170
|
)
|
170
171
|
end
|
171
172
|
|
173
|
+
if size_mod == 'selector'
|
174
|
+
target_to_check.convert_coordinates(&Applitools::Selenium::VgMatchWindowData::CONVERT_COORDINATES)
|
175
|
+
end
|
176
|
+
|
172
177
|
title = begin
|
173
178
|
driver.title
|
174
179
|
rescue StandardError => e
|
data/lib/applitools/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eyes_selenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.17.
|
4
|
+
version: 3.17.10
|
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-06-
|
11
|
+
date: 2020-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eyes_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.17.
|
19
|
+
version: 3.17.10
|
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.10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: selenium-webdriver
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|