Class: Applitools::EyesBaseConfiguration
Constant Summary
collapse
- DEFAULT_CONFIG =
{
branch_name: ENV['APPLITOOLS_BRANCH'] || '',
parent_branch_name: ENV['APPLITOOLS_PARENT_BRANCH'] || '',
baseline_branch_name: ENV['APPLITOOLS_BASELINE_BRANCH'] || '',
save_diffs: false,
server_url: ENV['APPLITOOLS_SERVER_URL'] ||
ENV['bamboo_APPLITOOLS_SERVER_URL'] || Applitools::Connectivity::ServerConnector::DEFAULT_SERVER_URL,
api_key: ENV['APPLITOOLS_API_KEY'] || ENV['bamboo_APPLITOOLS_API_KEY'] || '',
save_new_tests: true,
default_match_settings: Applitools::ImageMatchSettings.new,
accessibility_validation: nil,
properties: []
}.freeze
Instance Attribute Summary
#config_hash, #validation_errors
Class Method Summary
collapse
Instance Method Summary
collapse
#deep_clone
#accessor_methods, #boolean_field, #collect_method, #enum_field, #int_field, #methods_to_delegate, #object_field, #string_field
Constructor Details
Returns a new instance of EyesBaseConfiguration.
35
36
37
38
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 35
def initialize
super
end
|
Class Method Details
.default_config ⇒ Object
30
31
32
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 30
def default_config
DEFAULT_CONFIG
end
|
Instance Method Details
#add_property(name, value) ⇒ Object
174
175
176
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 174
def add_property(name, value)
properties << { name: name, value: value } if name && value
end
|
#batch ⇒ Object
76
77
78
79
80
81
82
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 76
def batch
if batch_info.nil?
Applitools::EyesLogger.info 'No batch set'
self.batch_info = BatchInfo.new
end
batch_info
end
|
#batch=(value) ⇒ Object
84
85
86
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 84
def batch=(value)
self.batch_info = value
end
|
#config_keys ⇒ Object
53
54
55
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 53
def config_keys
config_hash.keys
end
|
#custom_getter_for_exact(_value) ⇒ Object
145
146
147
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 145
def custom_getter_for_exact(_value)
default_match_settings.exact
end
|
#custom_getter_for_ignore_caret(_value) ⇒ Object
161
162
163
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 161
def custom_getter_for_ignore_caret(_value)
default_match_settings.ignore_caret
end
|
#custom_getter_for_match_level(_value) ⇒ Object
157
158
159
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 157
def custom_getter_for_match_level(_value)
default_match_settings.match_level
end
|
#custom_getter_for_remainder(_value) ⇒ Object
153
154
155
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 153
def custom_getter_for_remainder(_value)
default_match_settings.remainder
end
|
#custom_getter_for_scale(_value) ⇒ Object
149
150
151
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 149
def custom_getter_for_scale(_value)
default_match_settings.scale
end
|
#custom_setter_for_accessibility_validation(value) ⇒ Object
169
170
171
172
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 169
def custom_setter_for_accessibility_validation(value)
default_match_settings.accessibility_validation = value
end
|
#custom_setter_for_exact(value) ⇒ Object
129
130
131
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 129
def custom_setter_for_exact(value)
default_match_settings.exact = value
end
|
#custom_setter_for_ignore_caret(value) ⇒ Object
165
166
167
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 165
def custom_setter_for_ignore_caret(value)
default_match_settings.ignore_caret = value
end
|
#custom_setter_for_match_level(value) ⇒ Object
133
134
135
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 133
def custom_setter_for_match_level(value)
default_match_settings.match_level = value
end
|
#custom_setter_for_remainder(value) ⇒ Object
141
142
143
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 141
def custom_setter_for_remainder(value)
default_match_settings.remainder = value
end
|
#custom_setter_for_scale(value) ⇒ Object
137
138
139
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 137
def custom_setter_for_scale(value)
default_match_settings.scale = value
end
|
#merge(other_config) ⇒ Object
40
41
42
43
44
45
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 40
def merge(other_config)
return if object_id == other_config.object_id
(config_keys + other_config. config_keys).uniq do |k|
merge_key(other_config, k)
end
end
|
#merge_key(other_config, key) ⇒ Object
47
48
49
50
51
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 47
def merge_key(other_config, key)
return unless other_config.send("defined_#{key}?")
return unless respond_to?("#{key}=")
send("#{key}=", other_config.send(key))
end
|
#set_proxy(uri, user = nil, password = nil) ⇒ Object
125
126
127
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 125
def set_proxy(uri, user = nil, password = nil)
self.proxy = Applitools::Connectivity::Proxy.new(uri, user, password)
end
|
#short_description ⇒ Object
121
122
123
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 121
def short_description
"#{test_name} of #{app_name}"
end
|
#to_s ⇒ Object
57
58
59
60
61
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 57
def to_s
config_keys.map do |k|
"#{k} = #{send(k)}"
end.join("\n")
end
|
#valid? ⇒ Boolean
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 63
def valid?
validation_errors.clear
validation_errors[:app_name] = ':app_name is required' unless app_name
validation_errors[:test_name] = ':test_name is required' unless test_name
validation_errors[:app_name] = ':app_name is required' if app_name && app_name.empty?
validation_errors[:test_name] = ':test_name is required' if test_name && test_name.empty?
return true if validation_errors.keys.size.zero?
false
end
|