capybara 3.29.0 → 3.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +203 -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 +1 -1
  8. data/lib/capybara/dsl.rb +10 -2
  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 +24 -21
  17. data/lib/capybara/node/finders.rb +25 -18
  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 +71 -23
  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 +13 -4
  29. data/lib/capybara/rack_test/driver.rb +2 -1
  30. data/lib/capybara/rack_test/form.rb +2 -2
  31. data/lib/capybara/rack_test/node.rb +43 -15
  32. data/lib/capybara/registration_container.rb +44 -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 +14 -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 +13 -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 +79 -16
  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 +110 -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 +17 -6
  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 +9 -3
  99. data/lib/capybara/session/matchers.rb +11 -11
  100. data/lib/capybara/session.rb +73 -37
  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 +62 -9
  105. data/lib/capybara/spec/session/ancestor_spec.rb +5 -0
  106. data/lib/capybara/spec/session/assert_text_spec.rb +9 -5
  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 +31 -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 +15 -2
  118. data/lib/capybara/spec/session/has_field_spec.rb +40 -0
  119. data/lib/capybara/spec/session/has_link_spec.rb +24 -0
  120. data/lib/capybara/spec/session/has_select_spec.rb +32 -4
  121. data/lib/capybara/spec/session/has_selector_spec.rb +4 -4
  122. data/lib/capybara/spec/session/has_table_spec.rb +51 -5
  123. data/lib/capybara/spec/session/has_text_spec.rb +25 -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 +184 -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/window/switch_to_window_spec.rb +1 -1
  134. data/lib/capybara/spec/session/window/window_opened_by_spec.rb +1 -1
  135. data/lib/capybara/spec/session/window/window_spec.rb +8 -8
  136. data/lib/capybara/spec/session/window/windows_spec.rb +1 -1
  137. data/lib/capybara/spec/spec_helper.rb +17 -17
  138. data/lib/capybara/spec/test_app.rb +40 -29
  139. data/lib/capybara/spec/views/animated.erb +1 -1
  140. data/lib/capybara/spec/views/form.erb +52 -6
  141. data/lib/capybara/spec/views/frame_child.erb +1 -1
  142. data/lib/capybara/spec/views/frame_one.erb +1 -1
  143. data/lib/capybara/spec/views/frame_parent.erb +1 -1
  144. data/lib/capybara/spec/views/frame_two.erb +1 -1
  145. data/lib/capybara/spec/views/initial_alert.erb +2 -1
  146. data/lib/capybara/spec/views/layout.erb +10 -0
  147. data/lib/capybara/spec/views/obscured.erb +1 -1
  148. data/lib/capybara/spec/views/offset.erb +2 -1
  149. data/lib/capybara/spec/views/path.erb +2 -2
  150. data/lib/capybara/spec/views/popup_one.erb +1 -1
  151. data/lib/capybara/spec/views/popup_two.erb +1 -1
  152. data/lib/capybara/spec/views/react.erb +2 -2
  153. data/lib/capybara/spec/views/scroll.erb +2 -1
  154. data/lib/capybara/spec/views/spatial.erb +1 -1
  155. data/lib/capybara/spec/views/with_animation.erb +10 -3
  156. data/lib/capybara/spec/views/with_base_tag.erb +2 -2
  157. data/lib/capybara/spec/views/with_dragula.erb +5 -3
  158. data/lib/capybara/spec/views/with_fixed_header_footer.erb +2 -1
  159. data/lib/capybara/spec/views/with_hover.erb +2 -2
  160. data/lib/capybara/spec/views/with_html.erb +3 -3
  161. data/lib/capybara/spec/views/with_jquery_animation.erb +24 -0
  162. data/lib/capybara/spec/views/with_js.erb +5 -3
  163. data/lib/capybara/spec/views/with_jstree.erb +1 -1
  164. data/lib/capybara/spec/views/with_namespace.erb +1 -0
  165. data/lib/capybara/spec/views/with_slow_unload.erb +2 -1
  166. data/lib/capybara/spec/views/with_sortable_js.erb +3 -3
  167. data/lib/capybara/spec/views/with_unload_alert.erb +1 -0
  168. data/lib/capybara/spec/views/with_windows.erb +1 -1
  169. data/lib/capybara/spec/views/within_frames.erb +1 -1
  170. data/lib/capybara/version.rb +1 -1
  171. data/lib/capybara/window.rb +3 -7
  172. data/lib/capybara.rb +35 -29
  173. data/spec/basic_node_spec.rb +25 -11
  174. data/spec/capybara_spec.rb +1 -1
  175. data/spec/dsl_spec.rb +16 -3
  176. data/spec/fixtures/selenium_driver_rspec_success.rb +2 -2
  177. data/spec/minitest_spec.rb +3 -2
  178. data/spec/minitest_spec_spec.rb +46 -46
  179. data/spec/rack_test_spec.rb +37 -11
  180. data/spec/regexp_dissassembler_spec.rb +40 -36
  181. data/spec/result_spec.rb +42 -32
  182. data/spec/rspec/features_spec.rb +5 -2
  183. data/spec/rspec/scenarios_spec.rb +4 -0
  184. data/spec/rspec/shared_spec_matchers.rb +68 -56
  185. data/spec/rspec_spec.rb +8 -4
  186. data/spec/selector_spec.rb +17 -2
  187. data/spec/selenium_spec_chrome.rb +48 -25
  188. data/spec/selenium_spec_chrome_remote.rb +13 -6
  189. data/spec/selenium_spec_firefox.rb +25 -17
  190. data/spec/selenium_spec_firefox_remote.rb +2 -2
  191. data/spec/selenium_spec_ie.rb +3 -6
  192. data/spec/selenium_spec_safari.rb +27 -19
  193. data/spec/server_spec.rb +84 -31
  194. data/spec/session_spec.rb +1 -1
  195. data/spec/shared_selenium_node.rb +21 -7
  196. data/spec/shared_selenium_session.rb +114 -19
  197. data/spec/spec_helper.rb +1 -1
  198. metadata +78 -21
  199. data/lib/capybara/spec/session/source_spec.rb +0 -0
  200. 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: fd7f81974b21d47d35c99dff02f878607128c99c80b18b1fef54680797978898
4
+ data.tar.gz: ee6659925b7ddaaa0220ad0af81ae65a34e96094583308c160902470e7019128
5
5
  SHA512:
6
- metadata.gz: 82c37d1b9c8d1c7f9d858f8d7aebebfc2ecee4c5e35d35f9a3c949d978e4e97d48f78b9d5f93079e209fc779ab31e5707ecce8ac0d2a4ce8108fc3be2437e1bc
7
- data.tar.gz: '06886b335dd0ef5f93f59a09026877bc460e6430b2d2f1902cd31a3179b1bd52b9418a1b43ab558dcf18e92b198506023c3549a065949bb33f881538ec9e018d'
6
+ metadata.gz: ad7d2ea4d2612770e801443e61b23a45c0b9936fa4387170ffbbf051706dbc8aee5111b8eefb2d6fabb3042b479dc19d26248923d84da3e78d12dc090aca1e2d
7
+ data.tar.gz: 8868469dc6ddcb6c802f4a7b76df9455ff561d00ad78e3cab75e5f02e1b71b74402700c081864368d446304acb6fac2fed5cb79df117d309d4a0a278c95e35d8
data/History.md CHANGED
@@ -1,5 +1,194 @@
1
+ # Version 3.36.0
2
+ Release date: 2021-10-24
3
+
4
+ ### Changed
5
+
6
+ * Ruby 2.6.0+ is now required
7
+ * Minimum selenium-webdriver supported is now 3.142.7
8
+
9
+ ### Added
10
+
11
+ * Support for selenium-webdriver 4.x
12
+ * `allow_label_click` accepts click options to be used when clicking an associated label
13
+ * Deprecated `allow_gumbo=` in favor of `use_html5_parsing=` to enable use of Nokogiri::HTL5 when available
14
+ * `Session#active_element` returns the element with focus - Not supported by the `RackTest` driver [Sean Doyle]
15
+ * Support `focused:` filter for finding interactive elements - Not supported by the `RackTest` driver [Sean Doyle]
16
+
17
+ ### Fixed
18
+
19
+ * Sibling and ancestor queries now work with Simple::Node - Issue #2452
20
+ * rack_test correctly ignores readonly attribute on specific input element types
21
+ * `Node#all_text` always returns a string - Issue #2477
22
+ * `have_any_of_selectors` negated match - Issue #2473
23
+ * `Document#scroll_to` fixed for standards behavior - pass quirks: true if you need the older behavior [Eric Anderson]
24
+ * Use capture on attach file event listener for better React compatibility [Jeff Way]
25
+ * Animation disabler produces valid HTML [Javi Martin]
26
+
27
+ ### Removed
28
+
29
+ * 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
30
+
31
+ # Version 3.35.3
32
+ Release date: 2021-01-29
33
+
34
+ ### Fixed
35
+
36
+ * Just a release to have the correct dates in the History.md in released gem
37
+
38
+ # Version 3.35.2
39
+ Release date: 2021-01-29
40
+
41
+ ### Fixed
42
+
43
+ * Selenium deprecation suppressor with Selenium 3.x
44
+
45
+ # Version 3.35.1
46
+ Release date: 2021-01-26
47
+
48
+ ### Fixed
49
+
50
+ * Default chrome driver registrations use chrome - Issue #2442 [Yuriy Alekseyev]
51
+ * 'Capybara.test_id' usage with the :button selector - Issue #2443
52
+
53
+ # Version 3.35.0
54
+ Release date: 2021-01-25
55
+
56
+ ### Added
57
+
58
+ * Support Regexp matching for individual class names in :class filter passed an Array
59
+ * Animation disabler now supports JQuery animation disabling when JQuery loaded from body [Chien-Wei Huang]
60
+
61
+ ### Fixed
62
+
63
+ * :button selector type use with `enable_aria_role` [Sean Doyle]
64
+ * <label> elements don't associate with aria-role buttons
65
+ * Ignore Selenium::WebDriver::Error::InvalidSessionIdError when quitting driver [Robin Daugherty]
66
+ * Firefox: Don't click input when sending keys if already focused
67
+ * Miscellaneous issues with selenium-webdriver 4.0.0.alphas
68
+ * Nil return error in node details optimizations
69
+ * Animation disabler now inserts XHTML compliant content [Dale Morgan]
70
+
71
+ # Version 3.34.0
72
+ Release date: 2020-11-26
73
+
74
+ ### Added
75
+
76
+ * Ability to fill in with emoji when using Chrome with selenium driver (Firefox already worked)
77
+ * Current path assertions/expectations accept optional filter block
78
+ * Animation disabler now specifies `scroll-behavior: auto;` [Nathan Broadbent]
79
+ * :button selector can now find elements by label text [Sean Doyle]
80
+ * `Session#send_keys` to send keys to the current element with focus in drivers that support the
81
+ concept of a current element [Sean Doyle]
82
+
83
+ ### Changed
84
+
85
+ * Text query validates the type parameter to prevent undefined behavior
86
+
87
+ ### Fixed
88
+
89
+ * racktest driver better handles fragments and redirection to urls that include fragments
90
+ * Don't error when attempting to get XPath location of a shadow element
91
+ * Missing `readonly?` added to Node::Simple
92
+ * Selenium version detection when loaded via alternate method [Joel Hawksley]
93
+ * Connection count issue if REQUEST_URI value changed by app [Blake Williams]
94
+ * Maintain URI fragment when redirecting in rack-test driver
95
+ * Text query error message [Wojciech Wnętrzak]
96
+ * Checking a checkbox/radio button with `allow_label_click` now works if there are multiple labels (Issue #2421)
97
+ * `drop` with `Pathname` (Issue #2424)[Máximo Mussini]
98
+
99
+ # Version 3.33.0
100
+ Release date: 2020-06-21
101
+
102
+ ### Added
103
+
104
+ * Block passed to `within_session` now receives the new and old session
105
+ * Support for aria-role button when enabled [Seiei Miyagi]
106
+ * Support for aria-role link when enabled
107
+ * Support for `validation_message` filter with :field and :fillable_field selectors
108
+ * Deprecation warnings show source location [Koichi ITO]
109
+
110
+ ### Changed
111
+
112
+ * Ruby 2.5.0+ is now required
113
+ * Deprecated direct manipulation of the driver and server registries
114
+
115
+ ### Fixed
116
+
117
+ * Ruby 2.7 warning in minitest `assert_text` [Eileen M. Uchitelle]
118
+
119
+
120
+ # Version 3.32.2
121
+ Release date: 2020-05-16
122
+
123
+ ### Fixed
124
+
125
+ * Don't use lazy enumerator with JRuby due to leaking threads
126
+ * Ruby 2.7 deprecation warning when registering Webrick [Jon Zeppieri]
127
+ * `have_text` description [Juan Pablo Rinaldi]
128
+
129
+ # Version 3.32.1
130
+ Release date: 2020-04-05
131
+
132
+ ### Fixed
133
+
134
+ * Rapid set now respects field maxlength (Issue #2332)
135
+ * Only patch pause into legacy actions in Selenium < 4 (Issue #2334)
136
+
137
+ # Version 3.32.0
138
+ Release date: 2020-03-29
139
+
140
+ ### Added
141
+
142
+ * Support `delay` setting on click with Selenium
143
+ * Implement rapid set for values longer than 30 characters in text fields with Selenium
144
+
145
+ ### Fixed
146
+
147
+ * Result#[] and negative max on ranges (Issue #2302/2303) [Jeremy Evans]
148
+ * RackTest form submission rewrites query string when using GET method
149
+ * Ruby 2.7 deprecation warnings in RSpec matcher proxies
150
+
151
+ # Version 3.31.0
152
+ Release date: 2020-01-26
153
+
154
+ ### Added
155
+
156
+ * Support setting range inputs with the selenium driver [Andrew White]
157
+ * Support setting range inputs with the rack driver
158
+ * Support drop modifier keys in drag & drop [Elliot Crosby-McCullough]
159
+ * `enabled_options` and `disabled options` filters for select selector
160
+ * Support beginless ranges
161
+ * Optionally allow `all` results to be reloaded when stable - Beta feature - may be removed in
162
+ future version if problems occur
163
+
164
+ ### Fixed
165
+
166
+ * Fix Ruby 2.7 deprecation notices around keyword arguments. I have tried to do this without
167
+ any breaking changes, but due to the nature of the 2.7 changes and some selector types accepting
168
+ Hashes as locators there are a lot of edge cases. If you find any broken cases please report
169
+ them and I'll see if they're fixable.
170
+ * Clicking on details/summary element behavior in rack_test driver_
171
+
172
+ # Version 3.30.0
173
+ Release date: 2019-12-24
174
+
175
+ ### Added
176
+
177
+ * Display pending requests when they don't complete in time [Juan Carlos Medina]
178
+ * :order option in selector queries - set to :reverse to for reverse document order results
179
+ * Support regexp for :name and :placeholder options in selectors that import filters from
180
+ _field filter set
181
+
182
+ ### Fixed
183
+
184
+ * Issue around automatic port assignment - Issue #2245
185
+ * Label selector when label has no id - Issue #2260
186
+ * Preserve clientX/clientY in Selenium HTML5 drag emulation [Nicolò G.]
187
+ * table selector using :with_cols option if last specified column matched but others didn't - Issue #2287
188
+ * Some tests updated for Ruby 2.7 behavior change around keyword args
189
+
1
190
  # Version 3.29.0
2
- Release date: Unreleased
191
+ Release date: 2019-09-02
3
192
 
4
193
  ### Added
5
194
 
@@ -72,8 +261,8 @@ Release date: 2019-06-27
72
261
 
73
262
  ### Fixed
74
263
 
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
264
+ * Work around issue with chromedriver 76/77 in W3C mode losing mouse state during legacy drag. Only fixed if
265
+ both source and target are simultaneously inside the viewport - Issue #2223
77
266
  * Negative ancestor expectations/predicates were incorrectly checking siblings rather than ancestors
78
267
 
79
268
  # Version 3.24.0
@@ -352,7 +541,7 @@ Release date: 2018-10-23
352
541
 
353
542
  ### Fixed
354
543
 
355
- * Selector `css` expression definiton declared filters now work again
544
+ * Selector `css` expression definition declared filters now work again
356
545
  * Cleaned up warnings [Yuji Yaginuma]
357
546
  * 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
547
 
@@ -469,7 +658,7 @@ Release date: 2018-07-19
469
658
 
470
659
  ### Fixed
471
660
 
472
- * Make selenium driver :backspace clear stategy work even if caret location is in middle of field content [Champier Cyril]
661
+ * Make selenium driver :backspace clear strategy work even if caret location is in middle of field content [Champier Cyril]
473
662
  * Selenium issue with fieldset nested in disabled fieldset not being considered disabled
474
663
  * `Session#evaluate_script` and `Element#evaluate_script` now strip leading/trailing whitespace from scripts [Ian Lesperance]
475
664
 
@@ -568,7 +757,7 @@ Release date: 2018-04-13
568
757
  ### Fixes
569
758
 
570
759
  * Fix expression filter descriptions in some selector failure messages
571
- * Fix compounding of negated matechers - Issue #2010
760
+ * Fix compounding of negated matchers - Issue #2010
572
761
 
573
762
  # Version 3.0.1
574
763
  Release date: 2018-04-06
@@ -842,7 +1031,7 @@ Release date: 2016-12-05
842
1031
  * Options for clearing session/local storage on reset added to the Selenium driver
843
1032
  * Window size changes wait for the size to stabilize
844
1033
  * Defined return value for most actions
845
- * Ignore specific error when qutting selenium driver instance - Issue #1773 [Dylan Reichstadt, Thomas Walpole]
1034
+ * Ignore specific error when quitting selenium driver instance - Issue #1773 [Dylan Reichstadt, Thomas Walpole]
846
1035
  * Warn on selenium unknown errors rather than raising when quitting driver [Adam Pohorecki, Thomas Walpole]
847
1036
  * Capybara::Result#each now returns an `Enumerator` when called without a block - Issue #1777 [Thomas Walpole]
848
1037
 
@@ -904,7 +1093,7 @@ Release date: 2016-09-19
904
1093
 
905
1094
  ### Fixed
906
1095
 
907
- * Issue with rack-test driver and obselete mime-types when using `#attach_file` - Issue #1756 [Thomas Walpole]
1096
+ * Issue with rack-test driver and obsolete mime-types when using `#attach_file` - Issue #1756 [Thomas Walpole]
908
1097
 
909
1098
  ### Added
910
1099
 
@@ -971,7 +1160,7 @@ Release date: 2016-04-07
971
1160
 
972
1161
  ### Added
973
1162
 
974
- * Capybara now waits for requests to Capybaras server to complete while restting the session [John Hawthorn, Thomas Walpole]
1163
+ * Capybara now waits for requests to Capybaras server to complete while resetting the session [John Hawthorn, Thomas Walpole]
975
1164
  * Capybara.reuse_server option to allow disabling of sharing server instance between sessions [Thomas Walpole]
976
1165
  * :multiple filter added to relevant selectors [Thomas Walpole]
977
1166
  * Provided server registrations for :webrick and :puma. Capybara.server = :puma for testing with Rails 5 [Thomas Walpole]
@@ -985,7 +1174,7 @@ Release date: 2016-04-07
985
1174
 
986
1175
  # Version 2.6.2
987
1176
 
988
- Relase date: 2016-01-27
1177
+ Release date: 2016-01-27
989
1178
 
990
1179
  ### Fixed
991
1180
 
@@ -1531,8 +1720,8 @@ Release date: 2011-06-14
1531
1720
  * Rack::Test driver honours maxlength on input fields [Guilherme Carvalho]
1532
1721
  * Rack::Test now works as expected with domains and subdomains [Jonas Nicklas]
1533
1722
  * 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]
1723
+ * Raise error when uploading non-existent file [Jonas Nicklas]
1724
+ * Rack response body should respond to #each [Piotr Sarnacki]
1536
1725
  * Deprecation warnings with selenium webdriver 0.2.0 [Aaron Gibraltar]
1537
1726
  * Selenium Chrome no longer YELLS tagname [Carl Jackson & David W. Frank]
1538
1727
  * Capybara no longer strips encoding before sending to Rack [Jonas Nicklas]
@@ -1674,7 +1863,7 @@ Release date: 2010-05-12
1674
1863
 
1675
1864
  Release date: 2010-04-09
1676
1865
 
1677
- This is a drop in compatible maintainance release. It's mostly
1866
+ This is a drop in compatible maintenance release. It's mostly
1678
1867
  important for driver authors.
1679
1868
 
1680
1869
  ### Added
@@ -1693,7 +1882,7 @@ important for driver authors.
1693
1882
 
1694
1883
  Release date: 2010-03-22
1695
1884
 
1696
- This is a maintainance release with minor bug fixes, should be
1885
+ This is a maintenance release with minor bug fixes, should be
1697
1886
  drop in compatible.
1698
1887
 
1699
1888
  ### Added
@@ -1740,4 +1929,3 @@ too many users, please read the release notes carefully!
1740
1929
  * clicking links where the image's alt attribute contains the text is now possible
1741
1930
  * within_fieldset and within_table work when the default selector is CSS
1742
1931
  * 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.6.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
@@ -132,7 +132,7 @@ module Capybara
132
132
  end
133
133
 
134
134
  def ==(other)
135
- raise NotSupportedByDriverError, 'Capybara::Driver::Node#=='
135
+ eql?(other) || (other.respond_to?(:native) && native == other.native)
136
136
  end
137
137
  end
138
138
  end
data/lib/capybara/dsl.rb CHANGED
@@ -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
@@ -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/}
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