effective_test_bot 0.4.3 → 0.4.4

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.
@@ -5,12 +5,12 @@ module BaseTest
5
5
  protected
6
6
 
7
7
  def assert_page_normal(message = nil)
8
- unless test_bot_skip?(:normal)
9
- assert_no_exceptions unless test_bot_skip?(:exceptions)
10
- assert_page_status unless test_bot_skip?(:page_status)
11
- assert_page_title unless test_bot_skip?(:page_title)
12
- assert_no_js_errors unless test_bot_skip?(:no_js_errors)
13
- end
8
+ return if test_bot_skip?(:normal)
9
+
10
+ assert_no_exceptions unless test_bot_skip?(:exceptions)
11
+ assert_page_status unless test_bot_skip?(:page_status)
12
+ assert_no_js_errors unless test_bot_skip?(:no_js_errors)
13
+ assert_page_title unless test_bot_skip?(:page_title)
14
14
  end
15
15
 
16
16
  private
@@ -37,10 +37,12 @@ module BaseTest
37
37
  end
38
38
 
39
39
  def create_resource!
40
- visit(new_resource_path)
40
+ without_screenshots do
41
+ visit(new_resource_path)
41
42
 
42
- within("form#new_#{resource_name}") do
43
- fill_form(resource_attributes) and submit_form
43
+ within("form#new_#{resource_name}") do
44
+ fill_form(resource_attributes) and submit_novalidate_form
45
+ end
44
46
  end
45
47
 
46
48
  resource_class.last
@@ -6,6 +6,7 @@ module CrudTest
6
6
 
7
7
  def test_bot_new_test
8
8
  sign_in(user) and visit(new_resource_path)
9
+ save_test_bot_screenshot
9
10
 
10
11
  assert_page_normal
11
12
  assert_assigns(resource_name) # unskippable
@@ -17,22 +18,25 @@ module CrudTest
17
18
  within(form_selector) do
18
19
  assert_selector 'input[type=submit]', 'Expected submit button to be present'
19
20
  end
21
+
20
22
  end
21
23
 
22
24
  def test_bot_create_valid_test
23
25
  sign_in(user) and visit(new_resource_path)
26
+ save_test_bot_screenshot
24
27
 
25
28
  before = { count: resource_class.count, path: page.current_path }
26
29
 
27
30
  within("form#new_#{resource_name}") do
28
31
  fill_form(resource_attributes)
29
- test_bot_skip?(:unpermitted_params) ? submit_form : with_raised_unpermitted_params_exceptions { submit_form }
32
+ submit_form
30
33
  end
31
34
 
35
+ save_test_bot_screenshot
36
+
32
37
  after = { count: resource_class.count, path: page.current_path }
33
38
 
34
39
  assert_page_normal
35
- assert_no_unpermitted_params unless test_bot_skip?(:unpermitted_params)
36
40
 
37
41
  refute_equal before[:count], after[:count], "Expected fill_form to create a #{resource_class} object"
38
42
  refute_equal(before[:path], after[:path], "(path) Expected unique before and after paths") unless test_bot_skip?(:path)
@@ -49,20 +53,23 @@ module CrudTest
49
53
  before = { count: resource_class.count }
50
54
 
51
55
  within("form#new_#{resource_name}") do
52
- clear_form
56
+ without_screenshots { clear_form }
53
57
  submit_novalidate_form
54
58
  end
55
59
 
60
+ save_test_bot_screenshot
61
+
56
62
  after = { count: resource_class.count }
57
63
 
58
64
  assert_page_normal
59
65
 
60
66
  assert_equal before[:count], after[:count], "Expected #{resource_class}.count to be unchanged"
61
- assert_flash(:danger) unless test_bot_skip?(:flash)
62
67
 
63
68
  assert_assigns(resource_name) unless test_bot_skip?(:assigns)
64
69
  assert_assigns_errors(resource_name) unless test_bot_skip?(:assigns_errors)
65
70
 
71
+ assert_flash(:danger) unless test_bot_skip?(:flash)
72
+
66
73
  assert_equal(resources_path, page.current_path, "(path) Expected current_path to match resource #create path #{resources_path}") unless test_bot_skip?(:path)
67
74
  end
68
75
 
@@ -70,6 +77,7 @@ module CrudTest
70
77
  sign_in(user) and (resource = find_or_create_resource!)
71
78
 
72
79
  visit(edit_resource_path(resource))
80
+ save_test_bot_screenshot
73
81
 
74
82
  assert_page_normal
75
83
  assert_assigns(resource_name) unless test_bot_skip?(:assigns)
@@ -87,34 +95,40 @@ module CrudTest
87
95
  sign_in(user) and (resource = find_or_create_resource!)
88
96
 
89
97
  visit(edit_resource_path(resource))
98
+ save_test_bot_screenshot
90
99
 
91
100
  before = { count: resource_class.count, updated_at: (resource.updated_at rescue nil) }
92
101
 
93
102
  within("form#edit_#{resource_name}_#{resource.id}") do
94
103
  fill_form(resource_attributes)
95
- test_bot_skip?(:unpermitted_params) ? submit_form : with_raised_unpermitted_params_exceptions { submit_form }
104
+ submit_form
96
105
  end
106
+
107
+ save_test_bot_screenshot
108
+
97
109
  resource = resource_class.find(resource.id)
98
110
 
99
111
  after = { count: resource_class.count, updated_at: (resource.updated_at rescue nil) }
100
112
 
101
113
  assert_page_normal
102
114
 
103
- assert_equal before[:count], after[:count], "Expected #{resource_class}.count to be unchanged"
104
- refute_equal(before[:updated_at], after[:updated_at], "(updated_at_changed) Expected @#{resource_name}.updated_at to have changed") if (resource.respond_to?(:updated_at) && !test_bot_skip?(:updated_at_changed))
115
+ assert_no_assigns_errors(resource_name) unless test_bot_skip?(:no_assigns_errors)
116
+
117
+ assert_equal before[:count], after[:count], "Expected #{resource_class}.count to be unchanged" unless test_bot_skip?(:count)
118
+ refute_equal(before[:updated_at], after[:updated_at], "(updated_at) Expected @#{resource_name}.updated_at to have changed") if (resource.respond_to?(:updated_at) && !test_bot_skip?(:updated_at))
105
119
 
106
120
  assert_flash(:success) unless test_bot_skip?(:flash)
107
121
 
108
122
  # In a rails controller, if i redirect to resources_path it may not assign the instance variable
109
123
  # Wheras if I redirect to edit_resource_path I must ensure that the instance variable is set
110
124
  assert_assigns(resource_name) if (after[:path] == edit_resource_path(resource) && !test_bot_skip?(:assigns))
111
- assert_no_assigns_errors(resource_name) unless test_bot_skip?(:no_assigns_errors)
112
125
  end
113
126
 
114
127
  def test_bot_update_invalid_test
115
128
  sign_in(user) and (resource = find_or_create_resource!)
116
129
 
117
130
  visit(edit_resource_path(resource))
131
+ save_test_bot_screenshot
118
132
 
119
133
  before = { count: resource_class.count, updated_at: (resource.updated_at rescue nil) }
120
134
 
@@ -122,19 +136,21 @@ module CrudTest
122
136
  clear_form
123
137
  submit_novalidate_form
124
138
  end
139
+
140
+ save_test_bot_screenshot
141
+
125
142
  resource = resource_class.find(resource.id)
126
143
 
127
144
  after = { count: resource_class.count, updated_at: (resource.updated_at rescue nil) }
128
145
 
129
146
  assert_page_normal
130
-
131
147
  assert_equal before[:count], after[:count], "Expected: #{resource_class}.count to be unchanged"
132
- assert_equal(before[:updated_at], after[:updated_at], "Expected @#{resource_name}.updated_at to be unchanged") if resource.respond_to?(:updated_at)
133
-
134
- assert_flash(:danger) unless test_bot_skip?(:flash)
135
148
 
136
149
  assert_assigns(resource_name) unless test_bot_skip?(:assigns)
137
150
  assert_assigns_errors(resource_name) unless test_bot_skip?(:assigns_errors)
151
+ assert_equal(before[:updated_at], after[:updated_at], "(updated_at) Expected @#{resource_name}.updated_at to be unchanged") if (resource.respond_to?(:updated_at) && !test_bot_skip?(:updated_at))
152
+
153
+ assert_flash(:danger) unless test_bot_skip?(:flash)
138
154
 
139
155
  assert_equal(resource_path(resource), page.current_path, "(path) Expected current_path to match resource #update path") unless test_bot_skip?(:path)
140
156
  end
@@ -143,6 +159,7 @@ module CrudTest
143
159
  sign_in(user) and (resource = (find_or_create_resource! rescue nil))
144
160
 
145
161
  visit resources_path
162
+ save_test_bot_screenshot
146
163
 
147
164
  assert_page_normal
148
165
 
@@ -156,6 +173,7 @@ module CrudTest
156
173
  sign_in(user) and (resource = find_or_create_resource!)
157
174
 
158
175
  visit resource_path(resource)
176
+ save_test_bot_screenshot
159
177
 
160
178
  assert_page_normal
161
179
  assert_assigns(resource_name) unless test_bot_skip?(:assigns)
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.4.3
4
+ version: 0.4.4
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: 2015-10-01 00:00:00.000000000 Z
11
+ date: 2015-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -178,6 +178,20 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: rmagick
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
181
195
  - !ruby/object:Gem::Dependency
182
196
  name: faker
183
197
  requirement: !ruby/object:Gem::Requirement
@@ -220,8 +234,10 @@ files:
220
234
  - test/concerns/test_botable/wizard_dsl.rb
221
235
  - test/support/effective_assets_upload_file._test
222
236
  - test/support/effective_test_bot_assertions.rb
237
+ - test/support/effective_test_bot_form_filler.rb
223
238
  - test/support/effective_test_bot_form_helper.rb
224
239
  - test/support/effective_test_bot_login_helper.rb
240
+ - test/support/effective_test_bot_screenshots_helper.rb
225
241
  - test/support/effective_test_bot_test_helper.rb
226
242
  - test/test_bot/integration/application_test.rb
227
243
  - test/test_bot/integration/environment_test.rb