effective_test_bot 1.2.4 → 1.2.8
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/version.rb +1 -1
- data/test/support/effective_test_bot_assertions.rb +11 -4
- data/test/support/effective_test_bot_form_faker.rb +2 -2
- data/test/support/effective_test_bot_form_filler.rb +6 -4
- data/test/support/effective_test_bot_test_helper.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f020934794c731261aa532ab1fd8859f2cafd2e4ac307e7c47915e24775c3bb1
|
4
|
+
data.tar.gz: d151cf48ec7242676de9e9f98787c92aeaf454242659622592761fba89a9af3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55ebfa44b864e7728d0296fb080316b17fac6e4e129417d40ca7c4cb5d26e61bc830ef8c02f0359aff343bb33a360916d11c54f4d957fab1f93e32af56c1dcae
|
7
|
+
data.tar.gz: bf01f6eea8e21d3d3af6bd1b24a33ba052230b23b5921b745e6be17efbd9ef6263fba359444c83aada3bd4061a66b88ca6798b9a93f79913ca2307d4bd19cc23
|
@@ -1,5 +1,4 @@
|
|
1
1
|
module EffectiveTestBotAssertions
|
2
|
-
include ActiveJob::TestHelper if defined?(ActiveJob::TestHelper)
|
3
2
|
|
4
3
|
def assert_page_content(content, message: "(page_content) Expected page content :content: to be present")
|
5
4
|
assert page.has_text?(/#{Regexp.escape(content)}/i, wait: 0), message.sub(':content:', content)
|
@@ -236,17 +235,23 @@ module EffectiveTestBotAssertions
|
|
236
235
|
retval
|
237
236
|
end
|
238
237
|
|
238
|
+
|
239
|
+
#include ActiveJob::TestHelper if defined?(ActiveJob::TestHelper)
|
240
|
+
def assert_email_perform_enqueued_jobs
|
241
|
+
perform_enqueued_jobs if respond_to?(:perform_enqueued_jobs)
|
242
|
+
end
|
243
|
+
|
239
244
|
# assert_email :new_user_sign_up
|
240
245
|
# assert_email :new_user_sign_up, to: 'newuser@example.com'
|
241
246
|
# assert_email from: 'admin@example.com'
|
242
|
-
def assert_email(action = nil, to: nil, from: nil, subject: nil, body: nil, message: nil, count: nil, &block)
|
247
|
+
def assert_email(action = nil, perform: true, to: nil, from: nil, subject: nil, body: nil, message: nil, count: nil, &block)
|
243
248
|
retval = nil
|
244
249
|
|
245
|
-
perform_enqueued_jobs if respond_to?(:perform_enqueued_jobs)
|
246
|
-
|
247
250
|
if block_given?
|
248
251
|
before = ActionMailer::Base.deliveries.length
|
252
|
+
assert_email_perform_enqueued_jobs if perform
|
249
253
|
retval = yield
|
254
|
+
|
250
255
|
difference = (ActionMailer::Base.deliveries.length - before)
|
251
256
|
|
252
257
|
if count.present?
|
@@ -254,6 +259,8 @@ module EffectiveTestBotAssertions
|
|
254
259
|
else
|
255
260
|
assert (difference > 0), "(assert_email) Expected at least one email to have been delivered"
|
256
261
|
end
|
262
|
+
else
|
263
|
+
assert_email_perform_enqueued_jobs if perform
|
257
264
|
end
|
258
265
|
|
259
266
|
if (action || to || from || subject || body).nil?
|
@@ -152,7 +152,7 @@ module EffectiveTestBotFormFaker
|
|
152
152
|
|
153
153
|
if fills.key?(key)
|
154
154
|
fill = fills[key].to_s
|
155
|
-
fill = :unselect if
|
155
|
+
fill = :unselect if ['select', 'input_file'].include?(field_name) && fills[key].blank?
|
156
156
|
end
|
157
157
|
|
158
158
|
break if fill.present?
|
@@ -162,7 +162,7 @@ module EffectiveTestBotFormFaker
|
|
162
162
|
fill ||= fills[value]
|
163
163
|
|
164
164
|
# If this is a file field, make sure the file is present at Rails.root/test/fixtures/
|
165
|
-
if fill.present? && field_name == 'input_file'
|
165
|
+
if fill.present? && fill != :unselect && field_name == 'input_file'
|
166
166
|
filename = (fill.to_s.include?('/') ? fill : "#{Rails.root}/test/fixtures/#{fill}")
|
167
167
|
raise("Warning: Unable to load fill file #{fill}. Expected file #{filename}") unless File.exists?(filename)
|
168
168
|
return filename
|
@@ -72,7 +72,7 @@ module EffectiveTestBotFormFiller
|
|
72
72
|
end
|
73
73
|
|
74
74
|
# Fill all fields now
|
75
|
-
fields = all('input,select,textarea', visible: false).reject do |field|
|
75
|
+
fields = all('input,select,textarea,trix-editor', visible: false).reject do |field|
|
76
76
|
(seen[field_key(field)] rescue true)
|
77
77
|
end
|
78
78
|
|
@@ -98,7 +98,7 @@ module EffectiveTestBotFormFiller
|
|
98
98
|
field_name = [field.tag_name, field['type']].compact.join('_')
|
99
99
|
|
100
100
|
case field_name
|
101
|
-
when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_url', 'input_color'
|
101
|
+
when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_url', 'input_color', 'input_search'
|
102
102
|
if field['class'].to_s.include?('effective_date')
|
103
103
|
fill_input_date(field, value)
|
104
104
|
else
|
@@ -108,13 +108,13 @@ module EffectiveTestBotFormFiller
|
|
108
108
|
fill_input_checkbox(field, value)
|
109
109
|
when 'input_radio'
|
110
110
|
fill_input_radio(field, value)
|
111
|
-
when 'textarea', 'textarea_textarea'
|
111
|
+
when 'textarea', 'textarea_textarea', 'trix-editor'
|
112
112
|
fill_input_text_area(field, value)
|
113
113
|
when 'select', 'select_select-one', 'select_select-multiple'
|
114
114
|
fill_input_select(field, value)
|
115
115
|
when 'input_file'
|
116
116
|
fill_input_file(field, value)
|
117
|
-
when 'input_submit', '
|
117
|
+
when 'input_submit', 'input_button'
|
118
118
|
skip_field_screenshot = true # Do nothing
|
119
119
|
when 'input_hidden'
|
120
120
|
fill_action_text_input(field, value)
|
@@ -219,6 +219,8 @@ module EffectiveTestBotFormFiller
|
|
219
219
|
end
|
220
220
|
|
221
221
|
def fill_input_file(field, value)
|
222
|
+
return if value == :unselect
|
223
|
+
|
222
224
|
if field['class'].to_s.include?('asset-box-uploader-fileinput')
|
223
225
|
upload_effective_asset(field, value)
|
224
226
|
else
|
@@ -110,7 +110,7 @@ module EffectiveTestBotTestHelper
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def current_user_assigns_class
|
113
|
-
current_user_assigns_key.sub('current_').gsub('_', '::').classify.safe_constantize
|
113
|
+
current_user_assigns_key.sub('current_', '').gsub('_', '::').classify.safe_constantize
|
114
114
|
end
|
115
115
|
|
116
116
|
def access_denied_exception
|
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: 1.2.
|
4
|
+
version: 1.2.8
|
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: 2021-
|
11
|
+
date: 2021-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|