Class: Applitools::EyesBaseConfiguration
Constant Summary
collapse
- DEFAULT_MATCH_TIMEOUT =
2
- 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: [],
match_timeout: DEFAULT_MATCH_TIMEOUT
}.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.
37
38
39
40
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 37
def initialize
super
end
|
Class Method Details
.default_config ⇒ Object
32
33
34
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 32
def default_config
DEFAULT_CONFIG
end
|
Instance Method Details
#add_property(name, value) ⇒ Object
186
187
188
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 186
def add_property(name, value)
properties << { name: name, value: value } if name && value
end
|
#batch ⇒ Object
78
79
80
81
82
83
84
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 78
def batch
if batch_info.nil?
Applitools::EyesLogger.info 'No batch set'
self.batch_info = BatchInfo.new
end
batch_info
end
|
#batch=(value) ⇒ Object
86
87
88
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 86
def batch=(value)
self.batch_info = value
end
|
#config_keys ⇒ Object
55
56
57
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 55
def config_keys
config_hash.keys
end
|
#custom_getter_for_exact(_value) ⇒ Object
157
158
159
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 157
def custom_getter_for_exact(_value)
default_match_settings.exact
end
|
#custom_getter_for_ignore_caret(_value) ⇒ Object
173
174
175
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 173
def custom_getter_for_ignore_caret(_value)
default_match_settings.ignore_caret
end
|
#custom_getter_for_ignore_displacements(_value) ⇒ Object
153
154
155
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 153
def custom_getter_for_ignore_displacements(_value)
default_match_settings.ignore_displacements
end
|
#custom_getter_for_match_level(_value) ⇒ Object
169
170
171
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 169
def custom_getter_for_match_level(_value)
default_match_settings.match_level
end
|
#custom_getter_for_remainder(_value) ⇒ Object
165
166
167
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 165
def custom_getter_for_remainder(_value)
default_match_settings.remainder
end
|
#custom_getter_for_scale(_value) ⇒ Object
161
162
163
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 161
def custom_getter_for_scale(_value)
default_match_settings.scale
end
|
#custom_setter_for_accessibility_validation(value) ⇒ Object
181
182
183
184
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 181
def custom_setter_for_accessibility_validation(value)
default_match_settings.accessibility_validation = value
end
|
#custom_setter_for_exact(value) ⇒ Object
133
134
135
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 133
def custom_setter_for_exact(value)
default_match_settings.exact = value
end
|
#custom_setter_for_ignore_caret(value) ⇒ Object
177
178
179
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 177
def custom_setter_for_ignore_caret(value)
default_match_settings.ignore_caret = value
end
|
#custom_setter_for_ignore_displacements(value) ⇒ Object
149
150
151
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 149
def custom_setter_for_ignore_displacements(value)
default_match_settings.ignore_displacements = value
end
|
#custom_setter_for_match_level(value) ⇒ Object
137
138
139
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 137
def custom_setter_for_match_level(value)
default_match_settings.match_level = value
end
|
#custom_setter_for_remainder(value) ⇒ Object
145
146
147
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 145
def custom_setter_for_remainder(value)
default_match_settings.remainder = value
end
|
#custom_setter_for_scale(value) ⇒ Object
141
142
143
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 141
def custom_setter_for_scale(value)
default_match_settings.scale = value
end
|
#merge(other_config) ⇒ Object
42
43
44
45
46
47
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 42
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
49
50
51
52
53
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 49
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
129
130
131
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 129
def set_proxy(uri, user = nil, password = nil)
self.proxy = Applitools::Connectivity::Proxy.new(uri, user, password)
end
|
#short_description ⇒ Object
125
126
127
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 125
def short_description
"#{test_name} of #{app_name}"
end
|
#to_s ⇒ Object
59
60
61
62
63
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 59
def to_s
config_keys.map do |k|
"#{k} = #{send(k)}"
end.join("\n")
end
|
#valid? ⇒ Boolean
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 65
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
|