eyes_core 3.16.16 → 3.17.0

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: 3e542320871204f754110c7419d817feb2385f625dc0adff02c02fe33c42f876
4
+ data.tar.gz: c12ab16b92d42b54e1b925280efb94acf3e75a2bba2082bca89b5268ca1ada08
5
5
  SHA512:
6
- metadata.gz: c504140d557d1aac4516873f7c65149e293c10cde3c28f43bfbb31eee608b3ed5743b75e07a3674b51fe8a4ccde5a004b46ec986721957f342549575be345bc8
7
- data.tar.gz: 53cff244c5b9290bf8baf58bb6f6d1e294183dc0f10097eb2c55273ca9301b31c6d0df21d97a1a404bd95835f5a5e5beb4b6b1afd095784703574154ca46c7d0
6
+ metadata.gz: 8de1e5421cf619b5978bfdf3264b72d8b1c563b22fd9ea6c3a02448dbe650a2787d18f8ffc8edeac8b2dfd94096a1ba20df5266bbff6a9e91a9bf9710a3e496e
7
+ data.tar.gz: ef0e7307e4062eaad4825547f0cc97df89295d57cc6510500bca365d92575e3afbf0af2db598f0667ba800dc0ce83e565fd3b55a6b071e8bdb3abd3c4ba47be0
@@ -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,
@@ -20,7 +20,8 @@ module Applitools
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
24
25
  }.freeze
25
26
 
26
27
  class << self
@@ -109,6 +110,7 @@ module Applitools
109
110
  int_field :scale
110
111
  int_field :remainder
111
112
  boolean_field :ignore_caret
113
+ object_field :accessibility_validation, Applitools::AccessibilitySettings, true
112
114
 
113
115
  methods_to_delegate.delete(:batch_info)
114
116
  methods_to_delegate.delete(:batch_info=)
@@ -161,6 +163,12 @@ module Applitools
161
163
  default_match_settings.ignore_caret = value
162
164
  end
163
165
 
166
+ def custom_setter_for_accessibility_validation(value)
167
+ # self.default_match_settings = self.parent.class.default_config[:default_match_settings] unless default_match_settings
168
+ default_match_settings.accessibility_validation = value
169
+ end
170
+
171
+
164
172
  methods_to_delegate.push(:set_proxy)
165
173
  end
166
174
  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
@@ -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.0'.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.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: 2020-04-28 00:00:00.000000000 Z
11
+ date: 2020-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oily_png