effective_test_bot 0.6.7 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e70c529e79a56be7660a51e42e6361514392f0d
4
- data.tar.gz: 01331f562aa1b86336b63ef417c7077c26207fe6
3
+ metadata.gz: addba6a7997e4a369e13125bc2a58ee7daef0e60
4
+ data.tar.gz: 29f2ed1a40d36625bfb8a010e1a5653abece76f4
5
5
  SHA512:
6
- metadata.gz: 058341e8cf7ea0321deeb5d9cfe64105ba66d797785594fb92f24a64598f1a5541dab8263d834c913c334eb45a0aff106c24f4c390155549340dd131c0179b71
7
- data.tar.gz: 9dc78159d70bc057c883ef4b79ba1ec6b13766fa183e1320ee14d289009a49ad6c22a6e4b9c7006d2767d1a8383bc98552a1f8236544084a747c8943f8f8dce7
6
+ metadata.gz: ad4ffb7d07438ce61c84212f199c0539ca027d66f1ffc4a4176e07cbe0276b5b4038b8bdf2befcccd088d551b3d0520a4e9d2afa6039136ed647c4527770426a
7
+ data.tar.gz: b40772c6a5989f299db717109fa0fe35b402ba7f38dbbcc56bef3c299a6f0f107d14ab0dee887042b7b2324d514592ba6e32cc1f5311a250b7b6930ee9a25d17
@@ -1,3 +1,3 @@
1
1
  module EffectiveTestBot
2
- VERSION = '0.6.7'.freeze
2
+ VERSION = '0.6.8'.freeze
3
3
  end
@@ -78,12 +78,14 @@ module EffectiveTestBotFormFiller
78
78
  value = value_for_field(field, fills)
79
79
  ckeditor_text_area?(field) ? fill_ckeditor_text_area(field, value) : field.set(value)
80
80
  when 'select'
81
+ value = value_for_field(field, fills)
82
+
81
83
  if EffectiveTestBot.tour_mode_extreme? && field['class'].to_s.include?('select2') # select2
82
84
  page.execute_script("try { $('select##{field['id']}').select2('open'); } catch(e) {};")
83
85
  save_test_bot_screenshot
84
86
  end
85
87
 
86
- field.select(value_for_field(field, fills), match: :first)
88
+ field.select(value, match: :first) unless value == :unselect
87
89
 
88
90
  if EffectiveTestBot.tour_mode_extreme? && field['class'].to_s.include?('select2')
89
91
  page.execute_script("try { $('select##{field['id']}').select2('close'); } catch(e) {};")
@@ -101,6 +103,8 @@ module EffectiveTestBotFormFiller
101
103
  raise "unsupported field type #{[field.tag_name, field['type']].compact.join('_')}"
102
104
  end
103
105
 
106
+ wait_for_ajax
107
+
104
108
  if EffectiveTestBot.tour_mode_extreme?
105
109
  save_test_bot_screenshot unless skip_field_screenshot
106
110
  end
@@ -125,7 +129,7 @@ module EffectiveTestBotFormFiller
125
129
  attributes = field['name'].to_s.gsub(']', '').split('[') # user[something_attributes][last_name] => ['user', 'something_attributes', 'last_name']
126
130
  attribute = attributes.last.to_s
127
131
 
128
- fill_value = fill_value_for_field(fills, attributes, field['value'])
132
+ fill_value = fill_value_for_field(fills, attributes, field['value'], field_name)
129
133
 
130
134
  # If there is a predefined fill value for this field return it now
131
135
  # except for select, checkbox and radio fields which we want to match by value or label
@@ -219,6 +223,8 @@ module EffectiveTestBotFormFiller
219
223
  value_for_input_radio_field(field, fill_value)
220
224
 
221
225
  when 'select'
226
+ return fill_value if fill_value == :unselect
227
+
222
228
  if fill_value.present? # accept a value or text
223
229
  field.all('option:enabled').each do |option|
224
230
  if (option.text == fill_value || option.value.to_s == fill_value)
@@ -388,12 +394,14 @@ module EffectiveTestBotFormFiller
388
394
 
389
395
  private
390
396
 
391
- def fill_value_for_field(fills, attributes, value)
397
+ def fill_value_for_field(fills, attributes, value, field_name)
392
398
  return if fills.blank? || (attributes.blank? && value.blank?)
393
399
 
394
400
  key = nil
395
401
  attributes.reverse_each do |name| # match last_name, then something_attributes.last_name, then user.something_attributes.last_name
396
402
  key = (key.present? ? "#{name}.#{key}" : name) # builds up the string as we go along
403
+
404
+ return :unselect if field_name == 'select' && fills.key?(key) && [nil, ''].include?(fills[key])
397
405
  return fills[key].to_s if fills.key?(key)
398
406
  end
399
407
 
@@ -80,6 +80,9 @@ module EffectiveTestBotFormHelper
80
80
 
81
81
  submit.click
82
82
  synchronize!
83
+
84
+ save_test_bot_screenshot if EffectiveTestBot.screenshots? && page.current_path.present?
85
+
83
86
  true
84
87
  end
85
88
 
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.6.7
4
+ version: 0.6.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: 2017-10-05 00:00:00.000000000 Z
11
+ date: 2017-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails