eyes_core 3.15.36 → 3.15.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e83ac161c7c438799a4d6d8a5179d6444b3e2fa0b2c9514008a442803d864ff6
4
- data.tar.gz: 6adcc0d17224d03b32bf26158d47feb3e85aa92c188c2e7527628e791382ddd2
3
+ metadata.gz: a5bc549f02e42978f0f8b1c0354dc9211c04a43982ef0a96b0734a10ebecdaf3
4
+ data.tar.gz: 26012a8b6c30ec7fc36ce87a93837ab059d7f1dc5274e7393eb530fb99ca1a9f
5
5
  SHA512:
6
- metadata.gz: 6a7eb31c2124376db45cadaa7cfb0efe9ba5cee9181139143254bf733480a0a08a09995d25a62ccc0202f63ae5596f2ed470d386d164d99b35f16030a33bcb91
7
- data.tar.gz: b2a46e55eda62ff8845cddc7995da6f3cc5642eef6481a0e9ebe73f3636269aa429e938ed51d74706a1e84e0a870c9f23168483f809e490c3c8199b823afb2e8
6
+ metadata.gz: e8bd53adbf09648e26cdb331571d3b686ca725efe193a95e0074b1827e61faf2e7d753f53608d56bcefc341ce9b50b34ed16378974ac0eff704d73835f4fbc3b
7
+ data.tar.gz: e401a5cb7187c1eacc86970796ac85ccef0b365aabbcf2ba02c0eb9f73c37e106751984403611121fcfce1acf9f5f276e4261158d2e6efed6bd524935f8a7818
@@ -22,6 +22,7 @@ module Applitools::Connectivity
22
22
 
23
23
  RESOURCES_SHA_256 = '/resources/sha256/'.freeze
24
24
  RENDER_STATUS = '/render-status'.freeze
25
+ CLOSE_BATCH = '/api/sessions/batches/%s/close/bypointerid'.freeze
25
26
 
26
27
  HTTP_STATUS_CODES = {
27
28
  created: 201,
@@ -116,6 +117,19 @@ module Applitools::Connectivity
116
117
  response
117
118
  end
118
119
 
120
+ def close_batch(batch_id)
121
+ if 'true'.casecmp(ENV['APPLITOOLS_DONT_CLOSE_BATCHES'] || '') == 0
122
+ return Applitools::EyesLogger.info(
123
+ 'APPLITOOLS_DONT_CLOSE_BATCHES environment variable set to true. Doing nothing.'
124
+ ) && false
125
+ end
126
+ Applitools::ArgumentGuard.not_nil(batch_id, 'batch_id')
127
+ Applitools::EyesLogger.info("Called with #{batch_id}")
128
+ url = CLOSE_BATCH % batch_id
129
+ response = delete(URI.join(endpoint_url,url))
130
+ Applitools::EyesLogger.info "delete batch is done with #{response.status} status"
131
+ end
132
+
119
133
  def server_url=(url)
120
134
  @server_url = url.nil? ? DEFAULT_SERVER_URL : url
121
135
  unless @server_url.is_a? String
@@ -11,6 +11,7 @@ module Applitools
11
11
  environment_attribute :name, 'APPLITOOLS_BATCH_NAME'
12
12
  environment_attribute :id, 'APPLITOOLS_BATCH_ID'
13
13
  environment_attribute :sequence_name, 'APPLITOOLS_BATCH_SEQUENCE'
14
+ environment_attribute :notify_on_completion, 'APPLITOOLS_BATCH_NOTIFY'
14
15
 
15
16
  def initialize(name = nil, started_at = Time.now)
16
17
  self.name = name if name
@@ -23,7 +24,8 @@ module Applitools
23
24
  'id' => id,
24
25
  'name' => name,
25
26
  'startedAt' => @started_at.iso8601,
26
- 'batchSequenceName' => sequence_name
27
+ 'batchSequenceName' => sequence_name,
28
+ 'notifyOnCompletion' => 'true'.casecmp(notify_on_completion || '') == 0 ? true : false
27
29
  }
28
30
  end
29
31
 
@@ -0,0 +1,32 @@
1
+ require_relative 'eyes_runner'
2
+ module Applitools
3
+ class ClassicRunner < EyesRunner
4
+ attr_accessor :all_test_results, :all_pending_exceptions
5
+ def initialize()
6
+ super
7
+ self.all_test_results = []
8
+ end
9
+
10
+ def aggregate_result(test_result)
11
+ Applitools::ArgumentGuard.is_a?(test_result, 'test_result', Applitools::TestResults)
12
+ all_test_results << test_result
13
+ end
14
+
15
+ def aggregate_exceptions(result, exception)
16
+ all_pending_exceptions[result] = exception
17
+ end
18
+
19
+ def get_all_test_results(throw_exception = false)
20
+ begin
21
+ if false && throw_exception
22
+ all_pending_exceptions.each do |_result, exception|
23
+ raise exception
24
+ end
25
+ end
26
+ ensure
27
+ delete_all_batches
28
+ all_test_results
29
+ end
30
+ end
31
+ end
32
+ end
@@ -48,7 +48,7 @@ module Applitools
48
48
  :match_timeout, :save_new_tests, :save_failed_tests, :failure_reports, :default_match_settings, :cut_provider,
49
49
  :scale_ratio, :position_provider, :viewport_size, :verbose_results,
50
50
  :inferred_environment, :remove_session_if_matching, :server_scale, :server_remainder, :exact,
51
- :compare_with_parent_branch, :results
51
+ :compare_with_parent_branch, :results, :runner
52
52
 
53
53
  abstract_attr_accessor :base_agent_id
54
54
  abstract_method :capture_screenshot, true
@@ -62,7 +62,10 @@ module Applitools
62
62
 
63
63
  def_delegators 'config', *Applitools::EyesBaseConfiguration.methods_to_delegate
64
64
 
65
- def initialize(server_url = nil)
65
+ def initialize(*args)
66
+ options = Applitools::Utils.extract_options!(args)
67
+ self.runner = options[:runner]
68
+ server_url = args.first
66
69
  @server_connector = Applitools::Connectivity::ServerConnector.new(server_url)
67
70
  ensure_config
68
71
  self.server_url = server_url if server_url
@@ -406,6 +409,7 @@ module Applitools
406
409
  logger.info "Automatically save test? #{save}"
407
410
 
408
411
  results = server_connector.stop_session running_session, false, save
412
+ runner.aggregate_result(results) if runner
409
413
 
410
414
  results.is_new = is_new_session
411
415
  results.url = session_results_url
@@ -0,0 +1,18 @@
1
+ module Applitools
2
+ class EyesRunner
3
+ attr_accessor :batches_server_connectors_map
4
+
5
+ def initialize()
6
+ self.batches_server_connectors_map = {}
7
+ end
8
+
9
+ def add_batch(batch_id, &block)
10
+ puts batch_id
11
+ batches_server_connectors_map[batch_id] ||= block if block_given?
12
+ end
13
+
14
+ def delete_all_batches
15
+ batches_server_connectors_map.each_value { |v| v.call if v.respond_to? :call }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,13 @@
1
+ module Applitools
2
+ class TestResultSummary
3
+
4
+ attr_accessor :results, :passed, :unresolved, :failed, :exceptions, :mismatches, :missing, :matches
5
+ def initialize(results)
6
+ Applitools::ArgumentGuard.is_a?(results, 'results', Array)
7
+ results.each_with_index do |r, i|
8
+ Applitools::ArgumentGuard.is_a?(r, "results[#{i}]", Applitools::TestResults)
9
+ end
10
+
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.15.36'.freeze
4
+ VERSION = '3.15.37'.freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyes_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.15.36
4
+ version: 3.15.37
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-10-07 00:00:00.000000000 Z
11
+ date: 2019-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oily_png
@@ -268,10 +268,12 @@ files:
268
268
  - lib/applitools/core/argument_guard.rb
269
269
  - lib/applitools/core/batch_info.rb
270
270
  - lib/applitools/core/class_name.rb
271
+ - lib/applitools/core/classic_runner.rb
271
272
  - lib/applitools/core/debug_screenshot_provider.rb
272
273
  - lib/applitools/core/eyes_base.rb
273
274
  - lib/applitools/core/eyes_base_configuration.rb
274
275
  - lib/applitools/core/eyes_configuration_dsl.rb
276
+ - lib/applitools/core/eyes_runner.rb
275
277
  - lib/applitools/core/eyes_screenshot.rb
276
278
  - lib/applitools/core/fixed_cut_provider.rb
277
279
  - lib/applitools/core/fixed_scale_provider.rb
@@ -299,6 +301,7 @@ files:
299
301
  - lib/applitools/core/session.rb
300
302
  - lib/applitools/core/session_start_info.rb
301
303
  - lib/applitools/core/session_types.rb
304
+ - lib/applitools/core/test_result_summary.rb
302
305
  - lib/applitools/core/test_results.rb
303
306
  - lib/applitools/core/text_trigger.rb
304
307
  - lib/applitools/core/trigger.rb