eyes_core 3.17.0 → 3.17.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e542320871204f754110c7419d817feb2385f625dc0adff02c02fe33c42f876
4
- data.tar.gz: c12ab16b92d42b54e1b925280efb94acf3e75a2bba2082bca89b5268ca1ada08
3
+ metadata.gz: 7310e37493c80d222643d70ce6352cb784fe86d34b27b3fad8740665ee589063
4
+ data.tar.gz: 1674260c00c316a86251db7e3dd3da07d77558314b8014ac2f3a90b423b6e17e
5
5
  SHA512:
6
- metadata.gz: 8de1e5421cf619b5978bfdf3264b72d8b1c563b22fd9ea6c3a02448dbe650a2787d18f8ffc8edeac8b2dfd94096a1ba20df5266bbff6a9e91a9bf9710a3e496e
7
- data.tar.gz: ef0e7307e4062eaad4825547f0cc97df89295d57cc6510500bca365d92575e3afbf0af2db598f0667ba800dc0ce83e565fd3b55a6b071e8bdb3abd3c4ba47be0
6
+ metadata.gz: 2ac7176e612f88b29670b6675dbcd424d88462ca3a7d055899244438b3e33d3b2f14961b03a48a49bf7444c23145cac744f1a20febea15199c2b2de07480e06d
7
+ data.tar.gz: 03343c60d0e6547126f3279be37eac4ea1e138f32bbc1ab4853699b600f099d661b49df9531eb1f2d54311d95890b5dd68fe118dc697c26d466b9825bdafd761
@@ -279,9 +279,7 @@ 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
  )
@@ -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 + ' (Chrome emulation)'
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...'
@@ -8,6 +8,7 @@ require 'applitools/core/match_level'
8
8
  require 'applitools/core/match_level_setter'
9
9
  require 'applitools/connectivity/server_connector'
10
10
  require 'applitools/core/image_match_settings'
11
+ require 'active_support/deprecation'
11
12
 
12
13
  module Applitools
13
14
  class EyesBaseConfiguration < AbstractConfiguration
@@ -21,7 +22,8 @@ module Applitools
21
22
  api_key: ENV['APPLITOOLS_API_KEY'] || ENV['bamboo_APPLITOOLS_API_KEY'] || '',
22
23
  save_new_tests: true,
23
24
  default_match_settings: Applitools::ImageMatchSettings.new,
24
- accessibility_validation: nil
25
+ accessibility_validation: nil,
26
+ properties: []
25
27
  }.freeze
26
28
 
27
29
  class << self
@@ -111,6 +113,7 @@ module Applitools
111
113
  int_field :remainder
112
114
  boolean_field :ignore_caret
113
115
  object_field :accessibility_validation, Applitools::AccessibilitySettings, true
116
+ object_field :properties, Array
114
117
 
115
118
  methods_to_delegate.delete(:batch_info)
116
119
  methods_to_delegate.delete(:batch_info=)
@@ -168,7 +171,11 @@ module Applitools
168
171
  default_match_settings.accessibility_validation = value
169
172
  end
170
173
 
174
+ def add_property(name, value)
175
+ properties << { name: name, value: value } if name && value
176
+ end
171
177
 
172
178
  methods_to_delegate.push(:set_proxy)
179
+ methods_to_delegate.push(:add_property)
173
180
  end
174
181
  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,16 @@ 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 { |k, v| [k, json_value(send(v))] }.to_h
46
+ result = self.class.wrap_data_block.call(result) if self.class.wrap_data_block.is_a? Proc
47
+ result
41
48
  end
42
49
 
43
50
  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.1'.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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-18 00:00:00.000000000 Z
11
+ date: 2020-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oily_png
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: activesupport
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: bundler
99
113
  requirement: !ruby/object:Gem::Requirement