effective_test_bot 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1af9730f46872f097b9d825a6d6e084aa9b152ff
|
4
|
+
data.tar.gz: 3180d006dd3ff2fef23e86e68e8561f855bad160
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1d4f26b996ebb47642951ef294656e0526bdc676163c5d25291696d661295fbe7091b6d4ee93e3bc344e232e7b44c167d34ed15aa3452552bac612a17df34ed
|
7
|
+
data.tar.gz: 53d3c71075a40210e2ace8507497562cfbf9ca856396b2e6dca459ea47ea222359c3a453249351c8dc57e83c461a571f8655c6ca43823e8b642dec0a043a951a
|
@@ -37,6 +37,12 @@ module EffectiveTestBotFormFiller
|
|
37
37
|
within('div' + tab['href']) { fill_form_fields(fills) }
|
38
38
|
end
|
39
39
|
|
40
|
+
# If there is no visible submits, go back to the first tab
|
41
|
+
if all(:css, "input[type='submit']").length == 0
|
42
|
+
tabs.first.click()
|
43
|
+
synchronize!
|
44
|
+
save_test_bot_screenshot
|
45
|
+
end
|
40
46
|
end
|
41
47
|
|
42
48
|
# Only fills in visible fields
|
@@ -217,6 +223,15 @@ module EffectiveTestBotFormFiller
|
|
217
223
|
def value_for_input_checkbox_field(field, fill_value)
|
218
224
|
if fill_value.present?
|
219
225
|
fill_values = Array(fill_value) # Allow an array of fill values to be passed
|
226
|
+
|
227
|
+
if ::ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.include?(fill_value)
|
228
|
+
fill_values = ::ActiveRecord::ConnectionAdapters::Column::TRUE_VALUES.to_a
|
229
|
+
end
|
230
|
+
|
231
|
+
if ::ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES.include?(fill_value)
|
232
|
+
fill_values = ::ActiveRecord::ConnectionAdapters::Column::FALSE_VALUES.to_a
|
233
|
+
end
|
234
|
+
|
220
235
|
(fill_values.include?(field['value']) || fill_values.include?(field.find(:xpath, '..').text))
|
221
236
|
elsif field['value'] == 'true'
|
222
237
|
true
|
@@ -261,6 +276,10 @@ module EffectiveTestBotFormFiller
|
|
261
276
|
number = Random.new.rand(min..max)
|
262
277
|
number = (number.kind_of?(Float) ? number.round(2) : number)
|
263
278
|
|
279
|
+
if (field['step'] == '1' || field['class'].to_s.split(' ').include?('integer'))
|
280
|
+
number = number.to_i
|
281
|
+
end
|
282
|
+
|
264
283
|
return number if field['max'].blank?
|
265
284
|
|
266
285
|
shared_max_fields = all(selector)
|
@@ -64,22 +64,21 @@ module EffectiveTestBotFormHelper
|
|
64
64
|
# Instead we manually trigger submit buttons and use the data-disable-with to
|
65
65
|
# make the 'submit form' step look nice
|
66
66
|
def click_submit(label)
|
67
|
-
if EffectiveTestBot.screenshots?
|
68
|
-
page.execute_script "$('input[data-disable-with]').each(function(i) { $.rails.disableFormElement($(this)); });"
|
69
|
-
save_test_bot_screenshot
|
70
|
-
page.execute_script "$('input[data-disable-with]').each(function(i) { $.rails.enableFormElement($(this)); });"
|
71
|
-
end
|
72
|
-
|
73
67
|
if label.present?
|
74
68
|
submit = find(:link_or_button, label)
|
75
69
|
assert submit.present?, "TestBotError: Unable to find a visible submit link or button on #{page.current_path} with the label #{label}"
|
76
|
-
submit.click
|
77
70
|
else
|
78
71
|
submit = first(:css, "input[type='submit']")
|
79
72
|
assert submit.present?, "TestBotError: Unable to find a visible input[type='submit'] on #{page.current_path}"
|
80
|
-
submit.click
|
81
73
|
end
|
82
74
|
|
75
|
+
if EffectiveTestBot.screenshots?
|
76
|
+
page.execute_script "$('input[data-disable-with]').each(function(i) { $.rails.disableFormElement($(this)); });"
|
77
|
+
save_test_bot_screenshot
|
78
|
+
page.execute_script "$('input[data-disable-with]').each(function(i) { $.rails.enableFormElement($(this)); });"
|
79
|
+
end
|
80
|
+
|
81
|
+
submit.click
|
83
82
|
synchronize!
|
84
83
|
true
|
85
84
|
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.2
|
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-04-
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|