effective_test_bot 0.4.14 → 0.4.15
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 +2 -1
- data/lib/effective_test_bot/version.rb +1 -1
- data/test/support/effective_test_bot_assertions.rb +4 -4
- data/test/support/effective_test_bot_form_filler.rb +14 -3
- metadata +33 -35
- data/lib/effective_profile_bot/heap_analyzer.rb +0 -39
- data/lib/tasks/effecitve_profile_bot_tasks.rake +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a778c05ffd7dc030ac1a5ba973d18c6a246e544
|
4
|
+
data.tar.gz: 21883e88e7e4dce236b0da20e3defd3179100d00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42890c86671d96d6cf02c86da2a86c2d470cfac7bc7bf54f805334855c824c7a0170320b64f55fb55b03ff3f2f169b7eb9bc6ebb7afca6f7ef56dc9a63234af4
|
7
|
+
data.tar.gz: d98cdbb9dd5d68309fce7157ac15bc0b154fffaf82c02ff72610b3aa3caf8a8d306e2a4a4e7321eeb35ae99198973424b99e317cce3d693d3b26027dd160db9d
|
data/lib/effective_test_bot.rb
CHANGED
@@ -34,9 +34,10 @@ module EffectiveTestBot
|
|
34
34
|
end
|
35
35
|
|
36
36
|
value = "#{test} #{assertion}".strip # This is the format config.excepts is flattened into
|
37
|
+
test_prefix = test.split('#').first
|
37
38
|
|
38
39
|
# Excepts are defined in the app's config/initializers/effective_test_bot.rb file
|
39
|
-
return true if excepts.any? { |except| [test, assertion, value].include?(except) }
|
40
|
+
return true if excepts.any? { |except| [test, test_prefix, assertion, value].include?(except) }
|
40
41
|
|
41
42
|
# Onlies are defined in the same config file, or on the command like rake test:bot TEST=posts#new
|
42
43
|
# It doesn't match just 'flash' or 'page_title' assertions
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module EffectiveTestBotAssertions
|
2
2
|
def assert_page_content(content, message = "(page_content) Expected page content :content: to be present")
|
3
|
-
assert page.has_text?(content, wait: 0), message.sub(':content:', content)
|
3
|
+
assert page.has_text?(/#{Regexp.escape(content)}/i, wait: 0), message.sub(':content:', content)
|
4
4
|
end
|
5
5
|
|
6
6
|
def assert_no_page_content(content, message = "(page_content) Expected page content :content: to be blank")
|
7
|
-
assert page.has_no_text?(content, wait: 0), message.sub(':content:', content)
|
7
|
+
assert page.has_no_text?(/#{Regexp.escape(content)}/i, wait: 0), message.sub(':content:', content)
|
8
8
|
end
|
9
9
|
|
10
10
|
def assert_signed_in(message = nil)
|
@@ -78,8 +78,8 @@ module EffectiveTestBotAssertions
|
|
78
78
|
assert errors.blank?, message || "(no_js_errors) Unexpected javascript error:\n#{errors.first.to_s}"
|
79
79
|
end
|
80
80
|
|
81
|
-
def assert_no_unpermitted_params(message =
|
82
|
-
|
81
|
+
def assert_no_unpermitted_params(message = "(no_unpermitted_params) Encountered unpermitted params:\n:unpermitted_params:")
|
82
|
+
assert unpermitted_params.blank?, message.sub(':unpermitted_params:', unpermitted_params.to_s)
|
83
83
|
end
|
84
84
|
|
85
85
|
def assert_no_exceptions(message = "(no_exceptions) Unexpected rails server exception:\n:exception:")
|
@@ -63,9 +63,11 @@ module EffectiveTestBotFormFiller
|
|
63
63
|
skip_field_screenshot = false
|
64
64
|
|
65
65
|
case [field.tag_name, field['type']].compact.join('_')
|
66
|
-
when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_checkbox', 'input_radio'
|
66
|
+
when 'input_text', 'input_email', 'input_password', 'input_tel', 'input_number', 'input_checkbox', 'input_radio'
|
67
67
|
field.set(value_for_field(field, fills))
|
68
|
-
|
68
|
+
when 'textarea'
|
69
|
+
value = value_for_field(field, fills)
|
70
|
+
field['class'].to_s.include?('ckeditor') ? fill_ckeditor_text_area(field, value) : field.set(value)
|
69
71
|
when 'select'
|
70
72
|
if EffectiveTestBot.tour_mode_extreme? && field['class'].to_s.include?('select2') # select2
|
71
73
|
page.execute_script("try { $('select##{field['id']}').select2('open'); } catch(e) {};")
|
@@ -220,6 +222,8 @@ module EffectiveTestBotFormFiller
|
|
220
222
|
true
|
221
223
|
elsif field['value'] == 'false'
|
222
224
|
false
|
225
|
+
elsif field['required'].present?
|
226
|
+
true
|
223
227
|
else
|
224
228
|
[true, false].sample
|
225
229
|
end
|
@@ -280,6 +284,11 @@ module EffectiveTestBotFormFiller
|
|
280
284
|
amount
|
281
285
|
end
|
282
286
|
|
287
|
+
def fill_ckeditor_text_area(field, value)
|
288
|
+
value = "<p>#{value.gsub("'", '')}</p>"
|
289
|
+
page.execute_script("try { CKEDITOR.instances['#{field['id']}'].setData('#{value}'); } catch(e) {};")
|
290
|
+
end
|
291
|
+
|
283
292
|
# The field here is going to be the %input{:type => file}. Files can be one or more pathnames
|
284
293
|
# http://stackoverflow.com/questions/5188240/using-selenium-to-imitate-dragging-a-file-onto-an-upload-element/11203629#11203629
|
285
294
|
def upload_effective_asset(field, files)
|
@@ -350,7 +359,9 @@ module EffectiveTestBotFormFiller
|
|
350
359
|
def skip_form_field?(field)
|
351
360
|
field.reload # Handle a field changing visibility/disabled state from previous form field manipulations
|
352
361
|
|
353
|
-
field.
|
362
|
+
ckeditor = (field.tag_name == 'textarea' && field['class'].to_s.include?('ckeditor'))
|
363
|
+
|
364
|
+
(field.visible? == false && !ckeditor) ||
|
354
365
|
field.disabled? ||
|
355
366
|
['true', true, 1].include?(field['data-test-bot-skip']) ||
|
356
367
|
(@test_bot_excluded_fields_xpath.present? && field.path.include?(@test_bot_excluded_fields_xpath))
|
metadata
CHANGED
@@ -1,209 +1,209 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_test_bot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.15
|
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-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest-capybara
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest-rails-capybara
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest-reporters
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: capybara
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: capybara-webkit
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 1.6.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 1.6.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: capybara-screenshot
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: capybara-slow_finder_errors
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: shoulda
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: shoulda-matchers
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: rmagick
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: faker
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - ">="
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
description: A shared library of rails model & capybara-based feature tests that should
|
@@ -218,7 +218,6 @@ files:
|
|
218
218
|
- README.md
|
219
219
|
- Rakefile
|
220
220
|
- app/helpers/effective_test_bot_controller_helper.rb
|
221
|
-
- lib/effective_profile_bot/heap_analyzer.rb
|
222
221
|
- lib/effective_test_bot.rb
|
223
222
|
- lib/effective_test_bot/engine.rb
|
224
223
|
- lib/effective_test_bot/middleware.rb
|
@@ -226,7 +225,6 @@ files:
|
|
226
225
|
- lib/generators/effective_test_bot/install_generator.rb
|
227
226
|
- lib/generators/templates/effective_test_bot.rb
|
228
227
|
- lib/generators/templates/test_helper.rb
|
229
|
-
- lib/tasks/effecitve_profile_bot_tasks.rake
|
230
228
|
- lib/tasks/effective_test_bot_tasks.rake
|
231
229
|
- test/concerns/test_botable/base_dsl.rb
|
232
230
|
- test/concerns/test_botable/crud_dsl.rb
|
@@ -261,17 +259,17 @@ require_paths:
|
|
261
259
|
- lib
|
262
260
|
required_ruby_version: !ruby/object:Gem::Requirement
|
263
261
|
requirements:
|
264
|
-
- -
|
262
|
+
- - ">="
|
265
263
|
- !ruby/object:Gem::Version
|
266
264
|
version: '0'
|
267
265
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
268
266
|
requirements:
|
269
|
-
- -
|
267
|
+
- - ">="
|
270
268
|
- !ruby/object:Gem::Version
|
271
269
|
version: '0'
|
272
270
|
requirements: []
|
273
271
|
rubyforge_project:
|
274
|
-
rubygems_version: 2.4.
|
272
|
+
rubygems_version: 2.4.5.1
|
275
273
|
signing_key:
|
276
274
|
specification_version: 4
|
277
275
|
summary: A shared library of rails model & capybara-based feature tests that should
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# bundle exec derailed exec perf:heap
|
2
|
-
# http://samsaffron.com/archive/2015/03/31/debugging-memory-leaks-in-ruby
|
3
|
-
# HeapAnalyzer.new(ARGV[0]).analyze
|
4
|
-
|
5
|
-
require 'json'
|
6
|
-
|
7
|
-
module EffectiveProfileBot
|
8
|
-
class HeapAnalyzer
|
9
|
-
attr_accessor :data, :filename
|
10
|
-
|
11
|
-
def initialize(filename)
|
12
|
-
puts "Initialized with #{filename}"
|
13
|
-
|
14
|
-
@filename = filename
|
15
|
-
@data = []
|
16
|
-
end
|
17
|
-
|
18
|
-
def analyze
|
19
|
-
File.open(filename) do |f|
|
20
|
-
f.each_line do |line|
|
21
|
-
parsed = JSON.parse(line)
|
22
|
-
data << parsed
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
data.group_by { |row| row['generation'] }.sort{ |a, b| a[0].to_i <=> b[0].to_i }.each do |k, v|
|
28
|
-
puts "generation #{k} objects #{v.count}"
|
29
|
-
end
|
30
|
-
|
31
|
-
data.select { |row| row['generation'] == 95 }
|
32
|
-
.group_by { |row| "#{row["file"]}:#{row["line"]}" }
|
33
|
-
.sort { |a, b| b[1].count <=> a[1].count }.each do |k, v|
|
34
|
-
puts "#{k} * #{v.count}"
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
namespace :profile do
|
2
|
-
namespace :bot do
|
3
|
-
desc 'Runs the HeapAnalyzer on a dump file'
|
4
|
-
task :heap, [:filename] do |t, args|
|
5
|
-
if args[:filename].blank?
|
6
|
-
puts "Expected usage: rake profile:bot:heap[my_heap.dump]"
|
7
|
-
exit
|
8
|
-
end
|
9
|
-
|
10
|
-
require 'effective_profile_bot/heap_analyzer'
|
11
|
-
EffectiveProfileBot::HeapAnalyzer.new(args[:filename]).analyze
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|