eyes_selenium_ruby 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/eyes_selenium_ruby.gemspec +1 -1
- data/lib/eyes_selenium_ruby/eyes/environment.rb +2 -1
- data/lib/eyes_selenium_ruby/eyes/eyes.rb +7 -5
- data/lib/eyes_selenium_ruby/eyes/match_window_data.rb +1 -1
- data/lib/eyes_selenium_ruby/eyes/match_window_task.rb +2 -2
- data/lib/eyes_selenium_ruby/eyes/start_info.rb +4 -3
- data/lib/eyes_selenium_ruby/eyes/viewport_size.rb +5 -4
- data/lib/eyes_selenium_ruby/version.rb +1 -1
- data/test_script.rb +2 -3
- metadata +7 -7
data/eyes_selenium_ruby.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "selenium-webdriver", ["
|
21
|
+
spec.add_dependency "selenium-webdriver", [">= 2.37"]
|
22
22
|
spec.add_dependency "httparty"
|
23
23
|
spec.add_dependency "oily_png", [">= 1.1.0"]
|
24
24
|
|
@@ -8,6 +8,7 @@ class Applitools::Environment
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def to_hash
|
11
|
-
|
11
|
+
# display_size is an Applitools::ViewportSize object
|
12
|
+
{ os: os, hostingApp: hosting_app, displaySize: display_size.to_hash}
|
12
13
|
end
|
13
14
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class Applitools::Eyes
|
2
2
|
DEFAULT_MATCH_TIMEOUT = 2.0
|
3
|
+
AGENT_ID = 'eyes.selenium.ruby'
|
3
4
|
|
4
5
|
class << self
|
5
6
|
attr_accessor :config
|
@@ -7,7 +8,7 @@ class Applitools::Eyes
|
|
7
8
|
|
8
9
|
@config = {
|
9
10
|
server_url: 'https://eyes.applitools.com',
|
10
|
-
user:
|
11
|
+
user: AGENT_ID
|
11
12
|
# apikey: 'please supply an apikey in your initializer'
|
12
13
|
}
|
13
14
|
|
@@ -50,7 +51,7 @@ class Applitools::Eyes
|
|
50
51
|
self.failure_reports = params.fetch(:failure_reports, self.failure_reports)
|
51
52
|
self.match_level = params.fetch(:match_level,MatchLevel::EXACT)
|
52
53
|
self.test_name = params.fetch(:test_name)
|
53
|
-
self.viewport_size = params.fetch(:
|
54
|
+
self.viewport_size = params.fetch(:viewport_size, nil)
|
54
55
|
|
55
56
|
self.is_open = true
|
56
57
|
driver
|
@@ -72,7 +73,7 @@ class Applitools::Eyes
|
|
72
73
|
if !as_expected
|
73
74
|
self.should_match_window_run_once_on_timeout = true
|
74
75
|
if !session.new_session?
|
75
|
-
EyesLogger.info %( "mismatch! #{ tag ? "" : "(#{tag})" } )
|
76
|
+
#EyesLogger.info %( "mismatch! #{ tag ? "" : "(#{tag})" } )
|
76
77
|
if failure_reports.to_i == Applitools::FailureReports::IMMEDIATE
|
77
78
|
raise Applitools::TestFailedError.new("Mismatch found in '#{start_info.scenario_id_or_name}'"\
|
78
79
|
" of '#{start_info.app_id_or_name}'")
|
@@ -153,7 +154,7 @@ class Applitools::Eyes
|
|
153
154
|
test_batch ||= Applitools::BatchInfo.new
|
154
155
|
app_env = Applitools::Environment.new(host_os, host_app, viewport_size)
|
155
156
|
application = driver.create_application
|
156
|
-
self.session_start_info = Applitools::StartInfo.new(
|
157
|
+
self.session_start_info = Applitools::StartInfo.new(AGENT_ID,
|
157
158
|
app_name, test_name, test_batch, app_env, application,
|
158
159
|
match_level,nil, branch_name, parent_branch_name
|
159
160
|
)
|
@@ -167,7 +168,8 @@ class Applitools::Eyes
|
|
167
168
|
|
168
169
|
def assign_viewport_size
|
169
170
|
if viewport_size?
|
170
|
-
self.viewport_size = Applitools::ViewportSize.new(driver, viewport_size)
|
171
|
+
self.viewport_size = Applitools::ViewportSize.new(driver, viewport_size)
|
172
|
+
self.viewport_size.set
|
171
173
|
else
|
172
174
|
self.viewport_size = Applitools::ViewportSize.new(driver).extract_viewport_from_browser!
|
173
175
|
end
|
@@ -13,6 +13,6 @@ class Applitools::MatchWindowData
|
|
13
13
|
# not be included as part of the json.
|
14
14
|
def to_hash
|
15
15
|
{userInputs: user_inputs.map(&:to_hash), appOutput: Hash[app_output.each_pair.to_a],
|
16
|
-
tag: @tag,
|
16
|
+
tag: @tag, ignoreMismatch: @ignore_mismatch}
|
17
17
|
end
|
18
18
|
end
|
@@ -61,11 +61,11 @@ class Applitools::MatchWindowTask
|
|
61
61
|
|
62
62
|
def match(tag, ignore_mismatch=false)
|
63
63
|
data = prep_match_data(tag, ignore_mismatch)
|
64
|
-
agent_connector.match_window(session, data)
|
65
|
-
|
64
|
+
as_expected = agent_connector.match_window(session, data)
|
66
65
|
# If the server stored this image, it will be used as a base for our next screenshot compression
|
67
66
|
if !ignore_mismatch
|
68
67
|
@last_checked_window = @current_screenshot
|
69
68
|
end
|
69
|
+
return as_expected
|
70
70
|
end
|
71
71
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Applitools::StartInfo
|
2
2
|
|
3
|
-
ATTRIBUTES = %w[ app_id_or_name ver_id scenario_id_or_name batch_info
|
3
|
+
ATTRIBUTES = %w[ agent_id app_id_or_name ver_id scenario_id_or_name batch_info
|
4
4
|
environment application match_level branch_name parent_branch_name ]
|
5
5
|
|
6
6
|
ATTRIBUTES.each do |attr|
|
@@ -8,9 +8,10 @@ class Applitools::StartInfo
|
|
8
8
|
end
|
9
9
|
|
10
10
|
## add a config file with this stuff, and use hash arg
|
11
|
-
def initialize(app_id_or_name, scenario_id_or_name, batch_info, environment,
|
11
|
+
def initialize(agent_id, app_id_or_name, scenario_id_or_name, batch_info, environment,
|
12
12
|
application, match_level, ver_id=nil, branch_name=nil,
|
13
13
|
parent_branch_name=nil)
|
14
|
+
@agent_id = agent_id
|
14
15
|
@app_id_or_name = app_id_or_name
|
15
16
|
@ver_id = ver_id
|
16
17
|
@scenario_id_or_name = scenario_id_or_name
|
@@ -24,7 +25,7 @@ class Applitools::StartInfo
|
|
24
25
|
|
25
26
|
def to_hash
|
26
27
|
{
|
27
|
-
AppIdOrName: app_id_or_name, VerId: ver_id, ScenarioIdOrName: scenario_id_or_name,
|
28
|
+
AgentId: agent_id, AppIdOrName: app_id_or_name, VerId: ver_id, ScenarioIdOrName: scenario_id_or_name,
|
28
29
|
BatchInfo: batch_info.to_hash, Environment: environment.to_hash,
|
29
30
|
Application: application.to_hash, matchLevel: match_level, branchName: branch_name,
|
30
31
|
parentBranchName: parent_branch_name
|
@@ -68,14 +68,15 @@ class Applitools::ViewportSize
|
|
68
68
|
alias_method :viewport_size, :extract_viewport_from_browser
|
69
69
|
|
70
70
|
def set
|
71
|
-
if
|
71
|
+
if dimension.is_a?(Hash) && dimension.has_key?(:width) && dimension.has_key?(:height)
|
72
|
+
# If dimension is hash of width/height, we convert it to a struct with width/height properties.
|
73
|
+
self.dimension = Struct.new(:width, :height).new(dimension[:width], dimension[:height])
|
74
|
+
elsif !dimension.respond_to?(:width) || !dimension.respond_to?(:height)
|
72
75
|
raise ArgumentError, "expected #{dimension.inspect}:#{dimension.class}" +
|
73
|
-
|
76
|
+
" to respond to #width and #height, or be a hash with these keys"
|
74
77
|
end
|
75
|
-
|
76
78
|
self.browser_size = dimension
|
77
79
|
verify_size(:browser_size)
|
78
|
-
|
79
80
|
cur_viewport_size = extract_viewport_from_browser
|
80
81
|
self.browser_size = Dimension.new(
|
81
82
|
(2 * browser_size.width) - cur_viewport_size.width,
|
data/test_script.rb
CHANGED
@@ -4,11 +4,10 @@
|
|
4
4
|
|
5
5
|
require 'eyes_selenium_ruby'
|
6
6
|
|
7
|
-
Applitools::Eyes.config[:apikey] = '
|
7
|
+
Applitools::Eyes.config[:apikey] = 'YOUR_API_KEY'
|
8
8
|
|
9
9
|
eyes = Applitools::Eyes.new
|
10
|
-
|
11
|
-
eyes.test(app_name: 'my app', test_name: 'my test') do |eyes, driver|
|
10
|
+
eyes.test(app_name: 'Ruby SDK', test_name: 'Applitools website test',viewport_size: {width: 1024, height: 768}) do |eyes, driver|
|
12
11
|
driver.get "http://www.applitools.com"
|
13
12
|
eyes.check_window("initial")
|
14
13
|
driver.find_element(:css, "li.pricing a").click
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eyes_selenium_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -16,17 +16,17 @@ dependencies:
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '2.
|
21
|
+
version: '2.37'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '2.
|
29
|
+
version: '2.37'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: httparty
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
201
|
version: '0'
|
202
202
|
segments:
|
203
203
|
- 0
|
204
|
-
hash: -
|
204
|
+
hash: -2653418946361615766
|
205
205
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
206
|
none: false
|
207
207
|
requirements:
|
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
210
|
version: '0'
|
211
211
|
segments:
|
212
212
|
- 0
|
213
|
-
hash: -
|
213
|
+
hash: -2653418946361615766
|
214
214
|
requirements: []
|
215
215
|
rubyforge_project:
|
216
216
|
rubygems_version: 1.8.25
|