cornucopia 0.1.12
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 +7 -0
- data/.gitignore +51 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +16 -0
- data/LICENSE.TXT +22 -0
- data/README.md +341 -0
- data/Rakefile +18 -0
- data/cornucopia.gemspec +39 -0
- data/lib/cornucopia.rb +18 -0
- data/lib/cornucopia/capybara/finder_diagnostics.rb +536 -0
- data/lib/cornucopia/capybara/finder_extensions.rb +89 -0
- data/lib/cornucopia/capybara/install_finder_extensions.rb +105 -0
- data/lib/cornucopia/capybara/install_matcher_extensions.rb +39 -0
- data/lib/cornucopia/capybara/matcher_extensions.rb +83 -0
- data/lib/cornucopia/capybara/page_diagnostics.rb +228 -0
- data/lib/cornucopia/cucumber_hooks.rb +38 -0
- data/lib/cornucopia/factory_girl/dynamic_association.rb +14 -0
- data/lib/cornucopia/rspec_hooks.rb +37 -0
- data/lib/cornucopia/site_prism/element_extensions.rb +273 -0
- data/lib/cornucopia/site_prism/install_element_extensions.rb +23 -0
- data/lib/cornucopia/site_prism/page_application.rb +126 -0
- data/lib/cornucopia/source_files/collapse.gif +0 -0
- data/lib/cornucopia/source_files/cornucopia.css +162 -0
- data/lib/cornucopia/source_files/expand.gif +0 -0
- data/lib/cornucopia/source_files/index_base.html +10 -0
- data/lib/cornucopia/source_files/index_contents.html +2 -0
- data/lib/cornucopia/source_files/more_info.js +87 -0
- data/lib/cornucopia/source_files/report_base.html +10 -0
- data/lib/cornucopia/source_files/report_contents.html +3 -0
- data/lib/cornucopia/spinach_hooks.rb +51 -0
- data/lib/cornucopia/util/configuration.rb +493 -0
- data/lib/cornucopia/util/configured_report.rb +520 -0
- data/lib/cornucopia/util/file_asset.rb +46 -0
- data/lib/cornucopia/util/generic_settings.rb +37 -0
- data/lib/cornucopia/util/log_capture.rb +97 -0
- data/lib/cornucopia/util/pretty_formatter.rb +580 -0
- data/lib/cornucopia/util/report_builder.rb +474 -0
- data/lib/cornucopia/util/report_formatters.rb +11 -0
- data/lib/cornucopia/util/report_table.rb +195 -0
- data/lib/cornucopia/version.rb +3 -0
- data/lib/tasks/cornucopia_tasks.rake +4 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +27 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/cucumber.yml +8 -0
- data/spec/dummy/config/database.yml +37 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/db/schema.rb +16 -0
- data/spec/dummy/features/support/env.rb +66 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/lib/tasks/cucumber.rake +65 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/cucumber +10 -0
- data/spec/fixtures/sample_page.html +150 -0
- data/spec/lib/capybara/finder_diagnostics_spec.rb +517 -0
- data/spec/lib/capybara/finder_extensions_spec.rb +328 -0
- data/spec/lib/capybara/page_diagnostics_spec.rb +277 -0
- data/spec/lib/site_prism/element_extensions_spec.rb +290 -0
- data/spec/lib/site_prism/page_application_spec.rb +81 -0
- data/spec/lib/util/configuration_spec.rb +254 -0
- data/spec/lib/util/configured_report_spec.rb +1058 -0
- data/spec/lib/util/file_asset_spec.rb +86 -0
- data/spec/lib/util/generic_settings_spec.rb +48 -0
- data/spec/lib/util/log_capture_spec.rb +151 -0
- data/spec/lib/util/pretty_formatter_spec.rb +694 -0
- data/spec/lib/util/report_builder_spec.rb +983 -0
- data/spec/lib/util/report_formatters_spec.rb +13 -0
- data/spec/lib/util/report_table_exception_spec.rb +21 -0
- data/spec/lib/util/report_table_spec.rb +319 -0
- data/spec/pages/cornucopia_report_app.rb +10 -0
- data/spec/pages/google/email_page.rb +22 -0
- data/spec/pages/google/login_page.rb +25 -0
- data/spec/rails_helper.rb +43 -0
- data/spec/sample_report.rb +45 -0
- data/spec/spec_helper.rb +81 -0
- metadata +410 -0
|
Binary file
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
.hidden
|
|
2
|
+
{
|
|
3
|
+
display: none;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.base-body
|
|
7
|
+
{
|
|
8
|
+
margin: 0px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.cornucopia-frame
|
|
12
|
+
{
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
border: 0px;
|
|
16
|
+
overflow: scroll;
|
|
17
|
+
padding: 0px;
|
|
18
|
+
margin: 0px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.cornucopia-sample-frame
|
|
22
|
+
{
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 500px;
|
|
25
|
+
margin-bottom: 10px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.cornucopia-table
|
|
29
|
+
{
|
|
30
|
+
display: table;
|
|
31
|
+
width: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.cornucopia-row
|
|
35
|
+
{
|
|
36
|
+
display: table-row;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.cornucopia-section:nth-child(2n)
|
|
40
|
+
{
|
|
41
|
+
background-color: steelblue;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.cornucopia-section:nth-child(2n +1)
|
|
45
|
+
{
|
|
46
|
+
background-color: powderblue;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.cornucopia-row:nth-child(2n)
|
|
50
|
+
{
|
|
51
|
+
background-color: palegoldenrod;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.cornucopia-row:nth-child(2n +1)
|
|
55
|
+
{
|
|
56
|
+
background-color: lightgoldenrodyellow;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.cornucopia-cell-label
|
|
60
|
+
{
|
|
61
|
+
padding-right: 5px;
|
|
62
|
+
padding-left: 5px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.cornucopia-cell-expand,
|
|
66
|
+
.cornucopia-cell-label,
|
|
67
|
+
.cornucopia-cell-data-more
|
|
68
|
+
{
|
|
69
|
+
display: table-cell;
|
|
70
|
+
font-weight: bold;
|
|
71
|
+
vertical-align: top;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.cornucopia-cell-expand a
|
|
75
|
+
{
|
|
76
|
+
margin-right: 5px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.cornucopia-cell-data
|
|
80
|
+
{
|
|
81
|
+
display: table-cell;
|
|
82
|
+
width: 100%;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.cornucopia-cell-data > img
|
|
86
|
+
{
|
|
87
|
+
margin-right: 10px
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.cornucopia-page-dump
|
|
91
|
+
{
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 500px;
|
|
94
|
+
margin-bottom: 10px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.cornucopia-no-errors
|
|
98
|
+
{
|
|
99
|
+
font-weight: bold;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.cornucopia-section-label
|
|
103
|
+
{
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.cornucopia-section
|
|
107
|
+
{
|
|
108
|
+
padding-top: 0px;
|
|
109
|
+
padding-left: 10px;
|
|
110
|
+
padding-bottom: 10px;
|
|
111
|
+
padding-right: 10px;
|
|
112
|
+
float: left;
|
|
113
|
+
position: relative;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.cornucopia-section-image
|
|
117
|
+
{
|
|
118
|
+
margin-bottom: 10px;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.cornucopia-app-file
|
|
122
|
+
{
|
|
123
|
+
font-weight: bold;
|
|
124
|
+
color: blue;
|
|
125
|
+
text-decoration: underline;
|
|
126
|
+
cursor: hand;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.truncated-text
|
|
130
|
+
{
|
|
131
|
+
height: 4em;
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.hide-contents pre
|
|
136
|
+
{
|
|
137
|
+
margin-top: 0px
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.completed-other
|
|
141
|
+
{
|
|
142
|
+
font-weight: bold;
|
|
143
|
+
color: green
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.completed-error
|
|
147
|
+
{
|
|
148
|
+
font-weight: bold;
|
|
149
|
+
color: red
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.index-list
|
|
153
|
+
{
|
|
154
|
+
list-style-type: none;
|
|
155
|
+
margin-bottom: 10px;
|
|
156
|
+
padding-left: 20px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.padded-frame
|
|
160
|
+
{
|
|
161
|
+
padding-right: 10px;
|
|
162
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Diagnostics report list</title>
|
|
4
|
+
</head>
|
|
5
|
+
<body class="base-body">
|
|
6
|
+
<link href="cornucopia.css" rel="stylesheet" type="text/css" />
|
|
7
|
+
<iframe id="base-contents" src="report_contents.html" class="cornucopia-frame"></iframe>
|
|
8
|
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
|
9
|
+
</body>
|
|
10
|
+
</html>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
last_scroll_top = null;
|
|
2
|
+
|
|
3
|
+
function show_more_info (event_obj)
|
|
4
|
+
{
|
|
5
|
+
content_item = $ (event_obj.target).closest (".cornucopia-row").find (".hide-contents");
|
|
6
|
+
expand_item = $ (event_obj.target).closest (".cornucopia-row").find (".cornucopia-cell-expand div a img");
|
|
7
|
+
more_item = $ (event_obj.target).closest (".cornucopia-row").find (".cornucopia-cell-more");
|
|
8
|
+
|
|
9
|
+
last_scroll_top = $ (window).scrollTop ();
|
|
10
|
+
|
|
11
|
+
if (content_item.attr ("class").match (/truncated-text/))
|
|
12
|
+
{
|
|
13
|
+
content_item.removeClass ("truncated-text");
|
|
14
|
+
expand_item.attr ("src", "collapse.gif");
|
|
15
|
+
more_item.addClass ("hidden");
|
|
16
|
+
}
|
|
17
|
+
else
|
|
18
|
+
{
|
|
19
|
+
content_item.addClass ("truncated-text");
|
|
20
|
+
expand_item.attr ("src", "expand.gif");
|
|
21
|
+
more_item.removeClass ("hidden");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function copy_element_to_clipboard (event_obj)
|
|
26
|
+
{
|
|
27
|
+
window.prompt ("Copy to clipboard: Ctrl+C, Enter", $ (event_obj.target).text ());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function show_hide_additional_details (event_obj)
|
|
31
|
+
{
|
|
32
|
+
adtl_details = $ ($ (event_obj.target).closest (".cornucopia-show-hide-section").find ("div.cornucopia-additional-details"));
|
|
33
|
+
classes = " " + adtl_details.attr ("class") + " ";
|
|
34
|
+
|
|
35
|
+
last_scroll_top = $ (window).scrollTop ();
|
|
36
|
+
|
|
37
|
+
if (classes.indexOf (" hidden ") >= 0)
|
|
38
|
+
{
|
|
39
|
+
adtl_details.removeClass ("hidden")
|
|
40
|
+
hide_large_items();
|
|
41
|
+
$ (event_obj.target).text ("Hide Details")
|
|
42
|
+
}
|
|
43
|
+
else
|
|
44
|
+
{
|
|
45
|
+
adtl_details.addClass ("hidden")
|
|
46
|
+
$ (event_obj.target).text ("More Details")
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function hide_large_items()
|
|
51
|
+
{
|
|
52
|
+
hide_contents = $ (".hide-contents");
|
|
53
|
+
for (nIndex = hide_contents.length - 1; nIndex >= 0; nIndex -= 1)
|
|
54
|
+
{
|
|
55
|
+
hide_obj = $ (hide_contents[nIndex]);
|
|
56
|
+
if (hide_obj.height () > 100)
|
|
57
|
+
{
|
|
58
|
+
expand_item = hide_obj.closest (".cornucopia-row").find (".cornucopia-cell-expand div");
|
|
59
|
+
more_item = hide_obj.closest (".cornucopia-row").find (".cornucopia-cell-more");
|
|
60
|
+
hide_obj.addClass ("truncated-text");
|
|
61
|
+
expand_item.removeClass ("hidden");
|
|
62
|
+
more_item.removeClass ("hidden");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
$ (document).ready (function ()
|
|
68
|
+
{
|
|
69
|
+
$ (document).on ("click", "a.cornucopia-cell-more-data", {}, show_more_info);
|
|
70
|
+
$ (document).on ("click", ".cornucopia-app-file", {}, copy_element_to_clipboard);
|
|
71
|
+
$ (document).on ("click", "a.cornucopia-additional-details", {}, show_hide_additional_details);
|
|
72
|
+
|
|
73
|
+
hide_large_items();
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
$ (window).on ("scroll", function ()
|
|
78
|
+
{
|
|
79
|
+
if (last_scroll_top != null)
|
|
80
|
+
{
|
|
81
|
+
scroll_to = last_scroll_top;
|
|
82
|
+
last_scroll_top = null;
|
|
83
|
+
|
|
84
|
+
$ (window).scrollTop (scroll_to);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Diagnostics report</title>
|
|
4
|
+
</head>
|
|
5
|
+
<body class="base-body">
|
|
6
|
+
<link href="cornucopia.css" rel="stylesheet" type="text/css" />
|
|
7
|
+
<iframe id="report-base-contents" src="report_contents.html" class="cornucopia-frame"></iframe>
|
|
8
|
+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
|
9
|
+
</body>
|
|
10
|
+
</html>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require ::File.expand_path("../cornucopia", File.dirname(__FILE__))
|
|
2
|
+
require ::File.expand_path("../cornucopia/factory_girl/dynamic_association", File.dirname(__FILE__))
|
|
3
|
+
|
|
4
|
+
load ::File.expand_path("capybara/install_finder_extensions.rb", File.dirname(__FILE__))
|
|
5
|
+
load ::File.expand_path("capybara/install_matcher_extensions.rb", File.dirname(__FILE__))
|
|
6
|
+
load ::File.expand_path("site_prism/install_element_extensions.rb", File.dirname(__FILE__))
|
|
7
|
+
|
|
8
|
+
Spinach.hooks.before_scenario do |scenario, step_definitions|
|
|
9
|
+
@running_scenario = scenario
|
|
10
|
+
seed_value = Cornucopia::Util::Configuration.seed ||
|
|
11
|
+
100000000000000000000000000000000000000 + rand(899999999999999999999999999999999999999)
|
|
12
|
+
|
|
13
|
+
scenario.instance_variable_set :@seed_value, seed_value
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Spinach.hooks.after_scenario do |scenario, step_definitions|
|
|
17
|
+
@running_scenario = nil
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Spinach.hooks.on_failed_step do |step_data, exception, location, step_definitions|
|
|
21
|
+
debug_failed_step("Failure", step_data, exception, location, step_definitions)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
Spinach.hooks.on_error_step do |step_data, exception, location, step_definitions|
|
|
25
|
+
debug_failed_step("Error", step_data, exception, location, step_definitions)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def debug_failed_step(failure_description, step_data, exception, location, step_definitions)
|
|
29
|
+
seed_value = @running_scenario.instance_variable_get(:@seed_value)
|
|
30
|
+
puts ("random seed for testing was: #{seed_value}")
|
|
31
|
+
|
|
32
|
+
Cornucopia::Util::ReportBuilder.current_report.
|
|
33
|
+
within_section("Test Error: #{@running_scenario.feature.name}") do |report|
|
|
34
|
+
configured_report = Cornucopia::Util::Configuration.report_configuration :spinach
|
|
35
|
+
|
|
36
|
+
configured_report.add_report_objects failure_description: "#{failure_description} at:, #{location[0]}:#{location[1]}",
|
|
37
|
+
running_scenario: @running_scenario,
|
|
38
|
+
step_data: step_data,
|
|
39
|
+
exception: exception,
|
|
40
|
+
location: location,
|
|
41
|
+
step_definitions: step_definitions
|
|
42
|
+
|
|
43
|
+
configured_report.generate_report(report)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
Spinach.hooks.after_run do |status|
|
|
48
|
+
Cornucopia::Util::ReportBuilder.current_report.close
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
Cornucopia::Util::ReportBuilder.new_report "spinach_report"
|
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
require ::File.expand_path('configured_report', File.dirname(__FILE__))
|
|
2
|
+
require ::File.expand_path('generic_settings', File.dirname(__FILE__))
|
|
3
|
+
require ::File.expand_path('report_formatters', File.dirname(__FILE__))
|
|
4
|
+
|
|
5
|
+
module Cornucopia
|
|
6
|
+
module Util
|
|
7
|
+
class Configuration
|
|
8
|
+
@@configurations = Cornucopia::Util::GenericSettings.new
|
|
9
|
+
@@configurations.rand_seed = nil
|
|
10
|
+
@@configurations.user_log_files = {}
|
|
11
|
+
@@configurations.default_num_lines = 500
|
|
12
|
+
@@configurations.grab_logs = true
|
|
13
|
+
@@configurations.print_timeout_min = 10
|
|
14
|
+
@@configurations.selenium_cache_retry_count = 5
|
|
15
|
+
@@configurations.analyze_find_exceptions = true
|
|
16
|
+
@@configurations.analyze_selector_exceptions = true
|
|
17
|
+
@@configurations.retry_with_found = false
|
|
18
|
+
@@configurations.retry_match_with_found = false
|
|
19
|
+
@@configurations.open_report_settings = { default: false }
|
|
20
|
+
@@configurations.base_folder = "cornucopia_report"
|
|
21
|
+
|
|
22
|
+
# @@configurations.alternate_retry = false
|
|
23
|
+
|
|
24
|
+
@@configurations.configured_reports = {
|
|
25
|
+
rspec: Cornucopia::Util::ConfiguredReport.new(
|
|
26
|
+
min_fields: [
|
|
27
|
+
:example__full_description,
|
|
28
|
+
:example__location,
|
|
29
|
+
:example__exception__to_s,
|
|
30
|
+
:example__exception__backtrace
|
|
31
|
+
],
|
|
32
|
+
more_info_fields: [
|
|
33
|
+
:example__exception__class__name,
|
|
34
|
+
:example,
|
|
35
|
+
:example__example_group_instance,
|
|
36
|
+
:example__metadata__caller,
|
|
37
|
+
:logs,
|
|
38
|
+
:capybara_page_diagnostics
|
|
39
|
+
],
|
|
40
|
+
expand_fields: [
|
|
41
|
+
:example,
|
|
42
|
+
:example__example_group_instance__response,
|
|
43
|
+
:example__example_group_instance__controller,
|
|
44
|
+
:example__example_group_instance__request,
|
|
45
|
+
:example__example_group_instance
|
|
46
|
+
],
|
|
47
|
+
expand_inline_fields: [
|
|
48
|
+
:example__example_group_instance____memoized
|
|
49
|
+
],
|
|
50
|
+
exclude_fields: [
|
|
51
|
+
:example__fixture_connections,
|
|
52
|
+
:example,
|
|
53
|
+
:example__example_group_instance,
|
|
54
|
+
]
|
|
55
|
+
),
|
|
56
|
+
cucumber: Cornucopia::Util::ConfiguredReport.new(
|
|
57
|
+
min_fields: [
|
|
58
|
+
{
|
|
59
|
+
report_element: :scenario__feature__title,
|
|
60
|
+
report_options: { label: "feature" }
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
report_element: :scenario__feature__location,
|
|
64
|
+
# report_options: { format: ->(value) { "#{value.file}:#{value.line}" } }
|
|
65
|
+
report_options: { format_object: Cornucopia::Util::CucumberFormatter,
|
|
66
|
+
format_function: :format_location }
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
report_element: :scenario__title,
|
|
70
|
+
report_options: { label: "scenario" }
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
report_element: :scenario__location,
|
|
74
|
+
report_options: { format_object: Cornucopia::Util::CucumberFormatter,
|
|
75
|
+
format_function: :format_location }
|
|
76
|
+
},
|
|
77
|
+
:scenario__exception__to_s,
|
|
78
|
+
:scenario__exception__backtrace
|
|
79
|
+
],
|
|
80
|
+
more_info_fields: [
|
|
81
|
+
:scenario__exception__class__name,
|
|
82
|
+
:scenario,
|
|
83
|
+
:scenario__feature__comment,
|
|
84
|
+
:scenario__feature__keyword,
|
|
85
|
+
:scenario__feature__description,
|
|
86
|
+
:scenario__feature__gherkin_statement,
|
|
87
|
+
:scenario__feature__tags,
|
|
88
|
+
:scenario__current_visitor__configuration,
|
|
89
|
+
:cucumber,
|
|
90
|
+
:logs,
|
|
91
|
+
:capybara_page_diagnostics
|
|
92
|
+
],
|
|
93
|
+
expand_fields: [
|
|
94
|
+
:scenario,
|
|
95
|
+
:cucumber,
|
|
96
|
+
],
|
|
97
|
+
expand_inline_fields: [
|
|
98
|
+
],
|
|
99
|
+
exclude_fields: [
|
|
100
|
+
:scenario__background,
|
|
101
|
+
:scenario__feature,
|
|
102
|
+
:scenario__current_visitor,
|
|
103
|
+
:scenario__raw_steps,
|
|
104
|
+
:scenario__title,
|
|
105
|
+
:scenario__location,
|
|
106
|
+
:cucumber____cucumber_runtime,
|
|
107
|
+
:cucumber____natural_language,
|
|
108
|
+
:cucumber___rack_test_sessions,
|
|
109
|
+
:cucumber___rack_mock_sessions,
|
|
110
|
+
:cucumber__integration_session
|
|
111
|
+
]
|
|
112
|
+
),
|
|
113
|
+
spinach: Cornucopia::Util::ConfiguredReport.new(
|
|
114
|
+
min_fields: [
|
|
115
|
+
:failure_description,
|
|
116
|
+
:running_scenario__feature__name,
|
|
117
|
+
:running_scenario__name,
|
|
118
|
+
:running_scenario__line,
|
|
119
|
+
:step_data__name,
|
|
120
|
+
:step_data__line,
|
|
121
|
+
:exception__to_s,
|
|
122
|
+
:exception__backtrace
|
|
123
|
+
],
|
|
124
|
+
more_info_fields: [
|
|
125
|
+
:exception__class__name,
|
|
126
|
+
:running_scenario__feature__tags,
|
|
127
|
+
:running_scenario,
|
|
128
|
+
:step_data,
|
|
129
|
+
:step_definitions,
|
|
130
|
+
:logs,
|
|
131
|
+
:capybara_page_diagnostics
|
|
132
|
+
],
|
|
133
|
+
expand_fields: [
|
|
134
|
+
:running_scenario,
|
|
135
|
+
:step_data,
|
|
136
|
+
:step_definitions
|
|
137
|
+
],
|
|
138
|
+
expand_inline_fields: [
|
|
139
|
+
],
|
|
140
|
+
exclude_fields: [
|
|
141
|
+
:running_scenario__feature,
|
|
142
|
+
:step_data__scenario__feature,
|
|
143
|
+
:running_scenario__name,
|
|
144
|
+
:running_scenario__line,
|
|
145
|
+
:step_data__name,
|
|
146
|
+
:step_data__line
|
|
147
|
+
]
|
|
148
|
+
),
|
|
149
|
+
capybara_page_diagnostics: Cornucopia::Util::ConfiguredReport.new(
|
|
150
|
+
min_fields: [
|
|
151
|
+
:capybara__page_url,
|
|
152
|
+
:capybara__title,
|
|
153
|
+
:capybara__screen_shot
|
|
154
|
+
],
|
|
155
|
+
more_info_fields: [
|
|
156
|
+
:capybara,
|
|
157
|
+
:capybara__other_windows,
|
|
158
|
+
],
|
|
159
|
+
expand_fields: [
|
|
160
|
+
:capybara,
|
|
161
|
+
:capybara__other_windows,
|
|
162
|
+
"capybara__other_windows__*",
|
|
163
|
+
],
|
|
164
|
+
expand_inline_fields: [
|
|
165
|
+
:capybara,
|
|
166
|
+
],
|
|
167
|
+
exclude_fields: [
|
|
168
|
+
:capybara__page_url,
|
|
169
|
+
:capybara__title,
|
|
170
|
+
:capybara__screen_shot,
|
|
171
|
+
:capybara__page_url,
|
|
172
|
+
:capybara__title,
|
|
173
|
+
:capybara__screen_shot,
|
|
174
|
+
:capybara__options,
|
|
175
|
+
:capybara__report,
|
|
176
|
+
:capybara__table,
|
|
177
|
+
:capybara__unsupported_list,
|
|
178
|
+
:capybara__allow_other_windows,
|
|
179
|
+
:capybara__iterating,
|
|
180
|
+
:capybara__session,
|
|
181
|
+
:capybara__driver,
|
|
182
|
+
:capybara__window_handles,
|
|
183
|
+
:capybara__current_window,
|
|
184
|
+
"capybara__other_windows__*__options",
|
|
185
|
+
"capybara__other_windows__*__report",
|
|
186
|
+
"capybara__other_windows__*__table",
|
|
187
|
+
"capybara__other_windows__*__unsupported_list",
|
|
188
|
+
"capybara__other_windows__*__allow_other_windows",
|
|
189
|
+
"capybara__other_windows__*__iterating",
|
|
190
|
+
"capybara__other_windows__*__session",
|
|
191
|
+
"capybara__other_windows__*__driver",
|
|
192
|
+
"capybara__other_windows__*__window_handles",
|
|
193
|
+
"capybara__other_windows__*__current_window"
|
|
194
|
+
],
|
|
195
|
+
leaf_options: [
|
|
196
|
+
{ report_element: [:html_source,
|
|
197
|
+
:html_frame,
|
|
198
|
+
:screen_shot
|
|
199
|
+
],
|
|
200
|
+
report_options: { prevent_shrink: true,
|
|
201
|
+
exclude_code_block: true,
|
|
202
|
+
do_not_pretty_print: true
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{ report_element: [:html_file],
|
|
206
|
+
report_options: { exclude_code_block: true },
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
),
|
|
210
|
+
capybara_finder_diagnostics: Cornucopia::Util::ConfiguredReport.new(
|
|
211
|
+
min_fields: [
|
|
212
|
+
:finder__function_name,
|
|
213
|
+
:finder__args__0,
|
|
214
|
+
:finder__search_args,
|
|
215
|
+
:finder__options,
|
|
216
|
+
:exception__to_s,
|
|
217
|
+
:exception__backtrace
|
|
218
|
+
],
|
|
219
|
+
more_info_fields: [
|
|
220
|
+
:exception__class__name,
|
|
221
|
+
:finder,
|
|
222
|
+
:capybara_page_diagnostics
|
|
223
|
+
],
|
|
224
|
+
expand_fields: [
|
|
225
|
+
:finder,
|
|
226
|
+
:finder__args,
|
|
227
|
+
:finder__all_elements,
|
|
228
|
+
:finder__all_other_elements,
|
|
229
|
+
"finder__all_elements__*",
|
|
230
|
+
"finder__all_other_elements__*",
|
|
231
|
+
"finder__all_elements__*__native_size",
|
|
232
|
+
"finder__all_other_elements__*__native_size",
|
|
233
|
+
"finder__all_elements__*__elem_location",
|
|
234
|
+
"finder__all_other_elements__*__elem_location",
|
|
235
|
+
:finder__search_args,
|
|
236
|
+
:finder__options
|
|
237
|
+
],
|
|
238
|
+
expand_inline_fields: [
|
|
239
|
+
:finder
|
|
240
|
+
],
|
|
241
|
+
exclude_fields: [
|
|
242
|
+
:finder__return_value,
|
|
243
|
+
:finder__function_name,
|
|
244
|
+
:finder__args__0,
|
|
245
|
+
:finder__search_args,
|
|
246
|
+
:finder__options,
|
|
247
|
+
:finder__report_options,
|
|
248
|
+
:finder__test_object,
|
|
249
|
+
"finder__all_elements__*__found_element",
|
|
250
|
+
"finder__all_other_elements__*__found_element"
|
|
251
|
+
]
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
class << self
|
|
256
|
+
# rand_seed is the seed value used to seed the srand function at the start of a test
|
|
257
|
+
# suite. This is done to allow tests with random elements in them to be repeatable.
|
|
258
|
+
# If a test fails, simply set Cornucopia::Util::Configuration.rand_seed to the
|
|
259
|
+
# value of the failed tests seed value (output in the stdout and the generated report)
|
|
260
|
+
# and run the test again. This should re-run the exact same test, resulting in a
|
|
261
|
+
# repeatable test even with randomization in it.
|
|
262
|
+
def seed=(value)
|
|
263
|
+
@@configurations.rand_seed = value
|
|
264
|
+
srand(value) if value
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
def seed
|
|
268
|
+
@@configurations.rand_seed
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
# grab_logs indicates if the system should try to automatically grab a tail of
|
|
272
|
+
# the log file if outputing a diagnostics report.
|
|
273
|
+
#
|
|
274
|
+
# The system will try to grab the following log files:
|
|
275
|
+
# * Rails.env.log
|
|
276
|
+
# * any user specified logs
|
|
277
|
+
#
|
|
278
|
+
# The log capture is done by reading from the end of the file
|
|
279
|
+
# of the log file. If the log file cannot be found, or if the system
|
|
280
|
+
# cannot open the file (no access rights, etc.) nothing will be output.
|
|
281
|
+
#
|
|
282
|
+
# Related options:
|
|
283
|
+
# user_log_files
|
|
284
|
+
# num_lines
|
|
285
|
+
# add_log_file
|
|
286
|
+
# remove_log_file
|
|
287
|
+
def grab_logs=(value)
|
|
288
|
+
@@configurations.grab_logs = value
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def grab_logs
|
|
292
|
+
@@configurations.grab_logs
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
# user_log_files returns a hash of all of the log files which
|
|
296
|
+
# the user has specified are to be grabbed.
|
|
297
|
+
#
|
|
298
|
+
# The keys are the relative paths of the log files to be
|
|
299
|
+
# grabbed, and the values are the options specified for the
|
|
300
|
+
# files. The values may be an empty hash.
|
|
301
|
+
def user_log_files
|
|
302
|
+
@@configurations.user_log_files.clone
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
# num_lines returns the number of lines that will be grabbed
|
|
306
|
+
# for a file. If no file name is supplied, or the name does not match a
|
|
307
|
+
# user file, the default log length will returned.
|
|
308
|
+
def num_lines(log_file_name=nil)
|
|
309
|
+
@@configurations.user_log_files[log_file_name].try(:[], :num_lines) || @@configurations.default_num_lines
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
# default_num_lines sets the default number of lines to extract from the log file
|
|
313
|
+
def default_num_lines=(value)
|
|
314
|
+
@@configurations.default_num_lines = value
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
# Adds the specified log file to the list of log files to capture.
|
|
318
|
+
# If the log file is already in the list, the passed in options will be merged with
|
|
319
|
+
# the existing options.
|
|
320
|
+
# See Cornucopia::LogCapture
|
|
321
|
+
def add_log_file(log_file_name, options = {})
|
|
322
|
+
@@configurations.user_log_files[log_file_name] ||= {}
|
|
323
|
+
@@configurations.user_log_files[log_file_name] = @@configurations.user_log_files[log_file_name].merge options
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# Removes the specified log file from the list of log files to capture.
|
|
327
|
+
# NOTE: You cannot remove the default log file.
|
|
328
|
+
def remove_log_file(log_file_name)
|
|
329
|
+
@@configurations.user_log_files.delete log_file_name
|
|
330
|
+
end
|
|
331
|
+
|
|
332
|
+
# returns the report configuration object for that type of report
|
|
333
|
+
#
|
|
334
|
+
# values for report_name:
|
|
335
|
+
# :rspec
|
|
336
|
+
# :cucumber
|
|
337
|
+
# :spinach
|
|
338
|
+
# :capybara_page_diagnostics
|
|
339
|
+
def report_configuration(report_name)
|
|
340
|
+
@@configurations.configured_reports[report_name]
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
# Sets or returns the minimum amount of time in seconds to allow for the printing of variables.
|
|
344
|
+
# If it is available, the larger of this value and Capybara.default_wait_time will be used.
|
|
345
|
+
#
|
|
346
|
+
# This value exists to prevent the printing of a value on a report from taking too long
|
|
347
|
+
# and holding up the system. If it takes longer than this amount of time to get the value
|
|
348
|
+
# it probably isn't diagnostically important.
|
|
349
|
+
#
|
|
350
|
+
# Default: 10
|
|
351
|
+
def print_timeout_min
|
|
352
|
+
@@configurations.print_timeout_min
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
def print_timeout_min=(value)
|
|
356
|
+
@@configurations.print_timeout_min = value
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# The Selenium driver can throw a StaleElementReferenceError exception sometimes.
|
|
360
|
+
# I often see it with animated items like dialog boxes and the like. When the system
|
|
361
|
+
# is looping trying to find the element or stop seeing it.
|
|
362
|
+
#
|
|
363
|
+
# Because the element likely just disappeared between when it was found and when it
|
|
364
|
+
# was returned, trying again will often make the problem go away.
|
|
365
|
+
#
|
|
366
|
+
# The default for this setting is 5 which will retry the find function if this error
|
|
367
|
+
# occurs.
|
|
368
|
+
#
|
|
369
|
+
# NOTE: This should already be the default action (basically) for the Selenium
|
|
370
|
+
# driver, yet from a purely practical standpoint, this seems to be a problem
|
|
371
|
+
# that I've run into a lot. I am doing it this way to see if I can reduce the
|
|
372
|
+
# the occurrence of it.
|
|
373
|
+
def selenium_cache_retry_count
|
|
374
|
+
@@configurations.selenium_cache_retry_count
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
def selenium_cache_retry_count=(value)
|
|
378
|
+
@@configurations.selenium_cache_retry_count = value
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
# This setting is used by the Capybara utilities.
|
|
382
|
+
#
|
|
383
|
+
# When Capybara::Node.find throws an exception, if this is set, the system will try to
|
|
384
|
+
# use the FinderDiagnostics to output some diagnostic information about the page and the finder
|
|
385
|
+
# to try to assist in determining what happened.
|
|
386
|
+
def analyze_find_exceptions
|
|
387
|
+
@@configurations.analyze_find_exceptions
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
def analyze_find_exceptions=(value)
|
|
391
|
+
@@configurations.analyze_find_exceptions = value
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
# This setting is used by the Capybara utilities.
|
|
395
|
+
#
|
|
396
|
+
# When Capybara::Node.find throws an exception, if this is set, the system will try to
|
|
397
|
+
# use the FinderDiagnostics to output some diagnostic information about the page and the
|
|
398
|
+
# selector to try to assist in determining what happened.
|
|
399
|
+
def analyze_selector_exceptions
|
|
400
|
+
@@configurations.analyze_selector_exceptions
|
|
401
|
+
end
|
|
402
|
+
|
|
403
|
+
def analyze_selector_exceptions=(value)
|
|
404
|
+
@@configurations.analyze_selector_exceptions = value
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
# Sometimes, the analysis process found the element when it wasn't found other ways.
|
|
408
|
+
# This will cause the finder to try again with the found element.
|
|
409
|
+
#
|
|
410
|
+
# The default is false because I haven't seen this be useful in a while.
|
|
411
|
+
#
|
|
412
|
+
# WARNING: Using this is unsafe. If you use it, you could get false positive
|
|
413
|
+
# results in your test.
|
|
414
|
+
def retry_with_found
|
|
415
|
+
@@configurations.retry_with_found
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
def retry_with_found=(value)
|
|
419
|
+
@@configurations.retry_with_found = value
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
# Sometimes, the analysis process found the element when it wasn't found other ways.
|
|
423
|
+
# This will cause the match accessor to try again with the found element.
|
|
424
|
+
#
|
|
425
|
+
# The default is true because I have been getting a fair number of false negatives.
|
|
426
|
+
def retry_match_with_found
|
|
427
|
+
@@configurations.retry_match_with_found
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
def retry_match_with_found=(value)
|
|
431
|
+
@@configurations.retry_match_with_found = value
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
# To make it easier to know about and to see the reports, this configuration will cause a report to be
|
|
435
|
+
# automatically opened if there is anything to report when the report is closed.
|
|
436
|
+
#
|
|
437
|
+
# The posible values for report_name are:
|
|
438
|
+
# nil
|
|
439
|
+
# "rspec_report"
|
|
440
|
+
# "cucumber_report"
|
|
441
|
+
# "spinach_report"
|
|
442
|
+
|
|
443
|
+
def auto_open_report_after_generation(open_report, report_name = nil)
|
|
444
|
+
@@configurations.open_report_settings[report_name || :default] = open_report
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
def open_report_after_generation(report_name)
|
|
448
|
+
open_report = @@configurations.open_report_settings[report_name]
|
|
449
|
+
open_report = @@configurations.open_report_settings[:default] if open_report.nil?
|
|
450
|
+
open_report
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
### Commented this out.
|
|
454
|
+
### When I originally found a need for this type of function, I needed this feature.
|
|
455
|
+
### Since then, I haven't. I don't think this is needed anymore, so I'm leaving it out
|
|
456
|
+
### in this re-write for now. I'll add it back if I feel it is needed.
|
|
457
|
+
|
|
458
|
+
# # I have actually found times when the Selenium driver (in particular) simply would not work.
|
|
459
|
+
# # It was a bug. I think I've upgraded a couple of times since then and the problem probably
|
|
460
|
+
# # went away. It is useful code anyway, so I'm keeping it.
|
|
461
|
+
# #
|
|
462
|
+
# # In the event that default code simply won't work, this is a hail mary option which tries
|
|
463
|
+
# # to do whatever you were trying to do directly through javascript.
|
|
464
|
+
# #
|
|
465
|
+
# # This will only work if the element you are trying to manipulate (get the text or value from,
|
|
466
|
+
# # click, etc.) has an ID.
|
|
467
|
+
# #
|
|
468
|
+
# # The default is false since it is unlikely to work in so many circumstances
|
|
469
|
+
# #
|
|
470
|
+
# # WARNING: Using this is unsafe. If you use it, you could get false positive
|
|
471
|
+
# # results in your test.
|
|
472
|
+
# def alternate_retry
|
|
473
|
+
# @@configurations.alternate_retry
|
|
474
|
+
# end
|
|
475
|
+
#
|
|
476
|
+
# def alternate_retry=(value)
|
|
477
|
+
# @@configurations.alternate_retry = value
|
|
478
|
+
# end
|
|
479
|
+
|
|
480
|
+
# Sets or returns the name of the folder to generate reports into.
|
|
481
|
+
#
|
|
482
|
+
# Default: "cornucopia_report"
|
|
483
|
+
def base_folder
|
|
484
|
+
@@configurations.base_folder
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
def base_folder=(value)
|
|
488
|
+
@@configurations.base_folder = value
|
|
489
|
+
end
|
|
490
|
+
end
|
|
491
|
+
end
|
|
492
|
+
end
|
|
493
|
+
end
|