capybara 3.29.0 → 3.37.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +229 -15
  3. data/README.md +13 -4
  4. data/lib/capybara/config.rb +24 -10
  5. data/lib/capybara/cucumber.rb +1 -1
  6. data/lib/capybara/driver/base.rb +8 -0
  7. data/lib/capybara/driver/node.rb +5 -1
  8. data/lib/capybara/dsl.rb +5 -3
  9. data/lib/capybara/helpers.rb +19 -2
  10. data/lib/capybara/minitest/spec.rb +156 -97
  11. data/lib/capybara/minitest.rb +232 -144
  12. data/lib/capybara/node/actions.rb +41 -37
  13. data/lib/capybara/node/base.rb +6 -6
  14. data/lib/capybara/node/document.rb +2 -2
  15. data/lib/capybara/node/document_matchers.rb +3 -3
  16. data/lib/capybara/node/element.rb +35 -21
  17. data/lib/capybara/node/finders.rb +33 -19
  18. data/lib/capybara/node/matchers.rb +72 -57
  19. data/lib/capybara/node/simple.rb +13 -3
  20. data/lib/capybara/queries/active_element_query.rb +18 -0
  21. data/lib/capybara/queries/ancestor_query.rb +4 -3
  22. data/lib/capybara/queries/base_query.rb +2 -1
  23. data/lib/capybara/queries/current_path_query.rb +14 -4
  24. data/lib/capybara/queries/selector_query.rb +91 -30
  25. data/lib/capybara/queries/sibling_query.rb +4 -3
  26. data/lib/capybara/queries/style_query.rb +1 -1
  27. data/lib/capybara/queries/text_query.rb +7 -1
  28. data/lib/capybara/rack_test/browser.rb +68 -10
  29. data/lib/capybara/rack_test/driver.rb +6 -5
  30. data/lib/capybara/rack_test/form.rb +2 -2
  31. data/lib/capybara/rack_test/node.rb +44 -16
  32. data/lib/capybara/registration_container.rb +41 -0
  33. data/lib/capybara/registrations/drivers.rb +18 -12
  34. data/lib/capybara/registrations/patches/puma_ssl.rb +3 -1
  35. data/lib/capybara/registrations/servers.rb +3 -2
  36. data/lib/capybara/result.rb +35 -15
  37. data/lib/capybara/rspec/matcher_proxies.rb +8 -8
  38. data/lib/capybara/rspec/matchers/base.rb +12 -6
  39. data/lib/capybara/rspec/matchers/count_sugar.rb +2 -1
  40. data/lib/capybara/rspec/matchers/have_ancestor.rb +4 -3
  41. data/lib/capybara/rspec/matchers/have_current_path.rb +2 -2
  42. data/lib/capybara/rspec/matchers/have_selector.rb +16 -8
  43. data/lib/capybara/rspec/matchers/have_sibling.rb +3 -3
  44. data/lib/capybara/rspec/matchers/have_text.rb +3 -3
  45. data/lib/capybara/rspec/matchers/have_title.rb +2 -2
  46. data/lib/capybara/rspec/matchers/match_selector.rb +3 -3
  47. data/lib/capybara/rspec/matchers/match_style.rb +7 -2
  48. data/lib/capybara/rspec/matchers/spatial_sugar.rb +2 -1
  49. data/lib/capybara/rspec/matchers.rb +33 -32
  50. data/lib/capybara/rspec.rb +2 -0
  51. data/lib/capybara/selector/builders/css_builder.rb +2 -2
  52. data/lib/capybara/selector/builders/xpath_builder.rb +4 -2
  53. data/lib/capybara/selector/css.rb +2 -2
  54. data/lib/capybara/selector/definition/button.rb +35 -13
  55. data/lib/capybara/selector/definition/checkbox.rb +3 -3
  56. data/lib/capybara/selector/definition/css.rb +3 -1
  57. data/lib/capybara/selector/definition/datalist_input.rb +2 -2
  58. data/lib/capybara/selector/definition/datalist_option.rb +1 -1
  59. data/lib/capybara/selector/definition/element.rb +3 -2
  60. data/lib/capybara/selector/definition/field.rb +1 -1
  61. data/lib/capybara/selector/definition/file_field.rb +2 -2
  62. data/lib/capybara/selector/definition/fillable_field.rb +3 -3
  63. data/lib/capybara/selector/definition/label.rb +5 -3
  64. data/lib/capybara/selector/definition/link.rb +8 -0
  65. data/lib/capybara/selector/definition/radio_button.rb +3 -3
  66. data/lib/capybara/selector/definition/select.rb +33 -14
  67. data/lib/capybara/selector/definition/table.rb +6 -3
  68. data/lib/capybara/selector/definition/table_row.rb +2 -2
  69. data/lib/capybara/selector/definition.rb +15 -11
  70. data/lib/capybara/selector/filter_set.rb +17 -17
  71. data/lib/capybara/selector/filters/base.rb +6 -1
  72. data/lib/capybara/selector/filters/locator_filter.rb +1 -1
  73. data/lib/capybara/selector/selector.rb +17 -3
  74. data/lib/capybara/selector.rb +37 -19
  75. data/lib/capybara/selenium/atoms/getAttribute.min.js +1 -1
  76. data/lib/capybara/selenium/atoms/src/getAttribute.js +1 -1
  77. data/lib/capybara/selenium/atoms/src/isDisplayed.js +1 -1
  78. data/lib/capybara/selenium/driver.rb +84 -17
  79. data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +11 -13
  80. data/lib/capybara/selenium/driver_specializations/edge_driver.rb +10 -12
  81. data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +4 -4
  82. data/lib/capybara/selenium/extensions/find.rb +4 -4
  83. data/lib/capybara/selenium/extensions/html5_drag.rb +30 -13
  84. data/lib/capybara/selenium/extensions/scroll.rb +8 -10
  85. data/lib/capybara/selenium/logger_suppressor.rb +8 -2
  86. data/lib/capybara/selenium/node.rb +122 -26
  87. data/lib/capybara/selenium/nodes/chrome_node.rb +34 -19
  88. data/lib/capybara/selenium/nodes/edge_node.rb +5 -3
  89. data/lib/capybara/selenium/nodes/firefox_node.rb +11 -6
  90. data/lib/capybara/selenium/nodes/safari_node.rb +3 -3
  91. data/lib/capybara/selenium/patches/action_pauser.rb +26 -0
  92. data/lib/capybara/selenium/patches/atoms.rb +4 -4
  93. data/lib/capybara/selenium/patches/logs.rb +7 -9
  94. data/lib/capybara/server/animation_disabler.rb +38 -15
  95. data/lib/capybara/server/checker.rb +1 -1
  96. data/lib/capybara/server/middleware.rb +22 -10
  97. data/lib/capybara/server.rb +15 -3
  98. data/lib/capybara/session/config.rb +10 -4
  99. data/lib/capybara/session/matchers.rb +11 -11
  100. data/lib/capybara/session.rb +62 -39
  101. data/lib/capybara/spec/public/test.js +75 -7
  102. data/lib/capybara/spec/session/accept_alert_spec.rb +1 -1
  103. data/lib/capybara/spec/session/active_element_spec.rb +31 -0
  104. data/lib/capybara/spec/session/all_spec.rb +63 -12
  105. data/lib/capybara/spec/session/ancestor_spec.rb +5 -0
  106. data/lib/capybara/spec/session/assert_text_spec.rb +26 -22
  107. data/lib/capybara/spec/session/check_spec.rb +15 -0
  108. data/lib/capybara/spec/session/choose_spec.rb +6 -0
  109. data/lib/capybara/spec/session/click_button_spec.rb +16 -0
  110. data/lib/capybara/spec/session/click_link_or_button_spec.rb +9 -0
  111. data/lib/capybara/spec/session/current_url_spec.rb +11 -1
  112. data/lib/capybara/spec/session/fill_in_spec.rb +29 -0
  113. data/lib/capybara/spec/session/find_spec.rb +37 -8
  114. data/lib/capybara/spec/session/has_any_selectors_spec.rb +4 -0
  115. data/lib/capybara/spec/session/has_button_spec.rb +75 -0
  116. data/lib/capybara/spec/session/has_css_spec.rb +14 -10
  117. data/lib/capybara/spec/session/has_current_path_spec.rb +17 -4
  118. data/lib/capybara/spec/session/has_field_spec.rb +41 -1
  119. data/lib/capybara/spec/session/has_link_spec.rb +30 -0
  120. data/lib/capybara/spec/session/has_select_spec.rb +36 -8
  121. data/lib/capybara/spec/session/has_selector_spec.rb +19 -4
  122. data/lib/capybara/spec/session/has_table_spec.rb +51 -5
  123. data/lib/capybara/spec/session/has_text_spec.rb +21 -1
  124. data/lib/capybara/spec/session/html_spec.rb +1 -1
  125. data/lib/capybara/spec/session/matches_style_spec.rb +2 -2
  126. data/lib/capybara/spec/session/node_spec.rb +226 -33
  127. data/lib/capybara/spec/session/refresh_spec.rb +2 -1
  128. data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +2 -2
  129. data/lib/capybara/spec/session/save_page_spec.rb +4 -4
  130. data/lib/capybara/spec/session/save_screenshot_spec.rb +4 -4
  131. data/lib/capybara/spec/session/scroll_spec.rb +4 -4
  132. data/lib/capybara/spec/session/selectors_spec.rb +15 -2
  133. data/lib/capybara/spec/session/visit_spec.rb +20 -0
  134. data/lib/capybara/spec/session/window/switch_to_window_spec.rb +1 -1
  135. data/lib/capybara/spec/session/window/window_opened_by_spec.rb +1 -1
  136. data/lib/capybara/spec/session/window/window_spec.rb +9 -9
  137. data/lib/capybara/spec/session/window/windows_spec.rb +1 -1
  138. data/lib/capybara/spec/spec_helper.rb +17 -17
  139. data/lib/capybara/spec/test_app.rb +89 -29
  140. data/lib/capybara/spec/views/animated.erb +1 -1
  141. data/lib/capybara/spec/views/form.erb +52 -6
  142. data/lib/capybara/spec/views/frame_child.erb +1 -1
  143. data/lib/capybara/spec/views/frame_one.erb +1 -1
  144. data/lib/capybara/spec/views/frame_parent.erb +1 -1
  145. data/lib/capybara/spec/views/frame_two.erb +1 -1
  146. data/lib/capybara/spec/views/initial_alert.erb +2 -1
  147. data/lib/capybara/spec/views/layout.erb +10 -0
  148. data/lib/capybara/spec/views/obscured.erb +1 -1
  149. data/lib/capybara/spec/views/offset.erb +2 -1
  150. data/lib/capybara/spec/views/path.erb +2 -2
  151. data/lib/capybara/spec/views/popup_one.erb +1 -1
  152. data/lib/capybara/spec/views/popup_two.erb +1 -1
  153. data/lib/capybara/spec/views/react.erb +2 -2
  154. data/lib/capybara/spec/views/scroll.erb +2 -1
  155. data/lib/capybara/spec/views/spatial.erb +1 -1
  156. data/lib/capybara/spec/views/with_animation.erb +10 -3
  157. data/lib/capybara/spec/views/with_base_tag.erb +2 -2
  158. data/lib/capybara/spec/views/with_dragula.erb +5 -3
  159. data/lib/capybara/spec/views/with_fixed_header_footer.erb +2 -1
  160. data/lib/capybara/spec/views/with_hover.erb +2 -2
  161. data/lib/capybara/spec/views/with_html.erb +3 -3
  162. data/lib/capybara/spec/views/with_jquery_animation.erb +24 -0
  163. data/lib/capybara/spec/views/with_js.erb +5 -3
  164. data/lib/capybara/spec/views/with_jstree.erb +1 -1
  165. data/lib/capybara/spec/views/with_namespace.erb +1 -0
  166. data/lib/capybara/spec/views/with_shadow.erb +31 -0
  167. data/lib/capybara/spec/views/with_slow_unload.erb +2 -1
  168. data/lib/capybara/spec/views/with_sortable_js.erb +3 -3
  169. data/lib/capybara/spec/views/with_unload_alert.erb +1 -0
  170. data/lib/capybara/spec/views/with_windows.erb +1 -1
  171. data/lib/capybara/spec/views/within_frames.erb +1 -1
  172. data/lib/capybara/version.rb +1 -1
  173. data/lib/capybara/window.rb +4 -8
  174. data/lib/capybara.rb +36 -29
  175. data/spec/basic_node_spec.rb +25 -11
  176. data/spec/capybara_spec.rb +1 -1
  177. data/spec/dsl_spec.rb +18 -5
  178. data/spec/fixtures/selenium_driver_rspec_failure.rb +2 -2
  179. data/spec/fixtures/selenium_driver_rspec_success.rb +3 -3
  180. data/spec/minitest_spec.rb +3 -2
  181. data/spec/minitest_spec_spec.rb +46 -46
  182. data/spec/rack_test_spec.rb +43 -11
  183. data/spec/regexp_dissassembler_spec.rb +40 -36
  184. data/spec/result_spec.rb +53 -45
  185. data/spec/rspec/features_spec.rb +7 -4
  186. data/spec/rspec/scenarios_spec.rb +5 -1
  187. data/spec/rspec/shared_spec_matchers.rb +68 -56
  188. data/spec/rspec_spec.rb +8 -4
  189. data/spec/sauce_spec_chrome.rb +3 -3
  190. data/spec/selector_spec.rb +19 -4
  191. data/spec/selenium_spec_chrome.rb +49 -26
  192. data/spec/selenium_spec_chrome_remote.rb +13 -6
  193. data/spec/selenium_spec_firefox.rb +29 -17
  194. data/spec/selenium_spec_firefox_remote.rb +2 -2
  195. data/spec/selenium_spec_ie.rb +3 -6
  196. data/spec/selenium_spec_safari.rb +31 -19
  197. data/spec/server_spec.rb +88 -35
  198. data/spec/session_spec.rb +1 -1
  199. data/spec/shared_selenium_node.rb +21 -7
  200. data/spec/shared_selenium_session.rb +123 -21
  201. data/spec/spec_helper.rb +2 -2
  202. metadata +80 -21
  203. data/lib/capybara/spec/session/source_spec.rb +0 -0
  204. data/lib/capybara/spec/views/with_title.erb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f11a887ca6aed51d064d9c8eb797e0db4605a3d013082a11f4f4b1013b27bef
4
- data.tar.gz: 714e834fdb1c2f0e692f547a1d032113dd888d6905eddecc60f05503720bcd8e
3
+ metadata.gz: c7283f19c4364fa2c19379e8da670105ebf59754937fc80117d975cd89959b87
4
+ data.tar.gz: b4fe7210ee210667602e9ec0a9882a1a34d8a64ceddae4df888aba0dd6974940
5
5
  SHA512:
6
- metadata.gz: 82c37d1b9c8d1c7f9d858f8d7aebebfc2ecee4c5e35d35f9a3c949d978e4e97d48f78b9d5f93079e209fc779ab31e5707ecce8ac0d2a4ce8108fc3be2437e1bc
7
- data.tar.gz: '06886b335dd0ef5f93f59a09026877bc460e6430b2d2f1902cd31a3179b1bd52b9418a1b43ab558dcf18e92b198506023c3549a065949bb33f881538ec9e018d'
6
+ metadata.gz: 71de08c12fdd479453fa743e0a7ef858e72ca96d9a32d2ecb0b1721b365a1f1e494309432b52536dcac5669af78fe50e60b1a9f886f0b08a2ac2fd378abfc52e
7
+ data.tar.gz: 91a2e75a15768ef02e8c9b9f1400c4ee1dd2e1e2562b4733dc520afddc4c71be962fcd5c0379481fa65938d0776cfe5434c75f5faf0e512246abca48b06b0c00
data/History.md CHANGED
@@ -1,5 +1,220 @@
1
+ # Version 3.37.1
2
+ Relesae date: 2022-05-09
3
+
4
+ ### Fixed
5
+
6
+ * Regression in rack-test visit - Issue #2548
7
+
8
+ # Version 3.37.0
9
+ Release date: 2022-05-07
10
+
11
+ ### Changed
12
+
13
+ * Ruby 2.7.0+ is now required
14
+
15
+ ### Added
16
+
17
+ * [Beta] CSP nonces inserted into animation disabler additions - Issue #2542
18
+ * Support `<base>` element in rack-test driver - ISsue #2544
19
+ * [Beta] `Element#shadow_root` support. Requires selenium-webdriver 4.1+. Only currently supported with Chrome when using the selenium driver. Note: only CSS can be used to find elements from the shadow root. Therefore you won't be able to use most Capybara helper methods (`fill_in`, `click_link`, `find_field`, etc) directly from the shadow root since those locators are built using XPath. If you first locate a descendant from the shadow root using CSS then you should be able to use all the Capybara methods from there.
20
+ * Regexp now supported for `exact_text` finder option
21
+
22
+ ### Fixed
23
+
24
+ * Fragments in referer headers in rack-test driver - Issue #2525
25
+ * Selenium v4.1 deprecation notice
26
+
27
+ # Version 3.36.0
28
+ Release date: 2021-10-24
29
+
30
+ ### Changed
31
+
32
+ * Ruby 2.6.0+ is now required
33
+ * Minimum selenium-webdriver supported is now 3.142.7
34
+
35
+ ### Added
36
+
37
+ * Support for selenium-webdriver 4.x
38
+ * `allow_label_click` accepts click options to be used when clicking an associated label
39
+ * Deprecated `allow_gumbo=` in favor of `use_html5_parsing=` to enable use of Nokogiri::HTML5 when available
40
+ * `Session#active_element` returns the element with focus - Not supported by the `RackTest` driver [Sean Doyle]
41
+ * Support `focused:` filter for finding interactive elements - Not supported by the `RackTest` driver [Sean Doyle]
42
+
43
+ ### Fixed
44
+
45
+ * Sibling and ancestor queries now work with Simple::Node - Issue #2452
46
+ * rack_test correctly ignores readonly attribute on specific input element types
47
+ * `Node#all_text` always returns a string - Issue #2477
48
+ * `have_any_of_selectors` negated match - Issue #2473
49
+ * `Document#scroll_to` fixed for standards behavior - pass quirks: true if you need the older behavior [Eric Anderson]
50
+ * Use capture on attach file event listener for better React compatibility [Jeff Way]
51
+ * Animation disabler produces valid HTML [Javi Martin]
52
+
53
+ ### Removed
54
+
55
+ * References to non-w3c mode in drivers/tests. Non-w3c mode is obsolete and no one should be using it anymore. Capybara hasn't been testing/supporting it in a while
56
+
57
+ # Version 3.35.3
58
+ Release date: 2021-01-29
59
+
60
+ ### Fixed
61
+
62
+ * Just a release to have the correct dates in the History.md in released gem
63
+
64
+ # Version 3.35.2
65
+ Release date: 2021-01-29
66
+
67
+ ### Fixed
68
+
69
+ * Selenium deprecation suppressor with Selenium 3.x
70
+
71
+ # Version 3.35.1
72
+ Release date: 2021-01-26
73
+
74
+ ### Fixed
75
+
76
+ * Default chrome driver registrations use chrome - Issue #2442 [Yuriy Alekseyev]
77
+ * 'Capybara.test_id' usage with the :button selector - Issue #2443
78
+
79
+ # Version 3.35.0
80
+ Release date: 2021-01-25
81
+
82
+ ### Added
83
+
84
+ * Support Regexp matching for individual class names in :class filter passed an Array
85
+ * Animation disabler now supports JQuery animation disabling when JQuery loaded from body [Chien-Wei Huang]
86
+
87
+ ### Fixed
88
+
89
+ * :button selector type use with `enable_aria_role` [Sean Doyle]
90
+ * <label> elements don't associate with aria-role buttons
91
+ * Ignore Selenium::WebDriver::Error::InvalidSessionIdError when quitting driver [Robin Daugherty]
92
+ * Firefox: Don't click input when sending keys if already focused
93
+ * Miscellaneous issues with selenium-webdriver 4.0.0.alphas
94
+ * Nil return error in node details optimizations
95
+ * Animation disabler now inserts XHTML compliant content [Dale Morgan]
96
+
97
+ # Version 3.34.0
98
+ Release date: 2020-11-26
99
+
100
+ ### Added
101
+
102
+ * Ability to fill in with emoji when using Chrome with selenium driver (Firefox already worked)
103
+ * Current path assertions/expectations accept optional filter block
104
+ * Animation disabler now specifies `scroll-behavior: auto;` [Nathan Broadbent]
105
+ * :button selector can now find elements by label text [Sean Doyle]
106
+ * `Session#send_keys` to send keys to the current element with focus in drivers that support the
107
+ concept of a current element [Sean Doyle]
108
+
109
+ ### Changed
110
+
111
+ * Text query validates the type parameter to prevent undefined behavior
112
+
113
+ ### Fixed
114
+
115
+ * racktest driver better handles fragments and redirection to urls that include fragments
116
+ * Don't error when attempting to get XPath location of a shadow element
117
+ * Missing `readonly?` added to Node::Simple
118
+ * Selenium version detection when loaded via alternate method [Joel Hawksley]
119
+ * Connection count issue if REQUEST_URI value changed by app [Blake Williams]
120
+ * Maintain URI fragment when redirecting in rack-test driver
121
+ * Text query error message [Wojciech Wnętrzak]
122
+ * Checking a checkbox/radio button with `allow_label_click` now works if there are multiple labels (Issue #2421)
123
+ * `drop` with `Pathname` (Issue #2424)[Máximo Mussini]
124
+
125
+ # Version 3.33.0
126
+ Release date: 2020-06-21
127
+
128
+ ### Added
129
+
130
+ * Block passed to `within_session` now receives the new and old session
131
+ * Support for aria-role button when enabled [Seiei Miyagi]
132
+ * Support for aria-role link when enabled
133
+ * Support for `validation_message` filter with :field and :fillable_field selectors
134
+ * Deprecation warnings show source location [Koichi ITO]
135
+
136
+ ### Changed
137
+
138
+ * Ruby 2.5.0+ is now required
139
+ * Deprecated direct manipulation of the driver and server registries
140
+
141
+ ### Fixed
142
+
143
+ * Ruby 2.7 warning in minitest `assert_text` [Eileen M. Uchitelle]
144
+
145
+
146
+ # Version 3.32.2
147
+ Release date: 2020-05-16
148
+
149
+ ### Fixed
150
+
151
+ * Don't use lazy enumerator with JRuby due to leaking threads
152
+ * Ruby 2.7 deprecation warning when registering Webrick [Jon Zeppieri]
153
+ * `have_text` description [Juan Pablo Rinaldi]
154
+
155
+ # Version 3.32.1
156
+ Release date: 2020-04-05
157
+
158
+ ### Fixed
159
+
160
+ * Rapid set now respects field maxlength (Issue #2332)
161
+ * Only patch pause into legacy actions in Selenium < 4 (Issue #2334)
162
+
163
+ # Version 3.32.0
164
+ Release date: 2020-03-29
165
+
166
+ ### Added
167
+
168
+ * Support `delay` setting on click with Selenium
169
+ * Implement rapid set for values longer than 30 characters in text fields with Selenium
170
+
171
+ ### Fixed
172
+
173
+ * Result#[] and negative max on ranges (Issue #2302/2303) [Jeremy Evans]
174
+ * RackTest form submission rewrites query string when using GET method
175
+ * Ruby 2.7 deprecation warnings in RSpec matcher proxies
176
+
177
+ # Version 3.31.0
178
+ Release date: 2020-01-26
179
+
180
+ ### Added
181
+
182
+ * Support setting range inputs with the selenium driver [Andrew White]
183
+ * Support setting range inputs with the rack driver
184
+ * Support drop modifier keys in drag & drop [Elliot Crosby-McCullough]
185
+ * `enabled_options` and `disabled options` filters for select selector
186
+ * Support beginless ranges
187
+ * Optionally allow `all` results to be reloaded when stable - Beta feature - may be removed in
188
+ future version if problems occur
189
+
190
+ ### Fixed
191
+
192
+ * Fix Ruby 2.7 deprecation notices around keyword arguments. I have tried to do this without
193
+ any breaking changes, but due to the nature of the 2.7 changes and some selector types accepting
194
+ Hashes as locators there are a lot of edge cases. If you find any broken cases please report
195
+ them and I'll see if they're fixable.
196
+ * Clicking on details/summary element behavior in rack_test driver_
197
+
198
+ # Version 3.30.0
199
+ Release date: 2019-12-24
200
+
201
+ ### Added
202
+
203
+ * Display pending requests when they don't complete in time [Juan Carlos Medina]
204
+ * :order option in selector queries - set to :reverse to for reverse document order results
205
+ * Support regexp for :name and :placeholder options in selectors that import filters from
206
+ _field filter set
207
+
208
+ ### Fixed
209
+
210
+ * Issue around automatic port assignment - Issue #2245
211
+ * Label selector when label has no id - Issue #2260
212
+ * Preserve clientX/clientY in Selenium HTML5 drag emulation [Nicolò G.]
213
+ * table selector using :with_cols option if last specified column matched but others didn't - Issue #2287
214
+ * Some tests updated for Ruby 2.7 behavior change around keyword args
215
+
1
216
  # Version 3.29.0
2
- Release date: Unreleased
217
+ Release date: 2019-09-02
3
218
 
4
219
  ### Added
5
220
 
@@ -72,8 +287,8 @@ Release date: 2019-06-27
72
287
 
73
288
  ### Fixed
74
289
 
75
- * Woraround issue with chromedriver 76/77 in W3C mode losing mouse state during legacy drag. Only fixed if
76
- both source and target are simultaenously inside the viewport - Issue #2223
290
+ * Work around issue with chromedriver 76/77 in W3C mode losing mouse state during legacy drag. Only fixed if
291
+ both source and target are simultaneously inside the viewport - Issue #2223
77
292
  * Negative ancestor expectations/predicates were incorrectly checking siblings rather than ancestors
78
293
 
79
294
  # Version 3.24.0
@@ -352,7 +567,7 @@ Release date: 2018-10-23
352
567
 
353
568
  ### Fixed
354
569
 
355
- * Selector `css` expression definiton declared filters now work again
570
+ * Selector `css` expression definition declared filters now work again
356
571
  * Cleaned up warnings [Yuji Yaginuma]
357
572
  * Workaround installation of rspec matcher proxies under jruby by reverting to the old solution not using prepend, so jruby bugs are not hit - Issue #2115
358
573
 
@@ -469,7 +684,7 @@ Release date: 2018-07-19
469
684
 
470
685
  ### Fixed
471
686
 
472
- * Make selenium driver :backspace clear stategy work even if caret location is in middle of field content [Champier Cyril]
687
+ * Make selenium driver :backspace clear strategy work even if caret location is in middle of field content [Champier Cyril]
473
688
  * Selenium issue with fieldset nested in disabled fieldset not being considered disabled
474
689
  * `Session#evaluate_script` and `Element#evaluate_script` now strip leading/trailing whitespace from scripts [Ian Lesperance]
475
690
 
@@ -568,7 +783,7 @@ Release date: 2018-04-13
568
783
  ### Fixes
569
784
 
570
785
  * Fix expression filter descriptions in some selector failure messages
571
- * Fix compounding of negated matechers - Issue #2010
786
+ * Fix compounding of negated matchers - Issue #2010
572
787
 
573
788
  # Version 3.0.1
574
789
  Release date: 2018-04-06
@@ -842,7 +1057,7 @@ Release date: 2016-12-05
842
1057
  * Options for clearing session/local storage on reset added to the Selenium driver
843
1058
  * Window size changes wait for the size to stabilize
844
1059
  * Defined return value for most actions
845
- * Ignore specific error when qutting selenium driver instance - Issue #1773 [Dylan Reichstadt, Thomas Walpole]
1060
+ * Ignore specific error when quitting selenium driver instance - Issue #1773 [Dylan Reichstadt, Thomas Walpole]
846
1061
  * Warn on selenium unknown errors rather than raising when quitting driver [Adam Pohorecki, Thomas Walpole]
847
1062
  * Capybara::Result#each now returns an `Enumerator` when called without a block - Issue #1777 [Thomas Walpole]
848
1063
 
@@ -904,7 +1119,7 @@ Release date: 2016-09-19
904
1119
 
905
1120
  ### Fixed
906
1121
 
907
- * Issue with rack-test driver and obselete mime-types when using `#attach_file` - Issue #1756 [Thomas Walpole]
1122
+ * Issue with rack-test driver and obsolete mime-types when using `#attach_file` - Issue #1756 [Thomas Walpole]
908
1123
 
909
1124
  ### Added
910
1125
 
@@ -971,7 +1186,7 @@ Release date: 2016-04-07
971
1186
 
972
1187
  ### Added
973
1188
 
974
- * Capybara now waits for requests to Capybaras server to complete while restting the session [John Hawthorn, Thomas Walpole]
1189
+ * Capybara now waits for requests to Capybaras server to complete while resetting the session [John Hawthorn, Thomas Walpole]
975
1190
  * Capybara.reuse_server option to allow disabling of sharing server instance between sessions [Thomas Walpole]
976
1191
  * :multiple filter added to relevant selectors [Thomas Walpole]
977
1192
  * Provided server registrations for :webrick and :puma. Capybara.server = :puma for testing with Rails 5 [Thomas Walpole]
@@ -985,7 +1200,7 @@ Release date: 2016-04-07
985
1200
 
986
1201
  # Version 2.6.2
987
1202
 
988
- Relase date: 2016-01-27
1203
+ Release date: 2016-01-27
989
1204
 
990
1205
  ### Fixed
991
1206
 
@@ -1531,8 +1746,8 @@ Release date: 2011-06-14
1531
1746
  * Rack::Test driver honours maxlength on input fields [Guilherme Carvalho]
1532
1747
  * Rack::Test now works as expected with domains and subdomains [Jonas Nicklas]
1533
1748
  * Session is reset more thoroughly between tests. [Jonas Nicklas]
1534
- * Raise error when uploading non-existant file [Jonas Nicklas]
1535
- * Rack reponse body should respond to #each [Piotr Sarnacki]
1749
+ * Raise error when uploading non-existent file [Jonas Nicklas]
1750
+ * Rack response body should respond to #each [Piotr Sarnacki]
1536
1751
  * Deprecation warnings with selenium webdriver 0.2.0 [Aaron Gibraltar]
1537
1752
  * Selenium Chrome no longer YELLS tagname [Carl Jackson & David W. Frank]
1538
1753
  * Capybara no longer strips encoding before sending to Rack [Jonas Nicklas]
@@ -1674,7 +1889,7 @@ Release date: 2010-05-12
1674
1889
 
1675
1890
  Release date: 2010-04-09
1676
1891
 
1677
- This is a drop in compatible maintainance release. It's mostly
1892
+ This is a drop in compatible maintenance release. It's mostly
1678
1893
  important for driver authors.
1679
1894
 
1680
1895
  ### Added
@@ -1693,7 +1908,7 @@ important for driver authors.
1693
1908
 
1694
1909
  Release date: 2010-03-22
1695
1910
 
1696
- This is a maintainance release with minor bug fixes, should be
1911
+ This is a maintenance release with minor bug fixes, should be
1697
1912
  drop in compatible.
1698
1913
 
1699
1914
  ### Added
@@ -1740,4 +1955,3 @@ too many users, please read the release notes carefully!
1740
1955
  * clicking links where the image's alt attribute contains the text is now possible
1741
1956
  * within_fieldset and within_table work when the default selector is CSS
1742
1957
  * boolean attributes work the same across drivers (return true/false)
1743
-
data/README.md CHANGED
@@ -7,8 +7,6 @@
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.
11
-
12
10
  Capybara helps you test web applications by simulating how a real user would
13
11
  interact with your app. It is agnostic about the driver running your tests and
14
12
  comes with Rack::Test and Selenium support built in. WebKit is supported
@@ -76,7 +74,7 @@ GitHub): http://groups.google.com/group/ruby-capybara
76
74
 
77
75
  ## <a name="setup"></a>Setup
78
76
 
79
- Capybara requires Ruby 2.4.0 or later. To install, add this line to your
77
+ Capybara requires Ruby 2.7.0 or later. To install, add this line to your
80
78
  `Gemfile` and run `bundle install`:
81
79
 
82
80
  ```ruby
@@ -149,10 +147,12 @@ require 'capybara/rspec'
149
147
 
150
148
  If you are using Rails, put your Capybara specs in `spec/features` or `spec/system` (only works
151
149
  if [you have it configured in
152
- RSpec](https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#file-type-inference-disabled))
150
+ RSpec](https://relishapp.com/rspec/rspec-rails/v/4-0/docs/directory-structure))
153
151
  and if you have your Capybara specs in a different directory, then tag the
154
152
  example groups with `type: :feature` or `type: :system` depending on which type of test you're writing.
155
153
 
154
+ If you are using Rails system specs please see [their documentation](https://relishapp.com/rspec/rspec-rails/docs/system-specs/system-spec#system-specs-driven-by-selenium-chrome-headless) for selecting the driver you wish to use.
155
+
156
156
  If you are not using Rails, tag all the example groups in which you want to use
157
157
  Capybara with `type: :feature`.
158
158
 
@@ -260,6 +260,8 @@ end
260
260
 
261
261
  ## <a name="using-capybara-with-minitest"></a>Using Capybara with Minitest
262
262
 
263
+ * If you are using Rails system tests please see their documentation for information on selecting the driver you wish to use.
264
+
263
265
  * If you are using Rails, but not using Rails system tests, add the following code in your `test_helper.rb`
264
266
  file to make Capybara available in all test cases deriving from
265
267
  `ActionDispatch::IntegrationTest`:
@@ -1055,6 +1057,13 @@ additional info about how the underlying driver can be configured.
1055
1057
  are testing for specific server errors and using multiple sessions make sure to test for the
1056
1058
  errors using the initial session (usually :default)
1057
1059
 
1060
+ * If WebMock is enabled, you may encounter a "Too many open files"
1061
+ error. A simple `page.find` call may cause thousands of HTTP requests
1062
+ until the timeout occurs. By default, WebMock will cause each of these
1063
+ requests to spawn a new connection. To work around this problem, you
1064
+ may need to [enable WebMock's `net_http_connect_on_start: true`
1065
+ parameter](https://github.com/bblimke/webmock/blob/master/README.md#connecting-on-nethttpstart).
1066
+
1058
1067
  ## <a name="threadsafe"></a>"Threadsafe" mode
1059
1068
 
1060
1069
  In normal mode most of Capybara's configuration options are global settings which can cause issues
@@ -7,13 +7,13 @@ module Capybara
7
7
  class Config
8
8
  extend Forwardable
9
9
 
10
- OPTIONS = %i[app reuse_server threadsafe server default_driver javascript_driver allow_gumbo].freeze
10
+ OPTIONS = %i[
11
+ app reuse_server threadsafe server default_driver javascript_driver use_html5_parsing allow_gumbo
12
+ ].freeze
11
13
 
12
- attr_accessor :app
13
- attr_reader :reuse_server, :threadsafe
14
- attr_reader :session_options
14
+ attr_accessor :app, :use_html5_parsing
15
+ attr_reader :reuse_server, :threadsafe, :session_options # rubocop:disable Style/BisectedAttrAccessor
15
16
  attr_writer :default_driver, :javascript_driver
16
- attr_accessor :allow_gumbo
17
17
 
18
18
  SessionConfig::OPTIONS.each do |method|
19
19
  def_delegators :session_options, method, "#{method}="
@@ -24,10 +24,12 @@ module Capybara
24
24
  @javascript_driver = nil
25
25
  end
26
26
 
27
- attr_writer :reuse_server
27
+ attr_writer :reuse_server # rubocop:disable Style/BisectedAttrAccessor
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
@@ -81,10 +83,22 @@ module Capybara
81
83
  @javascript_driver || :selenium
82
84
  end
83
85
 
84
- def deprecate(method, alternate_method, once = false)
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
+ Capybara::Helpers.warn "DEPRECATED: ##{method} is deprecated, please use ##{alternate_method} instead: #{Capybara::Helpers.filter_backtrace(caller)}"
90
+ end
87
91
  @deprecation_notified[method] = true
88
92
  end
93
+
94
+ def allow_gumbo=(val)
95
+ deprecate('allow_gumbo=', 'use_html5_parsing=')
96
+ self.use_html5_parsing = val
97
+ end
98
+
99
+ def allow_gumbo
100
+ deprecate('allow_gumbo', 'use_html5_parsing')
101
+ use_html5_parsing
102
+ end
89
103
  end
90
104
  end
@@ -22,6 +22,6 @@ end
22
22
  Before do |scenario|
23
23
  scenario.source_tag_names.each do |tag|
24
24
  driver_name = tag.sub(/^@/, '').to_sym
25
- Capybara.current_driver = driver_name if Capybara.drivers.key?(driver_name)
25
+ Capybara.current_driver = driver_name if Capybara.drivers[driver_name]
26
26
  end
27
27
  end
@@ -59,6 +59,14 @@ class Capybara::Driver::Base
59
59
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#status_code'
60
60
  end
61
61
 
62
+ def send_keys(*)
63
+ raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#send_keys'
64
+ end
65
+
66
+ def active_element
67
+ raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#active_element'
68
+ end
69
+
62
70
  ##
63
71
  #
64
72
  # @param frame [Capybara::Node::Element, :parent, :top] The iframe element to switch to
@@ -125,6 +125,10 @@ module Capybara
125
125
  raise NotSupportedByDriverError, 'Capybara::Driver::Node#trigger'
126
126
  end
127
127
 
128
+ def shadow_root
129
+ raise NotSupportedByDriverError, 'Capybara::Driver::Node#shadow_root'
130
+ end
131
+
128
132
  def inspect
129
133
  %(#<#{self.class} tag="#{tag_name}" path="#{path}">)
130
134
  rescue NotSupportedByDriverError
@@ -132,7 +136,7 @@ module Capybara
132
136
  end
133
137
 
134
138
  def ==(other)
135
- raise NotSupportedByDriverError, 'Capybara::Driver::Node#=='
139
+ eql?(other) || (other.respond_to?(:native) && native == other.native)
136
140
  end
137
141
  end
138
142
  end
data/lib/capybara/dsl.rb CHANGED
@@ -47,9 +47,11 @@ 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
52
- end
50
+ class_eval <<~METHOD, __FILE__, __LINE__ + 1
51
+ def #{method}(...)
52
+ page.method("#{method}").call(...)
53
+ end
54
+ METHOD
53
55
  end
54
56
  end
55
57
 
@@ -15,7 +15,7 @@ module Capybara
15
15
  # @return [String] Normalized text
16
16
  #
17
17
  def normalize_whitespace(text)
18
- warn 'DEPRECATED: Capybara::Helpers::normalize_whitespace is deprecated, please update your driver'
18
+ Capybara::Helpers.warn 'DEPRECATED: Capybara::Helpers::normalize_whitespace is deprecated, please update your driver'
19
19
  text.to_s.gsub(/[[:space:]]+/, ' ').strip
20
20
  end
21
21
 
@@ -70,6 +70,21 @@ module Capybara
70
70
  count == 1 ? singular : plural
71
71
  end
72
72
 
73
+ def filter_backtrace(trace)
74
+ return 'No backtrace' unless trace
75
+
76
+ filter = %r{lib/capybara/|lib/rspec/|lib/minitest/|delegate.rb}
77
+ new_trace = trace.take_while { |line| line !~ filter }
78
+ new_trace = trace.grep_v(filter) if new_trace.empty?
79
+ new_trace = trace.dup if new_trace.empty?
80
+
81
+ new_trace.first.split(/:in /, 2).first
82
+ end
83
+
84
+ def warn(message, uplevel: 1)
85
+ Kernel.warn(message, uplevel: uplevel)
86
+ end
87
+
73
88
  if defined?(Process::CLOCK_MONOTONIC)
74
89
  def monotonic_time; Process.clock_gettime Process::CLOCK_MONOTONIC; end
75
90
  else
@@ -87,7 +102,9 @@ module Capybara
87
102
  end
88
103
 
89
104
  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?
105
+ if stalled?
106
+ raise Capybara::FrozenInTime, 'Time appears to be frozen. Capybara does not work with libraries which freeze time, consider using time travelling instead'
107
+ end
91
108
 
92
109
  current - @start >= @expire_in
93
110
  end