Class: Applitools::EyesBaseConfiguration
Constant Summary
collapse
- DEFAULT_MATCH_TIMEOUT =
0
- 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,
dont_fetch_resources: true,
enable_cross_origin_rendering: true,
dont_use_cookies: false,
}.freeze
Instance Attribute Summary
#config_hash, #validation_errors
Class Method Summary
collapse
Instance Method Summary
collapse
-
#add_property(name, value) ⇒ Object
-
#batch ⇒ Object
-
#batch=(value) ⇒ Object
-
#config_keys ⇒ Object
-
#custom_getter_for_exact(_value) ⇒ Object
-
#custom_getter_for_ignore_caret(_value) ⇒ Object
-
#custom_getter_for_ignore_displacements(_value) ⇒ Object
-
#custom_getter_for_match_level(_value) ⇒ Object
-
#custom_getter_for_remainder(_value) ⇒ Object
-
#custom_getter_for_scale(_value) ⇒ Object
-
#custom_setter_for_accessibility_validation(value) ⇒ Object
-
#custom_setter_for_exact(value) ⇒ Object
-
#custom_setter_for_ignore_caret(value) ⇒ Object
-
#custom_setter_for_ignore_displacements(value) ⇒ Object
-
#custom_setter_for_match_level(value) ⇒ Object
-
#custom_setter_for_remainder(value) ⇒ Object
-
#custom_setter_for_scale(value) ⇒ Object
-
#defined_figma_baselines? ⇒ Boolean
-
#disable_browser_fetching=(value) ⇒ Object
-
#figma_baselines ⇒ Object
-
#figma_baselines=(value) ⇒ Object
figmaBaselines open-config: String (single Figma URL) or Hash(testName => URL | [URLs]).
-
#initialize ⇒ EyesBaseConfiguration
constructor
A new instance of EyesBaseConfiguration.
-
#layout_breakpoints(value = nil, reload: nil, height_breakpoints: nil) ⇒ Object
-
#layout_breakpoints=(value) ⇒ Object
layoutBreakpoints?: boolean | number.
-
#merge(other_config) ⇒ Object
-
#merge_key(other_config, key) ⇒ Object
-
#scroll_root_element ⇒ Object
-
#scroll_root_element=(value) ⇒ Object
scrollRootElement?: TElement | TSelector.
-
#set_aut_proxy(uri, user = nil, password = nil, mode = nil, domains = nil) ⇒ Object
-
#set_baseline_env_name(value, options = nil) ⇒ Object
Overload of baseline_env_name= that also accepts a BaselineEnvOptions wrapper.
-
#set_proxy(uri, user = nil, password = nil) ⇒ Object
-
#short_description ⇒ Object
-
#to_s ⇒ Object
-
#valid? ⇒ Boolean
#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.
41
42
43
44
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 41
def initialize
super
end
|
Class Method Details
.default_config ⇒ Object
36
37
38
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 36
def default_config
DEFAULT_CONFIG
end
|
Instance Method Details
#add_property(name, value) ⇒ Object
230
231
232
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 230
def add_property(name, value)
properties << { name: name, value: value } if name && value
end
|
#batch ⇒ Object
82
83
84
85
86
87
88
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 82
def batch
if batch_info.nil?
Applitools::EyesLogger.info 'No batch set'
self.batch_info = BatchInfo.new
end
batch_info
end
|
#batch=(value) ⇒ Object
90
91
92
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 90
def batch=(value)
self.batch_info = value
end
|
#config_keys ⇒ Object
59
60
61
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 59
def config_keys
config_hash.keys
end
|
#custom_getter_for_exact(_value) ⇒ Object
201
202
203
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 201
def custom_getter_for_exact(_value)
default_match_settings.exact
end
|
#custom_getter_for_ignore_caret(_value) ⇒ Object
217
218
219
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 217
def custom_getter_for_ignore_caret(_value)
default_match_settings.ignore_caret
end
|
#custom_getter_for_ignore_displacements(_value) ⇒ Object
197
198
199
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 197
def custom_getter_for_ignore_displacements(_value)
default_match_settings.ignore_displacements
end
|
#custom_getter_for_match_level(_value) ⇒ Object
213
214
215
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 213
def custom_getter_for_match_level(_value)
default_match_settings.match_level
end
|
#custom_getter_for_remainder(_value) ⇒ Object
209
210
211
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 209
def custom_getter_for_remainder(_value)
default_match_settings.remainder
end
|
#custom_getter_for_scale(_value) ⇒ Object
205
206
207
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 205
def custom_getter_for_scale(_value)
default_match_settings.scale
end
|
#custom_setter_for_accessibility_validation(value) ⇒ Object
225
226
227
228
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 225
def custom_setter_for_accessibility_validation(value)
default_match_settings.accessibility_validation = value
end
|
#custom_setter_for_exact(value) ⇒ Object
177
178
179
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 177
def custom_setter_for_exact(value)
default_match_settings.exact = value
end
|
#custom_setter_for_ignore_caret(value) ⇒ Object
221
222
223
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 221
def custom_setter_for_ignore_caret(value)
default_match_settings.ignore_caret = value
end
|
#custom_setter_for_ignore_displacements(value) ⇒ Object
193
194
195
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 193
def custom_setter_for_ignore_displacements(value)
default_match_settings.ignore_displacements = value
end
|
#custom_setter_for_match_level(value) ⇒ Object
181
182
183
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 181
def custom_setter_for_match_level(value)
default_match_settings.match_level = value
end
|
#custom_setter_for_remainder(value) ⇒ Object
189
190
191
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 189
def custom_setter_for_remainder(value)
default_match_settings.remainder = value
end
|
#custom_setter_for_scale(value) ⇒ Object
185
186
187
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 185
def custom_setter_for_scale(value)
default_match_settings.scale = value
end
|
#defined_figma_baselines? ⇒ Boolean
117
118
119
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 117
def defined_figma_baselines?
!figma_baselines.nil?
end
|
#disable_browser_fetching=(value) ⇒ Object
234
235
236
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 234
def disable_browser_fetching=(value)
self.dont_fetch_resources = value
end
|
#figma_baselines ⇒ Object
113
114
115
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 113
def figma_baselines
config_hash[:figma_baselines]
end
|
#figma_baselines=(value) ⇒ Object
figmaBaselines open-config: String (single Figma URL) or Hash(testName => URL | [URLs]).
Union type, so it can't use string_field; stored verbatim and forwarded to core-universal.
109
110
111
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 109
def figma_baselines=(value)
config_hash[:figma_baselines] = value
end
|
#layout_breakpoints(value = nil, reload: nil, height_breakpoints: nil) ⇒ Object
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 259
def layout_breakpoints(value = nil, reload: nil, height_breakpoints: nil)
if value.nil?
config_hash[:layout_breakpoints]
else
if value.is_a?(Hash)
value[:layout_breakpoints][:reload] = value[:reload] || value['reload'] || reload
value[:layout_breakpoints][:height_breakpoints] = value[:height_breakpoints] || value['height_breakpoints'] || height_breakpoints
self.layout_breakpoints = value
else
self.layout_breakpoints = {
breakpoints: value,
reload: reload,
height_breakpoints: height_breakpoints
}
end
self
end
end
|
#layout_breakpoints=(value) ⇒ Object
layoutBreakpoints?: boolean | number
245
246
247
248
249
250
251
252
253
254
255
256
257
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 245
def layout_breakpoints=(value)
if value === true || value === false
config_hash[:layout_breakpoints] = { breakpoints: value }
elsif value.is_a?(Array) && value.all? {|v| v.is_a?(Numeric)}
config_hash[:layout_breakpoints] = { breakpoints: value }
elsif value.is_a?(Hash)
if value.has_key?(:breakpoints) || value.has_key?('breakpoints')
config_hash[:layout_breakpoints] = value
else
config_hash[:layout_breakpoints] = { breakpoints: value }
end
end
end
|
#merge(other_config) ⇒ Object
46
47
48
49
50
51
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 46
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
53
54
55
56
57
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 53
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
|
286
287
288
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 286
def scroll_root_element
config_hash[:scroll_root_element]
end
|
scrollRootElement?: TElement | TSelector
283
284
285
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 283
def scroll_root_element=(value)
config_hash[:scroll_root_element] = value
end
|
#set_aut_proxy(uri, user = nil, password = nil, mode = nil, domains = nil) ⇒ Object
173
174
175
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 173
def set_aut_proxy(uri, user = nil, password = nil, mode = nil, domains = nil)
self.aut_proxy = Applitools::Connectivity::AutProxy.new(uri, user, password, nil, mode, domains)
end
|
#set_baseline_env_name(value, options = nil) ⇒ Object
Overload of baseline_env_name= that also accepts a BaselineEnvOptions wrapper.
160
161
162
163
164
165
166
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 160
def set_baseline_env_name(value, options = nil)
self.baseline_env_name = value
if options.is_a?(Applitools::BaselineEnvOptions)
self._baseline_env_options = options
end
self
end
|
#set_proxy(uri, user = nil, password = nil) ⇒ Object
169
170
171
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 169
def set_proxy(uri, user = nil, password = nil)
self.proxy = Applitools::Connectivity::Proxy.new(uri, user, password)
end
|
#short_description ⇒ Object
155
156
157
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 155
def short_description
"#{test_name} of #{app_name}"
end
|
#to_s ⇒ Object
63
64
65
66
67
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 63
def to_s
config_keys.map do |k|
"#{k} = #{send(k)}"
end.join("\n")
end
|
#valid? ⇒ Boolean
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 69
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
|