capybara 3.29.0 → 3.32.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +62 -1
  3. data/README.md +1 -1
  4. data/lib/capybara/config.rb +7 -3
  5. data/lib/capybara/dsl.rb +10 -2
  6. data/lib/capybara/helpers.rb +3 -1
  7. data/lib/capybara/minitest.rb +231 -142
  8. data/lib/capybara/minitest/spec.rb +153 -97
  9. data/lib/capybara/node/actions.rb +23 -19
  10. data/lib/capybara/node/document.rb +2 -2
  11. data/lib/capybara/node/document_matchers.rb +3 -3
  12. data/lib/capybara/node/element.rb +23 -16
  13. data/lib/capybara/node/finders.rb +17 -11
  14. data/lib/capybara/node/matchers.rb +60 -45
  15. data/lib/capybara/node/simple.rb +4 -2
  16. data/lib/capybara/queries/ancestor_query.rb +1 -1
  17. data/lib/capybara/queries/base_query.rb +2 -1
  18. data/lib/capybara/queries/selector_query.rb +17 -4
  19. data/lib/capybara/queries/sibling_query.rb +1 -1
  20. data/lib/capybara/rack_test/browser.rb +7 -2
  21. data/lib/capybara/rack_test/driver.rb +1 -1
  22. data/lib/capybara/rack_test/form.rb +1 -1
  23. data/lib/capybara/rack_test/node.rb +34 -9
  24. data/lib/capybara/result.rb +25 -4
  25. data/lib/capybara/rspec/matcher_proxies.rb +4 -4
  26. data/lib/capybara/rspec/matchers.rb +27 -27
  27. data/lib/capybara/rspec/matchers/base.rb +12 -6
  28. data/lib/capybara/rspec/matchers/count_sugar.rb +2 -1
  29. data/lib/capybara/rspec/matchers/have_ancestor.rb +4 -3
  30. data/lib/capybara/rspec/matchers/have_current_path.rb +2 -2
  31. data/lib/capybara/rspec/matchers/have_selector.rb +15 -7
  32. data/lib/capybara/rspec/matchers/have_sibling.rb +3 -3
  33. data/lib/capybara/rspec/matchers/have_text.rb +2 -2
  34. data/lib/capybara/rspec/matchers/have_title.rb +2 -2
  35. data/lib/capybara/rspec/matchers/match_selector.rb +3 -3
  36. data/lib/capybara/rspec/matchers/match_style.rb +2 -2
  37. data/lib/capybara/rspec/matchers/spatial_sugar.rb +2 -1
  38. data/lib/capybara/selector.rb +24 -16
  39. data/lib/capybara/selector/css.rb +1 -1
  40. data/lib/capybara/selector/definition.rb +2 -2
  41. data/lib/capybara/selector/definition/button.rb +7 -2
  42. data/lib/capybara/selector/definition/checkbox.rb +2 -2
  43. data/lib/capybara/selector/definition/css.rb +3 -1
  44. data/lib/capybara/selector/definition/datalist_input.rb +1 -1
  45. data/lib/capybara/selector/definition/datalist_option.rb +1 -1
  46. data/lib/capybara/selector/definition/element.rb +1 -1
  47. data/lib/capybara/selector/definition/field.rb +1 -1
  48. data/lib/capybara/selector/definition/file_field.rb +1 -1
  49. data/lib/capybara/selector/definition/fillable_field.rb +1 -1
  50. data/lib/capybara/selector/definition/label.rb +4 -2
  51. data/lib/capybara/selector/definition/radio_button.rb +2 -2
  52. data/lib/capybara/selector/definition/select.rb +32 -13
  53. data/lib/capybara/selector/definition/table.rb +5 -2
  54. data/lib/capybara/selector/filter_set.rb +11 -9
  55. data/lib/capybara/selector/filters/base.rb +6 -1
  56. data/lib/capybara/selector/filters/locator_filter.rb +1 -1
  57. data/lib/capybara/selector/selector.rb +4 -2
  58. data/lib/capybara/selenium/atoms/getAttribute.min.js +1 -1
  59. data/lib/capybara/selenium/atoms/src/getAttribute.js +1 -1
  60. data/lib/capybara/selenium/driver.rb +20 -11
  61. data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +1 -1
  62. data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +2 -2
  63. data/lib/capybara/selenium/extensions/html5_drag.rb +30 -13
  64. data/lib/capybara/selenium/node.rb +96 -18
  65. data/lib/capybara/selenium/nodes/chrome_node.rb +11 -14
  66. data/lib/capybara/selenium/nodes/edge_node.rb +4 -2
  67. data/lib/capybara/selenium/nodes/firefox_node.rb +3 -3
  68. data/lib/capybara/selenium/patches/action_pauser.rb +26 -0
  69. data/lib/capybara/server.rb +15 -3
  70. data/lib/capybara/server/checker.rb +1 -1
  71. data/lib/capybara/server/middleware.rb +20 -10
  72. data/lib/capybara/session.rb +40 -23
  73. data/lib/capybara/session/config.rb +6 -2
  74. data/lib/capybara/session/matchers.rb +6 -6
  75. data/lib/capybara/spec/public/test.js +62 -6
  76. data/lib/capybara/spec/session/all_spec.rb +60 -5
  77. data/lib/capybara/spec/session/ancestor_spec.rb +5 -0
  78. data/lib/capybara/spec/session/assert_text_spec.rb +9 -5
  79. data/lib/capybara/spec/session/click_button_spec.rb +5 -0
  80. data/lib/capybara/spec/session/fill_in_spec.rb +29 -0
  81. data/lib/capybara/spec/session/find_spec.rb +31 -8
  82. data/lib/capybara/spec/session/has_css_spec.rb +12 -9
  83. data/lib/capybara/spec/session/has_select_spec.rb +28 -0
  84. data/lib/capybara/spec/session/has_table_spec.rb +51 -5
  85. data/lib/capybara/spec/session/has_text_spec.rb +35 -0
  86. data/lib/capybara/spec/session/node_spec.rb +154 -23
  87. data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +2 -2
  88. data/lib/capybara/spec/session/save_screenshot_spec.rb +4 -4
  89. data/lib/capybara/spec/session/selectors_spec.rb +15 -2
  90. data/lib/capybara/spec/session/window/window_spec.rb +7 -7
  91. data/lib/capybara/spec/spec_helper.rb +1 -2
  92. data/lib/capybara/spec/views/form.erb +16 -1
  93. data/lib/capybara/spec/views/with_html.erb +2 -2
  94. data/lib/capybara/version.rb +1 -1
  95. data/spec/dsl_spec.rb +2 -2
  96. data/spec/minitest_spec_spec.rb +46 -46
  97. data/spec/rack_test_spec.rb +12 -1
  98. data/spec/regexp_dissassembler_spec.rb +40 -36
  99. data/spec/result_spec.rb +42 -15
  100. data/spec/rspec/features_spec.rb +1 -0
  101. data/spec/rspec/shared_spec_matchers.rb +3 -3
  102. data/spec/rspec_spec.rb +4 -4
  103. data/spec/selenium_spec_chrome.rb +9 -4
  104. data/spec/selenium_spec_chrome_remote.rb +2 -0
  105. data/spec/selenium_spec_firefox.rb +7 -2
  106. data/spec/server_spec.rb +42 -0
  107. data/spec/session_spec.rb +1 -1
  108. data/spec/shared_selenium_node.rb +21 -3
  109. data/spec/shared_selenium_session.rb +23 -13
  110. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f11a887ca6aed51d064d9c8eb797e0db4605a3d013082a11f4f4b1013b27bef
4
- data.tar.gz: 714e834fdb1c2f0e692f547a1d032113dd888d6905eddecc60f05503720bcd8e
3
+ metadata.gz: e457be34204bbe3a7127ca305fdc2f60be46ec3e92249d27ad351f6bd4473f67
4
+ data.tar.gz: 9549c4cdc7c22c4c6540c9177aed22bf57e5a5301e97a6e0f407a3a3ef6b0ac9
5
5
  SHA512:
6
- metadata.gz: 82c37d1b9c8d1c7f9d858f8d7aebebfc2ecee4c5e35d35f9a3c949d978e4e97d48f78b9d5f93079e209fc779ab31e5707ecce8ac0d2a4ce8108fc3be2437e1bc
7
- data.tar.gz: '06886b335dd0ef5f93f59a09026877bc460e6430b2d2f1902cd31a3179b1bd52b9418a1b43ab558dcf18e92b198506023c3549a065949bb33f881538ec9e018d'
6
+ metadata.gz: e6f30d47408a541fdc06b38e53f4a5f9d5cbaad05c1b2d450ea5e1edd101afb7188c6718727beaf232ecf94d595570f92dbe0f1b29d1769c94bf557b8542b335
7
+ data.tar.gz: 4cff5a7b19910ff7a136a8e3976194d381aef6e49715480a1b70ea6123412ac7020520eca499a7b717c6c05d578a3216763400e65e2afb7f7f3a1e7b825c3721
data/History.md CHANGED
@@ -1,5 +1,66 @@
1
+ # Version 3.32.1
2
+ Release date: 2020-04-05
3
+
4
+ ### Fixed
5
+
6
+ * Rapid set now respects field maxlength (Issue #2332)
7
+ * Only patch pause into legacy actions in Selenium < 4 (Issue #2334)
8
+
9
+ # Version 3.32.0
10
+ Release date: 2020-03-29
11
+
12
+ ### Added
13
+
14
+ * Support `delay` setting on click with Selenium
15
+ * Implement rapid set for values longer thn 30 characters in text fields with Selenium
16
+
17
+ ### Fixed
18
+
19
+ * Result#[] and negative max on ranges (Issue #2302/2303) [Jeremy Evans]
20
+ * RackTest form submission rewrites query string when using GET method
21
+ * Ruby 2.7 deprecation warnings in RSpec matcher proxies
22
+
23
+ # Version 3.31.0
24
+ Release date: 2020-01-26
25
+
26
+ ### Added
27
+
28
+ * Support setting range inputs with the selenium driver [Andrew White]
29
+ * Support setting range inputs with the rack driver
30
+ * Support drop modifier keys in drag & drop [Elliot Crosby-McCullough]
31
+ * `enabled_options` and `disabled options` filters for select selector
32
+ * Support beginless ranges
33
+ * Optionally allow `all` results to be reloaded when stable - Beta feature - may be removed in
34
+ future version if problems occur
35
+
36
+ ### Fixed
37
+
38
+ * Fix Ruby 2.7 deprecation notices around keyword arguments. I have tried to do this without
39
+ any breaking changes, but due to the nature of the 2.7 changes and some selector types accepting
40
+ Hashes as locators there are a lot of edge cases. If you find any broken cases please report
41
+ them and I'll see if they're fixable.
42
+ * Clicking on details/summary element behavior in rack_test driver_
43
+
44
+ # Version 3.30.0
45
+ Release date: 2019-12-24
46
+
47
+ ### Added
48
+
49
+ * Display pending requests when they don't complete in time [Juan Carlos Medina]
50
+ * :order option in selector queries - set to :reverse to for reverse document order results
51
+ * Support regexp for :name and :placeholder options in selectors that import filters from
52
+ _field filter set
53
+
54
+ ### Fixed
55
+
56
+ * Issue around automatic port assignment - Issue #2245
57
+ * Label selector when label has no id - Issue #2260
58
+ * Preserve clientX/clientY in Selenium HTML5 drag emulation [Nicolò G.]
59
+ * table selector using :with_cols option if last specified column matched but others didn't - Issue #2287
60
+ * Some tests updated for Ruby 2.7 behavior change around keyword args
61
+
1
62
  # Version 3.29.0
2
- Release date: Unreleased
63
+ Release date: 2019-09-02
3
64
 
4
65
  ### Added
5
66
 
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jnicklas/capybara?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
8
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=capybara&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=capybara&package-manager=bundler&version-scheme=semver)
9
9
 
10
- **Note** You are viewing the README for the 3.29.x version of Capybara.
10
+ **Note** You are viewing the README for the 3.32.x version of Capybara.
11
11
 
12
12
  Capybara helps you test web applications by simulating how a real user would
13
13
  interact with your app. It is agnostic about the driver running your tests and
@@ -27,7 +27,9 @@ module Capybara
27
27
  attr_writer :reuse_server
28
28
 
29
29
  def threadsafe=(bool)
30
- raise 'Threadsafe setting cannot be changed once a session is created' if (bool != threadsafe) && Session.instance_created?
30
+ if (bool != threadsafe) && Session.instance_created?
31
+ raise 'Threadsafe setting cannot be changed once a session is created'
32
+ end
31
33
 
32
34
  @threadsafe = bool
33
35
  end
@@ -59,7 +61,7 @@ module Capybara
59
61
  @server = if name.respond_to? :call
60
62
  name
61
63
  elsif options
62
- proc { |app, port, host| Capybara.servers[name.to_sym].call(app, port, host, options) }
64
+ proc { |app, port, host| Capybara.servers[name.to_sym].call(app, port, host, **options) }
63
65
  else
64
66
  Capybara.servers[name.to_sym]
65
67
  end
@@ -83,7 +85,9 @@ module Capybara
83
85
 
84
86
  def deprecate(method, alternate_method, once = false)
85
87
  @deprecation_notified ||= {}
86
- warn "DEPRECATED: ##{method} is deprecated, please use ##{alternate_method} instead" unless once && @deprecation_notified[method]
88
+ unless once && @deprecation_notified[method]
89
+ warn "DEPRECATED: ##{method} is deprecated, please use ##{alternate_method} instead"
90
+ end
87
91
  @deprecation_notified[method] = true
88
92
  end
89
93
  end
@@ -47,8 +47,16 @@ module Capybara
47
47
  end
48
48
 
49
49
  Session::DSL_METHODS.each do |method|
50
- define_method method do |*args, &block|
51
- page.send method, *args, &block
50
+ if RUBY_VERSION >= '2.7'
51
+ class_eval <<~METHOD, __FILE__, __LINE__ + 1
52
+ def #{method}(...)
53
+ page.method("#{method}").call(...)
54
+ end
55
+ METHOD
56
+ else
57
+ define_method method do |*args, &block|
58
+ page.send method, *args, &block
59
+ end
52
60
  end
53
61
  end
54
62
  end
@@ -87,7 +87,9 @@ module Capybara
87
87
  end
88
88
 
89
89
  def expired?
90
- raise Capybara::FrozenInTime, 'Time appears to be frozen. Capybara does not work with libraries which freeze time, consider using time travelling instead' if stalled?
90
+ if stalled?
91
+ raise Capybara::FrozenInTime, 'Time appears to be frozen. Capybara does not work with libraries which freeze time, consider using time travelling instead'
92
+ end
91
93
 
92
94
  current - @start >= @expire_in
93
95
  end
@@ -6,41 +6,47 @@ require 'capybara/dsl'
6
6
  module Capybara
7
7
  module Minitest
8
8
  module Assertions
9
- ## Assert text exists
9
+ ##
10
+ # Assert text exists
10
11
  #
12
+ # @!method assert_content
11
13
  # @!method assert_text
12
- # @see Capybara::Node::Matchers#assert_text
14
+ # See {Capybara::Node::Matchers#assert_text}
13
15
 
14
- ## Assert text does not exist
16
+ ##
17
+ # Assert text does not exist
15
18
  #
19
+ # @!method refute_content
20
+ # @!method assert_no_content
21
+ # @!method refute_text
16
22
  # @!method assert_no_text
17
- # @see Capybara::Node::Matchers#assert_no_text
23
+ # See {Capybara::Node::Matchers#assert_no_text}
18
24
 
19
25
  ##
20
26
  # Assertion that page title does match
21
27
  #
22
28
  # @!method assert_title
23
- # @see Capybara::Node::DocumentMatchers#assert_title
29
+ # See {Capybara::Node::DocumentMatchers#assert_title}
24
30
 
25
31
  ##
26
32
  # Assertion that page title does not match
27
33
  #
28
34
  # @!method refute_title
29
35
  # @!method assert_no_title
30
- # @see Capybara::Node::DocumentMatchers#assert_no_title
36
+ # See {Capybara::Node::DocumentMatchers#assert_no_title}
31
37
 
32
38
  ##
33
39
  # Assertion that current path matches
34
40
  #
35
41
  # @!method assert_current_path
36
- # @see Capybara::SessionMatchers#assert_current_path
42
+ # See {Capybara::SessionMatchers#assert_current_path}
37
43
 
38
44
  ##
39
45
  # Assertion that current page does not match
40
46
  #
41
47
  # @!method refute_current_path
42
48
  # @!method assert_no_current_path
43
- # @see Capybara::SessionMatchers#assert_no_current_path
49
+ # See {Capybara::SessionMatchers#assert_no_current_path}
44
50
 
45
51
  %w[text no_text title no_title current_path no_current_path].each do |assertion_name|
46
52
  class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
@@ -52,6 +58,7 @@ module Capybara
52
58
  raise ::Minitest::Assertion, e.message
53
59
  end
54
60
  ASSERTION
61
+ ruby2_keywords "assert_#{assertion_name}" if respond_to?(:ruby2_keywords)
55
62
  end
56
63
 
57
64
  alias_method :refute_title, :assert_no_title
@@ -61,40 +68,81 @@ module Capybara
61
68
  alias_method :assert_content, :assert_text
62
69
  alias_method :assert_no_content, :refute_text
63
70
 
64
- ## Assert selector exists on page
71
+ ##
72
+ # Assert selector exists on page
65
73
  #
66
74
  # @!method assert_selector
67
- # @see Capybara::Node::Matchers#assert_selector
75
+ # See {Capybara::Node::Matchers#assert_selector}
68
76
 
69
- ## Assert selector does not exist on page
77
+ ##
78
+ # Assert selector does not exist on page
70
79
  #
80
+ # @!method refute_selector
71
81
  # @!method assert_no_selector
72
- # @see Capybara::Node::Matchers#assert_no_selector
82
+ # See {Capybara::Node::Matchers#assert_no_selector}
73
83
 
74
- ## Assert element matches selector
84
+ ##
85
+ # Assert element matches selector
75
86
  #
76
87
  # @!method assert_matches_selector
77
- # @see Capybara::Node::Matchers#assert_matches_selector
88
+ # See {Capybara::Node::Matchers#assert_matches_selector}
89
+
90
+ ##
91
+ # Assert element does not match selector
92
+ #
93
+ # @!method refute_matches_selector
94
+ # @!method assert_not_matches_selector
95
+ # See {Capybara::Node::Matchers#assert_not_matches_selector}
78
96
 
79
- ## Assert element does not match selector
97
+ ##
98
+ # Assert all of the provided selectors exist on page
80
99
  #
81
- # @!method assert_xpath
82
- # @see Capybara::Node::Matchers#assert_not_matches_selector
100
+ # @!method assert_all_of_selectors
101
+ # See {Capybara::Node::Matchers#assert_all_of_selectors}
102
+
103
+ ##
104
+ # Assert none of the provided selectors exist on page
105
+ #
106
+ # @!method assert_none_of_selectors
107
+ # See {Capybara::Node::Matchers#assert_none_of_selectors}
108
+
109
+ ##
110
+ # Assert any of the provided selectors exist on page
111
+ #
112
+ # @!method assert_any_of_selectors
113
+ # See {Capybara::Node::Matchers#assert_any_of_selectors}
83
114
 
84
- ## Assert element has the provided CSS styles
115
+ ##
116
+ # Assert element has the provided CSS styles
85
117
  #
86
118
  # @!method assert_matches_style
87
- # @see Capybara::Node::Matchers#assert_matches_style
119
+ # See {Capybara::Node::Matchers#assert_matches_style}
88
120
 
89
- ## Assert element has a matching sibling
121
+ ##
122
+ # Assert element has a matching sibling
90
123
  #
91
124
  # @!method assert_sibling
92
- # @see Capybara::Node::Matchers#assert_sibling
125
+ # See {Capybara::Node::Matchers#assert_sibling}
93
126
 
94
- ## Assert element has a matching ancestor
127
+ ##
128
+ # Assert element does not have a matching sibling
129
+ #
130
+ # @!method refute_sibling
131
+ # @!method assert_no_sibling
132
+ # See {Capybara::Node::Matchers#assert_no_sibling}
133
+
134
+ ##
135
+ # Assert element has a matching ancestor
95
136
  #
96
137
  # @!method assert_ancestor
97
- # @see Capybara::Node::Matchers#assert_ancestor
138
+ # See {Capybara::Node::Matchers#assert_ancestor}
139
+
140
+ ##
141
+ # Assert element does not have a matching ancestor
142
+ #
143
+ # @!method refute_ancestor
144
+ # @!method assert_no_ancestor
145
+ # See {Capybara::Node::Matchers#assert_no_ancestor}
98
146
 
99
147
  %w[selector no_selector matches_style
100
148
  all_of_selectors none_of_selectors any_of_selectors
@@ -109,6 +157,7 @@ module Capybara
109
157
  raise ::Minitest::Assertion, e.message
110
158
  end
111
159
  ASSERTION
160
+ ruby2_keywords "assert_#{assertion_name}" if respond_to?(:ruby2_keywords)
112
161
  end
113
162
 
114
163
  alias_method :refute_selector, :assert_no_selector
@@ -116,18 +165,137 @@ module Capybara
116
165
  alias_method :refute_ancestor, :assert_no_ancestor
117
166
  alias_method :refute_sibling, :assert_no_sibling
118
167
 
168
+ ##
169
+ # Assert that provided xpath exists
170
+ #
171
+ # @!method assert_xpath
172
+ # See {Capybara::Node::Matchers#has_xpath?}
173
+
174
+ ##
175
+ # Assert that provide xpath does not exist
176
+ #
177
+ # @!method refute_xpath
178
+ # @!method assert_no_xpath
179
+ # See {Capybara::Node::Matchers#has_no_xpath?}
180
+
181
+ ##
182
+ # Assert that provided css exists
183
+ #
184
+ # @!method assert_css
185
+ # See {Capybara::Node::Matchers#has_css?}
186
+
187
+ ##
188
+ # Assert that provided css does not exist
189
+ #
190
+ # @!method refute_css
191
+ # @!method assert_no_css
192
+ # See {Capybara::Node::Matchers#has_no_css?}
193
+
194
+ ##
195
+ # Assert that provided link exists
196
+ #
197
+ # @!method assert_link
198
+ # See {Capybara::Node::Matchers#has_link?}
199
+
200
+ ##
201
+ # Assert that provided link does not exist
202
+ #
203
+ # @!method assert_no_link
204
+ # @!method refute_link
205
+ # See {Capybara::Node::Matchers#has_no_link?}
206
+
207
+ ##
208
+ # Assert that provided button exists
209
+ #
210
+ # @!method assert_button
211
+ # See {Capybara::Node::Matchers#has_button?}
212
+
213
+ ##
214
+ # Assert that provided button does not exist
215
+ #
216
+ # @!method refute_button
217
+ # @!method assert_no_button
218
+ # See {Capybara::Node::Matchers#has_no_button?}
219
+
220
+ ##
221
+ # Assert that provided field exists
222
+ #
223
+ # @!method assert_field
224
+ # See {Capybara::Node::Matchers#has_field?}
225
+
226
+ ##
227
+ # Assert that provided field does not exist
228
+ #
229
+ # @!method refute_field
230
+ # @!method assert_no_field
231
+ # See {Capybara::Node::Matchers#has_no_field?}
232
+
233
+ ##
234
+ # Assert that provided checked field exists
235
+ #
236
+ # @!method assert_checked_field
237
+ # See {Capybara::Node::Matchers#has_checked_field?}
238
+
239
+ ##
240
+ # Assert that provided checked_field does not exist
241
+ #
242
+ # @!method assert_no_checked_field
243
+ # @!method refute_checked_field
244
+ # See {Capybara::Node::Matchers#has_no_checked_field?}
245
+
246
+ ##
247
+ # Assert that provided unchecked field exists
248
+ #
249
+ # @!method assert_unchecked_field
250
+ # See {Capybara::Node::Matchers#has_unchecked_field?}
251
+
252
+ ##
253
+ # Assert that provided unchecked field does not exist
254
+ #
255
+ # @!method assert_no_unchecked_field
256
+ # @!method refute_unchecked_field
257
+ # See {Capybara::Node::Matchers#has_no_unchecked_field?}
258
+
259
+ ##
260
+ # Assert that provided select exists
261
+ #
262
+ # @!method assert_select
263
+ # See {Capybara::Node::Matchers#has_select?}
264
+
265
+ ##
266
+ # Assert that provided select does not exist
267
+ #
268
+ # @!method refute_select
269
+ # @!method assert_no_select
270
+ # See {Capybara::Node::Matchers#has_no_select?}
271
+
272
+ ##
273
+ # Assert that provided table exists
274
+ #
275
+ # @!method assert_table
276
+ # See {Capybara::Node::Matchers#has_table?}
277
+
278
+ ##
279
+ # Assert that provided table does not exist
280
+ #
281
+ # @!method refute_table
282
+ # @!method assert_no_table
283
+ # See {Capybara::Node::Matchers#has_no_table?}
284
+
119
285
  %w[xpath css link button field select table].each do |selector_type|
120
286
  define_method "assert_#{selector_type}" do |*args, &optional_filter_block|
121
287
  subject, args = determine_subject(args)
122
288
  locator, options = extract_locator(args)
123
- assert_selector(subject, selector_type.to_sym, locator, options, &optional_filter_block)
289
+ assert_selector(subject, selector_type.to_sym, locator, **options, &optional_filter_block)
124
290
  end
291
+ ruby2_keywords "assert_#{selector_type}" if respond_to?(:ruby2_keywords)
125
292
 
126
293
  define_method "assert_no_#{selector_type}" do |*args, &optional_filter_block|
127
294
  subject, args = determine_subject(args)
128
295
  locator, options = extract_locator(args)
129
- assert_no_selector(subject, selector_type.to_sym, locator, options, &optional_filter_block)
296
+ assert_no_selector(subject, selector_type.to_sym, locator, **options, &optional_filter_block)
130
297
  end
298
+ ruby2_keywords "assert_no_#{selector_type}" if respond_to?(:ruby2_keywords)
131
299
  alias_method "refute_#{selector_type}", "assert_no_#{selector_type}"
132
300
  end
133
301
 
@@ -135,145 +303,66 @@ module Capybara
135
303
  define_method "assert_#{field_type}_field" do |*args, &optional_filter_block|
136
304
  subject, args = determine_subject(args)
137
305
  locator, options = extract_locator(args)
138
- assert_selector(subject, :field, locator, options.merge(field_type.to_sym => true), &optional_filter_block)
306
+ assert_selector(subject, :field, locator, **options.merge(field_type.to_sym => true), &optional_filter_block)
139
307
  end
308
+ ruby2_keywords "assert_#{field_type}_field" if respond_to?(:ruby2_keywords)
140
309
 
141
310
  define_method "assert_no_#{field_type}_field" do |*args, &optional_filter_block|
142
311
  subject, args = determine_subject(args)
143
312
  locator, options = extract_locator(args)
144
- assert_no_selector(subject, :field, locator, options.merge(field_type.to_sym => true), &optional_filter_block)
313
+ assert_no_selector(
314
+ subject,
315
+ :field,
316
+ locator,
317
+ **options.merge(field_type.to_sym => true),
318
+ &optional_filter_block
319
+ )
145
320
  end
321
+ ruby2_keywords "assert_no_#{field_type}_field" if respond_to?(:ruby2_keywords)
146
322
  alias_method "refute_#{field_type}_field", "assert_no_#{field_type}_field"
147
323
  end
148
324
 
325
+ ##
326
+ # Assert that element matches xpath
327
+ #
328
+ # @!method assert_matches_xpath
329
+ # See {Capybara::Node::Matchers#matches_xpath?}
330
+
331
+ ##
332
+ # Assert that element does not match xpath
333
+ #
334
+ # @!method refute_matches_xpath
335
+ # @!method assert_not_matches_xpath
336
+ # See {Capybara::Node::Matchers#not_matches_xpath?}
337
+
338
+ ##
339
+ # Assert that element matches css
340
+ #
341
+ # @!method assert_matches_css
342
+ # See {Capybara::Node::Matchers#matches_css?}
343
+
344
+ ##
345
+ # Assert that element matches css
346
+ #
347
+ # @!method refute_matches_css
348
+ # @!method assert_not_matches_css
349
+ # See {Capybara::Node::Matchers#not_matches_css?}
350
+
149
351
  %w[xpath css].each do |selector_type|
150
352
  define_method "assert_matches_#{selector_type}" do |*args, &optional_filter_block|
151
353
  subject, args = determine_subject(args)
152
354
  assert_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
153
355
  end
356
+ ruby2_keywords "assert_matches_#{selector_type}" if respond_to?(:ruby2_keywords)
154
357
 
155
358
  define_method "assert_not_matches_#{selector_type}" do |*args, &optional_filter_block|
156
359
  subject, args = determine_subject(args)
157
360
  assert_not_matches_selector(subject, selector_type.to_sym, *args, &optional_filter_block)
158
361
  end
362
+ ruby2_keywords "assert_not_matches_#{selector_type}" if respond_to?(:ruby2_keywords)
159
363
  alias_method "refute_matches_#{selector_type}", "assert_not_matches_#{selector_type}"
160
364
  end
161
365
 
162
- ##
163
- # Assertion that there is xpath
164
- #
165
- # @!method assert_xpath
166
- # @see Capybara::Node::Matchers#has_xpath?
167
-
168
- ##
169
- # Assertion that there is no xpath
170
- #
171
- # @!method refute_xpath
172
- # @!method assert_no_xpath
173
- # @see Capybara::Node::Matchers#has_no_xpath?
174
-
175
- ##
176
- # Assertion that there is css
177
- #
178
- # @!method assert_css
179
- # @see Capybara::Node::Matchers#has_css?
180
-
181
- ##
182
- # Assertion that there is no css
183
- #
184
- # @!method refute_css
185
- # @!method assert_no_css
186
- # @see Capybara::Node::Matchers#has_no_css?
187
-
188
- ##
189
- # Assertion that there is link
190
- #
191
- # @!method assert_link
192
- # @see Capybara::Node::Matchers#has_link?
193
-
194
- ##
195
- # Assertion that there is no link
196
- #
197
- # @!method assert_no_link
198
- # @!method refute_link
199
- # @see Capybara::Node::Matchers#has_no_link?
200
-
201
- ##
202
- # Assertion that there is button
203
- #
204
- # @!method assert_button
205
- # @see Capybara::Node::Matchers#has_button?
206
-
207
- ##
208
- # Assertion that there is no button
209
- #
210
- # @!method refute_button
211
- # @!method assert_no_button
212
- # @see Capybara::Node::Matchers#has_no_button?
213
-
214
- ##
215
- # Assertion that there is field
216
- #
217
- # @!method assert_field
218
- # @see Capybara::Node::Matchers#has_field?
219
-
220
- ##
221
- # Assertion that there is no field
222
- #
223
- # @!method refute_field
224
- # @!method assert_no_field
225
- # @see Capybara::Node::Matchers#has_no_field?
226
-
227
- ##
228
- # Assertion that there is checked_field
229
- #
230
- # @!method assert_checked_field
231
- # @see Capybara::Node::Matchers#has_checked_field?
232
-
233
- ##
234
- # Assertion that there is no checked_field
235
- #
236
- # @!method assert_no_checked_field
237
- # @!method refute_checked_field
238
-
239
- ##
240
- # Assertion that there is unchecked_field
241
- #
242
- # @!method assert_unchecked_field
243
- # @see Capybara::Node::Matchers#has_unchecked_field?
244
-
245
- ##
246
- # Assertion that there is no unchecked_field
247
- #
248
- # @!method assert_no_unchecked_field
249
- # @!method refute_unchecked_field
250
-
251
- ##
252
- # Assertion that there is select
253
- #
254
- # @!method assert_select
255
- # @see Capybara::Node::Matchers#has_select?
256
-
257
- ##
258
- # Assertion that there is no select
259
- #
260
- # @!method refute_select
261
- # @!method assert_no_select
262
- # @see Capybara::Node::Matchers#has_no_select?
263
-
264
- ##
265
- # Assertion that there is table
266
- #
267
- # @!method assert_table
268
- # @see Capybara::Node::Matchers#has_table?
269
-
270
- ##
271
- # Assertion that there is no table
272
- #
273
- # @!method refute_table
274
- # @!method assert_no_table
275
- # @see Capybara::Node::Matchers#has_no_table?
276
-
277
366
  private
278
367
 
279
368
  def determine_subject(args)