eyes_selenium 3.15.2.beta → 3.15.3.beta
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 +13 -0
- data/lib/applitools/selenium/browsers_info.rb +14 -0
- data/lib/applitools/selenium/configuration.rb +61 -0
- data/lib/applitools/selenium/external_css_resources.rb +29 -0
- data/lib/applitools/selenium/render_browser_info_fluent.rb +40 -0
- data/lib/applitools/selenium/render_resources.rb +13 -0
- data/lib/applitools/selenium/rgrid_dom.rb +44 -0
- data/lib/applitools/selenium/selenium_eyes.rb +2 -1
- data/lib/applitools/selenium/stitch_modes.rb +13 -0
- data/lib/applitools/selenium/{concerns/test_list.rb → test_list.rb} +0 -0
- data/lib/applitools/selenium/visual_grid/eyes_connector.rb +1 -1
- data/lib/applitools/selenium/visual_grid/render_browser_info.rb +3 -3
- data/lib/applitools/selenium/visual_grid/render_task.rb +3 -2
- data/lib/applitools/selenium/visual_grid/running_test.rb +2 -2
- data/lib/applitools/selenium/visual_grid/visual_grid_eyes.rb +13 -16
- data/lib/applitools/version.rb +1 -1
- data/lib/eyes_selenium.rb +0 -1
- metadata +13 -13
- data/lib/applitools/selenium/concerns/browser_types.rb +0 -15
- data/lib/applitools/selenium/concerns/browsers_info.rb +0 -16
- data/lib/applitools/selenium/concerns/external_css_resources.rb +0 -31
- data/lib/applitools/selenium/concerns/render_browser_info_fluent.rb +0 -42
- data/lib/applitools/selenium/concerns/render_resources.rb +0 -15
- data/lib/applitools/selenium/concerns/rgrid_dom.rb +0 -46
- data/lib/applitools/selenium/concerns/stitch_modes.rb +0 -15
- data/lib/applitools/selenium/selenium_configuration.rb +0 -64
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a16bd000d3c6425d1a5bdce022190199236939cd6386afe54bc808567c32a58
|
4
|
+
data.tar.gz: 07e34b7850610d964fd05d6bfec8b61af58427b4e78905af148b4dee32914085
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af6c6901ed20979de2da90cca6cbc8900d6bb33e55cc9e88d3a4915e67e7d2c3b4276d262b7f7d0566d63391f0f6e528b2405b18e855e840fa654e311c5cf94f
|
7
|
+
data.tar.gz: ab3f2253b38875e6e0f779f4f691bc388f84c466fabdaca790b099321e508bc5dbb345d4ba60141d7db47ea4bcf29659b7af412fb6a4dc67078fba5db4205591
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Applitools
|
2
|
+
module Selenium
|
3
|
+
class BrowsersInfo < Set
|
4
|
+
def add(obj)
|
5
|
+
return super if obj.is_a? Applitools::Selenium::RenderBrowserInfo
|
6
|
+
raise(
|
7
|
+
Applitools::EyesIllegalArgument,
|
8
|
+
"It is expected the value to be an Applitools::Selenium::RenderBrowserInfo instance," \
|
9
|
+
" but got #{obj.class} instead"
|
10
|
+
)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'applitools/selenium/stitch_modes'
|
2
|
+
require 'applitools/selenium/stitch_modes'
|
3
|
+
require 'applitools/selenium/browsers_info'
|
4
|
+
|
5
|
+
module Applitools
|
6
|
+
module Selenium
|
7
|
+
class Configuration < Applitools::EyesBaseConfiguration
|
8
|
+
DEFAULT_CONFIG = proc do
|
9
|
+
{
|
10
|
+
force_full_page_screenshot: false,
|
11
|
+
wait_before_screenshots: 100,
|
12
|
+
stitch_mode: Applitools::Selenium::StitchModes::CSS,
|
13
|
+
hide_scrollbars: false,
|
14
|
+
hide_caret: false,
|
15
|
+
browsers_info: Applitools::Selenium::BrowsersInfo.new
|
16
|
+
}
|
17
|
+
end
|
18
|
+
class << self
|
19
|
+
def default_config
|
20
|
+
super.merge DEFAULT_CONFIG.call
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
boolean_field :force_full_page_screenshot
|
25
|
+
int_field :wait_before_screenshots
|
26
|
+
enum_field :stitch_mode, Applitools::Selenium::StitchModes.enum_values
|
27
|
+
boolean_field :hide_scrollbars
|
28
|
+
boolean_field :hide_caret
|
29
|
+
boolean_field :send_dom
|
30
|
+
|
31
|
+
object_field :browsers_info, Applitools::Selenium::BrowsersInfo
|
32
|
+
|
33
|
+
int_field :concurrent_sessions
|
34
|
+
|
35
|
+
def add_browser(*args)
|
36
|
+
case args.size
|
37
|
+
when 0, 1
|
38
|
+
b = args[0]
|
39
|
+
browser = b || Applitools::Selenium::RenderBrowserInfo.new
|
40
|
+
when 3
|
41
|
+
browser = Applitools::Selenium::RenderBrowserInfo.new.tap do |bi|
|
42
|
+
bi.viewport_size = Applitools::RectangleSize.new(args[0], args[1])
|
43
|
+
bi.browser_type = args[2]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
yield(Applitools::Selenium::RenderBrowserInfoFluent.new(browser)) if block_given?
|
47
|
+
browsers_info.add browser
|
48
|
+
self.viewport_size = browser.viewport_size unless viewport_size
|
49
|
+
self
|
50
|
+
end
|
51
|
+
|
52
|
+
def deep_clone
|
53
|
+
new_config = self.class.new
|
54
|
+
config_keys.each do |k|
|
55
|
+
new_config.send("#{k}=", self.send(k).clone)
|
56
|
+
end
|
57
|
+
new_config
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'css_parser'
|
2
|
+
# require 'pry'
|
3
|
+
|
4
|
+
module Applitools
|
5
|
+
module Selenium
|
6
|
+
class ExternalCssResources
|
7
|
+
include CssParser
|
8
|
+
def initialize(url, base_url = nil)
|
9
|
+
@parser = CssParser::Parser.new(absolute_paths: true)
|
10
|
+
@parser.load_uri!(url)
|
11
|
+
@parser.compact!
|
12
|
+
end
|
13
|
+
|
14
|
+
def flatten_rules
|
15
|
+
@flatten ||= flatten_hash(hash, 0)
|
16
|
+
end
|
17
|
+
|
18
|
+
def hash
|
19
|
+
@h ||= @parser.to_h
|
20
|
+
end
|
21
|
+
|
22
|
+
def images
|
23
|
+
result = []
|
24
|
+
@parser.each_rule_set { |s| s.expand_background_shorthand!; result.push(s) unless s.get_value('background-image').empty? }
|
25
|
+
result
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Applitools
|
2
|
+
module Selenium
|
3
|
+
class RenderBrowserInfoFluent
|
4
|
+
attr_accessor :browser_info
|
5
|
+
def initialize(browser_info)
|
6
|
+
self.browser_info = browser_info
|
7
|
+
end
|
8
|
+
|
9
|
+
def width(value)
|
10
|
+
browser_info.viewport_size.width = value
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
14
|
+
def height(value)
|
15
|
+
browser_info.viewport_size.height = value
|
16
|
+
self
|
17
|
+
end
|
18
|
+
|
19
|
+
def type(value)
|
20
|
+
browser_info.browser_type = value
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
def platform(value)
|
25
|
+
browser_info.platform = value
|
26
|
+
self
|
27
|
+
end
|
28
|
+
|
29
|
+
def size_mode(value)
|
30
|
+
browser_info.size_mode = value
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
34
|
+
def environment(value)
|
35
|
+
browser_info.baseline_env_name = value
|
36
|
+
self
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Applitools
|
2
|
+
module Selenium
|
3
|
+
class RenderResources < Hash
|
4
|
+
def []=(key, value)
|
5
|
+
raise Applitools::EyesIllegalArgument, "Expected key to be an instance of URI (but got #{key.class})" unless
|
6
|
+
key.is_a? URI
|
7
|
+
raise Applitools::EyesIllegalArgument, "Expected key to be an instance of Applitools::Selenium::VGResource" \
|
8
|
+
" (but got #{value.class})" unless value.is_a? Applitools::Selenium::VGResource
|
9
|
+
return super
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Applitools
|
2
|
+
module Selenium
|
3
|
+
class RGridDom
|
4
|
+
CONTENT_TYPE = 'x-applitools-html/cdt'.freeze
|
5
|
+
include Applitools::Jsonable
|
6
|
+
json_fields :hash, :hashFormat
|
7
|
+
attr_accessor :dom_nodes, :resources, :url, :data
|
8
|
+
|
9
|
+
def initialize(*args)
|
10
|
+
options = Applitools::Utils.extract_options! args
|
11
|
+
self.url = options[:url]
|
12
|
+
self.dom_nodes = options[:dom_nodes]
|
13
|
+
self.resources = options[:resources]
|
14
|
+
self.hash_format = 'sha256'
|
15
|
+
self.data = {
|
16
|
+
'resources' => resources,
|
17
|
+
'domNodes' => dom_nodes
|
18
|
+
}
|
19
|
+
self.hash = calculate_sha_256
|
20
|
+
end
|
21
|
+
|
22
|
+
def calculate_sha_256
|
23
|
+
# str = Applitools::Utils.stringify_for_hash(data)
|
24
|
+
Digest::SHA256.hexdigest(content)
|
25
|
+
end
|
26
|
+
|
27
|
+
# def hash
|
28
|
+
# calculate_sha_256
|
29
|
+
# end
|
30
|
+
|
31
|
+
def content
|
32
|
+
Oj.dump(json_value(data.sort.to_h))
|
33
|
+
end
|
34
|
+
|
35
|
+
def resource
|
36
|
+
Applitools::Selenium::VGResource.new(
|
37
|
+
url,
|
38
|
+
CONTENT_TYPE,
|
39
|
+
content
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -98,7 +98,8 @@ module Applitools::Selenium
|
|
98
98
|
attr_accessor :base_agent_id, :screenshot, :force_full_page_screenshot, :hide_scrollbars,
|
99
99
|
:wait_before_screenshots, :debug_screenshots, :stitch_mode, :disable_horizontal_scrolling,
|
100
100
|
:disable_vertical_scrolling, :explicit_entire_size, :debug_screenshot_provider, :stitching_overlap,
|
101
|
-
:full_page_capture_algorithm_left_top_offset, :screenshot_type, :send_dom, :use_dom, :enable_patterns
|
101
|
+
:full_page_capture_algorithm_left_top_offset, :screenshot_type, :send_dom, :use_dom, :enable_patterns,
|
102
|
+
:config
|
102
103
|
attr_reader :driver
|
103
104
|
|
104
105
|
def_delegators 'Applitools::EyesLogger', :logger, :log_handler, :log_handler=
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'applitools/selenium/
|
1
|
+
require 'applitools/selenium/browser_types'
|
2
2
|
|
3
3
|
module Applitools
|
4
4
|
module Selenium
|
@@ -6,7 +6,7 @@ module Applitools
|
|
6
6
|
DEFAULT_CONFIG = proc do
|
7
7
|
{
|
8
8
|
platform: 'linux',
|
9
|
-
browser_type: Applitools::Selenium::
|
9
|
+
browser_type: Applitools::Selenium::BrowserTypes::CHROME,
|
10
10
|
size_mode: 'full-page',
|
11
11
|
viewport_size: Applitools::RectangleSize.from_any_argument(width: 0, height: 0)
|
12
12
|
}
|
@@ -18,7 +18,7 @@ module Applitools
|
|
18
18
|
end
|
19
19
|
|
20
20
|
object_field :viewport_size, Applitools::RectangleSize
|
21
|
-
enum_field :browser_type, Applitools::Selenium::
|
21
|
+
enum_field :browser_type, Applitools::Selenium::BrowserTypes.enum_values
|
22
22
|
string_field :platform
|
23
23
|
string_field :size_mode
|
24
24
|
string_field :baseline_env_name
|
@@ -87,6 +87,7 @@ module Applitools
|
|
87
87
|
def poll_render_status(rq)
|
88
88
|
iterations = 0
|
89
89
|
statuses = []
|
90
|
+
raise Applitools::EyesError, 'RenderStatus: Got empty renderId!' unless rq.render_id.is_a?(String) && !rq.render_id.empty?
|
90
91
|
begin
|
91
92
|
fails_count = 0
|
92
93
|
proc = proc do
|
@@ -118,7 +119,7 @@ module Applitools
|
|
118
119
|
def prepare_data_for_rg(data)
|
119
120
|
self.all_blobs = data["blobs"]
|
120
121
|
self.resource_urls = data["resourceUrls"]
|
121
|
-
self.request_resources = Applitools::Selenium::
|
122
|
+
self.request_resources = Applitools::Selenium::RenderResources.new
|
122
123
|
# self.request_resources = {}
|
123
124
|
all_blobs.map {|blob| Applitools::Selenium::VGResource.parse_blob_from_script(blob)}.each do |blob|
|
124
125
|
request_resources[blob.url] = blob
|
@@ -148,7 +149,7 @@ module Applitools
|
|
148
149
|
r.size_mode = running_test.browser_info.size_mode
|
149
150
|
end
|
150
151
|
|
151
|
-
dom = Applitools::Selenium::
|
152
|
+
dom = Applitools::Selenium::RGridDom.new(
|
152
153
|
url: script_data["url"], dom_nodes: script_data['cdt'], resources: request_resources
|
153
154
|
)
|
154
155
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'state_machine'
|
2
2
|
require 'digest'
|
3
|
+
require 'applitools/selenium/visual_grid/render_task'
|
3
4
|
|
4
5
|
module Applitools
|
5
6
|
module Selenium
|
@@ -106,7 +107,7 @@ module Applitools
|
|
106
107
|
end
|
107
108
|
|
108
109
|
event :becomes_tested do
|
109
|
-
transition :opened => :tested
|
110
|
+
transition [:new, :not_rendered, :opened] => :tested
|
110
111
|
end
|
111
112
|
|
112
113
|
event :becomes_completed do
|
@@ -120,7 +121,6 @@ module Applitools
|
|
120
121
|
|
121
122
|
def initialize(eyes, browser_info, driver)
|
122
123
|
Applitools::ArgumentGuard.is_a? eyes, 'eyes', Applitools::Selenium::EyesConnector
|
123
|
-
Applitools::ArgumentGuard.is_a? browser_info, 'browser_info', Applitools::Selenium::RenderBrowserInfo
|
124
124
|
|
125
125
|
self.eyes = eyes
|
126
126
|
self.browser_info = browser_info
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'applitools/selenium/
|
1
|
+
require 'applitools/selenium/configuration'
|
2
2
|
module Applitools
|
3
3
|
module Selenium
|
4
4
|
class VisualGridEyes
|
@@ -11,7 +11,7 @@ module Applitools
|
|
11
11
|
|
12
12
|
attr_accessor :api_key, :server_url, :proxy, :opened
|
13
13
|
|
14
|
-
def_delegators 'config', *Applitools::Selenium::
|
14
|
+
def_delegators 'config', *Applitools::Selenium::Configuration.methods_to_delegate
|
15
15
|
def_delegators 'config', *Applitools::EyesBaseConfiguration.methods_to_delegate
|
16
16
|
|
17
17
|
def initialize(visual_grid_manager, server_url = nil)
|
@@ -22,7 +22,7 @@ module Applitools
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def ensure_config
|
25
|
-
self.config = Applitools::Selenium::
|
25
|
+
self.config = Applitools::Selenium::Configuration.new
|
26
26
|
end
|
27
27
|
|
28
28
|
|
@@ -31,13 +31,6 @@ module Applitools
|
|
31
31
|
options = Applitools::Utils.extract_options!(args)
|
32
32
|
Applitools::ArgumentGuard.hash(options, 'options', [:driver])
|
33
33
|
|
34
|
-
# self.current_config = options.delete(:config)
|
35
|
-
# self.current_config = yield(Applitools::Selenium::SeleniumConfiguration.new) if block_given?
|
36
|
-
|
37
|
-
# Applitools::ArgumentGuard.is_a? options[:driver], 'options[:driver]', ::Selenium::WebDriver
|
38
|
-
# Applitools::ArgumentGuard.is_a? current_config, 'options[:config]', Applitools::Selenium::SeleniumConfiguration
|
39
|
-
|
40
|
-
# batch_info.name = config.app_name
|
41
34
|
self.driver = options.delete(:driver)
|
42
35
|
self.current_url = driver.current_url
|
43
36
|
|
@@ -66,13 +59,17 @@ module Applitools
|
|
66
59
|
script = <<-END
|
67
60
|
var callback = arguments[arguments.length - 1]; return (#{Applitools::Selenium::Scripts::PROCESS_RESOURCES})().then(JSON.stringify).then(callback, function(err) {callback(err.stack || err.toString())});
|
68
61
|
END
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
62
|
+
begin
|
63
|
+
script_result = driver.execute_async_script(script).freeze
|
64
|
+
mod = Digest::SHA2.hexdigest(script_result)
|
65
|
+
test_list.each do |t|
|
66
|
+
t.check(tag, target, script_result.dup, visual_grid_manager, mod)
|
67
|
+
end
|
68
|
+
test_list.each { |t| t.becomes_not_rendered}
|
69
|
+
rescue StandardError => e
|
70
|
+
Applitools::EyesLogger.error e.message
|
71
|
+
test_list.each { |t| t.becomes_tested}
|
74
72
|
end
|
75
|
-
test_list.each { |t| t.becomes_not_rendered}
|
76
73
|
end
|
77
74
|
|
78
75
|
def close(throw_exception = true)
|
data/lib/applitools/version.rb
CHANGED
data/lib/eyes_selenium.rb
CHANGED
@@ -20,7 +20,6 @@ end
|
|
20
20
|
|
21
21
|
Applitools::Selenium.require_dir 'selenium/scripts'
|
22
22
|
Applitools::Selenium.require_dir 'selenium/visual_grid'
|
23
|
-
Applitools::Selenium.require_dir 'selenium/concerns'
|
24
23
|
Applitools::Selenium.require_dir 'selenium'
|
25
24
|
Applitools::Selenium.require_dir 'selenium/dom_capture'
|
26
25
|
|
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.3.beta
|
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-04-01 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.3.beta
|
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.3.beta
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: selenium-webdriver
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,14 +75,9 @@ extra_rdoc_files: []
|
|
75
75
|
files:
|
76
76
|
- lib/applitools/selenium/border_aware_element_content_location_provider.rb
|
77
77
|
- lib/applitools/selenium/browser.rb
|
78
|
-
- lib/applitools/selenium/
|
79
|
-
- lib/applitools/selenium/
|
80
|
-
- lib/applitools/selenium/
|
81
|
-
- lib/applitools/selenium/concerns/render_browser_info_fluent.rb
|
82
|
-
- lib/applitools/selenium/concerns/render_resources.rb
|
83
|
-
- lib/applitools/selenium/concerns/rgrid_dom.rb
|
84
|
-
- lib/applitools/selenium/concerns/stitch_modes.rb
|
85
|
-
- lib/applitools/selenium/concerns/test_list.rb
|
78
|
+
- lib/applitools/selenium/browser_types.rb
|
79
|
+
- lib/applitools/selenium/browsers_info.rb
|
80
|
+
- lib/applitools/selenium/configuration.rb
|
86
81
|
- lib/applitools/selenium/context_based_scale_provider.rb
|
87
82
|
- lib/applitools/selenium/css_transform/css_transform.rb
|
88
83
|
- lib/applitools/selenium/css_translate_element_position_provider.rb
|
@@ -93,6 +88,7 @@ files:
|
|
93
88
|
- lib/applitools/selenium/element.rb
|
94
89
|
- lib/applitools/selenium/element_position_provider.rb
|
95
90
|
- lib/applitools/selenium/entire_element_screenshot.rb
|
91
|
+
- lib/applitools/selenium/external_css_resources.rb
|
96
92
|
- lib/applitools/selenium/eyes.rb
|
97
93
|
- lib/applitools/selenium/eyes_screenshot.rb
|
98
94
|
- lib/applitools/selenium/eyes_target_locator.rb
|
@@ -106,13 +102,17 @@ files:
|
|
106
102
|
- lib/applitools/selenium/move_to_region_visibility_strategy.rb
|
107
103
|
- lib/applitools/selenium/nop_region_visibility_strategy.rb
|
108
104
|
- lib/applitools/selenium/region_provider.rb
|
105
|
+
- lib/applitools/selenium/render_browser_info_fluent.rb
|
106
|
+
- lib/applitools/selenium/render_resources.rb
|
107
|
+
- lib/applitools/selenium/rgrid_dom.rb
|
109
108
|
- lib/applitools/selenium/sauce/driver.rb
|
110
109
|
- lib/applitools/selenium/scripts/process_page_and_serialize.rb
|
111
110
|
- lib/applitools/selenium/scroll_position_provider.rb
|
112
|
-
- lib/applitools/selenium/selenium_configuration.rb
|
113
111
|
- lib/applitools/selenium/selenium_eyes.rb
|
112
|
+
- lib/applitools/selenium/stitch_modes.rb
|
114
113
|
- lib/applitools/selenium/takes_screenshot_image_provider.rb
|
115
114
|
- lib/applitools/selenium/target.rb
|
115
|
+
- lib/applitools/selenium/test_list.rb
|
116
116
|
- lib/applitools/selenium/viewport_screenshot.rb
|
117
117
|
- lib/applitools/selenium/viewport_size.rb
|
118
118
|
- lib/applitools/selenium/visual_grid/eyes_connector.rb
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Applitools
|
2
|
-
module Selenium
|
3
|
-
module Concerns
|
4
|
-
class BrowsersInfo < Set
|
5
|
-
def add(obj)
|
6
|
-
return super if obj.is_a? Applitools::Selenium::RenderBrowserInfo
|
7
|
-
raise(
|
8
|
-
Applitools::EyesIllegalArgument,
|
9
|
-
"It is expected the value to be an Applitools::Selenium::RenderBrowserInfo instance," \
|
10
|
-
" but got #{obj.class} instead"
|
11
|
-
)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'css_parser'
|
2
|
-
# require 'pry'
|
3
|
-
|
4
|
-
module Applitools
|
5
|
-
module Selenium
|
6
|
-
module Concerns
|
7
|
-
class ExternalCssResources
|
8
|
-
include CssParser
|
9
|
-
def initialize(url, base_url = nil)
|
10
|
-
@parser = CssParser::Parser.new(absolute_paths: true)
|
11
|
-
@parser.load_uri!(url)
|
12
|
-
@parser.compact!
|
13
|
-
end
|
14
|
-
|
15
|
-
def flatten_rules
|
16
|
-
@flatten ||= flatten_hash(hash, 0)
|
17
|
-
end
|
18
|
-
|
19
|
-
def hash
|
20
|
-
@h ||= @parser.to_h
|
21
|
-
end
|
22
|
-
|
23
|
-
def images
|
24
|
-
result = []
|
25
|
-
@parser.each_rule_set { |s| s.expand_background_shorthand!; result.push(s) unless s.get_value('background-image').empty? }
|
26
|
-
result
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module Applitools
|
2
|
-
module Selenium
|
3
|
-
module Concerns
|
4
|
-
class RenderBrowserInfoFluent
|
5
|
-
attr_accessor :browser_info
|
6
|
-
def initialize(browser_info)
|
7
|
-
self.browser_info = browser_info
|
8
|
-
end
|
9
|
-
|
10
|
-
def width(value)
|
11
|
-
browser_info.viewport_size.width = value
|
12
|
-
self
|
13
|
-
end
|
14
|
-
|
15
|
-
def height(value)
|
16
|
-
browser_info.viewport_size.height = value
|
17
|
-
self
|
18
|
-
end
|
19
|
-
|
20
|
-
def type(value)
|
21
|
-
browser_info.browser_type = value
|
22
|
-
self
|
23
|
-
end
|
24
|
-
|
25
|
-
def platform(value)
|
26
|
-
browser_info.platform = value
|
27
|
-
self
|
28
|
-
end
|
29
|
-
|
30
|
-
def size_mode(value)
|
31
|
-
browser_info.size_mode = value
|
32
|
-
self
|
33
|
-
end
|
34
|
-
|
35
|
-
def environment(value)
|
36
|
-
browser_info.baseline_env_name = value
|
37
|
-
self
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
module Applitools
|
2
|
-
module Selenium
|
3
|
-
module Concerns
|
4
|
-
class RenderResources < Hash
|
5
|
-
def []=(key, value)
|
6
|
-
raise Applitools::EyesIllegalArgument, "Expected key to be an instance of URI (but got #{key.class})" unless
|
7
|
-
key.is_a? URI
|
8
|
-
raise Applitools::EyesIllegalArgument, "Expected key to be an instance of Applitools::Selenium::VGResource" \
|
9
|
-
" (but got #{value.class})" unless value.is_a? Applitools::Selenium::VGResource
|
10
|
-
return super
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
module Applitools
|
2
|
-
module Selenium
|
3
|
-
module Concerns
|
4
|
-
class RGridDom
|
5
|
-
CONTENT_TYPE = 'x-applitools-html/cdt'.freeze
|
6
|
-
include Applitools::Jsonable
|
7
|
-
json_fields :hash, :hashFormat
|
8
|
-
attr_accessor :dom_nodes, :resources, :url, :data
|
9
|
-
|
10
|
-
def initialize(*args)
|
11
|
-
options = Applitools::Utils.extract_options! args
|
12
|
-
self.url = options[:url]
|
13
|
-
self.dom_nodes = options[:dom_nodes]
|
14
|
-
self.resources = options[:resources]
|
15
|
-
self.hash_format = 'sha256'
|
16
|
-
self.data = {
|
17
|
-
'resources' => resources,
|
18
|
-
'domNodes' => dom_nodes
|
19
|
-
}
|
20
|
-
self.hash = calculate_sha_256
|
21
|
-
end
|
22
|
-
|
23
|
-
def calculate_sha_256
|
24
|
-
# str = Applitools::Utils.stringify_for_hash(data)
|
25
|
-
Digest::SHA256.hexdigest(content)
|
26
|
-
end
|
27
|
-
|
28
|
-
# def hash
|
29
|
-
# calculate_sha_256
|
30
|
-
# end
|
31
|
-
|
32
|
-
def content
|
33
|
-
Oj.dump(json_value(data.sort.to_h))
|
34
|
-
end
|
35
|
-
|
36
|
-
def resource
|
37
|
-
Applitools::Selenium::VGResource.new(
|
38
|
-
url,
|
39
|
-
CONTENT_TYPE,
|
40
|
-
content
|
41
|
-
)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
require 'applitools/selenium/concerns/stitch_modes'
|
2
|
-
require 'applitools/selenium/concerns/stitch_modes'
|
3
|
-
require 'applitools/selenium/concerns/browsers_info'
|
4
|
-
|
5
|
-
module Applitools
|
6
|
-
module Selenium
|
7
|
-
class SeleniumConfiguration < Applitools::EyesBaseConfiguration
|
8
|
-
DEFAULT_CONFIG = proc do
|
9
|
-
{
|
10
|
-
force_full_page_screenshot: false,
|
11
|
-
wait_before_screenshots: 100,
|
12
|
-
stitch_mode: Applitools::Selenium::Concerns::StitchModes::CSS,
|
13
|
-
hide_scrollbars: false,
|
14
|
-
hide_caret: false,
|
15
|
-
browsers_info: Applitools::Selenium::Concerns::BrowsersInfo.new
|
16
|
-
}
|
17
|
-
end
|
18
|
-
class << self
|
19
|
-
def default_config
|
20
|
-
super.merge DEFAULT_CONFIG.call
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
boolean_field :force_full_page_screenshot
|
25
|
-
int_field :wait_before_screenshots
|
26
|
-
enum_field :stitch_mode, Applitools::Selenium::Concerns::StitchModes.enum_values
|
27
|
-
boolean_field :hide_scrollbars
|
28
|
-
boolean_field :hide_caret
|
29
|
-
boolean_field :send_dom
|
30
|
-
|
31
|
-
object_field :browsers_info, Applitools::Selenium::Concerns::BrowsersInfo
|
32
|
-
|
33
|
-
int_field :concurrent_sessions
|
34
|
-
|
35
|
-
# private int waitBeforeScreenshots = DEFAULT_WAIT_BEFORE_SCREENSHOTS;
|
36
|
-
# private StitchMode stitchMode = StitchMode.SCROLL;
|
37
|
-
# private boolean hideScrollbars = true;
|
38
|
-
# private boolean hideCaret = true;
|
39
|
-
#
|
40
|
-
# //Rendering Configuration
|
41
|
-
# private int concurrentSessions = 3;
|
42
|
-
# private boolean isThrowExceptionOn = false;
|
43
|
-
# private Boolean isRenderingConfig = false;
|
44
|
-
#
|
45
|
-
# public enum BrowserType {CHROME, FIREFOX}
|
46
|
-
# private List<RenderBrowserInfo> browsersInfo =
|
47
|
-
def add_browser(b = nil)
|
48
|
-
browser = b || Applitools::Selenium::RenderBrowserInfo.new
|
49
|
-
yield(Applitools::Selenium::Concerns::RenderBrowserInfoFluent.new(browser)) if block_given?
|
50
|
-
browsers_info.add browser
|
51
|
-
self.viewport_size = browser.viewport_size unless viewport_size
|
52
|
-
self
|
53
|
-
end
|
54
|
-
|
55
|
-
def deep_clone
|
56
|
-
new_config = self.class.new
|
57
|
-
config_keys.each do |k|
|
58
|
-
new_config.send("#{k}=", self.send(k).clone)
|
59
|
-
end
|
60
|
-
new_config
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|