eyes_core 3.16.16 → 3.17.4

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: b136d9d87a89f8d7de25d38d7a6597d4dce20866def4985ba735a39e7b6e3462
4
- data.tar.gz: 8d5861b1392c336a75ca393ac20224493cc7fd26e40ebee43951ff479ce8f63c
3
+ metadata.gz: 312e54caac6310abd60d5bc82d8e0897fc635d374a66744f560143232d324d0a
4
+ data.tar.gz: 06c6261334f611245938c4653bb2e6619a6309538285e3ace4d4bcfc4e2be214
5
5
  SHA512:
6
- metadata.gz: c504140d557d1aac4516873f7c65149e293c10cde3c28f43bfbb31eee608b3ed5743b75e07a3674b51fe8a4ccde5a004b46ec986721957f342549575be345bc8
7
- data.tar.gz: 53cff244c5b9290bf8baf58bb6f6d1e294183dc0f10097eb2c55273ca9301b31c6d0df21d97a1a404bd95835f5a5e5beb4b6b1afd095784703574154ca46c7d0
6
+ metadata.gz: 86a30cb5da86b0f128f3265f52c61880f429eb5310529a1fbf755b013c6e017515327c11d0507513acee261c57ca89d24b33306d69ea4cdea9dadb9455d82172
7
+ data.tar.gz: 9ab3f66d06e33475bcdf250b80fce6013f413ec1d77fc92457e14ac36052382a97d5de964dc06e63feeef0e455711c23c4989fd5b8d5b2156037f1711e489e0d
@@ -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
 
@@ -3,12 +3,44 @@
3
3
  module Applitools
4
4
  module AccessibilityLevel
5
5
  extend self
6
- NONE = 'None'
7
6
  AA = 'AA'
8
7
  AAA = 'AAA'
9
8
 
10
9
  def enum_values
11
- [NONE, AA, AAA]
10
+ [AA, AAA]
11
+ end
12
+ end
13
+
14
+ module AccessibilityGuidelinesVersion
15
+ extend self
16
+ WCAG_2_1 = 'WCAG_2_1'
17
+ WCAG_2_0 = 'WCAG_2_0'
18
+ def enum_values
19
+ [WCAG_2_0, WCAG_2_1]
20
+ end
21
+ end
22
+
23
+ class AccessibilitySettings
24
+ attr_reader :config_hash
25
+ attr_accessor :validation_errors
26
+ extend Applitools::EyesConfigurationDSL
27
+
28
+ enum_field :level, Applitools::AccessibilityLevel.enum_values
29
+ enum_field :version, Applitools::AccessibilityGuidelinesVersion.enum_values
30
+
31
+ def initialize(accessibility_level, guidelines_version)
32
+ @config_hash = {}
33
+ self.validation_errors = []
34
+ self.level = accessibility_level
35
+ self.version = guidelines_version
36
+ end
37
+
38
+ def to_h
39
+ @config_hash
40
+ end
41
+
42
+ def json_data
43
+ to_h
12
44
  end
13
45
  end
14
46
  end
@@ -4,7 +4,6 @@ module Applitools
4
4
  module AccessibilityRegionType
5
5
  extend self
6
6
 
7
- NONE = 'None'
8
7
  IGNORE_CONTRAST = 'IgnoreContrast'
9
8
  REGULAR_TEXT = 'RegularText'
10
9
  LARGE_TEXT = 'LargeText'
@@ -13,7 +12,6 @@ module Applitools
13
12
 
14
13
  def enum_values
15
14
  [
16
- NONE,
17
15
  IGNORE_CONTRAST,
18
16
  REGULAR_TEXT,
19
17
  LARGE_TEXT,
@@ -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,15 +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
- default_match_settings: Applitools::ImageMatchSettings.new
23
+ default_match_settings: Applitools::ImageMatchSettings.new,
24
+ accessibility_validation: nil,
25
+ properties: []
24
26
  }.freeze
25
27
 
26
28
  class << self
@@ -109,6 +111,8 @@ module Applitools
109
111
  int_field :scale
110
112
  int_field :remainder
111
113
  boolean_field :ignore_caret
114
+ object_field :accessibility_validation, Applitools::AccessibilitySettings, true
115
+ object_field :properties, Array
112
116
 
113
117
  methods_to_delegate.delete(:batch_info)
114
118
  methods_to_delegate.delete(:batch_info=)
@@ -161,6 +165,16 @@ module Applitools
161
165
  default_match_settings.ignore_caret = value
162
166
  end
163
167
 
168
+ def custom_setter_for_accessibility_validation(value)
169
+ # self.default_match_settings = self.parent.class.default_config[:default_match_settings] unless default_match_settings
170
+ default_match_settings.accessibility_validation = value
171
+ end
172
+
173
+ def add_property(name, value)
174
+ properties << { name: name, value: value } if name && value
175
+ end
176
+
164
177
  methods_to_delegate.push(:set_proxy)
178
+ methods_to_delegate.push(:add_property)
165
179
  end
166
180
  end
@@ -62,7 +62,7 @@ module Applitools
62
62
  end
63
63
  end
64
64
 
65
- def object_field(field_name, klass)
65
+ def object_field(field_name, klass, allow_nil = false)
66
66
  collect_method field_name
67
67
  define_method(field_name) do
68
68
  return send("custom_getter_for_#{field_name}", config_hash[field_name.to_sym]) if
@@ -71,11 +71,11 @@ module Applitools
71
71
  end
72
72
  define_method("#{field_name}=") do |*args|
73
73
  value = args.shift
74
- unless value.is_a? klass
74
+ unless value.is_a?(klass)
75
75
  raise(
76
76
  Applitools::EyesIllegalArgument,
77
77
  "Expected #{klass} but got #{value.class}"
78
- )
78
+ ) unless allow_nil && value.nil?
79
79
  end
80
80
  config_hash[field_name.to_sym] = value
81
81
  config_hash[field_name.to_sym] = send("custom_setter_for_#{field_name}", config_hash[field_name.to_sym]) if
@@ -123,7 +123,7 @@ module Applitools
123
123
  unless available_values_array.include? value
124
124
  raise(
125
125
  Applitools::EyesIllegalArgument,
126
- "Unknown #{field_name} #{value}. Allowed session types: " \
126
+ "Unknown #{field_name} #{value}. Allowed #{field_name} values: " \
127
127
  "#{available_values_array.join(', ')}"
128
128
  )
129
129
  end
@@ -6,12 +6,12 @@ module Applitools
6
6
  class ImageMatchSettings
7
7
  include Applitools::Jsonable
8
8
  include Applitools::MatchLevelSetter
9
- json_fields :accessibilityLevel, :MatchLevel, :IgnoreCaret, :IgnoreDisplacements, :Accessibility,
9
+ json_fields :accessibilitySettings, :MatchLevel, :IgnoreCaret, :IgnoreDisplacements, :Accessibility,
10
10
  :Ignore, :Floating, :Layout, :Strict, :Content, :Exact, :EnablePatterns, :UseDom,
11
11
  :SplitTopHeight, :SplitBottomHeight, :scale, :remainder
12
12
 
13
13
  def initialize
14
- self.accessibility_level = 'None'
14
+ self.accessibility_settings = nil
15
15
  self.match_level = Applitools::MatchLevel::STRICT
16
16
  self.split_top_height = 0
17
17
  self.split_bottom_height = 0
@@ -49,6 +49,15 @@ module Applitools
49
49
  cloned_value
50
50
  end
51
51
 
52
+ def accessibility_validation
53
+ accessibility_settings
54
+ end
55
+
56
+ def accessibility_validation=(value)
57
+ raise Applitools::EyesIllegalArgument, "Expected value to be an Applitools::AccessibilitySettings instance but got #{value.class}" unless value.nil? || value.is_a?(Applitools::AccessibilitySettings)
58
+ self.accessibility_settings = value
59
+ end
60
+
52
61
  class Exact
53
62
  include Applitools::Jsonable
54
63
  json_fields :MinDiffIntensity, :MinDiffWidth, :MinDiffHeight, :MatchThreshold
@@ -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
@@ -4,6 +4,18 @@ require 'yaml'
4
4
 
5
5
  module Applitools
6
6
  class TestResults
7
+ class AccessibilityStatus
8
+ attr_accessor :status, :level, :version
9
+ def initialize(hash = {})
10
+ self.status = hash['status']
11
+ self.level = hash['level']
12
+ self.version = hash['version']
13
+ end
14
+
15
+ def failed?
16
+ status.downcase == 'Failed'.downcase
17
+ end
18
+ end
7
19
  attr_accessor :is_new, :url, :screenshot
8
20
  attr_reader :status, :steps, :matches, :mismatches, :missing, :original_results
9
21
 
@@ -50,6 +62,14 @@ module Applitools
50
62
  original_results['secretToken']
51
63
  end
52
64
 
65
+ def name
66
+ original_results['name']
67
+ end
68
+
69
+ def session_accessibility_status
70
+ @accessibility_status ||= original_results['accessibilityStatus'] && AccessibilityStatus.new(original_results['accessibilityStatus'] || {})
71
+ end
72
+
53
73
  def ==(other)
54
74
  if other.is_a? self.class
55
75
  result = true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '3.16.16'.freeze
4
+ VERSION = '3.17.4'.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.16.16
4
+ version: 3.17.4
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-04-28 00:00:00.000000000 Z
11
+ date: 2020-06-11 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: []