eyes_selenium 3.15.34 → 3.15.39
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/configuration.rb +12 -2
- data/lib/applitools/selenium/css_translate_position_provider.rb +3 -1
- data/lib/applitools/selenium/eyes.rb +2 -2
- data/lib/applitools/selenium/full_page_capture_algorithm.rb +2 -0
- data/lib/applitools/selenium/selenium_eyes.rb +28 -23
- data/lib/applitools/selenium/target.rb +65 -2
- data/lib/applitools/selenium/visual_grid/eyes_connector.rb +12 -12
- data/lib/applitools/selenium/visual_grid/vg_match_window_data.rb +14 -1
- data/lib/applitools/selenium/visual_grid/visual_grid_eyes.rb +21 -1
- data/lib/applitools/selenium/visual_grid/visual_grid_runner.rb +6 -2
- 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: aab8529dcb077f8221beb47146b533b99972fed1bb8564526ce3e3080ccadab4
|
4
|
+
data.tar.gz: c019144e8b13f7c3f7217dac08d96fbc91e935e028502406c0e76f1518e8facc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99b0b16d5160a1ccbff7915afedaf15b62965ca8a58980e73e198f3e1aa5986d4277dcf423cfaf14da1c61329e831f768af2e15c79fb202a47771da4b4169ad1
|
7
|
+
data.tar.gz: baf60a724aaf8819182a61b726cfbef865e49fe745fbb3c58a9ec589148f95d04aacb6e87b8534bcfcfe84be50a15eed8e8c1c4893b79811b88427b2f33c9255
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'applitools/selenium/stitch_modes'
|
2
|
-
require 'applitools/selenium/stitch_modes'
|
3
2
|
require 'applitools/selenium/browsers_info'
|
4
3
|
|
5
4
|
module Applitools
|
6
5
|
module Selenium
|
7
6
|
class Configuration < Applitools::EyesBaseConfiguration
|
7
|
+
|
8
8
|
DEFAULT_CONFIG = proc do
|
9
9
|
{
|
10
10
|
force_full_page_screenshot: false,
|
@@ -12,7 +12,8 @@ module Applitools
|
|
12
12
|
stitch_mode: Applitools::Selenium::StitchModes::CSS,
|
13
13
|
hide_scrollbars: false,
|
14
14
|
hide_caret: false,
|
15
|
-
browsers_info: Applitools::Selenium::BrowsersInfo.new
|
15
|
+
browsers_info: Applitools::Selenium::BrowsersInfo.new,
|
16
|
+
accessibility_validation: Applitools::AccessibilityLevel::NONE
|
16
17
|
}
|
17
18
|
end
|
18
19
|
class << self
|
@@ -30,6 +31,15 @@ module Applitools
|
|
30
31
|
|
31
32
|
object_field :browsers_info, Applitools::Selenium::BrowsersInfo
|
32
33
|
int_field :concurrent_sessions
|
34
|
+
enum_field :accessibility_validation, Applitools::AccessibilityLevel.enum_values
|
35
|
+
|
36
|
+
def match_level_keys
|
37
|
+
super << :accessibility_validation
|
38
|
+
end
|
39
|
+
|
40
|
+
def default_match_settings
|
41
|
+
super.merge(accessibility_validation: accessibility_validation)
|
42
|
+
end
|
33
43
|
|
34
44
|
def add_browser(*args)
|
35
45
|
case args.size
|
@@ -38,7 +38,9 @@ module Applitools::Selenium
|
|
38
38
|
#
|
39
39
|
# @param [Applitools::Location] value The location.
|
40
40
|
def restore_state(value)
|
41
|
-
|
41
|
+
Applitools::Utils::EyesSeleniumUtils.set_current_transforms(executor, "translate(10px, 0px)")
|
42
|
+
|
43
|
+
transforms = value.values.compact.map(&:to_s).select { |el| !el.empty? }
|
42
44
|
Applitools::Utils::EyesSeleniumUtils.set_transforms(executor, value)
|
43
45
|
if transforms.empty?
|
44
46
|
self.last_state_position = Applitools::Location::TOP_LEFT
|
@@ -6,11 +6,11 @@ module Applitools
|
|
6
6
|
options = Applitools::Utils.extract_options!(args)
|
7
7
|
server_url = options.delete(:server_url)
|
8
8
|
server_url = args.first unless server_url
|
9
|
-
runner = options.delete(:visual_grid_runner)
|
9
|
+
runner = options.delete(:visual_grid_runner) || options.delete(:runner)
|
10
10
|
if runner.is_a? Applitools::Selenium::VisualGridRunner
|
11
11
|
super Applitools::Selenium::VisualGridEyes.new(runner, server_url)
|
12
12
|
else
|
13
|
-
super Applitools::Selenium::SeleniumEyes.new(server_url)
|
13
|
+
super Applitools::Selenium::SeleniumEyes.new(server_url, runner: runner || Applitools::ClassicRunner.new)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -116,6 +116,8 @@ module Applitools::Selenium
|
|
116
116
|
logger.info 'Done! Adding initial screenshot..'
|
117
117
|
logger.info "Initial part:(0,0) [#{image.width} x #{image.height}]"
|
118
118
|
|
119
|
+
image.crop!(0,0,stitched_image.width < image.width ? stitched_image.width : image.width, stitched_image.height < image.height ? stitched_image.height : image.height)
|
120
|
+
|
119
121
|
stitched_image.replace! image, 0, 0
|
120
122
|
logger.info 'Done!'
|
121
123
|
|
@@ -109,7 +109,7 @@ module Applitools::Selenium
|
|
109
109
|
# Eyes Server at the specified url.
|
110
110
|
#
|
111
111
|
# @param server_url The Eyes Server URL.
|
112
|
-
def initialize(
|
112
|
+
def initialize(*args)
|
113
113
|
ensure_config
|
114
114
|
super
|
115
115
|
self.base_agent_id = "eyes.selenium.ruby/#{Applitools::VERSION}".freeze
|
@@ -178,7 +178,7 @@ module Applitools::Selenium
|
|
178
178
|
|
179
179
|
self.device_pixel_ratio = UNKNOWN_DEVICE_PIXEL_RATIO
|
180
180
|
self.position_provider = self.class.position_provider(
|
181
|
-
|
181
|
+
stitch_mode, driver, disable_horizontal_scrolling, disable_vertical_scrolling, explicit_entire_size
|
182
182
|
)
|
183
183
|
|
184
184
|
self.eyes_screenshot_factory = lambda do |image|
|
@@ -191,6 +191,11 @@ module Applitools::Selenium
|
|
191
191
|
self.viewport_size = nil if force_driver_resolution_as_viewport_size
|
192
192
|
ensure_running_session
|
193
193
|
end
|
194
|
+
if runner
|
195
|
+
runner.add_batch(batch.id) do
|
196
|
+
server_connector.close_batch(batch.id)
|
197
|
+
end
|
198
|
+
end
|
194
199
|
@driver
|
195
200
|
end
|
196
201
|
|
@@ -208,25 +213,25 @@ module Applitools::Selenium
|
|
208
213
|
# @option value [Symbol] :css use Css to perform stitching.
|
209
214
|
# @option value [Symbol] :scroll Scroll to perform stitching.
|
210
215
|
# @return [Symbol] The type of stitching.
|
211
|
-
def stitch_mode=(value)
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
end
|
216
|
+
# def stitch_mode=(value)
|
217
|
+
# @stitch_mode = if value.to_s.upcase == Applitools::STITCH_MODE[:css].to_s
|
218
|
+
# Applitools::STITCH_MODE[:css]
|
219
|
+
# else
|
220
|
+
# Applitools::STITCH_MODE[:scroll]
|
221
|
+
# end
|
222
|
+
# unless driver.nil?
|
223
|
+
# self.position_provider = self.class.position_provider(
|
224
|
+
# stitch_mode, driver, disable_horizontal_scrolling, disable_vertical_scrolling, explicit_entire_size
|
225
|
+
# )
|
226
|
+
# end
|
227
|
+
# if stitch_mode == Applitools::STITCH_MODE[:css]
|
228
|
+
# @css_transition_original_hide_scrollbars = hide_scrollbars
|
229
|
+
# self.hide_scrollbars = true
|
230
|
+
# else
|
231
|
+
# self.hide_scrollbars = @css_transition_original_hide_scrollbars || false
|
232
|
+
# end
|
233
|
+
# value
|
234
|
+
# end
|
230
235
|
|
231
236
|
# Takes a snapshot of the application under test and matches it with the expected output.
|
232
237
|
#
|
@@ -860,10 +865,10 @@ module Applitools::Selenium
|
|
860
865
|
max_height = explicit_entire_size.height
|
861
866
|
end
|
862
867
|
case stitch_mode
|
863
|
-
when
|
868
|
+
when Applitools::Selenium::StitchModes::SCROLL
|
864
869
|
Applitools::Selenium::ScrollPositionProvider.new(driver, disable_horizontal, disable_vertical,
|
865
870
|
max_width, max_height)
|
866
|
-
when
|
871
|
+
when Applitools::Selenium::StitchModes::CSS
|
867
872
|
Applitools::Selenium::CssTranslatePositionProvider.new(driver, disable_horizontal, disable_vertical,
|
868
873
|
max_width, max_height)
|
869
874
|
end
|
@@ -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, :match_level, :layout_regions, :content_regions,
|
24
|
-
:strict_regions
|
24
|
+
:strict_regions, :accessibility_regions
|
25
25
|
|
26
26
|
private :frame_or_element, :frame_or_element=
|
27
27
|
|
@@ -221,11 +221,20 @@ module Applitools
|
|
221
221
|
replace_element(original_region, new_region, floating_regions)
|
222
222
|
when :ignore
|
223
223
|
replace_element(original_region, new_region, ignored_regions)
|
224
|
+
when :accessibility_regions
|
225
|
+
replace_element(original_region, new_region, accessibility_regions)
|
224
226
|
end
|
225
227
|
end
|
226
228
|
|
227
229
|
def replace_element(original, new, array)
|
228
|
-
|
230
|
+
case new
|
231
|
+
when Array
|
232
|
+
index = array.index(original)
|
233
|
+
array.delete_at(index)
|
234
|
+
array.insert(index, *new)
|
235
|
+
when Applitools::Selenium::VGRegion
|
236
|
+
array[array.index(original)] = new
|
237
|
+
end
|
229
238
|
end
|
230
239
|
|
231
240
|
def match_level(*args)
|
@@ -306,6 +315,55 @@ module Applitools
|
|
306
315
|
dup.region(region)
|
307
316
|
end
|
308
317
|
|
318
|
+
def accessibility(*args)
|
319
|
+
options = Applitools::Utils.extract_options! args
|
320
|
+
unless options[:type]
|
321
|
+
raise Applitools::EyesError,
|
322
|
+
'You should call Target.accessibility(region, region_type: type). The region_type option is required'
|
323
|
+
end
|
324
|
+
unless Applitools::AccessibilityRegionType.enum_values.include?(options[:type])
|
325
|
+
raise Applitools::EyesIllegalArgument,
|
326
|
+
"The region type should be one of [#{Applitools::AccessibilityRegionType.enum_values.join(', ')}]"
|
327
|
+
end
|
328
|
+
handle_frames
|
329
|
+
padding_proc = proc do |region|
|
330
|
+
Applitools::AccessibilityRegion.new(
|
331
|
+
region, options[:type]
|
332
|
+
)
|
333
|
+
end
|
334
|
+
|
335
|
+
accessibility_regions << case args.first
|
336
|
+
when ::Selenium::WebDriver::Element
|
337
|
+
proc do |driver, return_element = false|
|
338
|
+
element = applitools_element_from_selenium_element(driver, args.first)
|
339
|
+
next element, padding_proc if return_element
|
340
|
+
padding_proc.call(element)
|
341
|
+
end
|
342
|
+
when Applitools::Selenium::Element
|
343
|
+
proc do |_driver, return_element = false|
|
344
|
+
next args.first, padding_proc if return_element
|
345
|
+
padding_proc.call(args.first)
|
346
|
+
end
|
347
|
+
when Applitools::Region
|
348
|
+
Applitools::AccessibilityRegion.new(
|
349
|
+
args.first, options[:type]
|
350
|
+
)
|
351
|
+
when String
|
352
|
+
proc do |driver, return_element = false|
|
353
|
+
element = driver.find_element(name_or_id: args.first)
|
354
|
+
next element, padding_proc if return_element
|
355
|
+
padding_proc.call(element)
|
356
|
+
end
|
357
|
+
else
|
358
|
+
proc do |driver, return_element = false|
|
359
|
+
elements = driver.find_elements(*args)
|
360
|
+
next elements, padding_proc if return_element
|
361
|
+
elements.map { |e| padding_proc.call(e) }
|
362
|
+
end
|
363
|
+
end
|
364
|
+
self
|
365
|
+
end
|
366
|
+
|
309
367
|
private
|
310
368
|
|
311
369
|
def reset_for_fullscreen
|
@@ -316,11 +374,16 @@ module Applitools
|
|
316
374
|
reset_content_regions
|
317
375
|
reset_layout_regions
|
318
376
|
reset_strict_regions
|
377
|
+
reset_accessibility_regions
|
319
378
|
options[:stitch_content] = false
|
320
379
|
options[:timeout] = nil
|
321
380
|
options[:trim] = false
|
322
381
|
end
|
323
382
|
|
383
|
+
def reset_accessibility_regions
|
384
|
+
self.accessibility_regions = []
|
385
|
+
end
|
386
|
+
|
324
387
|
def reset_ignore
|
325
388
|
self.ignored_regions = []
|
326
389
|
end
|
@@ -94,12 +94,12 @@ module Applitools
|
|
94
94
|
render_status['selectorRegions']
|
95
95
|
end
|
96
96
|
|
97
|
-
def match_level_keys
|
98
|
-
|
99
|
-
end
|
97
|
+
# def match_level_keys
|
98
|
+
# %w(match_level exact scale remainder ).map(&:to_sym)
|
99
|
+
# end
|
100
100
|
|
101
101
|
def update_default_settings(match_data)
|
102
|
-
match_level_keys.each do |k|
|
102
|
+
config.match_level_keys.each do |k|
|
103
103
|
match_data.send("#{k}=", default_match_settings[k])
|
104
104
|
end
|
105
105
|
end
|
@@ -108,14 +108,14 @@ module Applitools
|
|
108
108
|
"useragent: #{render_status['userAgent']}"
|
109
109
|
end
|
110
110
|
|
111
|
-
def default_match_settings
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
end
|
111
|
+
# def default_match_settings
|
112
|
+
# {
|
113
|
+
# match_level: match_level,
|
114
|
+
# exact: exact,
|
115
|
+
# scale: server_scale,
|
116
|
+
# remainder: server_remainder
|
117
|
+
# }
|
118
|
+
# end
|
119
119
|
|
120
120
|
def set_viewport_size(*_args); end
|
121
121
|
|
@@ -53,6 +53,11 @@ module Applitools
|
|
53
53
|
@need_convert_strict_regions_coordinates = true unless @strict_regions.empty?
|
54
54
|
end
|
55
55
|
|
56
|
+
if target.respond_to? :accessibility_regions
|
57
|
+
@accessibility_regions = obtain_regions_coordinates(target.accessibility_regions, driver)
|
58
|
+
@need_convert_accessibility_regions_coordinates = true unless @accessibility_regions.empty?
|
59
|
+
end
|
60
|
+
|
56
61
|
# # floating regions
|
57
62
|
return unless target.respond_to? :floating_regions
|
58
63
|
target.floating_regions.each do |r|
|
@@ -97,7 +102,9 @@ module Applitools
|
|
97
102
|
region = r.region
|
98
103
|
region = selector_regions[target.regions[region]]
|
99
104
|
raise RegionCoordinatesError.new(r, region['error']) if region['error']
|
100
|
-
|
105
|
+
retrieved_region = Applitools::Region.new(region['x'], region['y'], region['width'], region['height'])
|
106
|
+
result_region = r.padding_proc.call(retrieved_region) if r.padding_proc.is_a? Proc
|
107
|
+
result << result_region
|
101
108
|
end
|
102
109
|
end
|
103
110
|
result
|
@@ -132,6 +139,12 @@ module Applitools
|
|
132
139
|
self.content_regions = @content_regions
|
133
140
|
@need_convert_content_regions_coordinates = false
|
134
141
|
end
|
142
|
+
|
143
|
+
def convert_accessibility_regions_coordinates
|
144
|
+
return unless @need_convert_accessibility_regions_coordinates
|
145
|
+
self.accessibility_regions = @accessibility_regions
|
146
|
+
@need_convert_accessibility_regions_coordinates = false
|
147
|
+
end
|
135
148
|
end
|
136
149
|
end
|
137
150
|
end
|
@@ -48,6 +48,7 @@ module Applitools
|
|
48
48
|
|
49
49
|
config.app_name = options[:app_name] if config.app_name.nil? || config.app_name && config.app_name.empty?
|
50
50
|
config.test_name = options[:test_name] if config.test_name.nil? || config.test_name && config.test_name.empty?
|
51
|
+
config.viewport_size = Applitools::RectangleSize.from_any_argument(options[:viewport_size]) if config.viewport_size.nil? || config.viewport_size && config.viewport_size.empty?
|
51
52
|
|
52
53
|
self.driver = options.delete(:driver)
|
53
54
|
self.current_url = driver.current_url
|
@@ -59,6 +60,9 @@ module Applitools
|
|
59
60
|
end
|
60
61
|
|
61
62
|
visual_grid_manager.open(self)
|
63
|
+
visual_grid_manager.add_batch(batch.id) do
|
64
|
+
server_connector.close_batch(batch.id)
|
65
|
+
end
|
62
66
|
|
63
67
|
logger.info("getting all browsers info...")
|
64
68
|
browsers_info_list = config.browsers_info
|
@@ -169,6 +173,16 @@ module Applitools
|
|
169
173
|
target.content_regions.each do |r|
|
170
174
|
selenium_regions[element_or_region(r, target, :content_regions)] = :content
|
171
175
|
end
|
176
|
+
target.accessibility_regions.each do |r|
|
177
|
+
case (r = element_or_region(r, target, :accessibility_regions))
|
178
|
+
when Array
|
179
|
+
r.each do |rr|
|
180
|
+
selenium_regions[rr] = :accessibility
|
181
|
+
end
|
182
|
+
else
|
183
|
+
selenium_regions[r] = :accessibility
|
184
|
+
end
|
185
|
+
end
|
172
186
|
selenium_regions[region_to_check] = :target if size_mod == 'selector'
|
173
187
|
|
174
188
|
selenium_regions
|
@@ -194,7 +208,13 @@ module Applitools
|
|
194
208
|
def element_or_region(target_element, target, options_key)
|
195
209
|
if target_element.respond_to?(:call)
|
196
210
|
region, padding_proc = target_element.call(driver, true)
|
197
|
-
|
211
|
+
case region
|
212
|
+
when Array
|
213
|
+
regions_to_replace = region.map { |r| Applitools::Selenium::VGRegion.new(r, padding_proc) }
|
214
|
+
target.replace_region(target_element, regions_to_replace, options_key)
|
215
|
+
else
|
216
|
+
target.replace_region(target_element, Applitools::Selenium::VGRegion.new(region, padding_proc), options_key)
|
217
|
+
end
|
198
218
|
region
|
199
219
|
else
|
200
220
|
target_element
|
@@ -1,12 +1,13 @@
|
|
1
1
|
module Applitools
|
2
2
|
module Selenium
|
3
|
-
class VisualGridRunner
|
3
|
+
class VisualGridRunner < ::Applitools::EyesRunner
|
4
4
|
EMPTY_QUEUE = []
|
5
5
|
attr_accessor :all_eyes, :resource_cache, :put_cache, :rendering_info, :render_queue
|
6
6
|
|
7
7
|
alias queue render_queue
|
8
8
|
|
9
9
|
def initialize(concurrent_open_sessions = 10)
|
10
|
+
super()
|
10
11
|
self.all_eyes = []
|
11
12
|
self.render_queue = []
|
12
13
|
@thread_pool = Applitools::Selenium::VGThreadPool.new(concurrent_open_sessions)
|
@@ -41,13 +42,16 @@ module Applitools
|
|
41
42
|
@rendering_info ||= connector.rendering_info
|
42
43
|
end
|
43
44
|
|
44
|
-
def get_all_test_results
|
45
|
+
def get_all_test_results(throw_exception = false)
|
45
46
|
while !(all_eyes.select {|e| e.open?}.empty?)
|
46
47
|
sleep 0.5
|
47
48
|
end
|
49
|
+
delete_all_batches
|
48
50
|
all_eyes.map { |e| e.test_list.map(&:test_result) }.flatten
|
49
51
|
end
|
50
52
|
|
53
|
+
def aggregate_results(*_args); end
|
54
|
+
|
51
55
|
private
|
52
56
|
|
53
57
|
def all_running_tests
|
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.15.
|
4
|
+
version: 3.15.39
|
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-
|
11
|
+
date: 2019-11-06 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.15.
|
19
|
+
version: 3.15.39
|
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.15.
|
26
|
+
version: 3.15.39
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: selenium-webdriver
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|