eyes_selenium 1.20.0 → 1.21.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDEyOTk3MGRjYmJkZGIxZDk4ZjZhODY2MjMxYjJkZDMzZTQ5NjRiOQ==
4
+ ZjJjMzY0ZjBhZDViOGY0ZDExODA1Nzg5ZjBlZmJjMjNkM2ZkYjg2OQ==
5
5
  data.tar.gz: !binary |-
6
- ZjllN2EwMDYwZTVlZGEzMWQyMmMxMzE1Yjg0ZTY1ZGQ1MjliNGM4MQ==
6
+ MGQ5M2JmZjI0MWM2MWRmNGFmYzAzZWIxOTIzNzAyMmQzZGQxOWYxMg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTg0NWExYmI0ZGI3N2NjYzRiZGZjOGZkMTQ5ZjExOThhN2E0YjdjZGQ5Mzc5
10
- YTM2Y2Y4ZDI3ZWI2Y2RlOThmOWRmNTM3M2YxNGU0ZDQzZGI4MGY0NzNhMTE0
11
- MzdhMWFhMGJmY2YyZDEzN2Q5NGRkN2M5NzZlMjk0NzU2NGQ5MzM=
9
+ NzgwN2YyZDI2NzFkYWYwNWExMWNhODVlYTYxYTVmZDhmYjU0ZTJkM2M1YTkx
10
+ ZWIzZWRlYzJiY2ZjM2UxMjExNGMyNTU5NDU4YWU3NmE3ZThiMTY0NmQyZDE1
11
+ NzY3MTk1N2FiN2E0OWFiY2IyY2UxNzEyZDhlNjRkYTQyNTVjNzA=
12
12
  data.tar.gz: !binary |-
13
- MWRhYTk3NGUyMjc0NWIyN2JkZWE0NTUwMjgxM2UxY2M4MzQ0NTVjZTQ4M2Uw
14
- Y2EwMDk3NTUyOGNiYTkzMzdmMTk1YzRkNTEyMzBkMTQ3NGI5NTVhMzhlZDM0
15
- MjY2MWQ1NGNlMWE0NmJjMzI0YTZiZGI4NzgyNTY1YTg4ODZiMGE=
13
+ OTU3YTNmMzE5YjhiMGE2ZjA3Y2Y0YjZjNDExNTY0NTk4MzMxNzdlZWQyNjJm
14
+ YzNjZTJkNDZmYzcxNGExZmMxZjcyMmQ2NWJlYThlMGU4ODljNmQzODA5M2Nj
15
+ ZmM5MDFkZjU5MTE2MWQwNDZjYzM1NzIxOTdhM2E4NGFjY2Q2ZmQ=
@@ -31,9 +31,9 @@ class Applitools::AgentConnector
31
31
  Applitools::Session.new(parsed_res["id"], parsed_res["url"], status_code == "Created" )
32
32
  end
33
33
 
34
- def stop_session(session, aborted=nil)
34
+ def stop_session(session, aborted=nil, save=false)
35
35
  self.class.headers 'Content-Type' => 'application/json'
36
- res = self.class.delete(uri + "/#{session.id}", basic_auth: auth, params: { aborted: aborted.to_s })
36
+ res = self.class.delete(uri + "/#{session.id}", basic_auth: auth, query: { aborted: aborted.to_s, updateBaseline: save.to_s })
37
37
  parsed_res = res.parsed_response
38
38
  parsed_res.delete("$id")
39
39
  Applitools::TestResults.new(*parsed_res.values)
@@ -22,7 +22,8 @@ class Applitools::Eyes
22
22
 
23
23
  public
24
24
  attr_reader :disabled, :app_name, :test_name, :is_open, :viewport_size, :failure_reports, :match_level, :driver
25
- attr_accessor :match_timeout, :batch, :host_os, :host_app, :branch_name, :parent_branch_name, :user_inputs
25
+ attr_accessor :match_timeout, :batch, :host_os, :host_app, :branch_name, :parent_branch_name, :user_inputs,
26
+ :save_new_tests, :save_failed_tests
26
27
 
27
28
  def config
28
29
  self.class.config
@@ -48,6 +49,8 @@ class Applitools::Eyes
48
49
  @agent_connector = Applitools::AgentConnector.new(server_url, AGENT_ID, api_key)
49
50
  @match_timeout = DEFAULT_MATCH_TIMEOUT
50
51
  @failure_reports = Applitools::FailureReports::ON_CLOSE
52
+ @save_new_tests = true
53
+ @save_failed_tests = false
51
54
  end
52
55
 
53
56
  def open(params={})
@@ -113,20 +116,29 @@ class Applitools::Eyes
113
116
  return Applitools::TestResults.new if !session
114
117
 
115
118
  session_results_url = session.url
116
- results = agent_connector.stop_session(session,false)
117
119
  new_session = session.new_session?
120
+ save = (new_session && save_new_tests) || (!new_session && save_failed_tests)
121
+ results = agent_connector.stop_session(session, false, save)
118
122
  self.session = nil
119
-
120
123
  if new_session
121
- instructions = "Please approve the new baseline at #{session_results_url}"
124
+ if save
125
+ instructions = "Test was automatically accepted. You can review it at #{session_results_url}"
126
+ else
127
+ instructions = "Please approve the new baseline at #{session_results_url}"
128
+ end
122
129
  EyesLogger.info "--- New test ended. #{instructions}"
123
130
  message = "' #{session_start_info.scenario_id_or_name} of"\
124
131
  " #{session_start_info.app_id_or_name}. #{instructions}"
125
132
  raise Applitools::NewTestError.new(message, results)
126
- elsif 0 < results.mismatches || 0 < results.missing
127
- EyesLogger.info "--- Failed test ended. See details at #{session_results_url}"
133
+ elsif 0 < results.mismatches || 0 < results.missing
134
+ if save
135
+ instructions = "Test was automatically accepted. You can review it at #{session_results_url}"
136
+ else
137
+ instructions = "Test failed. You can review it at #{session_results_url}"
138
+ end
139
+ EyesLogger.info "--- Failed test ended. #{instructions}"
128
140
  message = "' #{session_start_info.scenario_id_or_name} of"\
129
- " #{session_start_info.app_id_or_name}'. See details at #{session_results_url}"
141
+ " #{session_start_info.app_id_or_name}'. #{instructions}"
130
142
  raise Applitools::TestFailedError.new(message, results)
131
143
  end
132
144
 
@@ -158,7 +170,7 @@ class Applitools::Eyes
158
170
  @is_open = false
159
171
  if session
160
172
  begin
161
- agent_connector.stop_session(session,true)
173
+ agent_connector.stop_session(session, true, false)
162
174
  rescue Applitools::EyesError => e
163
175
  EyesLogger.info "Failed to abort server session -> #{e.message} "
164
176
  ensure
@@ -1,3 +1,3 @@
1
1
  module Applitools
2
- VERSION = '1.20.0'
2
+ VERSION = '1.21.0'
3
3
  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: 1.20.0
4
+ version: 1.21.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: 2013-12-03 00:00:00.000000000 Z
11
+ date: 2013-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver