capybara 2.15.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. checksums.yaml +5 -5
  2. data/History.md +137 -2
  3. data/README.md +36 -25
  4. data/lib/capybara/config.rb +11 -57
  5. data/lib/capybara/cucumber.rb +2 -3
  6. data/lib/capybara/driver/base.rb +19 -16
  7. data/lib/capybara/driver/node.rb +5 -4
  8. data/lib/capybara/dsl.rb +1 -0
  9. data/lib/capybara/helpers.rb +19 -29
  10. data/lib/capybara/minitest/spec.rb +16 -13
  11. data/lib/capybara/minitest.rb +140 -137
  12. data/lib/capybara/node/actions.rb +68 -89
  13. data/lib/capybara/node/base.rb +11 -18
  14. data/lib/capybara/node/document.rb +2 -2
  15. data/lib/capybara/node/document_matchers.rb +8 -8
  16. data/lib/capybara/node/element.rb +32 -42
  17. data/lib/capybara/node/finders.rb +64 -71
  18. data/lib/capybara/node/matchers.rb +50 -71
  19. data/lib/capybara/node/simple.rb +11 -17
  20. data/lib/capybara/queries/ancestor_query.rb +12 -8
  21. data/lib/capybara/queries/base_query.rb +22 -18
  22. data/lib/capybara/queries/current_path_query.rb +12 -25
  23. data/lib/capybara/queries/match_query.rb +3 -7
  24. data/lib/capybara/queries/selector_query.rb +100 -96
  25. data/lib/capybara/queries/sibling_query.rb +5 -5
  26. data/lib/capybara/queries/text_query.rb +35 -35
  27. data/lib/capybara/queries/title_query.rb +8 -11
  28. data/lib/capybara/rack_test/browser.rb +15 -18
  29. data/lib/capybara/rack_test/css_handlers.rb +6 -4
  30. data/lib/capybara/rack_test/driver.rb +6 -10
  31. data/lib/capybara/rack_test/form.rb +52 -39
  32. data/lib/capybara/rack_test/node.rb +93 -63
  33. data/lib/capybara/rails.rb +2 -6
  34. data/lib/capybara/result.rb +22 -22
  35. data/lib/capybara/rspec/compound.rb +5 -10
  36. data/lib/capybara/rspec/features.rb +17 -48
  37. data/lib/capybara/rspec/matcher_proxies.rb +31 -15
  38. data/lib/capybara/rspec/matchers.rb +116 -58
  39. data/lib/capybara/rspec.rb +5 -10
  40. data/lib/capybara/selector/css.rb +6 -11
  41. data/lib/capybara/selector/filter.rb +1 -17
  42. data/lib/capybara/selector/filter_set.rb +18 -15
  43. data/lib/capybara/selector/filters/base.rb +7 -6
  44. data/lib/capybara/selector/filters/expression_filter.rb +6 -23
  45. data/lib/capybara/selector/filters/node_filter.rb +2 -12
  46. data/lib/capybara/selector/selector.rb +28 -34
  47. data/lib/capybara/selector.rb +129 -117
  48. data/lib/capybara/selenium/driver.rb +172 -163
  49. data/lib/capybara/selenium/node.rb +218 -104
  50. data/lib/capybara/server.rb +3 -2
  51. data/lib/capybara/session/config.rb +47 -59
  52. data/lib/capybara/session/matchers.rb +23 -14
  53. data/lib/capybara/session.rb +175 -229
  54. data/lib/capybara/spec/fixtures/no_extension +1 -0
  55. data/lib/capybara/spec/public/test.js +38 -6
  56. data/lib/capybara/spec/session/accept_alert_spec.rb +1 -0
  57. data/lib/capybara/spec/session/accept_confirm_spec.rb +3 -2
  58. data/lib/capybara/spec/session/accept_prompt_spec.rb +30 -1
  59. data/lib/capybara/spec/session/all_spec.rb +31 -18
  60. data/lib/capybara/spec/session/ancestor_spec.rb +6 -8
  61. data/lib/capybara/spec/session/assert_all_of_selectors_spec.rb +6 -5
  62. data/lib/capybara/spec/session/assert_current_path.rb +12 -11
  63. data/lib/capybara/spec/session/assert_selector.rb +1 -0
  64. data/lib/capybara/spec/session/assert_text.rb +31 -23
  65. data/lib/capybara/spec/session/assert_title.rb +13 -3
  66. data/lib/capybara/spec/session/attach_file_spec.rb +57 -29
  67. data/lib/capybara/spec/session/body_spec.rb +1 -0
  68. data/lib/capybara/spec/session/check_spec.rb +7 -6
  69. data/lib/capybara/spec/session/choose_spec.rb +5 -4
  70. data/lib/capybara/spec/session/click_button_spec.rb +24 -32
  71. data/lib/capybara/spec/session/click_link_or_button_spec.rb +8 -7
  72. data/lib/capybara/spec/session/click_link_spec.rb +8 -7
  73. data/lib/capybara/spec/session/current_scope_spec.rb +4 -3
  74. data/lib/capybara/spec/session/current_url_spec.rb +19 -8
  75. data/lib/capybara/spec/session/dismiss_confirm_spec.rb +1 -1
  76. data/lib/capybara/spec/session/dismiss_prompt_spec.rb +1 -0
  77. data/lib/capybara/spec/session/element/assert_match_selector.rb +1 -1
  78. data/lib/capybara/spec/session/element/match_xpath_spec.rb +1 -1
  79. data/lib/capybara/spec/session/element/matches_selector_spec.rb +5 -5
  80. data/lib/capybara/spec/session/evaluate_async_script_spec.rb +23 -0
  81. data/lib/capybara/spec/session/evaluate_script_spec.rb +5 -4
  82. data/lib/capybara/spec/session/execute_script_spec.rb +4 -3
  83. data/lib/capybara/spec/session/fill_in_spec.rb +30 -5
  84. data/lib/capybara/spec/session/find_button_spec.rb +4 -3
  85. data/lib/capybara/spec/session/find_by_id_spec.rb +2 -1
  86. data/lib/capybara/spec/session/find_field_spec.rb +9 -15
  87. data/lib/capybara/spec/session/find_link_spec.rb +6 -5
  88. data/lib/capybara/spec/session/find_spec.rb +37 -31
  89. data/lib/capybara/spec/session/first_spec.rb +60 -33
  90. data/lib/capybara/spec/session/frame/frame_title_spec.rb +23 -0
  91. data/lib/capybara/spec/session/frame/frame_url_spec.rb +23 -0
  92. data/lib/capybara/spec/session/frame/switch_to_frame_spec.rb +2 -1
  93. data/lib/capybara/spec/session/frame/within_frame_spec.rb +9 -16
  94. data/lib/capybara/spec/session/go_back_spec.rb +1 -0
  95. data/lib/capybara/spec/session/go_forward_spec.rb +1 -0
  96. data/lib/capybara/spec/session/has_all_selectors_spec.rb +69 -0
  97. data/lib/capybara/spec/session/has_button_spec.rb +2 -1
  98. data/lib/capybara/spec/session/has_css_spec.rb +3 -2
  99. data/lib/capybara/spec/session/has_current_path_spec.rb +49 -22
  100. data/lib/capybara/spec/session/has_field_spec.rb +4 -3
  101. data/lib/capybara/spec/session/has_link_spec.rb +5 -4
  102. data/lib/capybara/spec/session/has_none_selectors_spec.rb +76 -0
  103. data/lib/capybara/spec/session/has_select_spec.rb +32 -31
  104. data/lib/capybara/spec/session/has_selector_spec.rb +5 -4
  105. data/lib/capybara/spec/session/has_table_spec.rb +2 -1
  106. data/lib/capybara/spec/session/has_text_spec.rb +9 -13
  107. data/lib/capybara/spec/session/has_title_spec.rb +1 -0
  108. data/lib/capybara/spec/session/has_xpath_spec.rb +1 -0
  109. data/lib/capybara/spec/session/headers.rb +2 -1
  110. data/lib/capybara/spec/session/html_spec.rb +1 -0
  111. data/lib/capybara/spec/session/node_spec.rb +107 -58
  112. data/lib/capybara/spec/session/node_wrapper_spec.rb +36 -0
  113. data/lib/capybara/spec/session/refresh_spec.rb +6 -2
  114. data/lib/capybara/spec/session/reset_session_spec.rb +19 -0
  115. data/lib/capybara/spec/session/response_code.rb +1 -0
  116. data/lib/capybara/spec/session/save_and_open_page_spec.rb +1 -0
  117. data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +6 -11
  118. data/lib/capybara/spec/session/save_page_spec.rb +1 -17
  119. data/lib/capybara/spec/session/save_screenshot_spec.rb +3 -3
  120. data/lib/capybara/spec/session/select_spec.rb +21 -20
  121. data/lib/capybara/spec/session/selectors_spec.rb +2 -2
  122. data/lib/capybara/spec/session/sibling_spec.rb +1 -1
  123. data/lib/capybara/spec/session/text_spec.rb +17 -3
  124. data/lib/capybara/spec/session/title_spec.rb +11 -1
  125. data/lib/capybara/spec/session/uncheck_spec.rb +4 -3
  126. data/lib/capybara/spec/session/unselect_spec.rb +7 -6
  127. data/lib/capybara/spec/session/visit_spec.rb +64 -3
  128. data/lib/capybara/spec/session/window/become_closed_spec.rb +2 -1
  129. data/lib/capybara/spec/session/window/current_window_spec.rb +1 -0
  130. data/lib/capybara/spec/session/window/open_new_window_spec.rb +1 -0
  131. data/lib/capybara/spec/session/window/switch_to_window_spec.rb +2 -1
  132. data/lib/capybara/spec/session/window/window_opened_by_spec.rb +2 -1
  133. data/lib/capybara/spec/session/window/window_spec.rb +12 -12
  134. data/lib/capybara/spec/session/window/windows_spec.rb +2 -3
  135. data/lib/capybara/spec/session/window/within_window_spec.rb +15 -71
  136. data/lib/capybara/spec/session/within_spec.rb +1 -0
  137. data/lib/capybara/spec/spec_helper.rb +36 -18
  138. data/lib/capybara/spec/test_app.rb +17 -9
  139. data/lib/capybara/spec/views/form.erb +7 -0
  140. data/lib/capybara/spec/views/initial_alert.erb +10 -0
  141. data/lib/capybara/spec/views/with_fixed_header_footer.erb +17 -0
  142. data/lib/capybara/spec/views/with_hover.erb +5 -0
  143. data/lib/capybara/spec/views/with_html.erb +27 -1
  144. data/lib/capybara/spec/views/with_js.erb +11 -0
  145. data/lib/capybara/spec/views/within_frames.erb +4 -1
  146. data/lib/capybara/version.rb +2 -1
  147. data/lib/capybara/window.rb +6 -10
  148. data/lib/capybara.rb +29 -26
  149. data/spec/basic_node_spec.rb +1 -0
  150. data/spec/capybara_spec.rb +16 -69
  151. data/spec/dsl_spec.rb +5 -13
  152. data/spec/filter_set_spec.rb +5 -4
  153. data/spec/fixtures/selenium_driver_rspec_failure.rb +2 -1
  154. data/spec/fixtures/selenium_driver_rspec_success.rb +3 -2
  155. data/spec/minitest_spec.rb +13 -4
  156. data/spec/minitest_spec_spec.rb +12 -3
  157. data/spec/per_session_config_spec.rb +9 -8
  158. data/spec/rack_test_spec.rb +21 -20
  159. data/spec/result_spec.rb +17 -16
  160. data/spec/rspec/features_spec.rb +17 -14
  161. data/spec/rspec/scenarios_spec.rb +5 -7
  162. data/spec/rspec/shared_spec_matchers.rb +96 -99
  163. data/spec/rspec/views_spec.rb +2 -1
  164. data/spec/rspec_matchers_spec.rb +18 -2
  165. data/spec/rspec_spec.rb +11 -15
  166. data/spec/selector_spec.rb +5 -6
  167. data/spec/selenium_spec_chrome.rb +20 -11
  168. data/spec/selenium_spec_edge.rb +27 -0
  169. data/spec/selenium_spec_ie.rb +31 -0
  170. data/spec/selenium_spec_marionette.rb +38 -12
  171. data/spec/server_spec.rb +33 -33
  172. data/spec/session_spec.rb +2 -1
  173. data/spec/shared_selenium_session.rb +82 -22
  174. data/spec/spec_helper.rb +3 -6
  175. metadata +76 -81
  176. data/lib/capybara/query.rb +0 -7
  177. data/spec/selenium_spec_firefox.rb +0 -68
@@ -1,14 +1,12 @@
1
- # encoding: UTF-8
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Capybara
5
-
6
4
  # @api private
7
5
  module Helpers
8
6
  extend self
9
7
 
10
8
  ##
11
- #
9
+ # @deprecated
12
10
  # Normalizes whitespace space by stripping leading and trailing
13
11
  # whitespace and replacing sequences of whitespace characters
14
12
  # with a single space.
@@ -17,6 +15,7 @@ module Capybara
17
15
  # @return [String] Normalized text
18
16
  #
19
17
  def normalize_whitespace(text)
18
+ warn "DEPRECATED: Capybara::Helpers::normalize_whitespace is deprecated, please update your driver"
20
19
  text.to_s.gsub(/[[:space:]]+/, ' ').strip
21
20
  end
22
21
 
@@ -26,16 +25,17 @@ module Capybara
26
25
  # if text is not a regexp
27
26
  #
28
27
  # @param [String] text Text to escape
29
- # @return [String] Escaped text
28
+ # @param [Boolean] exact (false) Whether or not this should be an exact text match
29
+ # @param [Fixnum, Boolean, nil] options Options passed to Regexp.new when creating the Regexp
30
+ # @return [Regexp] Regexp to match the passed in text and options
30
31
  #
31
- def to_regexp(text, regexp_options=nil, exact=false)
32
- if text.is_a?(Regexp)
33
- text
34
- else
35
- escaped = Regexp.escape(normalize_whitespace(text))
36
- escaped = "\\A#{escaped}\\z" if exact
37
- Regexp.new(escaped, regexp_options)
38
- end
32
+ def to_regexp(text, exact: false, all_whitespace: false, options: nil)
33
+ return text if text.is_a?(Regexp)
34
+
35
+ escaped = Regexp.escape(text)
36
+ escaped = escaped.gsub("\\ ", "[[:blank:]]") if all_whitespace
37
+ escaped = "\\A#{escaped}\\z" if exact
38
+ Regexp.new(escaped, options)
39
39
  end
40
40
 
41
41
  ##
@@ -44,16 +44,14 @@ module Capybara
44
44
  # `Capybara.asset_host`.
45
45
  #
46
46
  # @param [String] html HTML code to inject into
47
+ # @param [URL] host (Capybara.asset_host) The host from which assets should be loaded
47
48
  # @return [String] The modified HTML code
48
49
  #
49
- def inject_asset_host(html, asset_host = Capybara.asset_host)
50
- if asset_host && Nokogiri::HTML(html).css("base").empty?
50
+ def inject_asset_host(html, host: Capybara.asset_host)
51
+ if host && Nokogiri::HTML(html).css("base").empty?
51
52
  match = html.match(/<head[^<]*?>/)
52
- if match
53
- return html.clone.insert match.end(0), "<base href='#{asset_host}' />"
54
- end
53
+ return html.clone.insert match.end(0), "<base href='#{host}' />" if match
55
54
  end
56
-
57
55
  html
58
56
  end
59
57
 
@@ -68,21 +66,13 @@ module Capybara
68
66
  # @param [Integer] count The number of items
69
67
  #
70
68
  def declension(singular, plural, count)
71
- if count == 1
72
- singular
73
- else
74
- plural
75
- end
69
+ count == 1 ? singular : plural
76
70
  end
77
71
 
78
72
  if defined?(Process::CLOCK_MONOTONIC)
79
- def monotonic_time
80
- Process.clock_gettime Process::CLOCK_MONOTONIC
81
- end
73
+ def monotonic_time; Process.clock_gettime Process::CLOCK_MONOTONIC; end
82
74
  else
83
- def monotonic_time
84
- Time.now.to_f
85
- end
75
+ def monotonic_time; Time.now.to_f; end
86
76
  end
87
77
  end
88
78
  end
@@ -3,30 +3,34 @@ require 'minitest/spec'
3
3
  module Capybara
4
4
  module Minitest
5
5
  module Expectations
6
- %w(text content title current_path).each do |assertion|
6
+ %w[text content title current_path].each do |assertion|
7
7
  infect_an_assertion "assert_#{assertion}", "must_have_#{assertion}", :reverse
8
8
  infect_an_assertion "refute_#{assertion}", "wont_have_#{assertion}", :reverse
9
9
  end
10
10
 
11
- (%w(selector xpath css link button field select table checked_field unchecked_field).map do |assertion|
12
- [["assert_#{assertion}", "must_have_#{assertion}"],
13
- ["refute_#{assertion}", "wont_have_#{assertion}"]]
14
- end.flatten(1) + %w(selector xpath css).map do |assertion|
15
- [["assert_matches_#{assertion}", "must_match_#{assertion}"],
16
- ["refute_matches_#{assertion}", "wont_match_#{assertion}"]]
17
- end.flatten(1)).each do |(meth, new_name)|
18
- self.class_eval <<-EOM, __FILE__, __LINE__ + 1
11
+ # rubocop:disable Style/MultilineBlockChain
12
+ (%w[selector xpath css link button field select table checked_field unchecked_field].flat_map do |assertion|
13
+ [%W[assert_#{assertion} must_have_#{assertion}],
14
+ %W[refute_#{assertion} wont_have_#{assertion}]]
15
+ end + [%w[assert_all_of_selectors must_have_all_of_selectors],
16
+ %w[assert_none_of_selectors must_have_none_of_selectors]] +
17
+ %w[selector xpath css].flat_map do |assertion|
18
+ [%W[assert_matches_#{assertion} must_match_#{assertion}],
19
+ %W[refute_matches_#{assertion} wont_match_#{assertion}]]
20
+ end).each do |(meth, new_name)|
21
+ class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
19
22
  def #{new_name} *args, &block
20
23
  ::Minitest::Expectation.new(self, ::Minitest::Spec.current).#{new_name}(*args, &block)
21
24
  end
22
- EOM
25
+ ASSERTION
23
26
 
24
- ::Minitest::Expectation.class_eval <<-EOM, __FILE__, __LINE__ + 1
27
+ ::Minitest::Expectation.class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
25
28
  def #{new_name} *args, &block
26
29
  ctx.#{meth}(target, *args, &block)
27
30
  end
28
- EOM
31
+ ASSERTION
29
32
  end
33
+ # rubocop:enable Style/MultilineBlockChain
30
34
 
31
35
  ##
32
36
  # Expectation that there is xpath
@@ -157,7 +161,6 @@ module Capybara
157
161
  #
158
162
  # @!method wont_have_current_path
159
163
  # see {Capybara::SessionMatchers#assert_no_current_path}
160
-
161
164
  end
162
165
  end
163
166
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'minitest'
3
4
  require 'capybara/dsl'
4
5
 
@@ -41,17 +42,16 @@ module Capybara
41
42
  # @!method assert_no_current_path
42
43
  # see {Capybara::SessionMatchers#assert_no_current_path}
43
44
 
44
-
45
- %w(assert_text assert_no_text assert_title assert_no_title assert_current_path assert_no_current_path).each do |assertion_name|
46
- self.class_eval <<-EOM, __FILE__, __LINE__ + 1
45
+ %w[assert_text assert_no_text assert_title assert_no_title assert_current_path assert_no_current_path].each do |assertion_name|
46
+ class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
47
47
  def #{assertion_name} *args
48
48
  self.assertions +=1
49
- subject, *args = determine_subject(args)
49
+ subject, args = determine_subject(args)
50
50
  subject.#{assertion_name}(*args)
51
51
  rescue Capybara::ExpectationNotMet => e
52
52
  raise ::Minitest::Assertion, e.message
53
53
  end
54
- EOM
54
+ ASSERTION
55
55
  end
56
56
 
57
57
  alias_method :refute_title, :assert_no_title
@@ -81,188 +81,191 @@ module Capybara
81
81
  # @!method assert_xpath
82
82
  # see {Capybara::Node::Matchers#assert_not_matches_selector}
83
83
 
84
- %w(assert_selector assert_no_selector assert_matches_selector assert_not_matches_selector).each do |assertion_name|
85
- self.class_eval <<-EOM, __FILE__, __LINE__ + 1
84
+ %w[assert_selector assert_no_selector
85
+ assert_all_of_selectors assert_none_of_selectors
86
+ assert_matches_selector assert_not_matches_selector].each do |assertion_name|
87
+ class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
86
88
  def #{assertion_name} *args, &optional_filter_block
87
89
  self.assertions +=1
88
- subject, *args = determine_subject(args)
90
+ subject, args = determine_subject(args)
89
91
  subject.#{assertion_name}(*args, &optional_filter_block)
90
92
  rescue Capybara::ExpectationNotMet => e
91
93
  raise ::Minitest::Assertion, e.message
92
94
  end
93
- EOM
95
+ ASSERTION
94
96
  end
95
97
 
96
98
  alias_method :refute_selector, :assert_no_selector
97
99
  alias_method :refute_matches_selector, :assert_not_matches_selector
98
100
 
99
- %w(xpath css link button field select table).each do |selector_type|
101
+ %w[xpath css link button field select table].each do |selector_type|
100
102
  define_method "assert_#{selector_type}" do |*args, &optional_filter_block|
101
- subject, *args = determine_subject(args)
103
+ subject, args = determine_subject(args)
102
104
  locator, options = extract_locator(args)
103
105
  assert_selector(subject, selector_type.to_sym, locator, options, &optional_filter_block)
104
106
  end
105
107
 
106
108
  define_method "assert_no_#{selector_type}" do |*args, &optional_filter_block|
107
- subject, *args = determine_subject(args)
109
+ subject, args = determine_subject(args)
108
110
  locator, options = extract_locator(args)
109
111
  assert_no_selector(subject, selector_type.to_sym, locator, options, &optional_filter_block)
110
112
  end
111
113
  alias_method "refute_#{selector_type}", "assert_no_#{selector_type}"
112
114
  end
113
115
 
114
- %w(checked unchecked).each do |field_type|
116
+ %w[checked unchecked].each do |field_type|
115
117
  define_method "assert_#{field_type}_field" do |*args, &optional_filter_block|
116
- subject, *args = determine_subject(args)
118
+ subject, args = determine_subject(args)
117
119
  locator, options = extract_locator(args)
118
120
  assert_selector(subject, :field, locator, options.merge(field_type.to_sym => true), &optional_filter_block)
119
121
  end
120
122
 
121
123
  define_method "assert_no_#{field_type}_field" do |*args, &optional_filter_block|
122
- subject, *args = determine_subject(args)
124
+ subject, args = determine_subject(args)
123
125
  locator, options = extract_locator(args)
124
126
  assert_no_selector(subject, :field, locator, options.merge(field_type.to_sym => true), &optional_filter_block)
125
127
  end
126
128
  alias_method "refute_#{field_type}_field", "assert_no_#{field_type}_field"
127
129
  end
128
130
 
129
- %w(xpath css).each do |selector_type|
131
+ %w[xpath css].each do |selector_type|
130
132
  define_method "assert_matches_#{selector_type}" do |*args, &optional_filter_block|
131
- subject, *args = determine_subject(args)
133
+ subject, args = determine_subject(args)
132
134
  assert_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
133
135
  end
134
136
 
135
137
  define_method "assert_not_matches_#{selector_type}" do |*args, &optional_filter_block|
136
- subject, *args = determine_subject(args)
138
+ subject, args = determine_subject(args)
137
139
  assert_not_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
138
140
  end
139
141
  alias_method "refute_matches_#{selector_type}", "assert_not_matches_#{selector_type}"
140
142
  end
141
143
 
142
-
143
- ##
144
- # Assertion that there is xpath
145
- #
146
- # @!method assert_xpath
147
- # see Capybara::Node::Matchers#has_xpath?
148
-
149
- ##
150
- # Assertion that there is no xpath
151
- #
152
- # @!method refute_xpath
153
- # @!method assert_no_xpath
154
- # see Capybara::Node::Matchers#has_no_xpath?
155
-
156
- ##
157
- # Assertion that there is css
158
- #
159
- # @!method assert_css
160
- # see Capybara::Node::Matchers#has_css?
161
-
162
- ##
163
- # Assertion that there is no css
164
- #
165
- # @!method refute_css
166
- # @!method assert_no_css
167
- # see Capybara::Node::Matchers#has_no_css?
168
-
169
- ##
170
- # Assertion that there is link
171
- #
172
- # @!method assert_link
173
- # see {Capybara::Node::Matchers#has_link?}
174
-
175
- ##
176
- # Assertion that there is no link
177
- #
178
- # @!method assert_no_link
179
- # @!method refute_link
180
- # see {Capybara::Node::Matchers#has_no_link?}
181
-
182
- ##
183
- # Assertion that there is button
184
- #
185
- # @!method assert_button
186
- # see {Capybara::Node::Matchers#has_button?}
187
-
188
- ##
189
- # Assertion that there is no button
190
- #
191
- # @!method refute_button
192
- # @!method assert_no_button
193
- # see {Capybara::Node::Matchers#has_no_button?}
194
-
195
- ##
196
- # Assertion that there is field
197
- #
198
- # @!method assert_field
199
- # see {Capybara::Node::Matchers#has_field?}
200
-
201
- ##
202
- # Assertion that there is no field
203
- #
204
- # @!method refute_field
205
- # @!method assert_no_field
206
- # see {Capybara::Node::Matchers#has_no_field?}
207
-
208
- ##
209
- # Assertion that there is checked_field
210
- #
211
- # @!method assert_checked_field
212
- # see {Capybara::Node::Matchers#has_checked_field?}
213
-
214
- ##
215
- # Assertion that there is no checked_field
216
- #
217
- # @!method assert_no_checked_field
218
- # @!method refute_chceked_field
219
-
220
- ##
221
- # Assertion that there is unchecked_field
222
- #
223
- # @!method assert_unchecked_field
224
- # see {Capybara::Node::Matchers#has_unchecked_field?}
225
-
226
- ##
227
- # Assertion that there is no unchecked_field
228
- #
229
- # @!method assert_no_unchecked_field
230
- # @!method refute_unchecked_field
231
-
232
- ##
233
- # Assertion that there is select
234
- #
235
- # @!method assert_select
236
- # see {Capybara::Node::Matchers#has_select?}
237
-
238
- ##
239
- # Assertion that there is no select
240
- #
241
- # @!method refute_select
242
- # @!method assert_no_select
243
- # see {Capybara::Node::Matchers#has_no_select?}
244
-
245
- ##
246
- # Assertion that there is table
247
- #
248
- # @!method assert_table
249
- # see {Capybara::Node::Matchers#has_table?}
250
-
251
- ##
252
- # Assertion that there is no table
253
- #
254
- # @!method refute_table
255
- # @!method assert_no_table
256
- # see {Capybara::Node::Matchers#has_no_table?}
257
-
258
- private
144
+ ##
145
+ # Assertion that there is xpath
146
+ #
147
+ # @!method assert_xpath
148
+ # see Capybara::Node::Matchers#has_xpath?
149
+
150
+ ##
151
+ # Assertion that there is no xpath
152
+ #
153
+ # @!method refute_xpath
154
+ # @!method assert_no_xpath
155
+ # see Capybara::Node::Matchers#has_no_xpath?
156
+
157
+ ##
158
+ # Assertion that there is css
159
+ #
160
+ # @!method assert_css
161
+ # see Capybara::Node::Matchers#has_css?
162
+
163
+ ##
164
+ # Assertion that there is no css
165
+ #
166
+ # @!method refute_css
167
+ # @!method assert_no_css
168
+ # see Capybara::Node::Matchers#has_no_css?
169
+
170
+ ##
171
+ # Assertion that there is link
172
+ #
173
+ # @!method assert_link
174
+ # see {Capybara::Node::Matchers#has_link?}
175
+
176
+ ##
177
+ # Assertion that there is no link
178
+ #
179
+ # @!method assert_no_link
180
+ # @!method refute_link
181
+ # see {Capybara::Node::Matchers#has_no_link?}
182
+
183
+ ##
184
+ # Assertion that there is button
185
+ #
186
+ # @!method assert_button
187
+ # see {Capybara::Node::Matchers#has_button?}
188
+
189
+ ##
190
+ # Assertion that there is no button
191
+ #
192
+ # @!method refute_button
193
+ # @!method assert_no_button
194
+ # see {Capybara::Node::Matchers#has_no_button?}
195
+
196
+ ##
197
+ # Assertion that there is field
198
+ #
199
+ # @!method assert_field
200
+ # see {Capybara::Node::Matchers#has_field?}
201
+
202
+ ##
203
+ # Assertion that there is no field
204
+ #
205
+ # @!method refute_field
206
+ # @!method assert_no_field
207
+ # see {Capybara::Node::Matchers#has_no_field?}
208
+
209
+ ##
210
+ # Assertion that there is checked_field
211
+ #
212
+ # @!method assert_checked_field
213
+ # see {Capybara::Node::Matchers#has_checked_field?}
214
+
215
+ ##
216
+ # Assertion that there is no checked_field
217
+ #
218
+ # @!method assert_no_checked_field
219
+ # @!method refute_checked_field
220
+
221
+ ##
222
+ # Assertion that there is unchecked_field
223
+ #
224
+ # @!method assert_unchecked_field
225
+ # see {Capybara::Node::Matchers#has_unchecked_field?}
226
+
227
+ ##
228
+ # Assertion that there is no unchecked_field
229
+ #
230
+ # @!method assert_no_unchecked_field
231
+ # @!method refute_unchecked_field
232
+
233
+ ##
234
+ # Assertion that there is select
235
+ #
236
+ # @!method assert_select
237
+ # see {Capybara::Node::Matchers#has_select?}
238
+
239
+ ##
240
+ # Assertion that there is no select
241
+ #
242
+ # @!method refute_select
243
+ # @!method assert_no_select
244
+ # see {Capybara::Node::Matchers#has_no_select?}
245
+
246
+ ##
247
+ # Assertion that there is table
248
+ #
249
+ # @!method assert_table
250
+ # see {Capybara::Node::Matchers#has_table?}
251
+
252
+ ##
253
+ # Assertion that there is no table
254
+ #
255
+ # @!method refute_table
256
+ # @!method assert_no_table
257
+ # see {Capybara::Node::Matchers#has_no_table?}
258
+
259
+ private
259
260
 
260
261
  def determine_subject(args)
261
262
  case args.first
262
263
  when Capybara::Session, Capybara::Node::Base, Capybara::Node::Simple
263
- args
264
+ [args.shift, args]
265
+ when ->(arg) { arg.respond_to?(:to_capybara_node) }
266
+ [args.shift.to_capybara_node, args]
264
267
  else
265
- [page, *args]
268
+ [page, args]
266
269
  end
267
270
  end
268
271