eyes_core 3.15.22 → 3.15.23
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/core/match_window_data.rb +136 -31
- data/lib/applitools/core/match_window_task.rb +12 -0
- data/lib/applitools/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8193a4da049d679616fb629be42d17037ada49ad051c44bd22b6d5efbd8f58ef
|
4
|
+
data.tar.gz: da5c9331be468acfacf0f7c1549bb46e86af071769aed22a4706d0e7a3b76604
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d4c8a0258045022e274cc81a581b70da4c050bb479ae2bfc3e60ed6ed7943a60f49b263d53635b5a8af9e84e9da8bf58974002a9f5ca351861777c939f1ce3b
|
7
|
+
data.tar.gz: f737aec5ca6a53344bb5afb922896562387fdd1874201a89b81a09d336c5e07fadf5debab32c17c812c24d20acd88a4881cb9f295115092baba85674fc1c6c42
|
@@ -26,6 +26,9 @@ module Applitools
|
|
26
26
|
'IgnoreDisplacements' => false,
|
27
27
|
'Ignore' => [],
|
28
28
|
'Floating' => [],
|
29
|
+
'Layout' => [],
|
30
|
+
'Strict' => [],
|
31
|
+
'Content' => [],
|
29
32
|
'Exact' => {
|
30
33
|
'MinDiffIntensity' => 0,
|
31
34
|
'MinDiffWidth' => 0,
|
@@ -80,6 +83,9 @@ module Applitools
|
|
80
83
|
@floating_regions = []
|
81
84
|
@need_convert_ignored_regions_coordinates = false
|
82
85
|
@need_convert_floating_regions_coordinates = false
|
86
|
+
@need_convert_strict_regions_coordinates = false
|
87
|
+
@need_convert_content_regions_coordinates = false
|
88
|
+
@need_convert_layout_regions_coordinates = false
|
83
89
|
end
|
84
90
|
|
85
91
|
def screenshot
|
@@ -118,6 +124,27 @@ module Applitools
|
|
118
124
|
end
|
119
125
|
end
|
120
126
|
|
127
|
+
def layout_regions=(value)
|
128
|
+
Applitools::ArgumentGuard.is_a? value, 'value', Array
|
129
|
+
value.each do |r|
|
130
|
+
current_data['Options']['ImageMatchSettings']['Layout'] << r.to_hash if self.class.valid_region(r)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def strict_regions=(value)
|
135
|
+
Applitools::ArgumentGuard.is_a? value, 'value', Array
|
136
|
+
value.each do |r|
|
137
|
+
current_data['Options']['ImageMatchSettings']['Strict'] << r.to_hash if self.class.valid_region(r)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def content_regions=(value)
|
142
|
+
Applitools::ArgumentGuard.is_a? value, 'value', Array
|
143
|
+
value.each do |r|
|
144
|
+
current_data['Options']['ImageMatchSettings']['Content'] << r.to_hash if self.class.valid_region(r)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
121
148
|
def app_output=(value)
|
122
149
|
Applitools::ArgumentGuard.is_a? value, 'value', Applitools::AppOutputWithScreenshot
|
123
150
|
@app_output = value
|
@@ -203,16 +230,18 @@ module Applitools
|
|
203
230
|
end
|
204
231
|
# ignored regions
|
205
232
|
if target.respond_to? :ignored_regions
|
206
|
-
target.ignored_regions
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
233
|
+
@ignored_regions = obtain_regions_coordinates(target.ignored_regions, driver)
|
234
|
+
@need_convert_ignored_regions_coordinates = true unless @ignored_regions.empty?
|
235
|
+
# target.ignored_regions.each do |r|
|
236
|
+
# case r
|
237
|
+
# when Proc
|
238
|
+
# @ignored_regions << r.call(driver)
|
239
|
+
# @need_convert_ignored_regions_coordinates = true
|
240
|
+
# when Applitools::Region
|
241
|
+
# @ignored_regions << r
|
242
|
+
# @need_convert_ignored_regions_coordinates = true
|
243
|
+
# end
|
244
|
+
# end
|
216
245
|
end
|
217
246
|
|
218
247
|
# floating regions
|
@@ -230,6 +259,39 @@ module Applitools
|
|
230
259
|
@need_convert_floating_regions_coordinates = true
|
231
260
|
end
|
232
261
|
end
|
262
|
+
|
263
|
+
# Layout regions
|
264
|
+
if target.respond_to? :layout_regions
|
265
|
+
@layout_regions = obtain_regions_coordinates(target.layout_regions, driver)
|
266
|
+
@need_convert_layout_regions_coordinates = true unless @layout_regions.empty?
|
267
|
+
end
|
268
|
+
|
269
|
+
# Strict regions
|
270
|
+
if target.respond_to? :strict_regions
|
271
|
+
@strict_regions = obtain_regions_coordinates(target.strict_regions, driver)
|
272
|
+
@need_convert_strict_regions_coordinates = true unless @strict_regions.empty?
|
273
|
+
end
|
274
|
+
|
275
|
+
# Content regions
|
276
|
+
if target.respond_to? :content_regions
|
277
|
+
@content_regions = obtain_regions_coordinates(target.content_regions, driver)
|
278
|
+
@need_convert_content_regions_coordinates = true unless @content_regions.empty?
|
279
|
+
end
|
280
|
+
target
|
281
|
+
end
|
282
|
+
|
283
|
+
def obtain_regions_coordinates(regions, driver)
|
284
|
+
result = []
|
285
|
+
regions.each do |r|
|
286
|
+
case r
|
287
|
+
when Proc
|
288
|
+
region = r.call(driver)
|
289
|
+
result << Applitools::Region.from_location_size(region.location, region.size)
|
290
|
+
when Applitools::Region
|
291
|
+
result << r
|
292
|
+
end
|
293
|
+
end
|
294
|
+
result
|
233
295
|
end
|
234
296
|
|
235
297
|
def target_options_to_read
|
@@ -256,36 +318,79 @@ module Applitools
|
|
256
318
|
|
257
319
|
def convert_ignored_regions_coordinates
|
258
320
|
return unless @need_convert_ignored_regions_coordinates
|
259
|
-
self.ignored_regions = @ignored_regions
|
260
|
-
|
261
|
-
|
321
|
+
self.ignored_regions = convert_regions_coordinates(@ignored_regions)
|
322
|
+
# self.ignored_regions = @ignored_regions.map do |r|
|
323
|
+
# self.class.convert_coordinates(r, app_output.screenshot)
|
324
|
+
# end unless app_output.screenshot.nil?
|
262
325
|
@need_convert_ignored_regions_coordinates = false
|
263
326
|
end
|
264
327
|
|
328
|
+
def convert_layout_regions_coordinates
|
329
|
+
return unless @need_convert_layout_regions_coordinates
|
330
|
+
self.layout_regions = convert_regions_coordinates(@layout_regions)
|
331
|
+
@need_convert_layout_regions_coordinates = false
|
332
|
+
end
|
333
|
+
|
334
|
+
def convert_strict_regions_coordinates
|
335
|
+
return unless @need_convert_strict_regions_coordinates
|
336
|
+
self.strict_regions = convert_regions_coordinates(@strict_regions)
|
337
|
+
@need_convert_strict_regions_coordinates = false
|
338
|
+
end
|
339
|
+
|
340
|
+
def convert_content_regions_coordinates
|
341
|
+
return unless @need_convert_content_regions_coordinates
|
342
|
+
self.content_regions = convert_regions_coordinates(@content_regions)
|
343
|
+
@need_convert_content_regions_coordinates = false
|
344
|
+
end
|
345
|
+
|
346
|
+
def convert_regions_coordinates(regions)
|
347
|
+
regions.dup.map { |r| self.class.convert_coordinates(r, app_output.screenshot) } unless app_output.screenshot.nil?
|
348
|
+
end
|
349
|
+
|
265
350
|
def convert_floating_regions_coordinates
|
266
351
|
return unless @need_convert_floating_regions_coordinates
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
352
|
+
unless app_output.screenshot.nil?
|
353
|
+
self.floating_regions = @floating_regions.map do |r|
|
354
|
+
updated_region = app_output.screenshot.convert_region_location(
|
355
|
+
r,
|
356
|
+
Applitools::EyesScreenshot::COORDINATE_TYPES[:context_relative],
|
357
|
+
Applitools::EyesScreenshot::COORDINATE_TYPES[:screenshot_as_is]
|
358
|
+
)
|
359
|
+
updated_region.to_hash
|
360
|
+
Applitools::FloatingRegion.new(
|
361
|
+
updated_region.left,
|
362
|
+
updated_region.top,
|
363
|
+
r.width,
|
364
|
+
r.height,
|
365
|
+
r.max_left_offset,
|
366
|
+
r.max_top_offset,
|
367
|
+
r.max_right_offset,
|
368
|
+
r.max_bottom_offset
|
369
|
+
).padding(r.current_padding)
|
370
|
+
end
|
371
|
+
end
|
285
372
|
@need_convert_floating_regions_coordinates = false
|
286
373
|
end
|
287
374
|
|
288
375
|
def to_hash
|
376
|
+
if @need_convert_content_regions_coordinates
|
377
|
+
raise Applitools::EyesError.new(
|
378
|
+
'You should convert coordinates for content_regions!'
|
379
|
+
)
|
380
|
+
end
|
381
|
+
|
382
|
+
if @need_convert_strict_regions_coordinates
|
383
|
+
raise Applitools::EyesError.new(
|
384
|
+
'You should convert coordinates for strict_regions!'
|
385
|
+
)
|
386
|
+
end
|
387
|
+
|
388
|
+
if @need_convert_layout_regions_coordinates
|
389
|
+
raise Applitools::EyesError.new(
|
390
|
+
'You should convert coordinates for layout_regions!'
|
391
|
+
)
|
392
|
+
end
|
393
|
+
|
289
394
|
if @need_convert_ignored_regions_coordinates
|
290
395
|
raise Applitools::EyesError.new(
|
291
396
|
'You should convert coordinates for ignored_regions!'
|
@@ -44,6 +44,9 @@ module Applitools
|
|
44
44
|
match_window_data.app_output = app_output
|
45
45
|
match_window_data.convert_ignored_regions_coordinates
|
46
46
|
match_window_data.convert_floating_regions_coordinates
|
47
|
+
match_window_data.convert_layout_regions_coordinates
|
48
|
+
match_window_data.convert_strict_regions_coordinates
|
49
|
+
match_window_data.convert_content_regions_coordinates
|
47
50
|
match_result = perform_match(match_window_data)
|
48
51
|
else
|
49
52
|
passed_ignore_mismatch = match_window_data.ignore_mismatch
|
@@ -51,6 +54,9 @@ module Applitools
|
|
51
54
|
match_window_data.app_output = app_output
|
52
55
|
match_window_data.convert_ignored_regions_coordinates
|
53
56
|
match_window_data.convert_floating_regions_coordinates
|
57
|
+
match_window_data.convert_layout_regions_coordinates
|
58
|
+
match_window_data.convert_strict_regions_coordinates
|
59
|
+
match_window_data.convert_content_regions_coordinates
|
54
60
|
match_window_data.ignore_mismatch = true
|
55
61
|
start = Time.now
|
56
62
|
match_result = perform_match(match_window_data)
|
@@ -68,6 +74,9 @@ module Applitools
|
|
68
74
|
match_window_data.app_output = app_output
|
69
75
|
match_window_data.convert_ignored_regions_coordinates
|
70
76
|
match_window_data.convert_floating_regions_coordinates
|
77
|
+
match_window_data.convert_layout_regions_coordinates
|
78
|
+
match_window_data.convert_strict_regions_coordinates
|
79
|
+
match_window_data.convert_content_regions_coordinates
|
71
80
|
match_window_data.ignore_mismatch = true
|
72
81
|
match_result = perform_match(match_window_data)
|
73
82
|
retry_time = Time.now - start
|
@@ -78,6 +87,9 @@ module Applitools
|
|
78
87
|
match_window_data.app_output = app_output
|
79
88
|
match_window_data.convert_ignored_regions_coordinates
|
80
89
|
match_window_data.convert_floating_regions_coordinates
|
90
|
+
match_window_data.convert_layout_regions_coordinates
|
91
|
+
match_window_data.convert_strict_regions_coordinates
|
92
|
+
match_window_data.convert_content_regions_coordinates
|
81
93
|
match_window_data.ignore_mismatch = passed_ignore_mismatch
|
82
94
|
match_result = perform_match(match_window_data)
|
83
95
|
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.15.
|
4
|
+
version: 3.15.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Applitools Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oily_png
|