cornucopia 0.1.40 → 0.1.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/cornucopia.gemspec +1 -1
- data/lib/cornucopia.rb +7 -0
- data/lib/cornucopia/capybara/finder_diagnostics.rb +10 -6
- data/lib/cornucopia/capybara/finder_extensions.rb +24 -15
- data/lib/cornucopia/capybara/install_extensions.rb +44 -0
- data/lib/cornucopia/capybara/matcher_extensions.rb +33 -21
- data/lib/cornucopia/capybara/page_diagnostics.rb +44 -1
- data/lib/cornucopia/capybara/selectable_values.rb +47 -0
- data/lib/cornucopia/capybara/synchronizable.rb +24 -0
- data/lib/cornucopia/cucumber_hooks.rb +6 -3
- data/lib/cornucopia/rspec_hooks.rb +5 -4
- data/lib/cornucopia/site_prism/element_extensions.rb +16 -2
- data/lib/cornucopia/site_prism/install_extensions.rb +18 -0
- data/lib/cornucopia/site_prism/page_application.rb +3 -1
- data/lib/cornucopia/site_prism/section_extensions.rb +23 -0
- data/lib/cornucopia/spinach_hooks.rb +6 -3
- data/lib/cornucopia/util/configuration.rb +14 -6
- data/lib/cornucopia/util/configured_report.rb +3 -1
- data/lib/cornucopia/util/file_asset.rb +3 -1
- data/lib/cornucopia/util/generic_settings.rb +3 -1
- data/lib/cornucopia/util/log_capture.rb +4 -2
- data/lib/cornucopia/util/pretty_formatter.rb +4 -2
- data/lib/cornucopia/util/report_builder.rb +9 -6
- data/lib/cornucopia/util/report_formatters.rb +3 -1
- data/lib/cornucopia/util/report_table.rb +4 -2
- data/lib/cornucopia/util/test_helper.rb +8 -2
- data/lib/cornucopia/version.rb +2 -2
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/config/application.rb +2 -0
- data/spec/dummy/config/boot.rb +2 -0
- data/spec/dummy/config/environment.rb +2 -0
- data/spec/dummy/config/environments/development.rb +2 -0
- data/spec/dummy/config/environments/production.rb +2 -0
- data/spec/dummy/config/environments/test.rb +2 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +2 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +2 -0
- data/spec/dummy/config/initializers/inflections.rb +2 -0
- data/spec/dummy/config/initializers/mime_types.rb +2 -0
- data/spec/dummy/config/initializers/secret_token.rb +2 -0
- data/spec/dummy/config/initializers/session_store.rb +2 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +2 -0
- data/spec/dummy/config/routes.rb +2 -0
- data/spec/dummy/db/schema.rb +2 -0
- data/spec/dummy/features/support/env.rb +2 -0
- data/spec/lib/capybara/finder_diagnostics_spec.rb +68 -58
- data/spec/lib/capybara/finder_extensions_spec.rb +13 -6
- data/spec/lib/capybara/matcher_extensions_spec.rb +2 -0
- data/spec/lib/capybara/page_diagnostics_spec.rb +2 -0
- data/spec/lib/site_prism/element_extensions_spec.rb +2 -0
- data/spec/lib/site_prism/page_application_spec.rb +2 -0
- data/spec/lib/util/configuration_spec.rb +2 -0
- data/spec/lib/util/configured_report_spec.rb +2 -0
- data/spec/lib/util/file_asset_spec.rb +2 -0
- data/spec/lib/util/generic_settings_spec.rb +2 -0
- data/spec/lib/util/log_capture_spec.rb +2 -0
- data/spec/lib/util/pretty_formatter_spec.rb +29 -27
- data/spec/lib/util/report_builder_spec.rb +5 -3
- data/spec/lib/util/report_formatters_spec.rb +2 -0
- data/spec/lib/util/report_table_exception_spec.rb +2 -0
- data/spec/lib/util/report_table_spec.rb +4 -2
- data/spec/lib/util/test_helper_spec.rb +2 -0
- data/spec/pages/cornucopia_report_app.rb +2 -0
- data/spec/pages/cornucopia_report_pages/cornucopia_report_holder_page.rb +2 -0
- data/spec/pages/cornucopia_report_pages/cornucopia_report_test_contents_page.rb +2 -0
- data/spec/pages/cornucopia_report_pages/index_page.rb +2 -0
- data/spec/pages/google/email_page.rb +2 -0
- data/spec/pages/google/login_page.rb +2 -0
- data/spec/rails_helper.rb +2 -0
- data/spec/sample_report.rb +2 -0
- data/spec/spec_helper.rb +2 -0
- metadata +11 -9
- data/lib/cornucopia/capybara/install_finder_extensions.rb +0 -105
- data/lib/cornucopia/capybara/install_matcher_extensions.rb +0 -43
- data/lib/cornucopia/site_prism/install_element_extensions.rb +0 -54
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "rails_helper"
|
2
4
|
require ::File.expand_path("../../../lib/cornucopia/util/report_builder", File.dirname(__FILE__))
|
3
5
|
|
@@ -251,7 +253,7 @@ This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features
|
|
251
253
|
end
|
252
254
|
|
253
255
|
it "returns a string as-is" do
|
254
|
-
test_object = "a string"
|
256
|
+
test_object = "a string".dup
|
255
257
|
|
256
258
|
expect(test_object).not_to receive(:pretty_inspect)
|
257
259
|
expect(test_object).not_to receive(:to_s)
|
@@ -1524,8 +1526,8 @@ This is a sample string c:/bizarro/ <span class=\"cornucopia-app-file\">features
|
|
1524
1526
|
|
1525
1527
|
expect(report_table.errors.count).to eq 1
|
1526
1528
|
section = report_table.errors[0]
|
1527
|
-
|
1529
|
+
|
1528
1530
|
expect(section.find("p").text).to eq section_names[0]
|
1529
1531
|
expect(section.name.text).to eq section_names[0]
|
1530
1532
|
end
|
1531
|
-
end
|
1533
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "rails_helper"
|
2
4
|
require ::File.expand_path("../../../lib/cornucopia/util/report_table", File.dirname(__FILE__))
|
3
5
|
|
@@ -263,7 +265,7 @@ describe Cornucopia::Util::ReportTable do
|
|
263
265
|
raise Exception.new("This is an exception")
|
264
266
|
end
|
265
267
|
end
|
266
|
-
end.to raise_error(Exception)
|
268
|
+
end.to raise_error(Exception, "This is an exception")
|
267
269
|
|
268
270
|
expect(report_table).to be
|
269
271
|
expect(report_table.full_table).to match /#{second_label}/
|
@@ -301,7 +303,7 @@ describe Cornucopia::Util::ReportTable do
|
|
301
303
|
end
|
302
304
|
end
|
303
305
|
end
|
304
|
-
end.to raise_error(Exception)
|
306
|
+
end.to raise_error(Exception, "This is an exception")
|
305
307
|
|
306
308
|
expect(report_table).to be
|
307
309
|
expect(report_table.full_table).to match /#{second_label}/
|
data/spec/rails_helper.rb
CHANGED
data/spec/sample_report.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
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.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RealNobody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -223,15 +223,17 @@ files:
|
|
223
223
|
- lib/cornucopia.rb
|
224
224
|
- lib/cornucopia/capybara/finder_diagnostics.rb
|
225
225
|
- lib/cornucopia/capybara/finder_extensions.rb
|
226
|
-
- lib/cornucopia/capybara/
|
227
|
-
- lib/cornucopia/capybara/install_matcher_extensions.rb
|
226
|
+
- lib/cornucopia/capybara/install_extensions.rb
|
228
227
|
- lib/cornucopia/capybara/matcher_extensions.rb
|
229
228
|
- lib/cornucopia/capybara/page_diagnostics.rb
|
229
|
+
- lib/cornucopia/capybara/selectable_values.rb
|
230
|
+
- lib/cornucopia/capybara/synchronizable.rb
|
230
231
|
- lib/cornucopia/cucumber_hooks.rb
|
231
232
|
- lib/cornucopia/rspec_hooks.rb
|
232
233
|
- lib/cornucopia/site_prism/element_extensions.rb
|
233
|
-
- lib/cornucopia/site_prism/
|
234
|
+
- lib/cornucopia/site_prism/install_extensions.rb
|
234
235
|
- lib/cornucopia/site_prism/page_application.rb
|
236
|
+
- lib/cornucopia/site_prism/section_extensions.rb
|
235
237
|
- lib/cornucopia/source_files/collapse.gif
|
236
238
|
- lib/cornucopia/source_files/cornucopia.css
|
237
239
|
- lib/cornucopia/source_files/expand.gif
|
@@ -1,105 +0,0 @@
|
|
1
|
-
$cornucopia_finder_extension_installed = false unless defined? $cornucopia_finder_extension_installed
|
2
|
-
|
3
|
-
if Object.const_defined?("Capybara") &&
|
4
|
-
Capybara.const_defined?("Node") &&
|
5
|
-
Capybara::Node.const_defined?("Document") &&
|
6
|
-
!$cornucopia_finder_extension_installed
|
7
|
-
module Capybara
|
8
|
-
module Node
|
9
|
-
class Document
|
10
|
-
alias_method :__cornucopia_orig_find, :find
|
11
|
-
alias_method :__cornucopia_orig_all, :all
|
12
|
-
|
13
|
-
include Cornucopia::Capybara::FinderExtensions
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
if Object.const_defined?("Capybara") &&
|
20
|
-
Capybara.const_defined?("Node") &&
|
21
|
-
Capybara::Node.const_defined?("Simple") &&
|
22
|
-
!$cornucopia_finder_extension_installed
|
23
|
-
module Capybara
|
24
|
-
module Node
|
25
|
-
class Simple
|
26
|
-
alias_method :__cornucopia_orig_find, :find
|
27
|
-
alias_method :__cornucopia_orig_all, :all
|
28
|
-
|
29
|
-
include Cornucopia::Capybara::FinderExtensions
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
if Object.const_defined?("Capybara") &&
|
36
|
-
Capybara.const_defined?("Node") &&
|
37
|
-
Capybara::Node.const_defined?("Element") &&
|
38
|
-
!$cornucopia_finder_extension_installed
|
39
|
-
module Capybara
|
40
|
-
module Node
|
41
|
-
class Element
|
42
|
-
alias_method :__cornucopia_orig_find, :find
|
43
|
-
alias_method :__cornucopia_orig_all, :all
|
44
|
-
|
45
|
-
include Cornucopia::Capybara::FinderExtensions
|
46
|
-
|
47
|
-
# select_value finds the option with the value #value then calls select_option on that item.
|
48
|
-
#
|
49
|
-
# select_value only works on select boxes.
|
50
|
-
def select_value(values)
|
51
|
-
raise "select_value is only valid for select items" unless self.tag_name == "select"
|
52
|
-
|
53
|
-
if values.is_a?(Array)
|
54
|
-
values.each do |value|
|
55
|
-
html_safe_value = "".html_safe + value.to_s
|
56
|
-
self.find("option[value=\"#{html_safe_value}\"]", visible: false).select_option
|
57
|
-
end
|
58
|
-
else
|
59
|
-
html_safe_value = "".html_safe + values.to_s
|
60
|
-
self.find("option[value=\"#{html_safe_value}\"]", visible: false).select_option
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# value_text returns the text for the selected items in the select box instead of the value(s)
|
65
|
-
#
|
66
|
-
# value_text only works on select boxes.
|
67
|
-
def value_text
|
68
|
-
raise "value_text is only valid for select items" unless self.tag_name == "select"
|
69
|
-
|
70
|
-
values = self.value
|
71
|
-
if values.is_a?(Array)
|
72
|
-
values.map do |value|
|
73
|
-
self.find("option[value=\"#{value}\"]", visible: false).text
|
74
|
-
end
|
75
|
-
else
|
76
|
-
self.find("option[value=\"#{values}\"]", visible: false).text
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
if Object.const_defined?("Capybara") &&
|
85
|
-
Capybara.const_defined?("Session") &&
|
86
|
-
!$cornucopia_finder_extension_installed
|
87
|
-
$cornucopia_finder_extension_installed = true
|
88
|
-
|
89
|
-
module Capybara
|
90
|
-
class Session
|
91
|
-
# alias_method :__cornucopia_orig_find, :find
|
92
|
-
# alias_method :__cornucopia_orig_all, :all
|
93
|
-
#
|
94
|
-
# include Cornucopia::Capybara::FinderExtensions
|
95
|
-
|
96
|
-
# This function uses Capybara's synchronize function to evaluate a block until
|
97
|
-
# it becomes true.
|
98
|
-
def synchronize_test(seconds=Capybara.default_wait_time, options = {}, &block)
|
99
|
-
document.synchronize(seconds, options) do
|
100
|
-
raise ::Capybara::ElementNotFound unless block.yield
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
$cornucopia_matcher_extension_installed = false unless defined? $cornucopia_matcher_extension_installed
|
2
|
-
|
3
|
-
if Object.const_defined?("Capybara") &&
|
4
|
-
Capybara.const_defined?("Node") &&
|
5
|
-
Capybara::Node.const_defined?("Document") &&
|
6
|
-
!$cornucopia_matcher_extension_installed
|
7
|
-
module Capybara
|
8
|
-
module Node
|
9
|
-
class Document
|
10
|
-
alias_method :__cornucopia_orig_assert_selector, :assert_selector
|
11
|
-
alias_method :__cornucopia_orig_assert_no_selector, :assert_no_selector
|
12
|
-
alias_method :__cornucopia_orig_has_selector?, :has_selector?
|
13
|
-
alias_method :__cornucopia_orig_has_no_selector?, :has_no_selector?
|
14
|
-
|
15
|
-
include Cornucopia::Capybara::MatcherExtensions
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
if Object.const_defined?("Capybara") &&
|
22
|
-
Capybara.const_defined?("Node") &&
|
23
|
-
Capybara::Node.const_defined?("Element") &&
|
24
|
-
!$cornucopia_matcher_extension_installed
|
25
|
-
module Capybara
|
26
|
-
module Node
|
27
|
-
class Element
|
28
|
-
alias_method :__cornucopia_orig_assert_selector, :assert_selector
|
29
|
-
alias_method :__cornucopia_orig_assert_no_selector, :assert_no_selector
|
30
|
-
alias_method :__cornucopia_orig_has_selector?, :has_selector?
|
31
|
-
alias_method :__cornucopia_orig_has_no_selector?, :has_no_selector?
|
32
|
-
|
33
|
-
include Cornucopia::Capybara::MatcherExtensions
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
if Object.const_defined?("Capybara") &&
|
40
|
-
Capybara.const_defined?("Session") &&
|
41
|
-
!$cornucopia_matcher_extension_installed
|
42
|
-
$cornucopia_matcher_extension_installed = true
|
43
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
$cornucopia_element_extension_installed = false unless defined? $cornucopia_element_extension_installed
|
2
|
-
|
3
|
-
if Object.const_defined?("SitePrism") &&
|
4
|
-
::SitePrism.const_defined?("Page") &&
|
5
|
-
!$cornucopia_element_extension_installed
|
6
|
-
module ::SitePrism
|
7
|
-
class Page
|
8
|
-
include Cornucopia::SitePrism::ElementExtensions
|
9
|
-
|
10
|
-
::Capybara::Session::DSL_METHODS.each do |method|
|
11
|
-
alias_method "__cornucopia_orig_#{method}".to_sym, method
|
12
|
-
|
13
|
-
define_method method do |*args, &block|
|
14
|
-
if @__corunucopia_base_node
|
15
|
-
@__corunucopia_base_node.send method, *args, &block
|
16
|
-
else
|
17
|
-
send "__cornucopia_orig_#{method}", *args, &block
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
if Object.const_defined?("SitePrism") &&
|
26
|
-
::SitePrism.const_defined?("Section") &&
|
27
|
-
!$cornucopia_element_extension_installed
|
28
|
-
$cornucopia_element_extension_installed = true
|
29
|
-
|
30
|
-
module ::SitePrism
|
31
|
-
class Section
|
32
|
-
include Cornucopia::SitePrism::ElementExtensions
|
33
|
-
|
34
|
-
alias_method :__corunucopia_orig_intialize, :initialize
|
35
|
-
def initialize(*args)
|
36
|
-
__corunucopia_orig_intialize(*args)
|
37
|
-
|
38
|
-
self.owner_node = args[0].owner_node
|
39
|
-
end
|
40
|
-
|
41
|
-
::Capybara::Session::DSL_METHODS.each do |method|
|
42
|
-
alias_method "__cornucopia_orig_#{method}".to_sym, method
|
43
|
-
|
44
|
-
define_method method do |*args, &block|
|
45
|
-
if @__corunucopia_base_node
|
46
|
-
@__corunucopia_base_node.send method, *args, &block
|
47
|
-
else
|
48
|
-
send "__cornucopia_orig_#{method}", *args, &block
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|