effective_test_bot 1.2.5 → 1.2.9

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
  SHA256:
3
- metadata.gz: fd91036d4b959a1a59934248064b1c42b6bb6e9cf8558b6809b9621fc67aed76
4
- data.tar.gz: e5bba54a9961847859d1e02963442d4065e75308336a97609eeb351ac9ab671c
3
+ metadata.gz: 0f3d9ab3cddaef1ad1ee91873759222b6a546f519e02217a741b4f16179bd1c4
4
+ data.tar.gz: 7c633130bc82e1e5fac09a5bf5cf8411dc8a3c3889b5af22c5ef1e8e56a4b4a3
5
5
  SHA512:
6
- metadata.gz: 574c821e54abc360af9b1f4f11990b8db8f06685a5c25f096621e8933e34a77829134ae9e06eb5836b171d9ba90a34289e7718566986cdd254af7097b0a1f628
7
- data.tar.gz: 6b3f2fd19df1a688cb2fb1bcfa79a2f7c3baf0a5832fdf80796cc1c7cec842314eb99ad03a64d922ce22f8a5d56795ff8f235d27d05675aa7b7988c9e811573d
6
+ metadata.gz: 7d17817f9ba053c08e510e1d76630b029d1f62cc02b1d93b9502cb2edf61259f2906ccc90afe0c3791d6b083f98f56b7b0aaa68a170a7dae6d1c9c7f7c9c9490
7
+ data.tar.gz: b596f08ecad87dad7a9cc71695352c85cdb6ef7b633a12e142f2123f256c2952fe84e3c92e4dd1519a4bc54ecf704982c60037b44627842e47cf97bedcd3b3a5
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '1.2.5'.freeze
2
+ VERSION = '1.2.9'.freeze
3
3
  end
@@ -235,17 +235,21 @@ module EffectiveTestBotAssertions
235
235
  retval
236
236
  end
237
237
 
238
+
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
239
243
 
240
244
  # assert_email :new_user_sign_up
241
245
  # assert_email :new_user_sign_up, to: 'newuser@example.com'
242
246
  # assert_email from: 'admin@example.com'
243
- def assert_email(action = nil, perform: 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)
244
248
  retval = nil
245
249
 
246
250
  if block_given?
247
251
  before = ActionMailer::Base.deliveries.length
248
- perform_enqueued_jobs if perform && respond_to?(:perform_enqueued_jobs)
252
+ assert_email_perform_enqueued_jobs if perform
249
253
  retval = yield
250
254
 
251
255
  difference = (ActionMailer::Base.deliveries.length - before)
@@ -256,7 +260,7 @@ module EffectiveTestBotAssertions
256
260
  assert (difference > 0), "(assert_email) Expected at least one email to have been delivered"
257
261
  end
258
262
  else
259
- perform_enqueued_jobs if perform && respond_to?(:perform_enqueued_jobs)
263
+ assert_email_perform_enqueued_jobs if perform
260
264
  end
261
265
 
262
266
  if (action || to || from || subject || body).nil?
@@ -123,7 +123,7 @@ module EffectiveTestBotFormFaker
123
123
  when 'input_url'
124
124
  Faker::Internet.url
125
125
 
126
- when 'textarea', 'textarea_textarea'
126
+ when 'textarea', 'textarea_textarea', 'trix-editor'
127
127
  Faker::Lorem.paragraph
128
128
 
129
129
  when 'input_hidden'
@@ -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 field_name == 'select' && fills[key].blank?
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', 'input_search', 'input_button'
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
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.5
4
+ version: 1.2.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: 2021-03-29 00:00:00.000000000 Z
11
+ date: 2021-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails