cornucopia 0.1.55 → 0.2.0

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.
Files changed (37) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +0 -2
  3. data/.ruby-version +1 -0
  4. data/Gemfile +4 -1
  5. data/Gemfile.lock +297 -0
  6. data/cornucopia.gemspec +13 -12
  7. data/lib/cornucopia/capybara/finder_diagnostics/find_action/found_element.rb +155 -0
  8. data/lib/cornucopia/capybara/finder_diagnostics/find_action.rb +417 -0
  9. data/lib/cornucopia/capybara/finder_diagnostics.rb +9 -551
  10. data/lib/cornucopia/capybara/finder_extensions.rb +34 -26
  11. data/lib/cornucopia/capybara/install_extensions.rb +6 -6
  12. data/lib/cornucopia/capybara/matcher_extensions.rb +110 -47
  13. data/lib/cornucopia/capybara/page_diagnostics/window_iterator.rb +42 -0
  14. data/lib/cornucopia/capybara/page_diagnostics.rb +1 -30
  15. data/lib/cornucopia/capybara/synchronizable.rb +1 -1
  16. data/lib/cornucopia/site_prism/class_extensions.rb +13 -0
  17. data/lib/cornucopia/site_prism/element_extensions.rb +7 -4
  18. data/lib/cornucopia/site_prism/install_extensions.rb +1 -1
  19. data/lib/cornucopia/site_prism/page_application.rb +3 -3
  20. data/lib/cornucopia/site_prism/section_extensions.rb +3 -11
  21. data/lib/cornucopia/util/report_builder.rb +1 -1
  22. data/lib/cornucopia/version.rb +1 -1
  23. data/spec/dummy/app/assets/config/manifest.js +2 -0
  24. data/spec/dummy/config/application.rb +1 -1
  25. data/spec/lib/capybara/finder_diagnostics_spec.rb +11 -13
  26. data/spec/lib/capybara/finder_extensions_spec.rb +19 -11
  27. data/spec/lib/capybara/matcher_extensions_spec.rb +13 -15
  28. data/spec/lib/capybara/page_diagnostics_spec.rb +1 -1
  29. data/spec/lib/site_prism/element_extensions_spec.rb +3 -3
  30. data/spec/lib/util/configured_report_spec.rb +4 -4
  31. data/spec/lib/util/log_capture_spec.rb +5 -5
  32. data/spec/lib/util/report_builder_spec.rb +3 -3
  33. data/spec/lib/util/report_table_spec.rb +5 -5
  34. data/spec/pages/cornucopia_report_pages/cornucopia_report_test_contents_page.rb +1 -1
  35. data/spec/sample_report.rb +6 -6
  36. data/spec/spec_helper.rb +5 -1
  37. metadata +37 -10
@@ -4,10 +4,10 @@ if Object.const_defined?("Capybara") &&
4
4
  Capybara.const_defined?("Node") &&
5
5
  Capybara::Node.const_defined?("Document")
6
6
  unless Capybara::Node::Document.included_modules.include?(Cornucopia::Capybara::FinderExtensions)
7
- Capybara::Node::Document.include Cornucopia::Capybara::FinderExtensions
7
+ Capybara::Node::Document.prepend Cornucopia::Capybara::FinderExtensions
8
8
  end
9
9
  unless Capybara::Node::Document.included_modules.include?(Cornucopia::Capybara::MatcherExtensions)
10
- Capybara::Node::Document.include Cornucopia::Capybara::MatcherExtensions
10
+ Capybara::Node::Document.prepend Cornucopia::Capybara::MatcherExtensions
11
11
  end
12
12
  end
13
13
 
@@ -15,10 +15,10 @@ if Object.const_defined?("Capybara") &&
15
15
  Capybara.const_defined?("Node") &&
16
16
  Capybara::Node.const_defined?("Simple")
17
17
  unless Capybara::Node::Simple.included_modules.include?(Cornucopia::Capybara::FinderExtensions)
18
- Capybara::Node::Simple.include Cornucopia::Capybara::FinderExtensions
18
+ Capybara::Node::Simple.prepend Cornucopia::Capybara::FinderExtensions
19
19
  end
20
20
  unless Capybara::Node::Simple.included_modules.include?(Cornucopia::Capybara::MatcherExtensions)
21
- Capybara::Node::Simple.include Cornucopia::Capybara::MatcherExtensions
21
+ Capybara::Node::Simple.prepend Cornucopia::Capybara::MatcherExtensions
22
22
  end
23
23
  end
24
24
 
@@ -26,10 +26,10 @@ if Object.const_defined?("Capybara") &&
26
26
  Capybara.const_defined?("Node") &&
27
27
  Capybara::Node.const_defined?("Element")
28
28
  unless Capybara::Node::Element.included_modules.include?(Cornucopia::Capybara::FinderExtensions)
29
- Capybara::Node::Element.include Cornucopia::Capybara::FinderExtensions
29
+ Capybara::Node::Element.prepend Cornucopia::Capybara::FinderExtensions
30
30
  end
31
31
  unless Capybara::Node::Element.included_modules.include?(Cornucopia::Capybara::MatcherExtensions)
32
- Capybara::Node::Element.include Cornucopia::Capybara::MatcherExtensions
32
+ Capybara::Node::Element.prepend Cornucopia::Capybara::MatcherExtensions
33
33
  end
34
34
  unless Capybara::Node::Element.included_modules.include?(Cornucopia::Capybara::SelectableValues)
35
35
  Capybara::Node::Element.include Cornucopia::Capybara::SelectableValues
@@ -10,62 +10,109 @@ module Cornucopia
10
10
  module MatcherExtensions
11
11
  extend ActiveSupport::Concern
12
12
 
13
- included do
14
- alias_method :__cornucopia_capybara_orig_assert_selector, :assert_selector
15
- alias_method :__cornucopia_capybara_orig_assert_no_selector, :assert_no_selector
16
- alias_method :__cornucopia_capybara_orig_has_selector?, :has_selector?
17
- alias_method :__cornucopia_capybara_orig_has_no_selector?, :has_no_selector?
18
-
19
- define_method :assert_selector do |*args|
20
- __cornucopia_assert_selector_function(:assert_selector, *args)
21
- end
13
+ def assert_selector(*args, &block)
14
+ retry_count = 0
15
+ result = nil
16
+ no_option_args = args.clone
17
+ options = no_option_args.pop if no_option_args.last.is_a?(Hash)
18
+ options ||= {}
19
+
20
+ support_options, normal_options = __cornucopia__extract_selector_support_options(**options)
21
+
22
+ begin
23
+ retry_count += 1
24
+ if __cornucopia__call_super?(:assert_selector, *no_option_args, **normal_options, &block)
25
+ result = super(*no_option_args, normal_options, &block)
26
+ end
27
+ rescue Selenium::WebDriver::Error::StaleElementReferenceError
28
+ retry if __cornucopia__retry_selector?(retry_count, support_options)
22
29
 
23
- define_method :assert_no_selector do |*args|
24
- __cornucopia_assert_selector_function(:assert_no_selector, *args)
30
+ result = __cornucopia__analyze_selector(:assert_selector, support_options, *no_option_args, **normal_options)
31
+ rescue
32
+ result = __cornucopia__analyze_selector(:assert_selector, support_options, *no_option_args, **normal_options)
25
33
  end
26
34
 
27
- define_method :has_selector? do |*args|
28
- new_args = args.dup
29
- options = (new_args.pop if new_args.length > 1 && new_args[-1].is_a?(Hash)) || {}
35
+ result
36
+ end
37
+
38
+ def assert_no_selector(*args, &block)
39
+ retry_count = 0
40
+ result = nil
41
+ no_option_args = args.clone
42
+ options = no_option_args.pop if no_option_args.last.is_a?(Hash)
43
+ options ||= {}
30
44
 
31
- if Cornucopia::Util::Configuration.ignore_has_selector_errors
32
- options = { __cornucopia_no_analysis: true }.merge options
45
+ support_options, normal_options = __cornucopia__extract_selector_support_options(**options)
46
+
47
+ begin
48
+ retry_count += 1
49
+ if __cornucopia__call_super?(:assert_no_selector, *no_option_args, **normal_options, &block)
50
+ result = super(*no_option_args, **normal_options, &block)
33
51
  end
52
+ rescue Selenium::WebDriver::Error::StaleElementReferenceError
53
+ retry if __cornucopia__retry_selector?(retry_count, support_options)
34
54
 
35
- __cornucopia_assert_selector_function(:has_selector?, *new_args, options)
55
+ result = __cornucopia__analyze_selector(:assert_no_selector, support_options, *no_option_args, **normal_options)
56
+ rescue
57
+ result = __cornucopia__analyze_selector(:assert_no_selector, support_options, *no_option_args, **normal_options)
36
58
  end
37
59
 
38
- define_method :has_no_selector? do |*args|
39
- new_args = args.dup
40
- options = (new_args.pop if new_args.length > 1 && new_args[-1].is_a?(Hash)) || {}
60
+ result
61
+ end
62
+
63
+ def has_selector?(*args, **options, &block)
64
+ new_args = args.dup
65
+ retry_count = 0
66
+ result = nil
41
67
 
42
- if Cornucopia::Util::Configuration.ignore_has_selector_errors
43
- options = { __cornucopia_no_analysis: true }.merge options
68
+ support_options, normal_options = __cornucopia__extract_selector_support_options(**options)
69
+
70
+ begin
71
+ retry_count += 1
72
+ if __cornucopia__call_super?(:has_selector?, *new_args, **options, &block)
73
+ __cornucopia_with_no_analysis do
74
+ result = super(*new_args, **options, &block)
75
+
76
+ unless Cornucopia::Util::Configuration.ignore_has_selector_errors
77
+ result ||= __cornucopia__analyze_selector(:has_no_selector?, support_options, *new_args, **normal_options)
78
+ end
79
+ end
44
80
  end
45
- __cornucopia_assert_selector_function(:has_no_selector?, *new_args, options)
81
+ rescue Selenium::WebDriver::Error::StaleElementReferenceError
82
+ retry if __cornucopia__retry_selector?(retry_count, support_options)
83
+
84
+ result = __cornucopia__analyze_selector(:has_selector?, support_options, *new_args, **normal_options)
85
+ rescue
86
+ result = __cornucopia__analyze_selector(:has_selector?, support_options, *new_args, **normal_options)
46
87
  end
47
- end
48
88
 
89
+ result
90
+ end
49
91
 
50
- def __cornucopia_assert_selector_function(assert_selector_function, *args)
92
+ def has_no_selector?(*args, **options, &block)
93
+ new_args = args.dup
51
94
  retry_count = 0
52
95
  result = nil
53
96
 
54
- support_options = if [:has_selector?, :has_no_selector?].include?(assert_selector_function)
55
- {}
56
- else
57
- __cornucopia__extract_selector_support_options(*args)
58
- end
97
+ support_options, normal_options = __cornucopia__extract_selector_support_options(**options)
59
98
 
60
99
  begin
61
100
  retry_count += 1
62
- result = send("__cornucopia_capybara_orig_#{assert_selector_function}", *args)
101
+ if __cornucopia__call_super?(:has_no_selector?, *new_args, **options, &block)
102
+ __cornucopia_with_no_analysis do
103
+ result = super(*new_args, **options, &block)
104
+
105
+ unless Cornucopia::Util::Configuration.ignore_has_selector_errors
106
+ result ||= __cornucopia__analyze_selector(:has_no_selector?, support_options, *new_args, **normal_options)
107
+ end
108
+ end
109
+ end
63
110
  rescue Selenium::WebDriver::Error::StaleElementReferenceError
64
- retry if __cornucopia__retry_selector(retry_count, support_options)
111
+ retry if __cornucopia__retry_selector?(retry_count, support_options)
65
112
 
66
- result = __cornucopia__analyze_selector(assert_selector_function, support_options, *args)
67
- rescue Exception
68
- result = __cornucopia__analyze_selector(assert_selector_function, support_options, *args)
113
+ result = __cornucopia__analyze_selector(:has_no_selector?, support_options, *new_args, **normal_options)
114
+ rescue
115
+ result = __cornucopia__analyze_selector(:has_no_selector?, support_options, *new_args, **normal_options)
69
116
  end
70
117
 
71
118
  result
@@ -73,18 +120,22 @@ module Cornucopia
73
120
 
74
121
  private
75
122
 
76
- def __cornucopia__extract_selector_support_options(*args)
77
- support_options = {}
123
+ attr_reader :__cornucopia_block_analysis
78
124
 
79
- if args[-1].is_a?(Hash)
80
- support_options[:__cornucopia_no_analysis] = args[-1].delete(:__cornucopia_no_analysis)
81
- support_options[:__cornucopia_retry_with_found] = args[-1].delete(:__cornucopia_retry_with_found)
82
- end
125
+ def __cornucopia__call_super?(_funciton_name, *_args, **_options, &_block)
126
+ true
127
+ end
128
+
129
+ def __cornucopia__extract_selector_support_options(**options)
130
+ support_options = options.slice(:__cornucopia_no_analysis, :__cornucopia_retry_with_found)
131
+ normal_options = options.slice(*(options.keys - %i[__cornucopia_no_analysis __cornucopia_retry_with_found]))
83
132
 
84
- support_options
133
+ support_options[:__cornucopia_no_analysis] = true if __cornucopia_block_analysis
134
+
135
+ [support_options, normal_options]
85
136
  end
86
137
 
87
- def __cornucopia__analyze_selector(function_name, support_options, *args)
138
+ def __cornucopia__analyze_selector(function_name, support_options, *args, **options)
88
139
  return_value = nil
89
140
  error = $!
90
141
 
@@ -97,26 +148,38 @@ module Cornucopia
97
148
  {},
98
149
  support_options,
99
150
  function_name,
100
- *args)
151
+ *args,
152
+ **options)
101
153
 
102
154
  if find_action.perform_analysis(Cornucopia::Util::Configuration.retry_match_with_found ||
103
155
  support_options[:__cornucopia_retry_with_found])
104
156
  return_value = find_action.simple_run({ __cornucopia_no_analysis: true }) rescue nil
105
157
  return_value ||= find_action.return_value
106
158
  else
107
- raise error
159
+ raise error if error
108
160
  end
109
161
  else
110
- raise error
162
+ raise error if error
111
163
  end
112
164
 
113
165
  return_value
114
166
  end
115
167
 
116
- def __cornucopia__retry_selector(retry_count, support_options)
168
+ def __cornucopia__retry_selector?(retry_count, support_options)
117
169
  retry_count <= Cornucopia::Util::Configuration.selenium_cache_retry_count &&
118
170
  !support_options[:__cornucopia_no_analysis]
119
171
  end
172
+
173
+ def __cornucopia_with_no_analysis
174
+ orig_block = __cornucopia_block_analysis
175
+
176
+ begin
177
+ @__cornucopia_block_analysis = true
178
+ yield
179
+ ensure
180
+ @__cornucopia_block_analysis = orig_block
181
+ end
182
+ end
120
183
  end
121
184
  end
122
185
  end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "digest"
4
+ # require ::File.expand_path("../../util/configuration", File.dirname(__FILE__))
5
+ require ::File.expand_path("../../util/report_builder", File.dirname(__FILE__))
6
+ require ::File.expand_path("../../util/report_table", File.dirname(__FILE__))
7
+
8
+ module Cornucopia
9
+ module Capybara
10
+ class PageDiagnostics
11
+ class WindowIterator
12
+ def initialize(window_handles, current_window, diagnostics)
13
+ @window_handles = window_handles
14
+ @current_window = current_window
15
+ @diagnostics = diagnostics
16
+ end
17
+
18
+ def each(&block)
19
+ begin
20
+ @diagnostics.allow_other_windows = false
21
+
22
+ if @window_handles.length > 1
23
+ @window_handles.each do |window_handle|
24
+ unless @current_window && @current_window == window_handle
25
+ switched = @diagnostics.execute_driver_function(:switch_to_window,
26
+ "could not switch windows",
27
+ window_handle)
28
+ if switched != "could not switch windows"
29
+ block.yield @diagnostics
30
+ end
31
+ end
32
+ end
33
+ end
34
+ ensure
35
+ @diagnostics.allow_other_windows = true
36
+ @diagnostics.execute_driver_function(:switch_to_window, "could not switch windows", @current_window)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -4,6 +4,7 @@ require "digest"
4
4
  # require ::File.expand_path("../util/configuration", File.dirname(__FILE__))
5
5
  require ::File.expand_path("../util/report_builder", File.dirname(__FILE__))
6
6
  require ::File.expand_path("../util/report_table", File.dirname(__FILE__))
7
+ require ::File.expand_path("page_diagnostics/window_iterator", File.dirname(__FILE__))
7
8
 
8
9
  module Cornucopia
9
10
  module Capybara
@@ -104,36 +105,6 @@ module Cornucopia
104
105
  end
105
106
  end
106
107
 
107
- class WindowIterator
108
- def initialize(window_handles, current_window, diagnostics)
109
- @window_handles = window_handles
110
- @current_window = current_window
111
- @diagnostics = diagnostics
112
- end
113
-
114
- def each(&block)
115
- begin
116
- @diagnostics.allow_other_windows = false
117
-
118
- if @window_handles.length > 1
119
- @window_handles.each do |window_handle|
120
- unless @current_window && @current_window == window_handle
121
- switched = @diagnostics.execute_driver_function(:switch_to_window,
122
- "could not switch windows",
123
- window_handle)
124
- if switched != "could not switch windows"
125
- block.yield @diagnostics
126
- end
127
- end
128
- end
129
- end
130
- ensure
131
- @diagnostics.allow_other_windows = true
132
- @diagnostics.execute_driver_function(:switch_to_window, "could not switch windows", @current_window)
133
- end
134
- end
135
- end
136
-
137
108
  def other_windows
138
109
  if @allow_other_windows
139
110
  Cornucopia::Capybara::PageDiagnostics::WindowIterator.new(@window_handles, @current_window, self)
@@ -15,7 +15,7 @@ module Cornucopia
15
15
  def synchronize_test(seconds = nil, options = {}, &block)
16
16
  seconds ||= ::Capybara.respond_to?(:default_max_wait_time) ? ::Capybara.default_max_wait_time : ::Capybara.default_wait_time
17
17
 
18
- document.synchronize(seconds, options) do
18
+ document.synchronize(seconds, **options) do
19
19
  raise ::Capybara::ElementNotFound unless block.yield
20
20
  end
21
21
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/concern'
4
+
5
+ module Cornucopia
6
+ module SitePrism
7
+ module ClassExtensions
8
+ def to_capybara_node
9
+ @__corunucopia_base_node || super
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/concern'
4
+ require ::File.expand_path("class_extensions", File.dirname(__FILE__))
4
5
 
5
6
  module Cornucopia
6
7
  module SitePrism
@@ -9,16 +10,18 @@ module Cornucopia
9
10
 
10
11
  included do
11
12
  ::Capybara::Session::DSL_METHODS.each do |method|
12
- alias_method "__cornucopia_site_prism_orig_#{method}".to_sym, method
13
+ next if Cornucopia::SitePrism::ClassExtensions.methods.include?(method)
13
14
 
14
- define_method method do |*args, &block|
15
+ Cornucopia::SitePrism::ClassExtensions.define_singleton_method(method) do |*args, **options, &block|
15
16
  if @__corunucopia_base_node
16
- @__corunucopia_base_node.send method, *args, &block
17
+ @__corunucopia_base_node.send(method, *args, **options, &block)
17
18
  else
18
- send "__cornucopia_site_prism_orig_#{method}", *args, &block
19
+ super(*args, **options, &block)
19
20
  end
20
21
  end
21
22
  end
23
+
24
+ self.prepend Cornucopia::SitePrism::ClassExtensions
22
25
  end
23
26
 
24
27
  module ClassMethods
@@ -13,6 +13,6 @@ if Object.const_defined?("SitePrism") &&
13
13
  SitePrism::Section.include Cornucopia::SitePrism::ElementExtensions
14
14
  end
15
15
  unless SitePrism::Section.included_modules.include?(Cornucopia::SitePrism::SectionExtensions)
16
- SitePrism::Section.include Cornucopia::SitePrism::SectionExtensions
16
+ SitePrism::Section.prepend Cornucopia::SitePrism::SectionExtensions
17
17
  end
18
18
  end
@@ -66,8 +66,8 @@ module Cornucopia
66
66
  end
67
67
  end
68
68
 
69
- def respond_to?(method_sym, include_private = false)
70
- if self.current_instance.respond_to?(method_sym, include_private)
69
+ def respond_to_missing?(method_name, include_private = false)
70
+ if self.current_instance.respond_to_missing?(method_sym, include_private)
71
71
  true
72
72
  else
73
73
  super
@@ -114,7 +114,7 @@ module Cornucopia
114
114
  end
115
115
  end
116
116
 
117
- def respond_to?(method_sym, include_private = false)
117
+ def respond_to_missing?(method_sym, include_private = false)
118
118
  method_name = method_sym.to_s
119
119
 
120
120
  if is_page_name?(method_name)
@@ -5,18 +5,10 @@ require 'active_support/concern'
5
5
  module Cornucopia
6
6
  module SitePrism
7
7
  module SectionExtensions
8
- extend ActiveSupport::Concern
8
+ def initialize(*args)
9
+ super(*args)
9
10
 
10
- included do |base|
11
- base.class_exec do
12
- alias :__cornucopia_site_prism_orig_initialize :initialize
13
-
14
- def initialize(*args)
15
- __cornucopia_site_prism_orig_initialize(*args)
16
-
17
- self.owner_node = args[0].owner_node
18
- end
19
- end
11
+ self.owner_node = args[0].owner_node
20
12
  end
21
13
  end
22
14
  end
@@ -313,7 +313,7 @@ module Cornucopia
313
313
 
314
314
  def delete_old_folders
315
315
  old_directories = Dir[File.join(index_folder_name, "#{@base_folder_name}_*")].
316
- map { |dir| File.directory?(dir) ? dir : nil }.compact
316
+ map { |dir| File.directory?(dir) ? dir : nil }.compact.sort
317
317
 
318
318
  if Array.wrap(old_directories).length > MAX_OLD_FOLDERS
319
319
  old_directories.each_with_index do |dir, index|
@@ -1,3 +1,3 @@
1
1
  module Cornucopia
2
- VERSION = "0.1.55"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,2 @@
1
+ // app/assets/config/manifest.js
2
+ //
@@ -6,7 +6,7 @@ require File.expand_path('../boot', __FILE__)
6
6
  # require "active_record/railtie"
7
7
  require "action_controller/railtie"
8
8
  require "action_mailer/railtie"
9
- require "sprockets/railtie"
9
+ # require "sprockets/railtie"
10
10
  # require "rails/test_unit/railtie"
11
11
 
12
12
  Bundler.require(*Rails.groups)
@@ -81,7 +81,7 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
81
81
  expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[0].values[0].text).to be == ":css"
82
82
  expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[1].labels[0].text).to be == "1"
83
83
  expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[1].values[0].text).to be == "#base-contentss"
84
- expect(contents_frame.errors[0].tables[0].rows[3].labels[0].text).to be == "exception"
84
+ expect(contents_frame.errors[0].tables[0].rows[3].labels[0].text).to be == "message"
85
85
  expect(contents_frame.errors[0].tables[0].rows[3].values[0].text).to be == "Unable to find css \"#base-contentss\""
86
86
  expect(contents_frame.errors[0].tables[0].rows[4].labels[0].text).to be == "backtrace"
87
87
  expect(contents_frame.errors[0].tables[0].rows[4].expands[0]).to be
@@ -93,7 +93,7 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
93
93
  expect(contents_frame.errors[0].more_details.details.rows[0].labels[0].text).to be == "name"
94
94
  expect(contents_frame.errors[0].more_details.details.rows[0].values[0].text).to be == "Capybara::ElementNotFound"
95
95
  expect(contents_frame.errors[0].more_details.details.rows[1].labels[0].text).to be == "support_options"
96
- expect(contents_frame.errors[0].more_details.details.rows[1].values[0].text).to be == "{:__cornucopia_no_analysis=>true, :__cornucopia_retry_with_found=>nil}"
96
+ expect(contents_frame.errors[0].more_details.details.rows[1].values[0].text).to be == "{:__cornucopia_no_analysis=>true}"
97
97
  expect(contents_frame.errors[0].more_details.details.rows[2].labels[0].text).to be == "page_url"
98
98
  expect(contents_frame.errors[0].more_details.details.rows[2].values[0].text).to match %r{sample_report/index\.html}
99
99
  expect(contents_frame.errors[0].more_details.details.rows[3].labels[0].text).to be == "title"
@@ -156,8 +156,8 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
156
156
  expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[0].values[0].text).to be == ":css"
157
157
  expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[1].labels[0].text).to be == "1"
158
158
  expect(contents_frame.errors[0].tables[0].rows[2].sub_tables[0].rows[1].values[0].text).to be == "a"
159
- expect(contents_frame.errors[0].tables[0].rows[3].labels[0].text).to be == "exception"
160
- expect(contents_frame.errors[0].tables[0].rows[3].values[0].text).to match /Ambiguous match, found .+ elements matching css "a"/
159
+ expect(contents_frame.errors[0].tables[0].rows[3].labels[0].text).to be == "message"
160
+ expect(contents_frame.errors[0].tables[0].rows[3].values[0].text).to match /Ambiguous match, found .+ elements matching visible css "a"/
161
161
  expect(contents_frame.errors[0].tables[0].rows[4].labels[0].text).to be == "backtrace"
162
162
  expect(contents_frame.errors[0].tables[0].rows[4].expands[0]).to be
163
163
  expect(contents_frame.errors[0].tables[0].rows[4].mores[0]).to be
@@ -173,7 +173,7 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
173
173
  expect(contents_frame.errors[0].more_details.details.rows[2].labels[0].text).to be == "guessed_types"
174
174
  expect(contents_frame.errors[0].more_details.details.rows[2].values[0].text).to be
175
175
  expect(contents_frame.errors[0].more_details.details.rows[3].labels[0].text).to be == "support_options"
176
- expect(contents_frame.errors[0].more_details.details.rows[3].values[0].text).to be == "{:__cornucopia_no_analysis=>true, :__cornucopia_retry_with_found=>nil}"
176
+ expect(contents_frame.errors[0].more_details.details.rows[3].values[0].text).to be == "{:__cornucopia_no_analysis=>true}"
177
177
  expect(contents_frame.errors[0].more_details.details.rows[4].labels[0].text).to be == "page_url"
178
178
  expect(contents_frame.errors[0].more_details.details.rows[4].values[0].text).to match %r{sample_report/index\.html}
179
179
  expect(contents_frame.errors[0].more_details.details.rows[5].labels[0].text).to be == "title"
@@ -279,8 +279,6 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
279
279
  expect(contents_frame.errors[0].more_details.details.rows[1].labels[0].text).to be == "args"
280
280
  expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables[0].rows[0].labels[0].text).to be == "1"
281
281
  expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables[0].rows[0].values[0].text).to be == "a"
282
- expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables[0].rows[1].labels[0].text).to be == "2"
283
- expect(contents_frame.errors[0].more_details.details.rows[1].sub_tables[0].rows[1].values[0].text).to be == "{:visible=>true}"
284
282
  expect(contents_frame.errors[0].more_details.details.rows[2].labels[0].text).to be == "guessed_types"
285
283
  expect(contents_frame.errors[0].more_details.details.rows[2].values[0].text).to be
286
284
  expect(contents_frame.errors[0].more_details.details.rows[3].labels[0].text).to be == "page_url"
@@ -539,7 +537,7 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
539
537
  to receive(:execute_script).at_least(1).times.and_raise(::Capybara::NotSupportedByDriverError)
540
538
 
541
539
  base_object = ::Capybara.current_session.find(:css, "#hidden-div", visible: false)
542
- button = base_object.first("Still cool!", count: 1)
540
+ button = base_object.first("input[type='button']", count: 1)
543
541
 
544
542
  expect(button.class).to be == ::Capybara::Node::Element
545
543
 
@@ -574,7 +572,7 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
574
572
  to receive(:execute_script).at_least(1).times.and_raise(::Capybara::NotSupportedByDriverError)
575
573
 
576
574
  base_object = ::Capybara.current_session.find(:css, "#hidden-div", visible: false)
577
- button = base_object.assert_selector("Still cool!", count: 1)
575
+ button = base_object.assert_selector("input[type='button']", count: 1)
578
576
 
579
577
  expect(button).to be true
580
578
 
@@ -617,18 +615,18 @@ describe Cornucopia::Capybara::FinderDiagnostics, type: :feature do
617
615
  allow_any_instance_of(::Cornucopia::Capybara::FinderDiagnostics::FindAction).
618
616
  to receive(:all_other_elements).and_return []
619
617
  allow(empty_find_button).to receive(:size).and_return 0
620
- allow_any_instance_of(::Capybara::Node::Element).
618
+ allow_any_instance_of(Cornucopia::Capybara::FinderDiagnostics::FindAction).
621
619
  to receive(:all).
622
620
  and_call_original
623
- allow_any_instance_of(::Capybara::Node::Element).
621
+ allow_any_instance_of(Cornucopia::Capybara::FinderDiagnostics::FindAction).
624
622
  to receive(:all).
625
623
  with("Still cool!", { count: 1 }).
626
624
  and_return(find_button)
627
- allow_any_instance_of(::Capybara::Node::Element).
625
+ allow_any_instance_of(Cornucopia::Capybara::FinderDiagnostics::FindAction).
628
626
  to receive(:all).
629
627
  with(instance_of(Symbol), "Still cool!", { visible: false, __cornucopia_no_analysis: true }).
630
628
  and_return(empty_find_button)
631
- allow_any_instance_of(::Capybara::Node::Element).
629
+ allow_any_instance_of(Cornucopia::Capybara::FinderDiagnostics::FindAction).
632
630
  to receive(:all).
633
631
  with("Still cool!", { visible: false, __cornucopia_no_analysis: true }).
634
632
  and_return(empty_find_button)