effective_test_bot 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/effective_test_bot.rb +1 -0
- data/lib/effective_test_bot/middleware.rb +1 -1
- data/lib/effective_test_bot/version.rb +1 -1
- data/lib/generators/templates/effective_test_bot.rb +4 -0
- data/test/support/effective_test_bot_form_filler.rb +24 -3
- data/test/test_botable/base_test.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30419a4b996dc2b0178006e804e1a3ecec0857a2
|
4
|
+
data.tar.gz: e17ad442c55d3986c0eddbfb626d3f7972ab6398
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5588d9ffb6a02b72ea17b719d8af563fd235f694120445e559b5b651a7912686ef3d7d28d8cd108140054e931c1389e8a783a2c55b5b4aaef7ffb7f19aefdde
|
7
|
+
data.tar.gz: 40a99d2ff37fa7f84f2d01434968330d3a8ff915b76bb4402a229f6dfac44762aaa396b9a1a7d4fe50ac6336f0f79ab5442584d93e2ad1cae6cf4eb895f133b9
|
data/lib/effective_test_bot.rb
CHANGED
@@ -22,7 +22,7 @@ module EffectiveTestBot
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def save(exception)
|
25
|
-
lines = [exception.message] + exception.backtrace.first(
|
25
|
+
lines = [exception.message] + exception.backtrace.first(EffectiveTestBot.backtrace_lines)
|
26
26
|
|
27
27
|
dir = File.join(Dir.pwd, 'tmp', 'test_bot')
|
28
28
|
file = File.join(dir, 'exception.txt')
|
@@ -20,6 +20,9 @@ if Rails.env.test?
|
|
20
20
|
# Exits immediately if there is a test failure
|
21
21
|
config.fail_fast = false
|
22
22
|
|
23
|
+
# Display x number of lines of a backtrace
|
24
|
+
config.backtrace_lines = 12
|
25
|
+
|
23
26
|
# Fill form fields with these values
|
24
27
|
# Based on the input name
|
25
28
|
# :email => 'j.smith@example.com', 'user.last_name' => 'Smith'
|
@@ -52,5 +55,6 @@ if Rails.env.test?
|
|
52
55
|
# bottom area filled by this color
|
53
56
|
# For best appearance, have this match your site's background color
|
54
57
|
config.animated_gif_background_color = 'white'
|
58
|
+
|
55
59
|
end
|
56
60
|
end
|
@@ -70,7 +70,7 @@ module EffectiveTestBotFormFiller
|
|
70
70
|
skip_field_screenshot = false
|
71
71
|
|
72
72
|
case [field.tag_name, field['type']].compact.join('_')
|
73
|
-
when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_checkbox', 'input_radio', 'input_url'
|
73
|
+
when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_checkbox', 'input_radio', 'input_url', 'input_color'
|
74
74
|
field.set(value_for_field(field, fills))
|
75
75
|
when 'textarea'
|
76
76
|
value = value_for_field(field, fills)
|
@@ -191,6 +191,9 @@ module EffectiveTestBotFormFiller
|
|
191
191
|
when 'input_checkbox'
|
192
192
|
value_for_input_checkbox_field(field, fill_value)
|
193
193
|
|
194
|
+
when 'input_color'
|
195
|
+
Faker::Color.hex_color
|
196
|
+
|
194
197
|
when 'input_email'
|
195
198
|
Faker::Internet.email
|
196
199
|
|
@@ -200,6 +203,7 @@ module EffectiveTestBotFormFiller
|
|
200
203
|
else
|
201
204
|
"#{File.dirname(__FILE__)}/../fixtures/logo.png"
|
202
205
|
end
|
206
|
+
|
203
207
|
when 'input_number'
|
204
208
|
value_for_input_numeric_field(field, "input[type='number'][name$='[#{attribute}]']")
|
205
209
|
|
@@ -225,6 +229,7 @@ module EffectiveTestBotFormFiller
|
|
225
229
|
@filled_country_fields = option.try(:value) if attribute == 'country_code' # So Postal Code can be set to a valid one
|
226
230
|
|
227
231
|
option.try(:text) || ''
|
232
|
+
|
228
233
|
when 'input_tel'
|
229
234
|
d = 10.times.map { DIGITS.sample }
|
230
235
|
d[0] + d[1] + d[2] + '-' + d[3] + d[4] + d[5] + '-' + d[6] + d[7] + d[8] + d[9]
|
@@ -241,9 +246,9 @@ module EffectiveTestBotFormFiller
|
|
241
246
|
end
|
242
247
|
|
243
248
|
def value_for_input_checkbox_field(field, fill_value)
|
244
|
-
if
|
249
|
+
if truthy?(fill_value)
|
245
250
|
true
|
246
|
-
elsif
|
251
|
+
elsif falsey?(fill_value)
|
247
252
|
false
|
248
253
|
elsif fill_value.present?
|
249
254
|
fill_values = Array(fill_value) # Allow an array of fill values to be passed
|
@@ -393,4 +398,20 @@ module EffectiveTestBotFormFiller
|
|
393
398
|
(@test_bot_excluded_fields_xpath.present? && field.path.include?(@test_bot_excluded_fields_xpath))
|
394
399
|
end
|
395
400
|
|
401
|
+
def truthy?(value)
|
402
|
+
if defined?(::ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES) # Rails 5
|
403
|
+
::ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(value)
|
404
|
+
else
|
405
|
+
ActiveRecord::Type::Boolean.new.cast(value)
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
def falsey?(value)
|
410
|
+
if defined?(::ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES) # Rails 5
|
411
|
+
::ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES.include?(value)
|
412
|
+
else
|
413
|
+
::ActiveRecord::Type::Boolean.new.cast(value) == false
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
396
417
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_test_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|