eyes_selenium 3.18.4 → 4.0.0
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/browser_types.rb +10 -10
- data/lib/applitools/selenium/browsers_info.rb +8 -0
- data/lib/applitools/selenium/concerns/selenium_eyes.rb +2 -6
- data/lib/applitools/selenium/configuration.rb +1 -1
- data/lib/applitools/selenium/devices.rb +115 -24
- data/lib/applitools/selenium/driver.rb +20 -0
- data/lib/applitools/selenium/eyes.rb +2 -2
- data/lib/applitools/selenium/scripts/process_page_and_poll.rb +3 -4
- data/lib/applitools/selenium/selenium_eyes.rb +52 -48
- data/lib/applitools/selenium/target.rb +119 -124
- data/lib/applitools/selenium/visual_grid/chrome_emulation_info.rb +4 -0
- data/lib/applitools/selenium/visual_grid/desktop_browser_info.rb +6 -0
- data/lib/applitools/selenium/visual_grid/ios_device_info.rb +12 -0
- data/lib/applitools/selenium/visual_grid/ios_device_name.rb +8 -0
- data/lib/applitools/selenium/visual_grid/thread_pool.rb +2 -1
- data/lib/applitools/selenium/visual_grid/visual_grid_eyes.rb +103 -56
- data/lib/applitools/selenium/visual_grid/visual_grid_runner.rb +4 -0
- data/lib/applitools/version.rb +2 -1
- data/lib/eyes_selenium.rb +9 -0
- metadata +10 -10
@@ -7,6 +7,13 @@ require 'securerandom'
|
|
7
7
|
module Applitools
|
8
8
|
module Selenium
|
9
9
|
class VisualGridEyes
|
10
|
+
# new open, with eyes-manager
|
11
|
+
include Applitools::UniversalEyesOpen
|
12
|
+
# all checks here
|
13
|
+
include Applitools::UniversalEyesChecks
|
14
|
+
# add extract_text, extract_text_regions, locate
|
15
|
+
include Applitools::UniversalNewApi
|
16
|
+
|
10
17
|
include Applitools::Selenium::Concerns::SeleniumEyes
|
11
18
|
USE_DEFAULT_MATCH_TIMEOUT = -1
|
12
19
|
extend Forwardable
|
@@ -26,6 +33,10 @@ module Applitools
|
|
26
33
|
def_delegators 'config', *Applitools::Selenium::Configuration.methods_to_delegate
|
27
34
|
def_delegators 'config', *Applitools::EyesBaseConfiguration.methods_to_delegate
|
28
35
|
|
36
|
+
alias runner visual_grid_manager
|
37
|
+
attr_accessor :universal_eyes, :universal_driver
|
38
|
+
attr_accessor :debug_screenshots, :save_failed_tests, :scale_ratio, :disabled, :stitching_overlap, :compare_with_parent_branch
|
39
|
+
|
29
40
|
def initialize(visual_grid_manager, server_url = nil)
|
30
41
|
ensure_config
|
31
42
|
@server_connector = Applitools::Connectivity::ServerConnector.new(server_url)
|
@@ -43,6 +54,7 @@ module Applitools
|
|
43
54
|
|
44
55
|
def ensure_config
|
45
56
|
self.config = Applitools::Selenium::Configuration.new
|
57
|
+
self.send_dom = true
|
46
58
|
end
|
47
59
|
|
48
60
|
def full_agent_id
|
@@ -56,51 +68,60 @@ module Applitools
|
|
56
68
|
end
|
57
69
|
|
58
70
|
def open(*args)
|
59
|
-
self.test_uuid = SecureRandom.uuid
|
71
|
+
# self.test_uuid = SecureRandom.uuid
|
60
72
|
options = Applitools::Utils.extract_options!(args)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
config.
|
65
|
-
config.
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
self.
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
visual_grid_manager.
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
73
|
+
universal_open(options)
|
74
|
+
# Applitools::ArgumentGuard.hash(options, 'options', [:driver])
|
75
|
+
#
|
76
|
+
# config.app_name = options[:app_name] if options[:app_name]
|
77
|
+
# config.test_name = options[:test_name] if options[:test_name]
|
78
|
+
# config.agent_run_id = "#{config.test_name}--#{SecureRandom.hex(10)}"
|
79
|
+
#
|
80
|
+
# if config.viewport_size.nil? || config.viewport_size && config.viewport_size.empty?
|
81
|
+
# config.viewport_size = Applitools::RectangleSize.from_any_argument(options[:viewport_size]) if options[:viewport_size]
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# self.driver = Applitools::Selenium::SeleniumEyes.eyes_driver(options.delete(:driver), self)
|
85
|
+
# self.current_url = driver.current_url
|
86
|
+
#
|
87
|
+
# if viewport_size
|
88
|
+
# set_viewport_size(viewport_size)
|
89
|
+
# else
|
90
|
+
# self.viewport_size = get_viewport_size
|
91
|
+
# end
|
92
|
+
#
|
93
|
+
# visual_grid_manager.open(self)
|
94
|
+
# visual_grid_manager.add_batch(batch.id) do
|
95
|
+
# server_connector.close_batch(batch.id)
|
96
|
+
# end
|
97
|
+
#
|
98
|
+
# logger.info('Getting all browsers info...')
|
99
|
+
# browsers_info_list = config.browsers_info
|
100
|
+
# logger.info('Creating test descriptors for each browser info...')
|
101
|
+
# browsers_info_list.each(viewport_size) do |bi|
|
102
|
+
# test = Applitools::Selenium::RunningTest.new(eyes_connector, bi, driver).tap do |t|
|
103
|
+
# t.on_results_received do |results|
|
104
|
+
# visual_grid_manager.aggregate_result(results)
|
105
|
+
# end
|
106
|
+
# t.test_uuid = test_uuid
|
107
|
+
# end
|
108
|
+
# test_list.push test
|
109
|
+
# end
|
110
|
+
# self.opened = true
|
111
|
+
# driver
|
99
112
|
end
|
100
113
|
|
101
114
|
def get_viewport_size(web_driver = driver)
|
102
115
|
Applitools::ArgumentGuard.not_nil 'web_driver', web_driver
|
103
|
-
self.utils.extract_viewport_size(driver)
|
116
|
+
# self.utils.extract_viewport_size(driver)
|
117
|
+
driver_config_json = universal_driver_config(web_driver)
|
118
|
+
|
119
|
+
Applitools::EyesLogger.debug 'extract_viewport_size()'
|
120
|
+
viewport_size = runner.universal_client.core_get_viewport_size(driver_config_json)
|
121
|
+
result = Applitools::RectangleSize.new viewport_size[:width], viewport_size[:height]
|
122
|
+
|
123
|
+
Applitools::EyesLogger.debug "Viewport size is #{result}."
|
124
|
+
result
|
104
125
|
end
|
105
126
|
|
106
127
|
def eyes_connector
|
@@ -127,6 +148,8 @@ module Applitools
|
|
127
148
|
render_task = nil
|
128
149
|
target.default_full_page_for_vg
|
129
150
|
|
151
|
+
return universal_check(tag, target)
|
152
|
+
|
130
153
|
target_to_check = target.finalize
|
131
154
|
begin
|
132
155
|
check_in_frame(target_frames: target_to_check.frames) do
|
@@ -296,21 +319,33 @@ module Applitools
|
|
296
319
|
end
|
297
320
|
|
298
321
|
def close(throw_exception = true)
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
322
|
+
logger.info "close(#{throw_exception})"
|
323
|
+
logger.info 'Ending server session...'
|
324
|
+
|
325
|
+
universal_results = universal_eyes.close # Array even for one test
|
326
|
+
raise Applitools::EyesError.new("Request failed: #{universal_results[:message]}") if server_error?(universal_results)
|
327
|
+
key_transformed_results = Applitools::Utils.deep_stringify_keys(universal_results)
|
328
|
+
results = key_transformed_results.map {|result| Applitools::TestResults.new(result) }
|
329
|
+
# results = results.first if results.size == 1
|
330
|
+
# session_results_url = results.url
|
331
|
+
all_results = results.compact
|
332
|
+
|
333
|
+
|
334
|
+
# return false if test_list.empty?
|
335
|
+
# close_async
|
336
|
+
#
|
337
|
+
# until (states = test_list.map(&:state_name).uniq).count == 1 && states.first == :completed
|
338
|
+
# sleep 0.5
|
339
|
+
# end
|
340
|
+
# self.opened = false
|
341
|
+
#
|
342
|
+
# test_list.select { |t| t.pending_exceptions && !t.pending_exceptions.empty? }.each do |t|
|
343
|
+
# t.pending_exceptions.each do |e|
|
344
|
+
# raise e
|
345
|
+
# end
|
346
|
+
# end
|
347
|
+
#
|
348
|
+
# all_results = test_list.map(&:test_result).compact
|
314
349
|
failed_results = all_results.select { |r| !r.as_expected? }
|
315
350
|
|
316
351
|
if throw_exception
|
@@ -321,16 +356,18 @@ module Applitools
|
|
321
356
|
end
|
322
357
|
end
|
323
358
|
|
324
|
-
failed_results.empty? ? all_results.first : failed_results
|
359
|
+
failed_results.empty? ? all_results.first : failed_results.first
|
325
360
|
end
|
326
361
|
|
327
362
|
def abort_async
|
328
363
|
test_list.each(&:abort)
|
364
|
+
universal_sdk_abort
|
329
365
|
end
|
330
366
|
|
331
367
|
def abort_if_not_closed
|
332
368
|
self.opened = false
|
333
369
|
test_list.each(&:abort)
|
370
|
+
universal_sdk_abort
|
334
371
|
end
|
335
372
|
|
336
373
|
alias abort abort_if_not_closed
|
@@ -347,6 +384,8 @@ module Applitools
|
|
347
384
|
|
348
385
|
# rubocop:disable Style/AccessorMethodName
|
349
386
|
def set_viewport_size(value)
|
387
|
+
# require('pry')
|
388
|
+
# binding.pry
|
350
389
|
self.utils.set_viewport_size driver, value
|
351
390
|
rescue => e
|
352
391
|
logger.error e.class.to_s
|
@@ -398,6 +437,14 @@ module Applitools
|
|
398
437
|
|
399
438
|
def add_text_trigger(_control, _text); end
|
400
439
|
|
440
|
+
def disabled=(value)
|
441
|
+
@disabled = Applitools::Utils.boolean_value value
|
442
|
+
end
|
443
|
+
|
444
|
+
def disabled?
|
445
|
+
@disabled
|
446
|
+
end
|
447
|
+
|
401
448
|
private :new_test_error_message, :diffs_found_error_message, :test_failed_error_message
|
402
449
|
|
403
450
|
private
|
data/lib/applitools/version.rb
CHANGED
data/lib/eyes_selenium.rb
CHANGED
@@ -31,5 +31,14 @@ if defined? Selenium::WebDriver::Driver
|
|
31
31
|
is_mobile_device = capabilities['platformName'] ? true : false
|
32
32
|
Applitools::Selenium::Driver.new(eyes, driver: self, is_mobile_device: is_mobile_device)
|
33
33
|
end
|
34
|
+
|
35
|
+
def universal_driver_config
|
36
|
+
hidden_server_url = bridge.http.send(:server_url).to_s
|
37
|
+
{
|
38
|
+
serverUrl: hidden_server_url,
|
39
|
+
sessionId: session_id,
|
40
|
+
capabilities: capabilities.as_json
|
41
|
+
}
|
42
|
+
end
|
34
43
|
end
|
35
44
|
end
|
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:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Applitools Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eyes_core
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.0.0
|
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:
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: selenium-webdriver
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: css_parser
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: nokogiri
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 1.10.10
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 1.10.10
|
97
97
|
description: Provides SDK for writing Applitools Selenium-based tests
|
98
98
|
email:
|
99
99
|
- team@applitools.com
|