capybara 3.16.1 → 3.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/History.md +321 -0
- data/README.md +51 -60
- data/lib/capybara.rb +71 -114
- data/lib/capybara/config.rb +8 -5
- data/lib/capybara/cucumber.rb +1 -1
- data/lib/capybara/driver/node.rb +15 -3
- data/lib/capybara/dsl.rb +10 -2
- data/lib/capybara/helpers.rb +5 -3
- data/lib/capybara/minitest.rb +242 -141
- data/lib/capybara/minitest/spec.rb +159 -90
- data/lib/capybara/node/actions.rb +85 -74
- data/lib/capybara/node/base.rb +4 -4
- data/lib/capybara/node/document.rb +2 -2
- data/lib/capybara/node/document_matchers.rb +3 -3
- data/lib/capybara/node/element.rb +216 -117
- data/lib/capybara/node/finders.rb +65 -65
- data/lib/capybara/node/matchers.rb +228 -126
- data/lib/capybara/node/simple.rb +9 -4
- data/lib/capybara/queries/ancestor_query.rb +5 -7
- data/lib/capybara/queries/base_query.rb +2 -1
- data/lib/capybara/queries/current_path_query.rb +1 -1
- data/lib/capybara/queries/selector_query.rb +296 -30
- data/lib/capybara/queries/sibling_query.rb +5 -4
- data/lib/capybara/queries/style_query.rb +2 -2
- data/lib/capybara/queries/text_query.rb +13 -1
- data/lib/capybara/queries/title_query.rb +1 -1
- data/lib/capybara/rack_test/browser.rb +7 -2
- data/lib/capybara/rack_test/driver.rb +1 -1
- data/lib/capybara/rack_test/form.rb +1 -1
- data/lib/capybara/rack_test/node.rb +43 -7
- data/lib/capybara/registration_container.rb +44 -0
- data/lib/capybara/registrations/drivers.rb +36 -0
- data/lib/capybara/registrations/patches/puma_ssl.rb +27 -0
- data/lib/capybara/registrations/servers.rb +44 -0
- data/lib/capybara/result.rb +36 -8
- data/lib/capybara/rspec/matcher_proxies.rb +6 -4
- data/lib/capybara/rspec/matchers.rb +100 -63
- data/lib/capybara/rspec/matchers/base.rb +23 -10
- data/lib/capybara/rspec/matchers/count_sugar.rb +37 -0
- data/lib/capybara/rspec/matchers/have_ancestor.rb +28 -0
- data/lib/capybara/rspec/matchers/have_current_path.rb +2 -2
- data/lib/capybara/rspec/matchers/have_selector.rb +16 -8
- data/lib/capybara/rspec/matchers/have_sibling.rb +27 -0
- data/lib/capybara/rspec/matchers/have_text.rb +4 -4
- data/lib/capybara/rspec/matchers/have_title.rb +2 -2
- data/lib/capybara/rspec/matchers/match_selector.rb +3 -3
- data/lib/capybara/rspec/matchers/match_style.rb +2 -2
- data/lib/capybara/rspec/matchers/spatial_sugar.rb +39 -0
- data/lib/capybara/selector.rb +219 -588
- data/lib/capybara/selector/builders/css_builder.rb +10 -6
- data/lib/capybara/selector/builders/xpath_builder.rb +1 -1
- data/lib/capybara/selector/css.rb +4 -2
- data/lib/capybara/selector/definition.rb +277 -0
- data/lib/capybara/selector/definition/button.rb +52 -0
- data/lib/capybara/selector/definition/checkbox.rb +26 -0
- data/lib/capybara/selector/definition/css.rb +10 -0
- data/lib/capybara/selector/definition/datalist_input.rb +35 -0
- data/lib/capybara/selector/definition/datalist_option.rb +25 -0
- data/lib/capybara/selector/definition/element.rb +27 -0
- data/lib/capybara/selector/definition/field.rb +40 -0
- data/lib/capybara/selector/definition/fieldset.rb +14 -0
- data/lib/capybara/selector/definition/file_field.rb +13 -0
- data/lib/capybara/selector/definition/fillable_field.rb +33 -0
- data/lib/capybara/selector/definition/frame.rb +17 -0
- data/lib/capybara/selector/definition/id.rb +6 -0
- data/lib/capybara/selector/definition/label.rb +62 -0
- data/lib/capybara/selector/definition/link.rb +54 -0
- data/lib/capybara/selector/definition/link_or_button.rb +16 -0
- data/lib/capybara/selector/definition/option.rb +27 -0
- data/lib/capybara/selector/definition/radio_button.rb +27 -0
- data/lib/capybara/selector/definition/select.rb +81 -0
- data/lib/capybara/selector/definition/table.rb +109 -0
- data/lib/capybara/selector/definition/table_row.rb +21 -0
- data/lib/capybara/selector/definition/xpath.rb +5 -0
- data/lib/capybara/selector/filter_set.rb +13 -9
- data/lib/capybara/selector/filters/base.rb +11 -2
- data/lib/capybara/selector/filters/locator_filter.rb +13 -3
- data/lib/capybara/selector/regexp_disassembler.rb +9 -2
- data/lib/capybara/selector/selector.rb +43 -448
- data/lib/capybara/selenium/atoms/getAttribute.min.js +1 -0
- data/lib/capybara/selenium/atoms/isDisplayed.min.js +1 -0
- data/lib/capybara/selenium/atoms/src/getAttribute.js +161 -0
- data/lib/capybara/selenium/atoms/src/isDisplayed.js +454 -0
- data/lib/capybara/selenium/driver.rb +125 -56
- data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +73 -17
- data/lib/capybara/selenium/driver_specializations/edge_driver.rb +124 -0
- data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +41 -2
- data/lib/capybara/selenium/driver_specializations/internet_explorer_driver.rb +14 -1
- data/lib/capybara/selenium/driver_specializations/safari_driver.rb +14 -5
- data/lib/capybara/selenium/extensions/file_input_click_emulation.rb +34 -0
- data/lib/capybara/selenium/extensions/find.rb +67 -45
- data/lib/capybara/selenium/extensions/html5_drag.rb +152 -36
- data/lib/capybara/selenium/extensions/modifier_keys_stack.rb +28 -0
- data/lib/capybara/selenium/logger_suppressor.rb +34 -0
- data/lib/capybara/selenium/node.rb +227 -56
- data/lib/capybara/selenium/nodes/chrome_node.rb +93 -8
- data/lib/capybara/selenium/nodes/edge_node.rb +104 -0
- data/lib/capybara/selenium/nodes/firefox_node.rb +37 -59
- data/lib/capybara/selenium/nodes/ie_node.rb +22 -0
- data/lib/capybara/selenium/nodes/safari_node.rb +27 -54
- data/lib/capybara/selenium/patches/action_pauser.rb +26 -0
- data/lib/capybara/selenium/patches/atoms.rb +18 -0
- data/lib/capybara/selenium/patches/is_displayed.rb +16 -0
- data/lib/capybara/selenium/patches/logs.rb +45 -0
- data/lib/capybara/server.rb +19 -3
- data/lib/capybara/server/animation_disabler.rb +2 -2
- data/lib/capybara/server/checker.rb +6 -2
- data/lib/capybara/server/middleware.rb +23 -13
- data/lib/capybara/session.rb +124 -106
- data/lib/capybara/session/config.rb +12 -10
- data/lib/capybara/session/matchers.rb +6 -6
- data/lib/capybara/spec/public/offset.js +6 -0
- data/lib/capybara/spec/public/test.js +94 -5
- data/lib/capybara/spec/session/all_spec.rb +84 -6
- data/lib/capybara/spec/session/ancestor_spec.rb +5 -0
- data/lib/capybara/spec/session/assert_current_path_spec.rb +5 -2
- data/lib/capybara/spec/session/assert_text_spec.rb +9 -5
- data/lib/capybara/spec/session/attach_file_spec.rb +14 -6
- data/lib/capybara/spec/session/check_spec.rb +10 -4
- data/lib/capybara/spec/session/choose_spec.rb +8 -2
- data/lib/capybara/spec/session/click_button_spec.rb +44 -1
- data/lib/capybara/spec/session/click_link_spec.rb +11 -0
- data/lib/capybara/spec/session/evaluate_script_spec.rb +12 -0
- data/lib/capybara/spec/session/fill_in_spec.rb +37 -2
- data/lib/capybara/spec/session/find_spec.rb +60 -6
- data/lib/capybara/spec/session/first_spec.rb +1 -1
- data/lib/capybara/spec/session/frame/switch_to_frame_spec.rb +14 -1
- data/lib/capybara/spec/session/frame/within_frame_spec.rb +12 -1
- data/lib/capybara/spec/session/has_ancestor_spec.rb +46 -0
- data/lib/capybara/spec/session/has_button_spec.rb +16 -0
- data/lib/capybara/spec/session/has_css_spec.rb +35 -6
- data/lib/capybara/spec/session/has_current_path_spec.rb +6 -4
- data/lib/capybara/spec/session/has_field_spec.rb +34 -0
- data/lib/capybara/spec/session/has_select_spec.rb +32 -4
- data/lib/capybara/spec/session/has_selector_spec.rb +4 -4
- data/lib/capybara/spec/session/has_sibling_spec.rb +50 -0
- data/lib/capybara/spec/session/has_table_spec.rb +51 -5
- data/lib/capybara/spec/session/has_text_spec.rb +47 -0
- data/lib/capybara/spec/session/matches_style_spec.rb +2 -2
- data/lib/capybara/spec/session/node_spec.rb +574 -16
- data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +2 -2
- data/lib/capybara/spec/session/save_screenshot_spec.rb +4 -4
- data/lib/capybara/spec/session/scroll_spec.rb +1 -1
- data/lib/capybara/spec/session/select_spec.rb +5 -10
- data/lib/capybara/spec/session/selectors_spec.rb +24 -3
- data/lib/capybara/spec/session/uncheck_spec.rb +2 -2
- data/lib/capybara/spec/session/unselect_spec.rb +1 -1
- data/lib/capybara/spec/session/window/window_spec.rb +10 -9
- data/lib/capybara/spec/spec_helper.rb +7 -2
- data/lib/capybara/spec/test_app.rb +26 -21
- data/lib/capybara/spec/views/animated.erb +49 -0
- data/lib/capybara/spec/views/form.erb +25 -4
- data/lib/capybara/spec/views/frame_child.erb +2 -1
- data/lib/capybara/spec/views/frame_one.erb +1 -0
- data/lib/capybara/spec/views/obscured.erb +9 -9
- data/lib/capybara/spec/views/offset.erb +32 -0
- data/lib/capybara/spec/views/react.erb +45 -0
- data/lib/capybara/spec/views/spatial.erb +31 -0
- data/lib/capybara/spec/views/with_animation.erb +29 -1
- data/lib/capybara/spec/views/with_dragula.erb +24 -0
- data/lib/capybara/spec/views/with_html.erb +28 -2
- data/lib/capybara/spec/views/with_js.erb +2 -1
- data/lib/capybara/spec/views/with_jstree.erb +26 -0
- data/lib/capybara/spec/views/with_sortable_js.erb +21 -0
- data/lib/capybara/version.rb +1 -1
- data/lib/capybara/window.rb +10 -10
- data/spec/basic_node_spec.rb +6 -6
- data/spec/capybara_spec.rb +28 -28
- data/spec/dsl_spec.rb +16 -3
- data/spec/filter_set_spec.rb +5 -5
- data/spec/fixtures/selenium_driver_rspec_failure.rb +1 -1
- data/spec/fixtures/selenium_driver_rspec_success.rb +1 -1
- data/spec/minitest_spec.rb +12 -2
- data/spec/minitest_spec_spec.rb +56 -45
- data/spec/rack_test_spec.rb +25 -12
- data/spec/regexp_dissassembler_spec.rb +53 -39
- data/spec/result_spec.rb +50 -54
- data/spec/rspec/features_spec.rb +1 -0
- data/spec/rspec/shared_spec_matchers.rb +78 -62
- data/spec/rspec_spec.rb +5 -5
- data/spec/sauce_spec_chrome.rb +1 -0
- data/spec/selector_spec.rb +26 -16
- data/spec/selenium_spec_chrome.rb +84 -5
- data/spec/selenium_spec_chrome_remote.rb +23 -8
- data/spec/selenium_spec_edge.rb +23 -8
- data/spec/selenium_spec_firefox.rb +16 -21
- data/spec/selenium_spec_firefox_remote.rb +4 -13
- data/spec/selenium_spec_ie.rb +23 -15
- data/spec/selenium_spec_safari.rb +17 -17
- data/spec/server_spec.rb +87 -42
- data/spec/session_spec.rb +11 -4
- data/spec/shared_selenium_node.rb +83 -0
- data/spec/shared_selenium_session.rb +62 -72
- data/spec/spec_helper.rb +43 -5
- metadata +114 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab64d9d47c6374c4f203945be70b868fb9e4c48d3fdca087ba4e66498e40b91c
|
|
4
|
+
data.tar.gz: 451c97390c148b5b0fad1b06107a4f0de87f17f7b8cef7156fb76ad2ee503f76
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b0ca3fd8a4535e1df696ddc7f547e066b873d3f4be2b54655fdbb0b6588c5086a87b93500e241e0da031b586c0b6a30cdd8522f209309cf6729c683226bfcf7f
|
|
7
|
+
data.tar.gz: d295dcd733856816a1c89810f4d54304a52c251d585afcc62b986a66d63e080e03ddc81bdc46cf51a044e29d2849ccce9bb3cb307a0757746e662394f648a717
|
data/.yardopts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--markup markdown
|
data/History.md
CHANGED
|
@@ -1,3 +1,324 @@
|
|
|
1
|
+
# Version 3.33.0
|
|
2
|
+
Release date: 2020-06-21
|
|
3
|
+
|
|
4
|
+
### Added
|
|
5
|
+
|
|
6
|
+
* Block passed to `within_session` now receives the new and old session
|
|
7
|
+
* Support for aria-role button when enabled [Seiei Miyagi]
|
|
8
|
+
* Support for aria-role link when enabled
|
|
9
|
+
* Support for `validation_message` filter with :field and :fillable_field selectors
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
* Ruby 2.5.0+ is now required
|
|
14
|
+
* Deprecated direct manupulation of the driver and server registries
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
* Ruby 2.7 warning in minitest `assert_text` [Eileen M. Uchitelle]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# Version 3.32.2
|
|
22
|
+
Release date: 2020-05-16
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
* Don't use lazy enumerator with JRuby due to leaking threads
|
|
27
|
+
* Ruby 2.7 deprecation warning when registering Webrick [Jon Zeppieri]
|
|
28
|
+
* `have_text` description [Juan Pablo Rinaldi]
|
|
29
|
+
|
|
30
|
+
# Version 3.32.1
|
|
31
|
+
Release date: 2020-04-05
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
* Rapid set now respects field maxlength (Issue #2332)
|
|
36
|
+
* Only patch pause into legacy actions in Selenium < 4 (Issue #2334)
|
|
37
|
+
|
|
38
|
+
# Version 3.32.0
|
|
39
|
+
Release date: 2020-03-29
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
* Support `delay` setting on click with Selenium
|
|
44
|
+
* Implement rapid set for values longer thn 30 characters in text fields with Selenium
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
|
|
48
|
+
* Result#[] and negative max on ranges (Issue #2302/2303) [Jeremy Evans]
|
|
49
|
+
* RackTest form submission rewrites query string when using GET method
|
|
50
|
+
* Ruby 2.7 deprecation warnings in RSpec matcher proxies
|
|
51
|
+
|
|
52
|
+
# Version 3.31.0
|
|
53
|
+
Release date: 2020-01-26
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
* Support setting range inputs with the selenium driver [Andrew White]
|
|
58
|
+
* Support setting range inputs with the rack driver
|
|
59
|
+
* Support drop modifier keys in drag & drop [Elliot Crosby-McCullough]
|
|
60
|
+
* `enabled_options` and `disabled options` filters for select selector
|
|
61
|
+
* Support beginless ranges
|
|
62
|
+
* Optionally allow `all` results to be reloaded when stable - Beta feature - may be removed in
|
|
63
|
+
future version if problems occur
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
|
|
67
|
+
* Fix Ruby 2.7 deprecation notices around keyword arguments. I have tried to do this without
|
|
68
|
+
any breaking changes, but due to the nature of the 2.7 changes and some selector types accepting
|
|
69
|
+
Hashes as locators there are a lot of edge cases. If you find any broken cases please report
|
|
70
|
+
them and I'll see if they're fixable.
|
|
71
|
+
* Clicking on details/summary element behavior in rack_test driver_
|
|
72
|
+
|
|
73
|
+
# Version 3.30.0
|
|
74
|
+
Release date: 2019-12-24
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
|
|
78
|
+
* Display pending requests when they don't complete in time [Juan Carlos Medina]
|
|
79
|
+
* :order option in selector queries - set to :reverse to for reverse document order results
|
|
80
|
+
* Support regexp for :name and :placeholder options in selectors that import filters from
|
|
81
|
+
_field filter set
|
|
82
|
+
|
|
83
|
+
### Fixed
|
|
84
|
+
|
|
85
|
+
* Issue around automatic port assignment - Issue #2245
|
|
86
|
+
* Label selector when label has no id - Issue #2260
|
|
87
|
+
* Preserve clientX/clientY in Selenium HTML5 drag emulation [Nicolò G.]
|
|
88
|
+
* table selector using :with_cols option if last specified column matched but others didn't - Issue #2287
|
|
89
|
+
* Some tests updated for Ruby 2.7 behavior change around keyword args
|
|
90
|
+
|
|
91
|
+
# Version 3.29.0
|
|
92
|
+
Release date: 2019-09-02
|
|
93
|
+
|
|
94
|
+
### Added
|
|
95
|
+
|
|
96
|
+
* Allow clicking on file input when using the block version of `attach_file` with Chrome and Firefox
|
|
97
|
+
* Spatial filters (`left_of`, `right_of`, `above`, `below`, `near`)
|
|
98
|
+
* rack_test driver now supports clicking on details elements to open/close them
|
|
99
|
+
|
|
100
|
+
### Fixed
|
|
101
|
+
|
|
102
|
+
* rack_test driver correctly determines visibility for open details elements descendants
|
|
103
|
+
|
|
104
|
+
### Changed
|
|
105
|
+
|
|
106
|
+
* Results will now be lazily evaluated when using JRuby >= 9.2.8.0
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
# Version 3.28.0
|
|
110
|
+
Release date: 2019-08-03
|
|
111
|
+
|
|
112
|
+
### Added
|
|
113
|
+
|
|
114
|
+
* Allow forcing HTML5 or legacy dragging via the `:html5` option to `drag_to` when using Selenium with Chrome or Firefox
|
|
115
|
+
* Autodetection of drag type interprets not seeing the mousedown event as legacy.
|
|
116
|
+
* HTML5 form validation `:valid` node filter added to `:field` and `:fillable_field` selectors
|
|
117
|
+
* When using Capybara registered :puma server - patches Puma 4.0.x to fix SSL connection behavior. Removes
|
|
118
|
+
default `queue_requests` setting - Issue #2227
|
|
119
|
+
|
|
120
|
+
# Version 3.27.0
|
|
121
|
+
Release date: 2019-07-28
|
|
122
|
+
|
|
123
|
+
### Added
|
|
124
|
+
|
|
125
|
+
* Allow to use chromedriver/geckodriver native `is_element_displayed` endpoint via Selenium
|
|
126
|
+
driver `native_displayed` option for performance reasons. Disabled by default due to endpoints
|
|
127
|
+
currently not handling <details> element descendants visibility correctly.
|
|
128
|
+
|
|
129
|
+
### Fixed
|
|
130
|
+
|
|
131
|
+
* Ignore negative lookahead/lookbehind regex when performing initial XPath text matching
|
|
132
|
+
* Reloading of elements found via `ancestor` and `sibling`
|
|
133
|
+
* Only default puma settings to `queue_requests: false` when using SSL
|
|
134
|
+
* Visibility of descendants of <details> elements is correctly determined when using rack_test
|
|
135
|
+
and the selenium driver with Capybara optimized atoms
|
|
136
|
+
* local/session storage clearance in Chrome when clearing only one of them - Issue #2233
|
|
137
|
+
|
|
138
|
+
# Version 3.26.0
|
|
139
|
+
Release date: 2019-07-15
|
|
140
|
+
|
|
141
|
+
### Added
|
|
142
|
+
|
|
143
|
+
* `w3c_click_offset` configuration option applies to `right_click` and `double_click` as well as `click`
|
|
144
|
+
* Warning when passing `nil` to the text/content assertions/expectations
|
|
145
|
+
* `Session#server_url` returns the base url the AUT is being run at (when controlled by Capybara)
|
|
146
|
+
* `option` selector type accepts an integer as locator
|
|
147
|
+
|
|
148
|
+
### Fixed
|
|
149
|
+
|
|
150
|
+
* Default puma server registration now specifies `queue_requests: false` - Issue #2227
|
|
151
|
+
* Workaround issue with FF 68 and hanging during reset if a system modal is visible
|
|
152
|
+
* Don't expand file path if it's already absolute - Issue #2228
|
|
153
|
+
|
|
154
|
+
# Version 3.25.0
|
|
155
|
+
Release date: 2019-06-27
|
|
156
|
+
|
|
157
|
+
### Added
|
|
158
|
+
|
|
159
|
+
* Animation disabler also disables before and after pseudoelements - Issue #2221 [Daniel Heath]
|
|
160
|
+
* `w3c_click_offset` configuration option to determine whether click offsets are calculated from element
|
|
161
|
+
center or top left corner
|
|
162
|
+
|
|
163
|
+
### Fixed
|
|
164
|
+
|
|
165
|
+
* Woraround issue with chromedriver 76/77 in W3C mode losing mouse state during legacy drag. Only fixed if
|
|
166
|
+
both source and target are simultaenously inside the viewport - Issue #2223
|
|
167
|
+
* Negative ancestor expectations/predicates were incorrectly checking siblings rather than ancestors
|
|
168
|
+
|
|
169
|
+
# Version 3.24.0
|
|
170
|
+
Release date: 2019-06-13
|
|
171
|
+
|
|
172
|
+
### Added
|
|
173
|
+
|
|
174
|
+
* Log access when using the Selenium driver with Chrome 75 in W3C mode has been reenabled.
|
|
175
|
+
|
|
176
|
+
### Changed
|
|
177
|
+
|
|
178
|
+
* Selenium driver now selects all current content and then sends keys rather than clearing field by JS
|
|
179
|
+
and then sending keys when setting values to text inputs in order to more closely simulate user behavior
|
|
180
|
+
|
|
181
|
+
### Fixed
|
|
182
|
+
|
|
183
|
+
* Relative paths passed to `attach_file` will be assumed to be relative to the current working directory when using the
|
|
184
|
+
Selenium driver
|
|
185
|
+
|
|
186
|
+
# Version 3.23.0
|
|
187
|
+
Release date: 2019-06-10
|
|
188
|
+
|
|
189
|
+
### Added
|
|
190
|
+
|
|
191
|
+
* Improved error message when using Chrome in W3C mode and attempting to access logs
|
|
192
|
+
* Support driver specific options for Element#drag_to
|
|
193
|
+
* Support setting `<input type="color">` elements with the selenium driver
|
|
194
|
+
|
|
195
|
+
### Fixed
|
|
196
|
+
|
|
197
|
+
* Tightened conditions when in expression text option matching will be used
|
|
198
|
+
* Improved Selenium drivers HTML5 drag and drop emulation compatibility with SortableJS library (and others)
|
|
199
|
+
|
|
200
|
+
# Version 3.22.0
|
|
201
|
+
Release date: 2019-05-29
|
|
202
|
+
|
|
203
|
+
### Added
|
|
204
|
+
|
|
205
|
+
* `ancestor`/`sibling` assertions and matchers added
|
|
206
|
+
* Documentation Updates and Fixes - Many thanks again to Masafumi Koba! [Masafumi Koba]
|
|
207
|
+
* Added `:with` alias for `:option` filter on `:checkbox` and `:radio_button` selectors
|
|
208
|
+
|
|
209
|
+
### Changed
|
|
210
|
+
|
|
211
|
+
* Selenium driver with Chrome >= 73 now resets cookies and local/session storage after navigating
|
|
212
|
+
to 'about:blank' when possible to minimize potential race condition
|
|
213
|
+
|
|
214
|
+
# Version 3.21.0
|
|
215
|
+
Release date: 2019-05-24
|
|
216
|
+
|
|
217
|
+
### Added
|
|
218
|
+
|
|
219
|
+
* Element#drop - Chrome and Firefox, via the selenium driver, support dropping files/data on elements
|
|
220
|
+
* Default CSS used for `attach_file` `make_visible: true` now includes auto for
|
|
221
|
+
height and width to handle more ways of hiding the file input element
|
|
222
|
+
* Documentation Updates and Fixes - Many thanks to Masafumi Koba! [Masafumi Koba]
|
|
223
|
+
|
|
224
|
+
### Changed
|
|
225
|
+
|
|
226
|
+
* Deprecate support for CSS locator being a Symbol
|
|
227
|
+
|
|
228
|
+
# Version 3.20.2
|
|
229
|
+
Release date: 2019-05-19
|
|
230
|
+
|
|
231
|
+
### Fixed
|
|
232
|
+
|
|
233
|
+
* Move `uglifier` from runtime to development dependency [miyucy]
|
|
234
|
+
|
|
235
|
+
# Version 3.20.1
|
|
236
|
+
Release date: 2019-05-17
|
|
237
|
+
|
|
238
|
+
### Fixed
|
|
239
|
+
|
|
240
|
+
* RackTest driver considers <template> elements to be non-visible and ignores the contents
|
|
241
|
+
|
|
242
|
+
# Version 3.20.0
|
|
243
|
+
Release date: 2019-05-14
|
|
244
|
+
|
|
245
|
+
### Added
|
|
246
|
+
|
|
247
|
+
* `Node#obscured?` to check viewport presence and element overlap
|
|
248
|
+
* `:obscured` system filter to check whether elements are obscured in finders, assertions, and expectations
|
|
249
|
+
* :label selector :for option can be a regexp
|
|
250
|
+
* Significantly smaller `isDisplayed`/`getAttribute` atoms for selenium driver. If these produce issues you can disable their use
|
|
251
|
+
by setting an environment variable named 'DISABLE_CAPYBARA_SELENIUM_OPTIMIZATIONS' (Please also report any issues).
|
|
252
|
+
* `href: false` option with `find_link`/`click_link`/:link selector ignores `href` presence/absence
|
|
253
|
+
|
|
254
|
+
### Fixed
|
|
255
|
+
|
|
256
|
+
* Workaround Safari issue with send_keys not correctly using top level modifiers
|
|
257
|
+
* Workaround Safari not retrying click due to incorrect error type
|
|
258
|
+
* Fix Safari attach_file block mode when clicking elements associated to the file input
|
|
259
|
+
* Workaround Safari issue with repeated hover
|
|
260
|
+
|
|
261
|
+
# Version 3.19.1
|
|
262
|
+
Release date: 2019-05-11
|
|
263
|
+
|
|
264
|
+
### Fixed
|
|
265
|
+
|
|
266
|
+
* Fix access to specializations when Selenium::Driver is subclassed [James Mead]
|
|
267
|
+
|
|
268
|
+
# Version 3.19.0
|
|
269
|
+
Release date: 2019-05-09
|
|
270
|
+
|
|
271
|
+
### Added
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
* Syntactic sugar `#once`, `#twice`, `#thrice`, `#exactly`, `#at_least`, `#at_most`, and `#times`
|
|
275
|
+
added to `have_selector`, `have_css`, `have_xpath`, and `have_text` RSpec matchers
|
|
276
|
+
* Support for multiple expression types in Selector definitions
|
|
277
|
+
* Reduced wirecalls for common actions in Selenium driver
|
|
278
|
+
|
|
279
|
+
### Fixed
|
|
280
|
+
|
|
281
|
+
* Workaround Chrome 75 appending files to multiple file inputs
|
|
282
|
+
* Suppressed retry when detecting http vs https server connection
|
|
283
|
+
|
|
284
|
+
# Version 3.18.0
|
|
285
|
+
Release date: 2019-04-22
|
|
286
|
+
|
|
287
|
+
### Added
|
|
288
|
+
|
|
289
|
+
* XPath Selector query optimized to make use of Regexp :text option in initial element find
|
|
290
|
+
|
|
291
|
+
### Fixed
|
|
292
|
+
|
|
293
|
+
* Workaround issue where Chrome/chromedriver 74 can return the wrong error type when a click is intercepted
|
|
294
|
+
|
|
295
|
+
# Version 3.17.0
|
|
296
|
+
Release date: 2019-04-18
|
|
297
|
+
|
|
298
|
+
### Added
|
|
299
|
+
|
|
300
|
+
* Initial support for selenium-webdriver 4.0.0.alpha1
|
|
301
|
+
* :button selector will now also match on `name` attribute
|
|
302
|
+
|
|
303
|
+
### Fixed
|
|
304
|
+
|
|
305
|
+
* Suppress warnings generated by using selenium-webdriver 3.141.5926
|
|
306
|
+
* Mask Appium issue with finder visibility optimizations (non-optimal)
|
|
307
|
+
|
|
308
|
+
# Version 3.16.2
|
|
309
|
+
Release date: 2019-04-10
|
|
310
|
+
|
|
311
|
+
### Fixed
|
|
312
|
+
|
|
313
|
+
* Fix Session#quit resetting of memoized document
|
|
314
|
+
|
|
315
|
+
# Version 3.16.1
|
|
316
|
+
Release date: 2019-03-30
|
|
317
|
+
|
|
318
|
+
### Fixed
|
|
319
|
+
|
|
320
|
+
* Fix potential 'uninitialized constant' error when using the :selenium_chrome driver [jeffclemens-ab]
|
|
321
|
+
|
|
1
322
|
# Version 3.16
|
|
2
323
|
Release date: 2019-03-28
|
|
3
324
|
|
data/README.md
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
[](https://travis-ci.org/teamcapybara/capybara)
|
|
4
4
|
[](https://ci.appveyor.com/api/projects/github/teamcapybara/capybara)
|
|
5
5
|
[](https://codeclimate.com/github/teamcapybara/capybara)
|
|
6
|
+
[](https://coveralls.io/github/teamcapybara/capybara?branch=master)
|
|
6
7
|
[](https://gitter.im/jnicklas/capybara?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
7
8
|
[](https://dependabot.com/compatibility-score.html?dependency-name=capybara&package-manager=bundler&version-scheme=semver)
|
|
8
9
|
|
|
9
|
-
**Note** You are viewing the README for the 3.
|
|
10
|
-
|
|
10
|
+
**Note** You are viewing the README for the 3.33.x release 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
|
|
@@ -37,8 +37,6 @@ GitHub): http://groups.google.com/group/ruby-capybara
|
|
|
37
37
|
- [RackTest](#racktest)
|
|
38
38
|
- [Selenium](#selenium)
|
|
39
39
|
- [Apparition](#apparition)
|
|
40
|
-
- [Capybara-webkit](#capybara-webkit)
|
|
41
|
-
- [Poltergeist](#poltergeist)
|
|
42
40
|
- [The DSL](#the-dsl)
|
|
43
41
|
- [Navigating](#navigating)
|
|
44
42
|
- [Clicking links and buttons](#clicking-links-and-buttons)
|
|
@@ -58,11 +56,13 @@ GitHub): http://groups.google.com/group/ruby-capybara
|
|
|
58
56
|
- [Using the DSL elsewhere](#using-the-dsl-elsewhere)
|
|
59
57
|
- [Calling remote servers](#calling-remote-servers)
|
|
60
58
|
- [Using sessions](#using-sessions)
|
|
59
|
+
- [Named sessions](#named-sessions)
|
|
60
|
+
- [Using sessions manually](#using-sessions-manually)
|
|
61
61
|
- [XPath, CSS and selectors](#xpath-css-and-selectors)
|
|
62
62
|
- [Beware the XPath // trap](#beware-the-xpath--trap)
|
|
63
63
|
- [Configuring and adding drivers](#configuring-and-adding-drivers)
|
|
64
64
|
- [Gotchas:](#gotchas)
|
|
65
|
-
- ["Threadsafe" mode](#threadsafe)
|
|
65
|
+
- ["Threadsafe" mode](#threadsafe-mode)
|
|
66
66
|
- [Development](#development)
|
|
67
67
|
|
|
68
68
|
## <a name="key-benefits"></a>Key benefits
|
|
@@ -76,7 +76,7 @@ GitHub): http://groups.google.com/group/ruby-capybara
|
|
|
76
76
|
|
|
77
77
|
## <a name="setup"></a>Setup
|
|
78
78
|
|
|
79
|
-
Capybara requires Ruby 2.
|
|
79
|
+
Capybara requires Ruby 2.5.0 or later. To install, add this line to your
|
|
80
80
|
`Gemfile` and run `bundle install`:
|
|
81
81
|
|
|
82
82
|
```ruby
|
|
@@ -149,7 +149,7 @@ require 'capybara/rspec'
|
|
|
149
149
|
|
|
150
150
|
If you are using Rails, put your Capybara specs in `spec/features` or `spec/system` (only works
|
|
151
151
|
if [you have it configured in
|
|
152
|
-
RSpec](https://
|
|
152
|
+
RSpec](https://relishapp.com/rspec/rspec-rails/v/4-0/docs/directory-structure))
|
|
153
153
|
and if you have your Capybara specs in a different directory, then tag the
|
|
154
154
|
example groups with `type: :feature` or `type: :system` depending on which type of test you're writing.
|
|
155
155
|
|
|
@@ -183,7 +183,7 @@ to one specific driver. For example:
|
|
|
183
183
|
```ruby
|
|
184
184
|
describe 'some stuff which requires js', js: true do
|
|
185
185
|
it 'will use the default js driver'
|
|
186
|
-
it 'will switch to one specific driver', driver: :
|
|
186
|
+
it 'will switch to one specific driver', driver: :apparition
|
|
187
187
|
end
|
|
188
188
|
```
|
|
189
189
|
|
|
@@ -260,7 +260,7 @@ end
|
|
|
260
260
|
|
|
261
261
|
## <a name="using-capybara-with-minitest"></a>Using Capybara with Minitest
|
|
262
262
|
|
|
263
|
-
* If you are using Rails, add the following code in your `test_helper.rb`
|
|
263
|
+
* If you are using Rails, but not using Rails system tests, add the following code in your `test_helper.rb`
|
|
264
264
|
file to make Capybara available in all test cases deriving from
|
|
265
265
|
`ActionDispatch::IntegrationTest`:
|
|
266
266
|
|
|
@@ -275,8 +275,7 @@ end
|
|
|
275
275
|
include Capybara::Minitest::Assertions
|
|
276
276
|
|
|
277
277
|
# Reset sessions and driver between tests
|
|
278
|
-
|
|
279
|
-
def teardown
|
|
278
|
+
teardown do
|
|
280
279
|
Capybara.reset_sessions!
|
|
281
280
|
Capybara.use_default_driver
|
|
282
281
|
end
|
|
@@ -341,9 +340,9 @@ For example if you'd prefer to run everything in Selenium, you could do:
|
|
|
341
340
|
Capybara.default_driver = :selenium # :selenium_chrome and :selenium_chrome_headless are also registered
|
|
342
341
|
```
|
|
343
342
|
|
|
344
|
-
However, if you are using RSpec or Cucumber
|
|
345
|
-
leaving the faster `:rack_test` as the __default_driver__, and
|
|
346
|
-
tests that require a JavaScript-capable driver using `js: true` or
|
|
343
|
+
However, if you are using RSpec or Cucumber (and your app runs correctly without JS),
|
|
344
|
+
you may instead want to consider leaving the faster `:rack_test` as the __default_driver__, and
|
|
345
|
+
marking only those tests that require a JavaScript-capable driver using `js: true` or
|
|
347
346
|
`@javascript`, respectively. By default, JavaScript tests are run using the
|
|
348
347
|
`:selenium` driver. You can change this by setting
|
|
349
348
|
`Capybara.javascript_driver`.
|
|
@@ -352,7 +351,7 @@ You can also change the driver temporarily (typically in the Before/setup and
|
|
|
352
351
|
After/teardown blocks):
|
|
353
352
|
|
|
354
353
|
```ruby
|
|
355
|
-
Capybara.current_driver = :
|
|
354
|
+
Capybara.current_driver = :apparition # temporarily select different driver
|
|
356
355
|
# tests here
|
|
357
356
|
Capybara.use_default_driver # switch back to default driver
|
|
358
357
|
```
|
|
@@ -392,7 +391,7 @@ Capybara supports [Selenium 3.5+
|
|
|
392
391
|
In order to use Selenium, you'll need to install the `selenium-webdriver` gem,
|
|
393
392
|
and add it to your Gemfile if you're using bundler.
|
|
394
393
|
|
|
395
|
-
Capybara pre-registers a number of named
|
|
394
|
+
Capybara pre-registers a number of named drivers that use Selenium - they are:
|
|
396
395
|
|
|
397
396
|
* :selenium => Selenium driving Firefox
|
|
398
397
|
* :selenium_headless => Selenium driving Firefox in a headless configuration
|
|
@@ -410,42 +409,12 @@ and test server, see [Transactions and database setup](#transactions-and-databas
|
|
|
410
409
|
|
|
411
410
|
### <a name="apparition"></a>Apparition
|
|
412
411
|
|
|
413
|
-
The [apparition driver](https://github.com/twalpole/apparition)
|
|
412
|
+
The [apparition driver](https://github.com/twalpole/apparition) is a new driver that allows you to run tests using Chrome in a headless
|
|
414
413
|
or headed configuration. It attempts to provide backwards compatibility with the [Poltergeist driver API](https://github.com/teampoltergeist/poltergeist)
|
|
415
|
-
while allowing for the use of modern JS/CSS. It
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
teamcapybara repo once
|
|
419
|
-
|
|
420
|
-
### <a name="capybara-webkit"></a>Capybara-webkit
|
|
421
|
-
|
|
422
|
-
Note: `capybara-webkit` depends on QtWebkit which went end-of-life quite some time ago. There has been an attempt to revive the project but `capybara-webkit` is not yet (as far as I know) compatible with the revived version of QtWebKit (could be a good open source project for someone) and as such is still limited to an old version of QtWebKit. This means its support for modern JS and CSS is severely limited.
|
|
423
|
-
|
|
424
|
-
The [capybara-webkit driver](https://github.com/thoughtbot/capybara-webkit) is for true headless
|
|
425
|
-
testing. It uses QtWebKit to start a rendering engine process. It can execute JavaScript as well.
|
|
426
|
-
It is significantly faster than drivers like Selenium since it does not load an entire browser.
|
|
427
|
-
|
|
428
|
-
You can install it with:
|
|
429
|
-
|
|
430
|
-
```bash
|
|
431
|
-
gem install capybara-webkit
|
|
432
|
-
```
|
|
433
|
-
|
|
434
|
-
And you can use it by:
|
|
435
|
-
|
|
436
|
-
```ruby
|
|
437
|
-
Capybara.javascript_driver = :webkit
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
### <a name="poltergeist"></a>Poltergeist
|
|
441
|
-
|
|
442
|
-
Note: `poltergeist` depends on PhantomJS for which active development ended quite some time ago (2.1.1). As such it is roughly equivalent to a 6-7 year old version of Safari, meaning lack of support for modern JS and CSS. If any effort to update PhantomJS succeeds in the future this situation could change.
|
|
443
|
-
|
|
444
|
-
[Poltergeist](https://github.com/teampoltergeist/poltergeist) is another
|
|
445
|
-
headless driver which integrates Capybara with
|
|
446
|
-
[PhantomJS](http://phantomjs.org/). It is truly headless, so doesn't
|
|
447
|
-
require Xvfb to run on your CI server. It will also detect and report
|
|
448
|
-
any Javascript errors that happen within the page.
|
|
414
|
+
and [capybara-webkit API](https://github.com/thoughtbot/capybara-webkit) while allowing for the use of modern JS/CSS. It
|
|
415
|
+
uses CDP to communicate with Chrome, thereby obviating the need for chromedriver. This driver is being developed by the
|
|
416
|
+
current developer of Capybara and will attempt to keep up to date with new Capybara releases. It will probably be moved into the
|
|
417
|
+
teamcapybara repo once it reaches v1.0.
|
|
449
418
|
|
|
450
419
|
## <a name="the-dsl"></a>The DSL
|
|
451
420
|
|
|
@@ -640,13 +609,23 @@ In drivers which support it, you can easily execute JavaScript:
|
|
|
640
609
|
page.execute_script("$('body').empty()")
|
|
641
610
|
```
|
|
642
611
|
|
|
643
|
-
For simple expressions, you can return the result of the script.
|
|
644
|
-
that this may break with more complicated expressions:
|
|
612
|
+
For simple expressions, you can return the result of the script.
|
|
645
613
|
|
|
646
614
|
```ruby
|
|
647
615
|
result = page.evaluate_script('4 + 4');
|
|
648
616
|
```
|
|
649
617
|
|
|
618
|
+
For more complicated scripts you'll need to write them as one expression.
|
|
619
|
+
|
|
620
|
+
```ruby
|
|
621
|
+
result = page.evaluate_script(<<~JS, 3, element)
|
|
622
|
+
(function(n, el){
|
|
623
|
+
var val = parseInt(el.value, 10);
|
|
624
|
+
return n+val;
|
|
625
|
+
})(arguments[0], arguments[1])
|
|
626
|
+
JS
|
|
627
|
+
```
|
|
628
|
+
|
|
650
629
|
### <a name="modals"></a>Modals
|
|
651
630
|
|
|
652
631
|
In drivers which support it, you can accept, dismiss and respond to alerts, confirms and prompts.
|
|
@@ -955,12 +934,17 @@ Capybara.default_selector = :xpath
|
|
|
955
934
|
find('.//ul/li').text
|
|
956
935
|
```
|
|
957
936
|
|
|
958
|
-
Capybara
|
|
959
|
-
|
|
937
|
+
Capybara provides a number of other built-in selector types. The full list, along
|
|
938
|
+
with applicable filters, can be seen at [built-in selectors](https://www.rubydoc.info/github/teamcapybara/capybara/Capybara/Selector)
|
|
939
|
+
|
|
940
|
+
Capybara also allows you to add custom selectors, which can be very useful if you
|
|
941
|
+
find yourself using the same kinds of selectors very often. The examples below are very
|
|
942
|
+
simple, and there are many available features not demonstrated. For more in-depth examples
|
|
943
|
+
please see Capybaras built-in selector definitions.
|
|
960
944
|
|
|
961
945
|
```ruby
|
|
962
|
-
Capybara.add_selector(:
|
|
963
|
-
xpath { |id| XPath.descendant[XPath.attr(:
|
|
946
|
+
Capybara.add_selector(:my_attribute) do
|
|
947
|
+
xpath { |id| XPath.descendant[XPath.attr(:my_attribute) == id.to_s] }
|
|
964
948
|
end
|
|
965
949
|
|
|
966
950
|
Capybara.add_selector(:row) do
|
|
@@ -977,9 +961,9 @@ an XPath expression generated through the XPath gem. You can now use these
|
|
|
977
961
|
selectors like this:
|
|
978
962
|
|
|
979
963
|
```ruby
|
|
980
|
-
find(:
|
|
981
|
-
find(:row, 3)
|
|
982
|
-
find(:flash_type, :notice)
|
|
964
|
+
find(:my_attribute, 'post_123') # find element with matching attribute
|
|
965
|
+
find(:row, 3) # find 3rd row in table body
|
|
966
|
+
find(:flash_type, :notice) # find element with id of 'flash' and class of 'notice'
|
|
983
967
|
```
|
|
984
968
|
|
|
985
969
|
## <a name="beware-the-xpath--trap"></a>Beware the XPath // trap
|
|
@@ -1071,6 +1055,13 @@ additional info about how the underlying driver can be configured.
|
|
|
1071
1055
|
are testing for specific server errors and using multiple sessions make sure to test for the
|
|
1072
1056
|
errors using the initial session (usually :default)
|
|
1073
1057
|
|
|
1058
|
+
* If WebMock is enabled, you may encounter a "Too many open files"
|
|
1059
|
+
error. A simple `page.find` call may cause thousands of HTTP requests
|
|
1060
|
+
until the timeout occurs. By default, WebMock will cause each of these
|
|
1061
|
+
requests to spawn a new connection. To work around this problem, you
|
|
1062
|
+
may need to [enable WebMock's `net_http_connect_on_start: true`
|
|
1063
|
+
parameter](https://github.com/bblimke/webmock/blob/master/README.md#connecting-on-nethttpstart).
|
|
1064
|
+
|
|
1074
1065
|
## <a name="threadsafe"></a>"Threadsafe" mode
|
|
1075
1066
|
|
|
1076
1067
|
In normal mode most of Capybara's configuration options are global settings which can cause issues
|