eyes_core 3.17.0 → 3.17.5

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: 3e542320871204f754110c7419d817feb2385f625dc0adff02c02fe33c42f876
4
- data.tar.gz: c12ab16b92d42b54e1b925280efb94acf3e75a2bba2082bca89b5268ca1ada08
3
+ metadata.gz: 864e172f6fa3b2035c0e8aa7a655e98d83de4bfe07c821f2cef2260e5df12747
4
+ data.tar.gz: e85acaa6dc31a5d09fc0e8060267b7c0be45c435fd54d5a1ef621a20d4c9de35
5
5
  SHA512:
6
- metadata.gz: 8de1e5421cf619b5978bfdf3264b72d8b1c563b22fd9ea6c3a02448dbe650a2787d18f8ffc8edeac8b2dfd94096a1ba20df5266bbff6a9e91a9bf9710a3e496e
7
- data.tar.gz: ef0e7307e4062eaad4825547f0cc97df89295d57cc6510500bca365d92575e3afbf0af2db598f0667ba800dc0ce83e565fd3b55a6b071e8bdb3abd3c4ba47be0
6
+ metadata.gz: 3d62989db64a12ab1542ea9e1218a21646e5d209c17723570568f60ef13cfd8cd16aed6fd678afa34c5be60cb0c8d3c382b65b448760c52bf2faa49f89131601
7
+ data.tar.gz: 57696e8e7e2145ef6570ac42f55cff2560046fd5ce3193f16c2f6328811e8439a50b3d9bbdfcbddfa9d745ce12840d4f6754ef668896b3c357c75d5803f59c28
@@ -279,14 +279,11 @@ module Applitools::Connectivity
279
279
  end
280
280
 
281
281
  def start_session(session_start_info)
282
- request_body = Oj.dump(
283
- startInfo: Applitools::Utils.camelcase_hash_keys(session_start_info.to_hash)
284
- )
282
+ request_body = session_start_info.json
285
283
  res = long_post(
286
284
  endpoint_url, body: request_body
287
285
  )
288
286
  raise Applitools::EyesError.new("Request failed: #{res.status} #{res.body} #{request_body}") unless res.success?
289
-
290
287
  response = Oj.load(res.body)
291
288
  Applitools::Session.new(response, res.status == HTTP_STATUS_CODES[:created])
292
289
  end
@@ -11,9 +11,11 @@ module Applitools
11
11
  def initialize
12
12
  @config_hash = {}
13
13
  self.validation_errors = {}
14
- default_config = self.class.default_config
15
- default_config.keys.each do |k|
16
- send "#{k}=", default_config[k]
14
+ if self.class.respond_to? :default_config
15
+ default_config = self.class.default_config
16
+ default_config.keys.each do |k|
17
+ send "#{k}=", default_config[k] unless default_config[k].nil?
18
+ end
17
19
  end
18
20
  end
19
21
 
@@ -12,16 +12,20 @@ module Applitools
12
12
  self.device_info = options[:device_info]
13
13
  end
14
14
 
15
- def to_hash
15
+ def json_data
16
16
  {
17
- 'os' => os,
18
- 'hostingApp' => hosting_app,
19
- 'displaySize' => display_size && display_size.to_hash,
20
- 'inferred' => inferred_environment,
21
- 'deviceInfo' => device_info.nil? || device_info.empty? ? 'Desktop' : device_info + ' (Chrome emulation)'
17
+ 'os' => os,
18
+ 'hostingApp' => hosting_app,
19
+ 'displaySize' => display_size && display_size.to_hash,
20
+ 'inferred' => inferred_environment,
21
+ 'deviceInfo' => device_info.nil? || device_info.empty? ? 'Desktop' : device_info
22
22
  }
23
23
  end
24
24
 
25
+ def to_hash
26
+ json_data
27
+ end
28
+
25
29
  def to_s
26
30
  result = ''
27
31
  to_hash.each_pair do |k, v|
@@ -19,16 +19,20 @@ module Applitools
19
19
  self.id = SecureRandom.uuid unless id
20
20
  end
21
21
 
22
- def to_hash
22
+ def json_data
23
23
  {
24
- 'id' => id,
25
- 'name' => name,
26
- 'startedAt' => @started_at.iso8601,
27
- 'batchSequenceName' => sequence_name,
28
- 'notifyOnCompletion' => 'true'.casecmp(notify_on_completion || '') == 0 ? true : false
24
+ 'id' => id,
25
+ 'name' => name,
26
+ 'startedAt' => @started_at.iso8601,
27
+ 'batchSequenceName' => sequence_name,
28
+ 'notifyOnCompletion' => 'true'.casecmp(notify_on_completion || '') == 0 ? true : false
29
29
  }
30
30
  end
31
31
 
32
+ def to_hash
33
+ json_data
34
+ end
35
+
32
36
  def to_s
33
37
  to_hash.to_s
34
38
  end
@@ -87,7 +87,6 @@ module Applitools
87
87
  self.results = []
88
88
  self.allow_empty_screenshot = true
89
89
  @inferred_environment = nil
90
- @properties = []
91
90
  @server_scale = 0
92
91
  @server_remainder = 0
93
92
  get_app_output_method = ->(r, s) { get_app_output_with_screenshot r, s }
@@ -151,10 +150,6 @@ module Applitools
151
150
  running_session && running_session.new_session?
152
151
  end
153
152
 
154
- def add_property(name, value)
155
- @properties << { name: name, value: value }
156
- end
157
-
158
153
  def abort_if_not_closed
159
154
  if disabled?
160
155
  logger.info "#{__method__} Ignored"
@@ -319,11 +314,14 @@ module Applitools
319
314
 
320
315
  tag = '' if tag.nil?
321
316
 
322
- session_start_info = SessionStartInfo.new agent_id: base_agent_id, app_id_or_name: app_name,
323
- scenario_id_or_name: test_name, batch_info: batch,
324
- env_name: baseline_env_name, environment: app_environment,
325
- default_match_settings: default_match_settings.json_data,
326
- branch_name: branch_name, parent_branch_name: parent_branch_name, properties: properties
317
+ self.session_start_info = SessionStartInfo.new agent_id: base_agent_id, app_id_or_name: app_name,
318
+ scenario_id_or_name: test_name, batch_info: batch,
319
+ baseline_env_name: baseline_env_name, environment: app_env,
320
+ default_match_settings: default_match_settings,
321
+ environment_name: environment_name, session_type: session_type,
322
+ branch_name: branch_name, parent_branch_name: parent_branch_name,
323
+ baseline_branch_name: baseline_branch_name, save_diffs: save_diffs,
324
+ properties: properties
327
325
 
328
326
  match_window_data.start_info = session_start_info
329
327
  match_window_data.update_baseline_if_new = save_new_tests
@@ -481,7 +479,7 @@ module Applitools
481
479
  attr_accessor :running_session, :last_screenshot, :scale_provider, :session_start_info,
482
480
  :should_match_window_run_once_on_timeout, :app_output_provider, :failed
483
481
 
484
- attr_reader :user_inputs, :properties
482
+ attr_reader :user_inputs
485
483
 
486
484
  private :full_agent_id, :full_agent_id=
487
485
 
@@ -596,9 +594,11 @@ module Applitools
596
594
 
597
595
  self.session_start_info = SessionStartInfo.new agent_id: base_agent_id, app_id_or_name: app_name,
598
596
  scenario_id_or_name: test_name, batch_info: batch,
599
- env_name: baseline_env_name, environment: app_env,
600
- default_match_settings: default_match_settings.json_data,
597
+ baseline_env_name: baseline_env_name, environment: app_env,
598
+ default_match_settings: default_match_settings,
599
+ environment_name: environment_name, session_type: session_type,
601
600
  branch_name: branch_name, parent_branch_name: parent_branch_name,
601
+ baseline_branch_name: baseline_branch_name, save_diffs: save_diffs,
602
602
  properties: properties
603
603
 
604
604
  logger.info 'Starting server session...'
@@ -12,16 +12,17 @@ require 'applitools/core/image_match_settings'
12
12
  module Applitools
13
13
  class EyesBaseConfiguration < AbstractConfiguration
14
14
  DEFAULT_CONFIG = {
15
- branch_name: ENV['APPLITOOLS_BRANCH'] || '',
16
- parent_branch_name: ENV['APPLITOOLS_PARENT_BRANCH'] || '',
17
- baseline_branch_name: ENV['APPLITOOLS_BASELINE_BRANCH'] || '',
15
+ branch_name: ENV['APPLITOOLS_BRANCH'],
16
+ parent_branch_name: ENV['APPLITOOLS_PARENT_BRANCH'],
17
+ baseline_branch_name: ENV['APPLITOOLS_BASELINE_BRANCH'],
18
18
  save_diffs: false,
19
19
  server_url: ENV['APPLITOOLS_SERVER_URL'] ||
20
20
  ENV['bamboo_APPLITOOLS_SERVER_URL'] || Applitools::Connectivity::ServerConnector::DEFAULT_SERVER_URL,
21
21
  api_key: ENV['APPLITOOLS_API_KEY'] || ENV['bamboo_APPLITOOLS_API_KEY'] || '',
22
22
  save_new_tests: true,
23
23
  default_match_settings: Applitools::ImageMatchSettings.new,
24
- accessibility_validation: nil
24
+ accessibility_validation: nil,
25
+ properties: []
25
26
  }.freeze
26
27
 
27
28
  class << self
@@ -111,6 +112,7 @@ module Applitools
111
112
  int_field :remainder
112
113
  boolean_field :ignore_caret
113
114
  object_field :accessibility_validation, Applitools::AccessibilitySettings, true
115
+ object_field :properties, Array
114
116
 
115
117
  methods_to_delegate.delete(:batch_info)
116
118
  methods_to_delegate.delete(:batch_info=)
@@ -168,7 +170,11 @@ module Applitools
168
170
  default_match_settings.accessibility_validation = value
169
171
  end
170
172
 
173
+ def add_property(name, value)
174
+ properties << { name: name, value: value } if name && value
175
+ end
171
176
 
172
177
  methods_to_delegate.push(:set_proxy)
178
+ methods_to_delegate.push(:add_property)
173
179
  end
174
180
  end
@@ -7,9 +7,10 @@ module Applitools
7
7
  base.extend ClassMethods
8
8
  base.class_eval do
9
9
  class << self
10
- attr_accessor :json_methods
10
+ attr_accessor :json_methods, :wrap_data_block
11
11
  end
12
12
  @json_methods = {}
13
+ @wrap_data_block = nil
13
14
  end
14
15
  end
15
16
 
@@ -34,10 +35,20 @@ module Applitools
34
35
  def json_fields(*args)
35
36
  args.each { |m| json_field m }
36
37
  end
38
+
39
+ def wrap_data(&block)
40
+ @wrap_data_block = block
41
+ end
37
42
  end
38
43
 
39
44
  def json_data
40
- self.class.json_methods.sort.map { |k, v| [k, json_value(send(v))] }.to_h
45
+ result = self.class.json_methods.sort.map do |k,v|
46
+ val = json_value(send(v))
47
+ next if val.nil?
48
+ [k, val]
49
+ end.compact.to_h
50
+ result = self.class.wrap_data_block.call(result) if self.class.wrap_data_block.is_a? Proc
51
+ result
41
52
  end
42
53
 
43
54
  def json
@@ -2,38 +2,36 @@
2
2
 
3
3
  module Applitools
4
4
  class SessionStartInfo
5
- attr_accessor :app_id_or_name, :scenario_id_or_name
5
+ include Applitools::Jsonable
6
+ json_fields :batchInfo, :agentId, :appIdOrName, :verId, :environment, :environmentName, :branchName, :defaultMatchSettings,
7
+ :scenarioIdOrName, :properties, :parentBranchName, :compareWithParentBranch, :baselineEnvName, :saveDiffs, :sessionType,
8
+ :baselineBranchName
9
+
10
+ wrap_data do |value|
11
+ { startInfo: value }
12
+ end
6
13
 
7
14
  def initialize(options = {})
8
- @agent_id = options[:agent_id]
9
- @app_id_or_name = options[:app_id_or_name]
10
- @ver_id = options[:ver_id]
11
- @scenario_id_or_name = options[:scenario_id_or_name]
12
- @batch_info = options[:batch_info]
13
- @env_name = options[:env_name]
14
- @environment = options[:environment]
15
- @default_match_settings = options[:default_match_settings]
16
- @branch_name = options[:branch_name]
17
- @parent_branch_name = options[:parent_branch_name]
18
- @properties = options[:properties]
19
- @compare_with_parent_branch = options[:compare_with_parent_branch]
15
+ self.agent_id = options[:agent_id]
16
+ self.app_id_or_name = options[:app_id_or_name]
17
+ self.ver_id = options[:ver_id]
18
+ self.scenario_id_or_name = options[:scenario_id_or_name]
19
+ self.batch_info = options[:batch_info]
20
+ self.environment_name = options[:environment_name]
21
+ self.baseline_env_name = options[:baseline_env_name]
22
+ self.environment = options[:environment]
23
+ self.default_match_settings = options[:default_match_settings]
24
+ self.branch_name = options[:branch_name]
25
+ self.parent_branch_name = options[:parent_branch_name]
26
+ self.properties = options[:properties]
27
+ self.compare_with_parent_branch = options[:compare_with_parent_branch]
28
+ self.save_diffs = options[:save_diffs]
29
+ self.session_type = options[:session_type]
30
+ self.baseline_branch_name = options[:baseline_branch_name]
20
31
  end
21
32
 
22
33
  def to_hash
23
- {
24
- agent_id: @agent_id,
25
- app_id_or_name: @app_id_or_name,
26
- ver_id: @ver_id,
27
- scenario_id_or_name: @scenario_id_or_name,
28
- batch_info: @batch_info && @batch_info.to_hash,
29
- env_name: @env_name,
30
- environment: @environment.to_hash,
31
- default_match_settings: @default_match_settings,
32
- branch_name: @branch_name,
33
- parent_branch_name: @parent_branch_name,
34
- compare_with_parent_branch: @compare_with_parent_branch,
35
- properties: @properties
36
- }
34
+ json_data
37
35
  end
38
36
  end
39
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.17.0'.freeze
4
+ VERSION = '3.17.5'.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.17.0
4
+ version: 3.17.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-18 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oily_png
@@ -370,7 +370,7 @@ licenses:
370
370
  - Applitools
371
371
  metadata:
372
372
  yard.run: yri
373
- post_install_message:
373
+ post_install_message:
374
374
  rdoc_options: []
375
375
  require_paths:
376
376
  - lib
@@ -387,7 +387,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
387
387
  version: '0'
388
388
  requirements: []
389
389
  rubygems_version: 3.0.8
390
- signing_key:
390
+ signing_key:
391
391
  specification_version: 4
392
392
  summary: Core of the Applitools Ruby SDK
393
393
  test_files: []