cornucopia 0.1.34 → 0.1.35
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.
- data/lib/cornucopia/cucumber_hooks.rb +2 -2
- data/lib/cornucopia/rspec_hooks.rb +2 -2
- data/lib/cornucopia/spinach_hooks.rb +1 -1
- data/lib/cornucopia/version.rb +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/database.yml +36 -36
- data/spec/lib/capybara/finder_diagnostics_spec.rb +109 -103
- data/spec/lib/util/configuration_spec.rb +20 -0
- data/spec/lib/util/report_builder_spec.rb +35 -29
- data/spec/pages/cornucopia_report_pages/cornucopia_report_holder_page.rb +14 -0
- data/spec/pages/cornucopia_report_pages/cornucopia_report_test_contents_page.rb +121 -0
- data/spec/pages/cornucopia_report_pages/index_page.rb +16 -0
- data/spec/rails_helper.rb +3 -3
- data/spec/spec_helper.rb +4 -4
- metadata +8 -2
@@ -38,7 +38,7 @@ if Cucumber::VERSION.split[0].to_i >= 2
|
|
38
38
|
Cornucopia::Util::TestHelper.instance.record_test_start(test_name)
|
39
39
|
|
40
40
|
seed_value = Cornucopia::Util::Configuration.seed ||
|
41
|
-
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
41
|
+
100000000000000000000000000000000000000 + Random.new.rand(899999999999999999999999999999999999999)
|
42
42
|
|
43
43
|
scenario.instance_variable_set :@seed_value, seed_value
|
44
44
|
|
@@ -101,7 +101,7 @@ else
|
|
101
101
|
Cornucopia::Util::TestHelper.instance.record_test_start(test_name)
|
102
102
|
|
103
103
|
seed_value = Cornucopia::Util::Configuration.seed ||
|
104
|
-
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
104
|
+
100000000000000000000000000000000000000 + Random.new.rand(899999999999999999999999999999999999999)
|
105
105
|
|
106
106
|
scenario.instance_variable_set :@seed_value, seed_value
|
107
107
|
|
@@ -65,7 +65,7 @@ RSpec.configure do |config|
|
|
65
65
|
puts "Cornucopia::Hook::before group" if Cornucopia::Util::Configuration.benchmark
|
66
66
|
|
67
67
|
Cornucopia::RSpecHelper.instance.context_seed_value = Cornucopia::Util::Configuration.context_seed ||
|
68
|
-
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
68
|
+
100000000000000000000000000000000000000 + Random.new.rand(899999999999999999999999999999999999999)
|
69
69
|
|
70
70
|
srand(Cornucopia::RSpecHelper.instance.context_seed_value)
|
71
71
|
end
|
@@ -106,7 +106,7 @@ RSpec.configure do |config|
|
|
106
106
|
Cornucopia::Util::TestHelper.instance.record_test_start(test_example.full_description)
|
107
107
|
|
108
108
|
Cornucopia::RSpecHelper.instance.seed_value = Cornucopia::Util::Configuration.seed ||
|
109
|
-
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
109
|
+
100000000000000000000000000000000000000 + Random.new.rand(899999999999999999999999999999999999999)
|
110
110
|
|
111
111
|
srand(Cornucopia::RSpecHelper.instance.seed_value)
|
112
112
|
|
@@ -10,7 +10,7 @@ Spinach.hooks.around_scenario do |scenario_data, step_definitions, &block|
|
|
10
10
|
Cornucopia::Util::TestHelper.instance.spinach_reported_error = false
|
11
11
|
Cornucopia::Util::TestHelper.instance.spinach_running_scenario = scenario_data
|
12
12
|
seed_value = Cornucopia::Util::Configuration.seed ||
|
13
|
-
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
13
|
+
100000000000000000000000000000000000000 + Random.new.rand(899999999999999999999999999999999999999)
|
14
14
|
|
15
15
|
scenario_data.instance_variable_set :@seed_value, seed_value
|
16
16
|
|
data/lib/cornucopia/version.rb
CHANGED
@@ -1,37 +1,37 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
## SQLite version 3.x
|
2
|
+
## gem install sqlite3
|
3
|
+
##
|
4
|
+
## Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
## gem 'sqlite3'
|
6
|
+
#development:
|
7
|
+
# adapter: mysql2
|
8
|
+
# encoding: utf8
|
9
|
+
# reconnect: false
|
10
|
+
# database: cornucopia_dev
|
11
|
+
# pool: 5
|
12
|
+
# username: root
|
13
|
+
# password: lp!8288178
|
14
|
+
# socket: /tmp/mysql.sock
|
3
15
|
#
|
4
|
-
|
5
|
-
|
6
|
-
development
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
password: lp!8288178
|
27
|
-
socket: /tmp/mysql.sock
|
28
|
-
|
29
|
-
production:
|
30
|
-
adapter: mysql2
|
31
|
-
encoding: utf8
|
32
|
-
reconnect: false
|
33
|
-
database: cornucopia_production
|
34
|
-
pool: 5
|
35
|
-
username: root
|
36
|
-
password: lp!8288178
|
37
|
-
socket: /tmp/mysql.sock
|
16
|
+
## Warning: The database defined as "test" will be erased and
|
17
|
+
## re-generated from your development database when you run "rake".
|
18
|
+
## Do not set this db to the same as development or production.
|
19
|
+
#test:
|
20
|
+
# adapter: mysql2
|
21
|
+
# encoding: utf8
|
22
|
+
# reconnect: false
|
23
|
+
# database: cornucopia_test
|
24
|
+
# pool: 5
|
25
|
+
# username: root
|
26
|
+
# password: lp!8288178
|
27
|
+
# socket: /tmp/mysql.sock
|
28
|
+
#
|
29
|
+
#production:
|
30
|
+
# adapter: mysql2
|
31
|
+
# encoding: utf8
|
32
|
+
# reconnect: false
|
33
|
+
# database: cornucopia_production
|
34
|
+
# pool: 5
|
35
|
+
# username: root
|
36
|
+
# password: lp!8288178
|
37
|
+
# socket: /tmp/mysql.sock
|
@@ -67,7 +67,7 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
67
67
|
test_page.contents do |contents_frame|
|
68
68
|
expect(contents_frame.errors.length).to be == 1
|
69
69
|
expect(contents_frame.errors[0].name.text).to be == "An error occurred while processing \"find\":"
|
70
|
-
expect(contents_frame.errors[0].tables[0].rows.length).to be ==
|
70
|
+
expect(contents_frame.errors[0].tables[0].rows.length).to be == 5
|
71
71
|
expect(contents_frame.errors[0].tables[0].rows[0].labels[0].text).to be == "function_name"
|
72
72
|
expect(contents_frame.errors[0].tables[0].rows[0].values[0].text).to be == ":find"
|
73
73
|
expect(contents_frame.errors[0].tables[0].rows[1].labels[0].text).to be == "args[0]"
|
@@ -79,12 +79,12 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
79
79
|
expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[0].values[0].text).to be == ":css"
|
80
80
|
expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[1].labels[0].text).to be == "1"
|
81
81
|
expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[1].values[0].text).to be == "#base-contentss"
|
82
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
83
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
84
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
85
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
86
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
87
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
82
|
+
expect(contents_frame.errors[0].tables[0].rows[3].labels[0].text).to be == "exception"
|
83
|
+
expect(contents_frame.errors[0].tables[0].rows[3].values[0].text).to be == "Unable to find css \"#base-contentss\""
|
84
|
+
expect(contents_frame.errors[0].tables[0].rows[4].labels[0].text).to be == "backtrace"
|
85
|
+
expect(contents_frame.errors[0].tables[0].rows[4].expands[0]).to be
|
86
|
+
expect(contents_frame.errors[0].tables[0].rows[4].mores[0]).to be
|
87
|
+
expect(contents_frame.errors[0].tables[0].rows[4].values[0].text.length).to be > 0
|
88
88
|
|
89
89
|
contents_frame.errors[0].more_details.show_hide.click
|
90
90
|
expect(contents_frame.errors[0].more_details.details.rows.length).to be == 10
|
@@ -121,7 +121,9 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
121
121
|
|
122
122
|
index_page.load base_folder: "sample_report"
|
123
123
|
|
124
|
+
total_tests = 0
|
124
125
|
index_page.contents do |contents_frame|
|
126
|
+
total_tests = contents_frame.all("a").length
|
125
127
|
tester = Cornucopia::Capybara::FinderDiagnostics::FindAction.new(contents_frame, {}, {}, :find, "a")
|
126
128
|
expect(tester).to receive(:perform_analysis).and_call_original
|
127
129
|
|
@@ -132,12 +134,13 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
132
134
|
report_page.load(report_name: "cornucopia_report", base_folder: "cornucopia_report")
|
133
135
|
|
134
136
|
expect(report_page.tests.length).to be >= 1
|
137
|
+
|
135
138
|
report_page.tests[0].click
|
136
139
|
report_page.displayed_test do |test_page|
|
137
140
|
test_page.contents do |contents_frame|
|
138
141
|
expect(contents_frame.errors.length).to be == 1
|
139
142
|
expect(contents_frame.errors[0].name.text).to be == "An error occurred while processing \"find\":"
|
140
|
-
expect(contents_frame.errors[0].tables[0].rows.length).to be ==
|
143
|
+
expect(contents_frame.errors[0].tables[0].rows.length).to be == 5
|
141
144
|
expect(contents_frame.errors[0].tables[0].rows[0].labels[0].text).to be == "function_name"
|
142
145
|
expect(contents_frame.errors[0].tables[0].rows[0].values[0].text).to be == ":find"
|
143
146
|
expect(contents_frame.errors[0].tables[0].rows[1].labels[0].text).to be == "args[0]"
|
@@ -149,42 +152,42 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
149
152
|
expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[0].values[0].text).to be == ":css"
|
150
153
|
expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[1].labels[0].text).to be == "1"
|
151
154
|
expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[1].values[0].text).to be == "a"
|
152
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
153
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
154
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
155
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
156
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
157
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
155
|
+
expect(contents_frame.errors[0].tables[0].rows[3].labels[0].text).to be == "exception"
|
156
|
+
expect(contents_frame.errors[0].tables[0].rows[3].values[0].text).to match /Ambiguous match, found .+ elements matching css "a"/
|
157
|
+
expect(contents_frame.errors[0].tables[0].rows[4].labels[0].text).to be == "backtrace"
|
158
|
+
expect(contents_frame.errors[0].tables[0].rows[4].expands[0]).to be
|
159
|
+
expect(contents_frame.errors[0].tables[0].rows[4].mores[0]).to be
|
160
|
+
expect(contents_frame.errors[0].tables[0].rows[4].values[0].text.length).to be > 0
|
158
161
|
|
159
162
|
contents_frame.errors[0].more_details.show_hide.click
|
160
|
-
|
161
|
-
expect(contents_frame.errors[0].more_details.details.rows.length).to be == 12 + num_rows
|
163
|
+
expect(contents_frame.errors[0].more_details.details.rows.length).to be == 12
|
162
164
|
expect(contents_frame.errors[0].more_details.details.rows[0].labels[0].text).to be == "name"
|
163
165
|
expect(contents_frame.errors[0].more_details.details.rows[0].values[0].text).to be == "Capybara::Ambiguous"
|
164
166
|
expect(contents_frame.errors[0].more_details.details.rows[1].labels[0].text).to be == "all_elements"
|
165
|
-
expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables.length).to
|
166
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
167
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
168
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
169
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
170
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
171
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
172
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
173
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
174
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
175
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
176
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
177
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
167
|
+
expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables.length).to eq 1
|
168
|
+
expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables[0].rows.length).to eq total_tests
|
169
|
+
expect(contents_frame.errors[0].more_details.details.rows[2].labels[0].text).to be == "guessed_types"
|
170
|
+
expect(contents_frame.errors[0].more_details.details.rows[2].values[0].text).to be
|
171
|
+
expect(contents_frame.errors[0].more_details.details.rows[3].labels[0].text).to be == "support_options"
|
172
|
+
expect(contents_frame.errors[0].more_details.details.rows[3].values[0].text).to be == "{:__cornucopia_no_analysis=>true, :__cornucopia_retry_with_found=>nil}"
|
173
|
+
expect(contents_frame.errors[0].more_details.details.rows[4].labels[0].text).to be == "page_url"
|
174
|
+
expect(contents_frame.errors[0].more_details.details.rows[4].values[0].text).to match /report_contents\.html/
|
175
|
+
expect(contents_frame.errors[0].more_details.details.rows[5].labels[0].text).to be == "title"
|
176
|
+
expect(contents_frame.errors[0].more_details.details.rows[5].values[0].text).to be == "Diagnostics report list"
|
177
|
+
expect(contents_frame.errors[0].more_details.details.rows[6].labels[0].text).to be == "screen_shot"
|
178
|
+
expect(contents_frame.errors[0].more_details.details.rows[6].value_images[0][:src]).to match /\/screen_shot\.png/
|
179
|
+
expect(contents_frame.errors[0].more_details.details.rows[7].labels[0].text).to be == "html_file"
|
180
|
+
expect(contents_frame.errors[0].more_details.details.rows[7].value_links[0][:href]).
|
178
181
|
to match /html_save_file\/__cornucopia_save_page\.html/
|
179
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
180
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
182
|
+
expect(contents_frame.errors[0].more_details.details.rows[8].labels[0].text).to be == "html_frame"
|
183
|
+
expect(contents_frame.errors[0].more_details.details.rows[8].value_frames[0][:src]).
|
181
184
|
to match /page_dump\.html/
|
182
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
183
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
184
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
185
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
186
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
187
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
185
|
+
expect(contents_frame.errors[0].more_details.details.rows[9].labels[0].text).to be == "html_source"
|
186
|
+
expect(contents_frame.errors[0].more_details.details.rows[9].value_textareas[0].text).to be
|
187
|
+
expect(contents_frame.errors[0].more_details.details.rows[10].labels[0].text).to be == "page_height"
|
188
|
+
expect(contents_frame.errors[0].more_details.details.rows[10].values[0].text).to be
|
189
|
+
expect(contents_frame.errors[0].more_details.details.rows[11].labels[0].text).to be == "page_width"
|
190
|
+
expect(contents_frame.errors[0].more_details.details.rows[11].values[0].text).to be
|
188
191
|
end
|
189
192
|
end
|
190
193
|
end
|
@@ -214,7 +217,9 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
214
217
|
|
215
218
|
index_page.load base_folder: "sample_report"
|
216
219
|
|
220
|
+
total_tests = 0
|
217
221
|
index_page.contents do |contents_frame|
|
222
|
+
total_tests = contents_frame.all("a").length
|
218
223
|
diag = Cornucopia::Capybara::FinderDiagnostics::FindAction.
|
219
224
|
new(contents_frame, {}, {}, :all, :css, "a", visible: true)
|
220
225
|
expect(Cornucopia::Capybara::FinderDiagnostics::FindAction).
|
@@ -235,6 +240,7 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
235
240
|
report_page.load(report_name: "cornucopia_report", base_folder: "cornucopia_report")
|
236
241
|
|
237
242
|
expect(report_page.tests.length).to be >= 1
|
243
|
+
|
238
244
|
report_page.tests[0].click
|
239
245
|
report_page.displayed_test do |test_page|
|
240
246
|
test_page.contents do |contents_frame|
|
@@ -242,7 +248,7 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
242
248
|
# this line is the same as the next one. I added this line to test a line in the site-prims extentions.
|
243
249
|
expect(contents_frame.errors[0].find("p").text).to be == "Diagnostic report on \"all\":"
|
244
250
|
expect(contents_frame.errors[0].name.text).to be == "Diagnostic report on \"all\":"
|
245
|
-
expect(contents_frame.errors[0].tables[0].rows.length).to be ==
|
251
|
+
expect(contents_frame.errors[0].tables[0].rows.length).to be == 4
|
246
252
|
expect(contents_frame.errors[0].tables[0].rows[0].labels[0].text).to be == "function_name"
|
247
253
|
expect(contents_frame.errors[0].tables[0].rows[0].values[0].text).to be == ":all"
|
248
254
|
expect(contents_frame.errors[0].tables[0].rows[1].labels[0].text).to be == "args[0]"
|
@@ -254,45 +260,45 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
254
260
|
expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[0].values[0].text).to be == ":css"
|
255
261
|
expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[1].labels[0].text).to be == "1"
|
256
262
|
expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[1].values[0].text).to be == "a"
|
257
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
258
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
259
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
260
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
261
|
-
expect(contents_frame.errors[0].tables[0].rows[
|
263
|
+
expect(contents_frame.errors[0].tables[0].rows[3].labels[0].text).to be == "options"
|
264
|
+
expect(contents_frame.errors[0].tables[0].rows[3].sub_tables.length).to be == 1
|
265
|
+
expect(contents_frame.errors[0].tables[0].rows[3].sub_tables[0].rows.length).to be == 1
|
266
|
+
expect(contents_frame.errors[0].tables[0].rows[3].sub_tables[0].rows[0].labels[0].text).to be == "visible"
|
267
|
+
expect(contents_frame.errors[0].tables[0].rows[3].sub_tables[0].rows[0].values[0].text).to be == "true"
|
262
268
|
|
263
269
|
contents_frame.errors[0].more_details.show_hide.click
|
264
|
-
|
265
|
-
expect(contents_frame.errors[0].more_details.details.rows.length).to be == 13 + num_rows
|
270
|
+
expect(contents_frame.errors[0].more_details.details.rows.length).to be == 11
|
266
271
|
expect(contents_frame.errors[0].more_details.details.rows[0].labels[0].text).to be == "all_elements"
|
267
|
-
expect(contents_frame.errors[0].more_details.details.rows[0].sub_tables.length).to
|
268
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
269
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
270
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
271
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
272
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
273
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
274
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
275
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
276
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
272
|
+
expect(contents_frame.errors[0].more_details.details.rows[0].sub_tables.length).to eq 1
|
273
|
+
expect(contents_frame.errors[0].more_details.details.rows[0].sub_tables[0].rows.length).to eq total_tests
|
274
|
+
expect(contents_frame.errors[0].more_details.details.rows[1].labels[0].text).to be == "args"
|
275
|
+
expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables[0].rows[0].labels[0].text).to be == "1"
|
276
|
+
expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables[0].rows[0].values[0].text).to be == "a"
|
277
|
+
expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables[0].rows[1].labels[0].text).to be == "2"
|
278
|
+
expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables[0].rows[1].values[0].text).to be == "{:visible=>true}"
|
279
|
+
expect(contents_frame.errors[0].more_details.details.rows[2].labels[0].text).to be == "guessed_types"
|
280
|
+
expect(contents_frame.errors[0].more_details.details.rows[2].values[0].text).to be
|
281
|
+
expect(contents_frame.errors[0].more_details.details.rows[3].labels[0].text).to be == "page_url"
|
282
|
+
expect(contents_frame.errors[0].more_details.details.rows[3].values[0].text).
|
277
283
|
to match /report_contents\.html/
|
278
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
279
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
284
|
+
expect(contents_frame.errors[0].more_details.details.rows[4].labels[0].text).to be == "title"
|
285
|
+
expect(contents_frame.errors[0].more_details.details.rows[4].values[0].text).
|
280
286
|
to be == "Diagnostics report list"
|
281
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
282
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
287
|
+
expect(contents_frame.errors[0].more_details.details.rows[5].labels[0].text).to be == "screen_shot"
|
288
|
+
expect(contents_frame.errors[0].more_details.details.rows[5].value_images[0][:src]).
|
283
289
|
to match /\/screen_shot\.png/
|
284
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
285
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
290
|
+
expect(contents_frame.errors[0].more_details.details.rows[6].labels[0].text).to be == "html_file"
|
291
|
+
expect(contents_frame.errors[0].more_details.details.rows[6].value_links[0][:href]).
|
286
292
|
to match /html_save_file\/__cornucopia_save_page\.html/
|
287
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
288
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
293
|
+
expect(contents_frame.errors[0].more_details.details.rows[7].labels[0].text).to be == "html_frame"
|
294
|
+
expect(contents_frame.errors[0].more_details.details.rows[7].value_frames[0][:src]).
|
289
295
|
to match /page_dump\.html/
|
290
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
291
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
292
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
293
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
294
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
295
|
-
expect(contents_frame.errors[0].more_details.details.rows[
|
296
|
+
expect(contents_frame.errors[0].more_details.details.rows[8].labels[0].text).to be == "html_source"
|
297
|
+
expect(contents_frame.errors[0].more_details.details.rows[8].value_textareas[0].text).to be
|
298
|
+
expect(contents_frame.errors[0].more_details.details.rows[9].labels[0].text).to be == "page_height"
|
299
|
+
expect(contents_frame.errors[0].more_details.details.rows[9].values[0].text).to be
|
300
|
+
expect(contents_frame.errors[0].more_details.details.rows[10].labels[0].text).to be == "page_width"
|
301
|
+
expect(contents_frame.errors[0].more_details.details.rows[10].values[0].text).to be
|
296
302
|
end
|
297
303
|
end
|
298
304
|
end
|
@@ -320,19 +326,19 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
320
326
|
test_page.contents do |contents_frame|
|
321
327
|
expect(contents_frame.errors.length).to be == 1
|
322
328
|
contents_frame.errors[0].more_details.show_hide.click
|
323
|
-
expect(contents_frame.errors[0].more_details.details.rows.length).to eq
|
324
|
-
expect(contents_frame.errors[0].more_details.details.
|
325
|
-
expect(contents_frame.errors[0].more_details.details.
|
326
|
-
expect(contents_frame.errors[0].more_details.details.
|
327
|
-
expect(contents_frame.errors[0].more_details.details.
|
328
|
-
expect(contents_frame.errors[0].more_details.details.
|
329
|
-
expect(contents_frame.errors[0].more_details.details.
|
330
|
-
expect(contents_frame.errors[0].more_details.details.
|
331
|
-
expect(contents_frame.errors[0].more_details.details.
|
332
|
-
expect(contents_frame.errors[0].more_details.details.
|
333
|
-
expect(contents_frame.errors[0].more_details.details.
|
334
|
-
expect(contents_frame.errors[0].more_details.details.
|
335
|
-
expect(contents_frame.errors[0].more_details.details.
|
329
|
+
expect(contents_frame.errors[0].more_details.details.rows.length).to eq 12
|
330
|
+
expect(contents_frame.errors[0].more_details.details.rows[0].labels[0].text).to eq "name"
|
331
|
+
expect(contents_frame.errors[0].more_details.details.rows[1].labels[0].text).to eq "args"
|
332
|
+
expect(contents_frame.errors[0].more_details.details.rows[2].labels[0].text).to eq "guessed_types"
|
333
|
+
expect(contents_frame.errors[0].more_details.details.rows[3].labels[0].text).to eq "support_options"
|
334
|
+
expect(contents_frame.errors[0].more_details.details.rows[4].labels[0].text).to eq "page_url"
|
335
|
+
expect(contents_frame.errors[0].more_details.details.rows[5].labels[0].text).to eq "title"
|
336
|
+
expect(contents_frame.errors[0].more_details.details.rows[6].labels[0].text).to eq "screen_shot"
|
337
|
+
expect(contents_frame.errors[0].more_details.details.rows[7].labels[0].text).to eq "html_file"
|
338
|
+
expect(contents_frame.errors[0].more_details.details.rows[8].labels[0].text).to eq "html_frame"
|
339
|
+
expect(contents_frame.errors[0].more_details.details.rows[9].labels[0].text).to eq "html_source"
|
340
|
+
expect(contents_frame.errors[0].more_details.details.rows[10].labels[0].text).to eq "page_height"
|
341
|
+
expect(contents_frame.errors[0].more_details.details.rows[11].labels[0].text).to eq "page_width"
|
336
342
|
end
|
337
343
|
end
|
338
344
|
end
|
@@ -350,29 +356,29 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
350
356
|
test_page.contents do |contents_frame|
|
351
357
|
expect(contents_frame.errors.length).to be == 1
|
352
358
|
contents_frame.errors[0].more_details.show_hide.click
|
353
|
-
expect(contents_frame.errors[0].more_details.details.
|
359
|
+
expect(contents_frame.errors[0].more_details.details.rows[2].labels[0].text).to be == "all_other_elements"
|
354
360
|
|
355
|
-
hidden_row_specs = contents_frame.errors[0].more_details.details.
|
361
|
+
hidden_row_specs = contents_frame.errors[0].more_details.details.rows[1].sub_tables[0].rows[0].sub_tables[0].rows
|
356
362
|
expect(hidden_row_specs[0].labels[0].text).to be == "elem_checked"
|
357
363
|
expect(hidden_row_specs[1].labels[0].text).to be == "elem_id"
|
358
364
|
expect(hidden_row_specs[1].values[0].text).to be == "hidden-cool-button"
|
359
365
|
expect(hidden_row_specs[2].labels[0].text).to be == "elem_location"
|
360
|
-
expect(hidden_row_specs[
|
361
|
-
expect(hidden_row_specs[
|
362
|
-
expect(hidden_row_specs[
|
363
|
-
expect(hidden_row_specs[
|
364
|
-
expect(hidden_row_specs[
|
365
|
-
expect(hidden_row_specs[
|
366
|
-
expect(hidden_row_specs[
|
367
|
-
expect(hidden_row_specs[
|
368
|
-
expect(hidden_row_specs[
|
369
|
-
expect(hidden_row_specs[
|
370
|
-
expect(hidden_row_specs[
|
371
|
-
expect(hidden_row_specs[
|
372
|
-
expect(hidden_row_specs[
|
373
|
-
expect(hidden_row_specs[
|
374
|
-
expect(hidden_row_specs[
|
375
|
-
expect(hidden_row_specs[
|
366
|
+
expect(hidden_row_specs[2].sub_tables[0].rows[0].labels[0].text).to be == "x"
|
367
|
+
expect(hidden_row_specs[2].sub_tables[0].rows[1].labels[0].text).to be == "y"
|
368
|
+
expect(hidden_row_specs[3].labels[0].text).to be == "elem_outerHTML"
|
369
|
+
expect(hidden_row_specs[4].labels[0].text).to be == "elem_selected"
|
370
|
+
expect(hidden_row_specs[5].labels[0].text).to be == "elem_tag_name"
|
371
|
+
expect(hidden_row_specs[6].labels[0].text).to be == "elem_value"
|
372
|
+
expect(hidden_row_specs[7].labels[0].text).to be == "elem_visible"
|
373
|
+
expect(hidden_row_specs[7].values[0].text).to be == "false"
|
374
|
+
expect(hidden_row_specs[8].labels[0].text).to be == "native_aria_meta_data"
|
375
|
+
expect(hidden_row_specs[9].labels[0].text).to be == "native_class"
|
376
|
+
expect(hidden_row_specs[10].labels[0].text).to be == "native_onclick"
|
377
|
+
expect(hidden_row_specs[11].labels[0].text).to be == "native_size"
|
378
|
+
expect(hidden_row_specs[11].sub_tables[0].rows[0].labels[0].text).to be == "width"
|
379
|
+
expect(hidden_row_specs[11].sub_tables[0].rows[1].labels[0].text).to be == "height"
|
380
|
+
expect(hidden_row_specs[12].labels[0].text).to be == "native_type"
|
381
|
+
expect(hidden_row_specs[12].values[0].text).to be == "button"
|
376
382
|
end
|
377
383
|
end
|
378
384
|
end
|
@@ -411,11 +417,11 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
411
417
|
test_page.contents do |contents_frame|
|
412
418
|
expect(contents_frame.errors.length).to be == 1
|
413
419
|
|
414
|
-
the_row = contents_frame.errors[0].tables[0].
|
420
|
+
the_row = contents_frame.errors[0].tables[0].rows[0]
|
415
421
|
expect(the_row.labels[0].text).to be == "something"
|
416
422
|
expect(the_row.values[0].text).to be == "a value"
|
417
423
|
|
418
|
-
the_row = contents_frame.errors[0].tables[0].
|
424
|
+
the_row = contents_frame.errors[0].tables[0].rows[2]
|
419
425
|
expect(the_row.labels[0].text).to be == "function_name"
|
420
426
|
expect(the_row.values[0].text).to be == ":find"
|
421
427
|
|
@@ -446,7 +452,7 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
|
|
446
452
|
test_page.contents do |contents_frame|
|
447
453
|
expect(contents_frame.errors.length).to be == 1
|
448
454
|
|
449
|
-
the_row = contents_frame.errors[0].tables[
|
455
|
+
the_row = contents_frame.errors[0].tables[1].rows[0]
|
450
456
|
expect(the_row.labels[0].text).to be == "function_name"
|
451
457
|
expect(the_row.values[0].text).to be == ":select"
|
452
458
|
end
|
@@ -495,6 +495,26 @@ describe "Cornucopia::Util::Configuration" do
|
|
495
495
|
end
|
496
496
|
end
|
497
497
|
|
498
|
+
describe "#benchmark" do
|
499
|
+
it "has a default value" do
|
500
|
+
expect(Cornucopia::Util::Configuration.benchmark).to eq false
|
501
|
+
end
|
502
|
+
|
503
|
+
it "can set the value" do
|
504
|
+
orig_value = Cornucopia::Util::Configuration.benchmark
|
505
|
+
|
506
|
+
begin
|
507
|
+
new_value = [true, false].sample
|
508
|
+
|
509
|
+
Cornucopia::Util::Configuration.benchmark = new_value
|
510
|
+
|
511
|
+
expect(Cornucopia::Util::Configuration.benchmark).to eq new_value
|
512
|
+
ensure
|
513
|
+
Cornucopia::Util::Configuration.benchmark= orig_value
|
514
|
+
end
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
498
518
|
# describe "#alternate_retry" do
|
499
519
|
# it "#can read the default" do
|
500
520
|
# expect(Cornucopia::Util::Configuration.alternate_retry).to be_falsy
|
@@ -213,10 +213,10 @@ This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features
|
|
213
213
|
it "calls #pretty_format on a sub-array after it is converted to a string" do
|
214
214
|
expect(Cornucopia::Util::ReportBuilder).
|
215
215
|
to receive(:pretty_format).
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
216
|
+
with(anything, in_pretty_print: true).
|
217
|
+
exactly(4).
|
218
|
+
times.
|
219
|
+
and_call_original
|
220
220
|
|
221
221
|
array_values << [1, 2, 3]
|
222
222
|
|
@@ -1102,25 +1102,31 @@ This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features
|
|
1102
1102
|
|
1103
1103
|
describe "#within_test" do
|
1104
1104
|
it "starts a test with a specific name" do
|
1105
|
-
|
1105
|
+
backup = Cornucopia::Util::Configuration.backup_logs_on_failure
|
1106
|
+
begin
|
1107
|
+
Cornucopia::Util::Configuration.backup_logs_on_failure = true
|
1108
|
+
current_report = send(report_settings[:report])
|
1106
1109
|
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1110
|
+
current_report.within_test(test_names[0]) do
|
1111
|
+
current_report.within_section(section_names[0]) do |report_section|
|
1112
|
+
report_section.within_table do |report_table|
|
1113
|
+
report_table.write_stats(Faker::Lorem.word, Faker::Lorem.sentence)
|
1114
|
+
end
|
1111
1115
|
end
|
1112
1116
|
end
|
1113
|
-
end
|
1114
1117
|
|
1115
|
-
|
1118
|
+
current_report.close
|
1116
1119
|
|
1117
|
-
|
1120
|
+
report_page = Capybara::Node::Simple.new(File.read(current_report.report_base_page_name))
|
1118
1121
|
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1122
|
+
expect(report_page.all(".coruncopia-report-link").length).to eq 2
|
1123
|
+
expect(report_page.all(".coruncopia-report-link")[0].text).to eq test_names[0]
|
1124
|
+
expect(report_page.all(".coruncopia-report-link")[0]["href"]).to eq "test_1/index.html"
|
1125
|
+
expect(report_page.all(".coruncopia-report-link")[1].text).to eq "test.log"
|
1126
|
+
expect(report_page.all(".coruncopia-report-link")[1]["href"]).to eq "log_files/test.log"
|
1127
|
+
ensure
|
1128
|
+
Cornucopia::Util::Configuration.backup_logs_on_failure = backup
|
1129
|
+
end
|
1124
1130
|
end
|
1125
1131
|
|
1126
1132
|
it "doesn't output anything if nothing is written to a section or table" do
|
@@ -1154,14 +1160,14 @@ This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features
|
|
1154
1160
|
|
1155
1161
|
report_page = Capybara::Node::Simple.new(File.read(current_report.report_base_page_name))
|
1156
1162
|
|
1157
|
-
expect(report_page.all(".coruncopia-report-link").length).to eq
|
1163
|
+
expect(report_page.all(".coruncopia-report-link").length).to eq test_names.length
|
1158
1164
|
|
1159
1165
|
test_names.each_with_index do |test_name, test_index|
|
1160
1166
|
expect(report_page.all(".coruncopia-report-link")[test_index].text).to eq test_name
|
1161
1167
|
expect(report_page.all(".coruncopia-report-link")[test_index]["href"]).to eq "test_#{test_index + 1}/index.html"
|
1162
1168
|
end
|
1163
|
-
expect(report_page.all(".coruncopia-report-link")[-1].text).to eq "test.log"
|
1164
|
-
expect(report_page.all(".coruncopia-report-link")[-1]["href"]).to eq "log_files/test.log"
|
1169
|
+
# expect(report_page.all(".coruncopia-report-link")[-1].text).to eq "test.log"
|
1170
|
+
# expect(report_page.all(".coruncopia-report-link")[-1]["href"]).to eq "log_files/test.log"
|
1165
1171
|
end
|
1166
1172
|
|
1167
1173
|
it "handles a test within a test as an independent test" do
|
@@ -1186,13 +1192,13 @@ This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features
|
|
1186
1192
|
|
1187
1193
|
report_page = Capybara::Node::Simple.new(File.read(current_report.report_base_page_name))
|
1188
1194
|
|
1189
|
-
expect(report_page.all(".coruncopia-report-link").length).to eq
|
1195
|
+
expect(report_page.all(".coruncopia-report-link").length).to eq 2
|
1190
1196
|
expect(report_page.all(".coruncopia-report-link")[0].text).to eq test_names[0]
|
1191
1197
|
expect(report_page.all(".coruncopia-report-link")[0]["href"]).to eq "test_1/index.html"
|
1192
1198
|
expect(report_page.all(".coruncopia-report-link")[1].text).to eq test_names[1]
|
1193
1199
|
expect(report_page.all(".coruncopia-report-link")[1]["href"]).to eq "test_2/index.html"
|
1194
|
-
expect(report_page.all(".coruncopia-report-link")[2].text).to eq "test.log"
|
1195
|
-
expect(report_page.all(".coruncopia-report-link")[2]["href"]).to eq "log_files/test.log"
|
1200
|
+
# expect(report_page.all(".coruncopia-report-link")[2].text).to eq "test.log"
|
1201
|
+
# expect(report_page.all(".coruncopia-report-link")[2]["href"]).to eq "log_files/test.log"
|
1196
1202
|
|
1197
1203
|
report_page = Capybara::Node::Simple.new(File.read(File.join(current_report.report_folder_name, "test_1/report_contents.html")))
|
1198
1204
|
expect(report_page.all(".cornucopia-section-label").length).to eq 1
|
@@ -1231,13 +1237,13 @@ This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features
|
|
1231
1237
|
|
1232
1238
|
report_page = Capybara::Node::Simple.new(File.read(current_report.report_base_page_name))
|
1233
1239
|
|
1234
|
-
expect(report_page.all(".coruncopia-report-link").length).to eq
|
1240
|
+
expect(report_page.all(".coruncopia-report-link").length).to eq 2
|
1235
1241
|
expect(report_page.all(".coruncopia-report-link")[0].text).to eq test_names[0]
|
1236
1242
|
expect(report_page.all(".coruncopia-report-link")[0]["href"]).to eq "test_1/index.html"
|
1237
1243
|
expect(report_page.all(".coruncopia-report-link")[1].text).to eq test_names[1]
|
1238
1244
|
expect(report_page.all(".coruncopia-report-link")[1]["href"]).to eq "test_2/index.html"
|
1239
|
-
expect(report_page.all(".coruncopia-report-link")[2].text).to eq "test.log"
|
1240
|
-
expect(report_page.all(".coruncopia-report-link")[2]["href"]).to eq "log_files/test.log"
|
1245
|
+
# expect(report_page.all(".coruncopia-report-link")[2].text).to eq "test.log"
|
1246
|
+
# expect(report_page.all(".coruncopia-report-link")[2]["href"]).to eq "log_files/test.log"
|
1241
1247
|
|
1242
1248
|
report_page = Capybara::Node::Simple.new(File.read(File.join(current_report.report_folder_name, "test_1/report_contents.html")))
|
1243
1249
|
expect(report_page.all(".cornucopia-section-label").length).to eq 2
|
@@ -1264,14 +1270,14 @@ This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features
|
|
1264
1270
|
|
1265
1271
|
report_page = Capybara::Node::Simple.new(File.read(current_report.report_base_page_name))
|
1266
1272
|
|
1267
|
-
expect(report_page.all(".coruncopia-report-link").length).to eq
|
1273
|
+
expect(report_page.all(".coruncopia-report-link").length).to eq 2
|
1268
1274
|
|
1269
1275
|
expect(report_page.all(".coruncopia-report-link")[0].text).to eq test_names[0]
|
1270
1276
|
expect(report_page.all(".coruncopia-report-link")[0]["href"]).to eq "test_1/index.html"
|
1271
1277
|
expect(report_page.all(".coruncopia-report-link")[1].text).to eq test_names[-1]
|
1272
1278
|
expect(report_page.all(".coruncopia-report-link")[1]["href"]).to eq "test_2/index.html"
|
1273
|
-
expect(report_page.all(".coruncopia-report-link")[2].text).to eq "test.log"
|
1274
|
-
expect(report_page.all(".coruncopia-report-link")[2]["href"]).to eq "log_files/test.log"
|
1279
|
+
# expect(report_page.all(".coruncopia-report-link")[2].text).to eq "test.log"
|
1280
|
+
# expect(report_page.all(".coruncopia-report-link")[2]["href"]).to eq "log_files/test.log"
|
1275
1281
|
end
|
1276
1282
|
end
|
1277
1283
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.expand_path("cornucopia_report_test_contents_page", File.dirname(__FILE__))
|
2
|
+
|
3
|
+
module CornucopiaReportPages
|
4
|
+
class CornucopiaReportHolderPage < SitePrism::Page
|
5
|
+
class CornucopiaReportHolderIndexPage < SitePrism::Page
|
6
|
+
iframe :contents, CornucopiaReportPages::CornucopiaReportTestContentsPage, "#report-base-contents"
|
7
|
+
end
|
8
|
+
|
9
|
+
set_url "{/base_folder}{/report_name}/index.html"
|
10
|
+
|
11
|
+
elements :tests, ".report-index-list li a"
|
12
|
+
iframe :displayed_test, CornucopiaReportHolderIndexPage, "#report-display-document"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
module CornucopiaReportPages
|
2
|
+
class CornucopiaReportTestContentsPage < SitePrism::Page
|
3
|
+
class RowSection < SitePrism::Section
|
4
|
+
attr_accessor :parent_index,
|
5
|
+
:parent_path,
|
6
|
+
:parent_path_owner
|
7
|
+
|
8
|
+
def labels
|
9
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-cell-label")
|
10
|
+
end
|
11
|
+
|
12
|
+
def expands
|
13
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-cell-expand .cornucopia-cell-more-data")
|
14
|
+
end
|
15
|
+
|
16
|
+
def mores
|
17
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-cell-data > .cornucopia-cell-more .cornucopia-cell-more-data")
|
18
|
+
end
|
19
|
+
|
20
|
+
def values
|
21
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-cell-data > .hide-contents")
|
22
|
+
end
|
23
|
+
|
24
|
+
def value_images
|
25
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-cell-data > .cornucopia-section-image")
|
26
|
+
end
|
27
|
+
|
28
|
+
def value_links
|
29
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-cell-data > .hide-contents > a")
|
30
|
+
end
|
31
|
+
|
32
|
+
def value_frames
|
33
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-cell-data > .padded-frame > iframe")
|
34
|
+
end
|
35
|
+
|
36
|
+
def value_textareas
|
37
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-cell-data > .padded-frame > textarea")
|
38
|
+
end
|
39
|
+
|
40
|
+
def sub_tables
|
41
|
+
index = 1
|
42
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-cell-data > .cornucopia-table").map do |element|
|
43
|
+
table = TableSection.new self, element
|
44
|
+
table.parent_index = index
|
45
|
+
table.parent_path = "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-cell-data > .cornucopia-table"
|
46
|
+
table.parent_path_owner = parent_path_owner
|
47
|
+
index += 1
|
48
|
+
table
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class TableSection < SitePrism::Section
|
54
|
+
attr_accessor :parent_index,
|
55
|
+
:parent_path,
|
56
|
+
:parent_path_owner
|
57
|
+
|
58
|
+
def rows
|
59
|
+
index = 1
|
60
|
+
|
61
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-row").map do |element|
|
62
|
+
row = RowSection.new self, element
|
63
|
+
row.parent_index = index
|
64
|
+
row.parent_path = "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-row"
|
65
|
+
row.parent_path_owner = parent_path_owner
|
66
|
+
index += 1
|
67
|
+
|
68
|
+
row
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
class MoreDetailsSection < SitePrism::Section
|
74
|
+
element :show_hide, "a.cornucopia-additional-details"
|
75
|
+
|
76
|
+
def details
|
77
|
+
table = TableSection.new self, send(:find_first, "div.cornucopia-additional-details > .cornucopia-table")
|
78
|
+
table.parent_index = 1
|
79
|
+
table.parent_path = "div.cornucopia-additional-details > .cornucopia-table"
|
80
|
+
table.parent_path_owner = self
|
81
|
+
|
82
|
+
table
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
class ErrorSection < SitePrism::Section
|
87
|
+
attr_accessor :parent_index,
|
88
|
+
:parent_path,
|
89
|
+
:parent_path_owner
|
90
|
+
|
91
|
+
element :name, ".cornucopia-section-label"
|
92
|
+
section :more_details, MoreDetailsSection, ".cornucopia-show-hide-section"
|
93
|
+
|
94
|
+
def tables
|
95
|
+
index = 2
|
96
|
+
parent_path_owner.send(:find_all, "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-table").map do |element|
|
97
|
+
table = TableSection.new self, element
|
98
|
+
table.parent_index = index
|
99
|
+
table.parent_path = "#{parent_path}:nth-child(#{parent_index}) > .cornucopia-table"
|
100
|
+
table.parent_path_owner = parent_path_owner
|
101
|
+
index += 1
|
102
|
+
table
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
sections :all_errors, ErrorSection, ".cornucopia-section"
|
108
|
+
|
109
|
+
def errors
|
110
|
+
unless defined?(@all_errros)
|
111
|
+
@errors ||= all_errors
|
112
|
+
|
113
|
+
@errors.each_with_index do |error, index|
|
114
|
+
error.parent_index = index + 1
|
115
|
+
error.parent_path = ".cornucopia-section"
|
116
|
+
error.parent_path_owner = self
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module CornucopiaReportPages
|
2
|
+
class IndexPage < SitePrism::Page
|
3
|
+
class IndexContentsPage < SitePrism::Page
|
4
|
+
class ReportBlock < SitePrism::Section
|
5
|
+
element :name, "h4"
|
6
|
+
elements :reports, ".index-list li a"
|
7
|
+
end
|
8
|
+
|
9
|
+
sections :reports, ReportBlock, ".report-block"
|
10
|
+
end
|
11
|
+
|
12
|
+
set_url "{/base_folder}/index.html"
|
13
|
+
|
14
|
+
iframe :contents, IndexContentsPage, "#base-contents"
|
15
|
+
end
|
16
|
+
end
|
data/spec/rails_helper.rb
CHANGED
@@ -13,9 +13,9 @@ require 'rspec/rails'
|
|
13
13
|
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
14
14
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
15
15
|
|
16
|
-
# Checks for pending migrations before tests are run.
|
17
|
-
# If you are not using ActiveRecord, you can remove this line.
|
18
|
-
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
16
|
+
# # Checks for pending migrations before tests are run.
|
17
|
+
# # If you are not using ActiveRecord, you can remove this line.
|
18
|
+
# ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
19
19
|
|
20
20
|
RSpec.configure do |config|
|
21
21
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
data/spec/spec_helper.rb
CHANGED
@@ -21,9 +21,9 @@ require 'rspec/rails'
|
|
21
21
|
# in spec/support/ and its subdirectories.
|
22
22
|
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
23
23
|
|
24
|
-
# Checks for pending migrations before tests are run.
|
25
|
-
# If you are not using ActiveRecord, you can remove this line.
|
26
|
-
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
24
|
+
# # Checks for pending migrations before tests are run.
|
25
|
+
# # If you are not using ActiveRecord, you can remove this line.
|
26
|
+
# ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
27
27
|
|
28
28
|
RSpec.configure do |config|
|
29
29
|
# ## Mock Framework
|
@@ -64,7 +64,7 @@ Capybara.default_driver = :selenium
|
|
64
64
|
RSpec.configure do |config|
|
65
65
|
config.around(:each) do |example|
|
66
66
|
@test_seed_value = Cornucopia::Util::Configuration.seed ||
|
67
|
-
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
67
|
+
100000000000000000000000000000000000000 + Random.new.rand(899999999999999999999999999999999999999)
|
68
68
|
|
69
69
|
srand(@test_seed_value)
|
70
70
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cornucopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.35
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-11-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -345,6 +345,9 @@ files:
|
|
345
345
|
- spec/lib/util/report_table_spec.rb
|
346
346
|
- spec/lib/util/test_helper_spec.rb
|
347
347
|
- spec/pages/cornucopia_report_app.rb
|
348
|
+
- spec/pages/cornucopia_report_pages/cornucopia_report_holder_page.rb
|
349
|
+
- spec/pages/cornucopia_report_pages/cornucopia_report_test_contents_page.rb
|
350
|
+
- spec/pages/cornucopia_report_pages/index_page.rb
|
348
351
|
- spec/pages/google/email_page.rb
|
349
352
|
- spec/pages/google/login_page.rb
|
350
353
|
- spec/rails_helper.rb
|
@@ -437,6 +440,9 @@ test_files:
|
|
437
440
|
- spec/lib/util/report_table_spec.rb
|
438
441
|
- spec/lib/util/test_helper_spec.rb
|
439
442
|
- spec/pages/cornucopia_report_app.rb
|
443
|
+
- spec/pages/cornucopia_report_pages/cornucopia_report_holder_page.rb
|
444
|
+
- spec/pages/cornucopia_report_pages/cornucopia_report_test_contents_page.rb
|
445
|
+
- spec/pages/cornucopia_report_pages/index_page.rb
|
440
446
|
- spec/pages/google/email_page.rb
|
441
447
|
- spec/pages/google/login_page.rb
|
442
448
|
- spec/rails_helper.rb
|