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
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 1d77b60c09f0e90ba7b71c236ace93759f505747
|
|
4
|
+
data.tar.gz: e28665b7fae1b76f551d0f6a6bb54a8b140ff376
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c7042a179f4d6b33772dd5ffd31f1fac82698a32ce7c1d7a745e234c5270a692e7840fb757dea98f04e5925fdda64a885390519cdf55fbebd48bf3cb51aaa1ed
|
|
7
|
+
data.tar.gz: 415cf0bf47a7636c6dcdb9a053fb1ec08aa5d18ea05df93378c7899639f1c25430c7d1f680efb9512a78067c1aca12c7ef5825b089baa7939214c59f31a28d98
|
data/.gitignore
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
*.rbc
|
|
2
|
+
capybara-*.html
|
|
3
|
+
.rspec
|
|
4
|
+
/log
|
|
5
|
+
/tmp
|
|
6
|
+
/db/*.sqlite3
|
|
7
|
+
/public/system
|
|
8
|
+
/coverage/
|
|
9
|
+
/spec/tmp
|
|
10
|
+
**.orig
|
|
11
|
+
rerun.txt
|
|
12
|
+
pickle-email-*.html
|
|
13
|
+
config/initializers/secret_token.rb
|
|
14
|
+
config/secrets.yml
|
|
15
|
+
|
|
16
|
+
## Environment normalisation:
|
|
17
|
+
/.bundle
|
|
18
|
+
/vendor/bundle
|
|
19
|
+
|
|
20
|
+
# these should all be checked in to normalise the environment:
|
|
21
|
+
# Gemfile.lock, .ruby-version, .ruby-gemset
|
|
22
|
+
|
|
23
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
24
|
+
.rvmrc
|
|
25
|
+
|
|
26
|
+
spec/dummy/log/*.log
|
|
27
|
+
pkg/
|
|
28
|
+
spec/dummy/db/*.sqlite3
|
|
29
|
+
spec/dummy/db/*.sqlite3-journal
|
|
30
|
+
spec/dummy/tmp/
|
|
31
|
+
spec/dummy/.sass-cache
|
|
32
|
+
*.gem
|
|
33
|
+
*.rbc
|
|
34
|
+
.config
|
|
35
|
+
.yardoc
|
|
36
|
+
Gemfile.lock
|
|
37
|
+
InstalledFiles
|
|
38
|
+
_yardoc
|
|
39
|
+
doc/
|
|
40
|
+
lib/bundler/man
|
|
41
|
+
rdoc
|
|
42
|
+
spec/reports
|
|
43
|
+
test/tmp
|
|
44
|
+
test/version_tmp
|
|
45
|
+
tmp
|
|
46
|
+
cornucopia_report/
|
|
47
|
+
spec/dummy/cornucopia_report/
|
|
48
|
+
spec/dummy/sample_report/
|
|
49
|
+
spec/dummy/.rspec
|
|
50
|
+
test_reports/*
|
|
51
|
+
.idea/
|
data/.ruby-gemset
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cornucopia
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby-2.0.0
|
data/Gemfile
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
# Declare your gem's dependencies in cornucopia.gemspec.
|
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
|
5
|
+
# development dependencies will be added by default to the :development group.
|
|
6
|
+
gemspec
|
|
7
|
+
|
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
|
11
|
+
# your gem to rubygems.org.
|
|
12
|
+
|
|
13
|
+
# To use debugger
|
|
14
|
+
# gem 'debugger'
|
|
15
|
+
|
|
16
|
+
gem "gem-release"
|
data/LICENSE.TXT
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2014 RealNobody
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
# Cornucopia
|
|
2
|
+
|
|
3
|
+
This is a gem with a bunch of tools which I think are useful when testing. There are many parts to the gem and not
|
|
4
|
+
all parts are useful in all projects. The gem is designed to work so that you can only use the parts that you need.
|
|
5
|
+
If the gem ever grows large enough or complex enough, I might break it into pieces similar to rspec. For now,
|
|
6
|
+
this is just the way it is.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
Add this line to your application's Gemfile:
|
|
11
|
+
|
|
12
|
+
gem 'cornucopia', '~> 0.1.0', git: "git@github.com:RealNobody/cornucopia.git"
|
|
13
|
+
|
|
14
|
+
And then execute:
|
|
15
|
+
|
|
16
|
+
$ bundle
|
|
17
|
+
|
|
18
|
+
Or install it yourself as:
|
|
19
|
+
|
|
20
|
+
$ gem install cornucopia
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Hooks
|
|
25
|
+
|
|
26
|
+
The primary usefulness of the system is the built in integration system. Using your favorite supported test system
|
|
27
|
+
include the appropriate files.
|
|
28
|
+
|
|
29
|
+
#### RSPEC:
|
|
30
|
+
|
|
31
|
+
spec_helper.rb:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
require "cornucopia/rspec_hooks"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### Cucumber:
|
|
38
|
+
|
|
39
|
+
env.rb:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
require "cornucopia/cucumber_hooks"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
#### Spinach:
|
|
46
|
+
|
|
47
|
+
env.rb:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
require "cornucopia/spinach_hooks"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Once required in the hooks are installed, the system will automatically generate a report detailing the error. The
|
|
54
|
+
automatic report includes information about the failure including:
|
|
55
|
+
|
|
56
|
+
* The exception
|
|
57
|
+
* The callstack
|
|
58
|
+
* Any instance variables for the test
|
|
59
|
+
* Details about the failed test and/or step
|
|
60
|
+
* Any Capybara windows and their details including a screen shot
|
|
61
|
+
|
|
62
|
+
### Capybara
|
|
63
|
+
|
|
64
|
+
I have added the following functions to Capybara to help simplify using it.
|
|
65
|
+
|
|
66
|
+
* synchronize_test(seconds=Capybara.default_wait_time, options = {}, &block)
|
|
67
|
+
|
|
68
|
+
This function yields to a block until the Capybara timeout occurs or the block returns true.
|
|
69
|
+
|
|
70
|
+
# Wait until either #some_element or #another_element exists.
|
|
71
|
+
Capybara::current_session.synchronize_test do
|
|
72
|
+
page.all("#some_element").length > 0 ||
|
|
73
|
+
page.all("#another_element").length > 0
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
* **select_value**
|
|
77
|
+
|
|
78
|
+
This function selects the option from a select box based on the value for the selected option instead of the
|
|
79
|
+
value string.
|
|
80
|
+
|
|
81
|
+
page.find("#state_selector").select_value(my_address.state_abbreviation)
|
|
82
|
+
|
|
83
|
+
* **value_text**
|
|
84
|
+
|
|
85
|
+
This function returns the string value of the currently selected option(s).
|
|
86
|
+
|
|
87
|
+
page.find("#state_selector").value_text # returns "Arizona" instead of "AZ"
|
|
88
|
+
|
|
89
|
+
### SitePrism
|
|
90
|
+
|
|
91
|
+
I love using SitePrism. Unfortunately, I find it involves a lot of copy/paste. To simplify the use of SitePrism, I
|
|
92
|
+
have created what are basically some macros:
|
|
93
|
+
|
|
94
|
+
* **patterned_elements(pattern, *element, options = {})**
|
|
95
|
+
|
|
96
|
+
This allows you to define a list of multiple elements where the pattern for the finder includes the text for what you
|
|
97
|
+
want the call the element.
|
|
98
|
+
|
|
99
|
+
You can specify the type of finder to be used with the _finder_type_ parameter, and if necessary include additional
|
|
100
|
+
parameters as well.
|
|
101
|
+
|
|
102
|
+
Examples:
|
|
103
|
+
|
|
104
|
+
class MySection < SitePrism::Section
|
|
105
|
+
patterned_elements "td.column_%{element_name}",
|
|
106
|
+
:my_element_1,
|
|
107
|
+
:my_element_2,
|
|
108
|
+
:my_element_3
|
|
109
|
+
|
|
110
|
+
# instead of:
|
|
111
|
+
# element :my_element_1, "td.column_my_element_1"
|
|
112
|
+
# element :my_element_2, "td.column_my_element_2"
|
|
113
|
+
# element :my_element_3, "td.column_my_element_3"
|
|
114
|
+
|
|
115
|
+
patterned_elements "//td[name = \"${element_name}\"]",
|
|
116
|
+
:my_element_1,
|
|
117
|
+
:my_element_2,
|
|
118
|
+
:my_element_3,
|
|
119
|
+
finder_type: :xpath,
|
|
120
|
+
visible: false
|
|
121
|
+
|
|
122
|
+
# instead of:
|
|
123
|
+
# element :my_element_1, :xpath, "//td[name = \"my_element_1\"]", visible: false
|
|
124
|
+
# element :my_element_2, :xpath, "//td[name = \"my_element_2\"]", visible: false
|
|
125
|
+
# element :my_element_3, :xpath, "//td[name = \"my_element_3\"]", visible: false
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
* **patterned_elements(form_type, *elements)**
|
|
129
|
+
|
|
130
|
+
This provides a quick and easy way to define elements for the items in forms. The ids of the elements in a form
|
|
131
|
+
follow the simple pattern of: <form_name><element_id>. Most of the time, you want the name of the
|
|
132
|
+
element to match the <element_id>.
|
|
133
|
+
|
|
134
|
+
Example:
|
|
135
|
+
|
|
136
|
+
= form_for my_table_object do |form|
|
|
137
|
+
= form.select :field_1
|
|
138
|
+
= form.text_box :field_2
|
|
139
|
+
= form.check_box :field_3
|
|
140
|
+
|
|
141
|
+
class MySection < SitePrism::Section
|
|
142
|
+
form_elements :my_table,
|
|
143
|
+
:field_1,
|
|
144
|
+
:field_2,
|
|
145
|
+
:field_3,
|
|
146
|
+
|
|
147
|
+
# instead of:
|
|
148
|
+
# element :field_1, "#my_table_field_1"
|
|
149
|
+
# element :field_2, "#my_table_field_2"
|
|
150
|
+
# element :field_3, "#my_table_field_3"
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
* **id_elements(*elements)**
|
|
154
|
+
|
|
155
|
+
This is a quick and easy way to define elements where the name of the element is the same as the id for the element.
|
|
156
|
+
|
|
157
|
+
Example:
|
|
158
|
+
|
|
159
|
+
class MySection < SitePrism::Section
|
|
160
|
+
id_elements :my_item_1,
|
|
161
|
+
:my_item_2,
|
|
162
|
+
:my_item_3
|
|
163
|
+
|
|
164
|
+
# instead of:
|
|
165
|
+
# element :my_item_1, "#my_item_1"
|
|
166
|
+
# element :my_item_2, "#my_item_2"
|
|
167
|
+
# element :my_item_3, "#my_item_3"
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
* **class_elements(*elements)**
|
|
171
|
+
|
|
172
|
+
This is a quick and easy way to define elements where the name of the element is the same as the class name used to
|
|
173
|
+
identify the element.
|
|
174
|
+
|
|
175
|
+
Example:
|
|
176
|
+
|
|
177
|
+
class MySection < SitePrism::Section
|
|
178
|
+
id_elements :my_item_1,
|
|
179
|
+
:my_item_2,
|
|
180
|
+
:my_item_3
|
|
181
|
+
|
|
182
|
+
# instead of:
|
|
183
|
+
# element :my_item_1, ".my_item_1"
|
|
184
|
+
# element :my_item_2, ".my_item_2"
|
|
185
|
+
# element :my_item_3, ".my_item_3"
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
* **indexed_elements(pattern, *element, options = {})**
|
|
189
|
+
|
|
190
|
+
This allows you to define a list of multiple elements where the pattern for the finder is based on an index value.
|
|
191
|
+
This is useful for things like table columns.
|
|
192
|
+
|
|
193
|
+
You can specify the type of finder to be used with the _finder_type_ parameter, and if necessary include additional
|
|
194
|
+
parameters as well with _additional_options_.
|
|
195
|
+
|
|
196
|
+
Examples:
|
|
197
|
+
|
|
198
|
+
class MySection < SitePrism::Section
|
|
199
|
+
patterned_elements "td:nth-child(%{element_index})",
|
|
200
|
+
:my_element_1,
|
|
201
|
+
:my_element_2,
|
|
202
|
+
:my_element_3
|
|
203
|
+
|
|
204
|
+
# instead of:
|
|
205
|
+
# element :my_element_1, "td:nth-child(1)"
|
|
206
|
+
# element :my_element_2, "td:nth-child(2)"
|
|
207
|
+
# element :my_element_3, "td:nth-child(3)"
|
|
208
|
+
|
|
209
|
+
patterned_elements "//td_%{element_index}",
|
|
210
|
+
:my_element_1,
|
|
211
|
+
:my_element_2,
|
|
212
|
+
:my_element_3,
|
|
213
|
+
finder_type: :xpath,
|
|
214
|
+
additional_options: { visible: false },
|
|
215
|
+
start_index: 3,
|
|
216
|
+
increment: 12
|
|
217
|
+
|
|
218
|
+
# instead of:
|
|
219
|
+
# element :my_element_1, :xpath, "//td_3", visible: false
|
|
220
|
+
# element :my_element_2, :xpath, "//td_15", visible: false
|
|
221
|
+
# element :my_element_3, :xpath, "//td_27", visible: false
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
* **PageApplication**
|
|
225
|
+
|
|
226
|
+
SitePrism recommends memoizing the page objects. I found it annoying to create a class for the pages and define a
|
|
227
|
+
new function for each page. To simplify my life, I created the PageApplication class. It will memoize pages for me
|
|
228
|
+
automatically as long as I follow some simple rules.
|
|
229
|
+
|
|
230
|
+
Basically, just create all of my pages underneath a single module in a single folder, and the a class derived from
|
|
231
|
+
PageApplication will find the pages and memoize them for you automatically.
|
|
232
|
+
|
|
233
|
+
class MyApplication < Cornucopia::SitePrism::PageApplication
|
|
234
|
+
def pages_module
|
|
235
|
+
MyPagesModule
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
module MyPagesModule
|
|
240
|
+
module MyModule
|
|
241
|
+
class MyPage < SitePrism::Page
|
|
242
|
+
# your SitePirsm page definition here...
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
module MyPagesModule
|
|
248
|
+
class MyOtherPage < SitePrism::Page
|
|
249
|
+
# your SitePirsm page definition here...
|
|
250
|
+
end
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
a_memoized_page = MyApplication.my_module__my_page
|
|
254
|
+
a_memoized_other_page = MyApplication.my_other_page
|
|
255
|
+
|
|
256
|
+
### Utilities
|
|
257
|
+
|
|
258
|
+
#### Configuration
|
|
259
|
+
|
|
260
|
+
Cornucopia::Util::Configuration
|
|
261
|
+
|
|
262
|
+
The configuration class contains the various configurations that are used by the system.
|
|
263
|
+
|
|
264
|
+
* **seed**
|
|
265
|
+
|
|
266
|
+
The seed value represents the seed value for `rand`. It is used by the testing hooks to allow tests with
|
|
267
|
+
randomized values to still be repeatable. This value can be set or read.
|
|
268
|
+
|
|
269
|
+
* **grab_logs**
|
|
270
|
+
|
|
271
|
+
Indicates if the `Cornucopia::Util::LogCapture` class will capture any log files or not.
|
|
272
|
+
|
|
273
|
+
* **user_log_files**
|
|
274
|
+
|
|
275
|
+
Returns a list of the log files which will be captures. Changing the returned value will not affect log
|
|
276
|
+
capturing settings.
|
|
277
|
+
|
|
278
|
+
* **num_lines(log_file_name=nil)**
|
|
279
|
+
|
|
280
|
+
This gets the number of lines that are captured for the indicated log file. If no value is passed in for
|
|
281
|
+
`log_file_name`, the default number of lines will be returned.
|
|
282
|
+
|
|
283
|
+
* **default_num_lines=**
|
|
284
|
+
|
|
285
|
+
Set the default number of lines to be captured when capturing log files.
|
|
286
|
+
|
|
287
|
+
* **add_log_file(log_file_name, options = {})**
|
|
288
|
+
|
|
289
|
+
Add a log file to be captured. The log path needs to be relative to the `Rails` log folder,
|
|
290
|
+
or if Rails is not being used in the project, relative to the current working directory. If a file is added
|
|
291
|
+
multiple times, the file will be captured only once. Subsequent calls will update the options for the file.
|
|
292
|
+
|
|
293
|
+
Options:
|
|
294
|
+
|
|
295
|
+
*num_lines* - The number of lines to capture for the file.
|
|
296
|
+
|
|
297
|
+
* **remove_log_file**
|
|
298
|
+
|
|
299
|
+
Removes a log file from the list of files to be captured.
|
|
300
|
+
|
|
301
|
+
* **report_configuration(report_name)**
|
|
302
|
+
|
|
303
|
+
Returns the `Cornucopia::Util::ConfiguredReport` for different reports.
|
|
304
|
+
|
|
305
|
+
Supported Reports:
|
|
306
|
+
|
|
307
|
+
*rspec*
|
|
308
|
+
|
|
309
|
+
*cucumber*
|
|
310
|
+
|
|
311
|
+
*spinach*
|
|
312
|
+
|
|
313
|
+
*capybara_page_diagnostics*
|
|
314
|
+
|
|
315
|
+
* **print_timeout_min**
|
|
316
|
+
|
|
317
|
+
This is the amount of time (in seconds) the will be allowed for the rendering of a variable when printing a
|
|
318
|
+
value using `Cornucopia::Util::ReportBuilder.pretty_object`.
|
|
319
|
+
|
|
320
|
+
This value exists because in real testing I found a few vaules (which I now exclude automatically) which took
|
|
321
|
+
literally hours to print out using `pretty_inspect`. (I suspect an infinite loop.) This value prevents that by
|
|
322
|
+
interrupting a printout which takes too long.
|
|
323
|
+
|
|
324
|
+
#### ConfiguredReport
|
|
325
|
+
|
|
326
|
+
The `Cornucopia::Util::ConfiguredReport` class allows you to configure what information is exported to generated
|
|
327
|
+
report files.
|
|
328
|
+
|
|
329
|
+
## Contributing
|
|
330
|
+
|
|
331
|
+
1. Fork it
|
|
332
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
333
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
334
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
335
|
+
5. Create new Pull Request
|
|
336
|
+
|
|
337
|
+
## Todos...
|
|
338
|
+
|
|
339
|
+
ReportBuilder - delayed reports
|
|
340
|
+
@delayed_reports = { key: { report_name: "", report_table: ReportTable.new do || end} }
|
|
341
|
+
finder diagnostics - within sub-report. delayed_report?
|