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
}.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.
33
34
35
36
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 33
def initialize
super
end
|
Class Method Details
.default_config ⇒ Object
28
29
30
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 28
def default_config
DEFAULT_CONFIG
end
|
Instance Method Details
#batch ⇒ Object
74
75
76
77
78
79
80
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 74
def batch
if batch_info.nil?
Applitools::EyesLogger.info 'No batch set'
self.batch_info = BatchInfo.new
end
batch_info
end
|
#batch=(value) ⇒ Object
82
83
84
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 82
def batch=(value)
self.batch_info = value
end
|
#config_keys ⇒ Object
51
52
53
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 51
def config_keys
config_hash.keys
end
|
#custom_getter_for_exact(_value) ⇒ Object
142
143
144
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 142
def custom_getter_for_exact(_value)
default_match_settings.exact
end
|
#custom_getter_for_ignore_caret(_value) ⇒ Object
158
159
160
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 158
def custom_getter_for_ignore_caret(_value)
default_match_settings.ignore_caret
end
|
#custom_getter_for_match_level(_value) ⇒ Object
154
155
156
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 154
def custom_getter_for_match_level(_value)
default_match_settings.match_level
end
|
#custom_getter_for_remainder(_value) ⇒ Object
150
151
152
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 150
def custom_getter_for_remainder(_value)
default_match_settings.remainder
end
|
#custom_getter_for_scale(_value) ⇒ Object
146
147
148
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 146
def custom_getter_for_scale(_value)
default_match_settings.scale
end
|
#custom_setter_for_accessibility_validation(value) ⇒ Object
166
167
168
169
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 166
def custom_setter_for_accessibility_validation(value)
default_match_settings.accessibility_validation = value
end
|
#custom_setter_for_exact(value) ⇒ Object
126
127
128
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 126
def custom_setter_for_exact(value)
default_match_settings.exact = value
end
|
#custom_setter_for_ignore_caret(value) ⇒ Object
162
163
164
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 162
def custom_setter_for_ignore_caret(value)
default_match_settings.ignore_caret = value
end
|
#custom_setter_for_match_level(value) ⇒ Object
130
131
132
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 130
def custom_setter_for_match_level(value)
default_match_settings.match_level = value
end
|
#custom_setter_for_remainder(value) ⇒ Object
138
139
140
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 138
def custom_setter_for_remainder(value)
default_match_settings.remainder = value
end
|
#custom_setter_for_scale(value) ⇒ Object
134
135
136
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 134
def custom_setter_for_scale(value)
default_match_settings.scale = value
end
|
#merge(other_config) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 38
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
45
46
47
48
49
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 45
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
122
123
124
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 122
def set_proxy(uri, user = nil, password = nil)
self.proxy = Applitools::Connectivity::Proxy.new(uri, user, password)
end
|
#short_description ⇒ Object
118
119
120
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 118
def short_description
"#{test_name} of #{app_name}"
end
|
#to_s ⇒ Object
55
56
57
58
59
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 55
def to_s
config_keys.map do |k|
"#{k} = #{send(k)}"
end.join("\n")
end
|
#valid? ⇒ Boolean
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/applitools/core/eyes_base_configuration.rb', line 61
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
|