capybara 2.18.0 → 3.38.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/History.md +889 -12
- data/License.txt +1 -1
- data/README.md +108 -78
- data/lib/capybara/config.rb +29 -57
- data/lib/capybara/cucumber.rb +2 -3
- data/lib/capybara/driver/base.rb +35 -18
- data/lib/capybara/driver/node.rb +40 -10
- data/lib/capybara/dsl.rb +10 -7
- data/lib/capybara/helpers.rb +70 -31
- data/lib/capybara/minitest/spec.rb +173 -83
- data/lib/capybara/minitest.rb +219 -112
- data/lib/capybara/node/actions.rb +274 -171
- data/lib/capybara/node/base.rb +42 -34
- data/lib/capybara/node/document.rb +15 -3
- data/lib/capybara/node/document_matchers.rb +19 -21
- data/lib/capybara/node/element.rb +362 -135
- data/lib/capybara/node/finders.rb +149 -137
- data/lib/capybara/node/matchers.rb +369 -209
- data/lib/capybara/node/simple.rb +59 -26
- data/lib/capybara/queries/active_element_query.rb +18 -0
- data/lib/capybara/queries/ancestor_query.rb +12 -9
- data/lib/capybara/queries/base_query.rb +39 -28
- data/lib/capybara/queries/current_path_query.rb +21 -27
- data/lib/capybara/queries/match_query.rb +14 -7
- data/lib/capybara/queries/selector_query.rb +658 -149
- data/lib/capybara/queries/sibling_query.rb +11 -9
- data/lib/capybara/queries/style_query.rb +45 -0
- data/lib/capybara/queries/text_query.rb +56 -38
- data/lib/capybara/queries/title_query.rb +8 -11
- data/lib/capybara/rack_test/browser.rb +113 -42
- data/lib/capybara/rack_test/css_handlers.rb +6 -4
- data/lib/capybara/rack_test/driver.rb +22 -17
- data/lib/capybara/rack_test/errors.rb +6 -0
- data/lib/capybara/rack_test/form.rb +93 -58
- data/lib/capybara/rack_test/node.rb +188 -81
- data/lib/capybara/rails.rb +3 -7
- data/lib/capybara/registration_container.rb +41 -0
- data/lib/capybara/registrations/drivers.rb +42 -0
- data/lib/capybara/registrations/patches/puma_ssl.rb +29 -0
- data/lib/capybara/registrations/servers.rb +53 -0
- data/lib/capybara/result.rb +96 -62
- data/lib/capybara/rspec/features.rb +17 -50
- data/lib/capybara/rspec/matcher_proxies.rb +52 -15
- data/lib/capybara/rspec/matchers/base.rb +111 -0
- data/lib/capybara/rspec/matchers/become_closed.rb +33 -0
- data/lib/capybara/rspec/matchers/compound.rb +88 -0
- 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 +29 -0
- data/lib/capybara/rspec/matchers/have_selector.rb +77 -0
- data/lib/capybara/rspec/matchers/have_sibling.rb +27 -0
- data/lib/capybara/rspec/matchers/have_text.rb +33 -0
- data/lib/capybara/rspec/matchers/have_title.rb +29 -0
- data/lib/capybara/rspec/matchers/match_selector.rb +27 -0
- data/lib/capybara/rspec/matchers/match_style.rb +43 -0
- data/lib/capybara/rspec/matchers/spatial_sugar.rb +39 -0
- data/lib/capybara/rspec/matchers.rb +142 -311
- data/lib/capybara/rspec.rb +7 -11
- data/lib/capybara/selector/builders/css_builder.rb +84 -0
- data/lib/capybara/selector/builders/xpath_builder.rb +71 -0
- data/lib/capybara/selector/css.rb +89 -17
- data/lib/capybara/selector/definition/button.rb +68 -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 +28 -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/definition.rb +280 -0
- data/lib/capybara/selector/filter.rb +2 -17
- data/lib/capybara/selector/filter_set.rb +80 -33
- data/lib/capybara/selector/filters/base.rb +50 -6
- data/lib/capybara/selector/filters/expression_filter.rb +8 -26
- data/lib/capybara/selector/filters/locator_filter.rb +29 -0
- data/lib/capybara/selector/filters/node_filter.rb +16 -12
- data/lib/capybara/selector/regexp_disassembler.rb +211 -0
- data/lib/capybara/selector/selector.rb +93 -210
- data/lib/capybara/selector/xpath_extensions.rb +17 -0
- data/lib/capybara/selector.rb +227 -526
- 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 +332 -261
- data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +117 -0
- data/lib/capybara/selenium/driver_specializations/edge_driver.rb +124 -0
- data/lib/capybara/selenium/driver_specializations/firefox_driver.rb +89 -0
- data/lib/capybara/selenium/driver_specializations/internet_explorer_driver.rb +26 -0
- data/lib/capybara/selenium/driver_specializations/safari_driver.rb +24 -0
- data/lib/capybara/selenium/extensions/file_input_click_emulation.rb +34 -0
- data/lib/capybara/selenium/extensions/find.rb +110 -0
- data/lib/capybara/selenium/extensions/html5_drag.rb +226 -0
- data/lib/capybara/selenium/extensions/modifier_keys_stack.rb +28 -0
- data/lib/capybara/selenium/extensions/scroll.rb +76 -0
- data/lib/capybara/selenium/logger_suppressor.rb +44 -0
- data/lib/capybara/selenium/node.rb +545 -144
- data/lib/capybara/selenium/nodes/chrome_node.rb +137 -0
- data/lib/capybara/selenium/nodes/edge_node.rb +104 -0
- data/lib/capybara/selenium/nodes/firefox_node.rb +136 -0
- data/lib/capybara/selenium/nodes/ie_node.rb +22 -0
- data/lib/capybara/selenium/nodes/safari_node.rb +118 -0
- 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/selenium/patches/pause_duration_fix.rb +9 -0
- data/lib/capybara/selenium/patches/persistent_client.rb +20 -0
- data/lib/capybara/server/animation_disabler.rb +81 -0
- data/lib/capybara/server/checker.rb +44 -0
- data/lib/capybara/server/middleware.rb +71 -0
- data/lib/capybara/server.rb +59 -67
- data/lib/capybara/session/config.rb +81 -67
- data/lib/capybara/session/matchers.rb +28 -20
- data/lib/capybara/session.rb +336 -365
- data/lib/capybara/spec/public/jquery.js +5 -5
- data/lib/capybara/spec/public/offset.js +6 -0
- data/lib/capybara/spec/public/test.js +147 -12
- data/lib/capybara/spec/session/accept_alert_spec.rb +12 -11
- data/lib/capybara/spec/session/accept_confirm_spec.rb +6 -5
- data/lib/capybara/spec/session/accept_prompt_spec.rb +10 -10
- data/lib/capybara/spec/session/active_element_spec.rb +31 -0
- data/lib/capybara/spec/session/all_spec.rb +160 -56
- data/lib/capybara/spec/session/ancestor_spec.rb +27 -24
- data/lib/capybara/spec/session/assert_all_of_selectors_spec.rb +68 -38
- data/lib/capybara/spec/session/assert_current_path_spec.rb +75 -0
- data/lib/capybara/spec/session/assert_selector_spec.rb +143 -0
- data/lib/capybara/spec/session/assert_style_spec.rb +26 -0
- data/lib/capybara/spec/session/assert_text_spec.rb +258 -0
- data/lib/capybara/spec/session/{assert_title.rb → assert_title_spec.rb} +22 -12
- data/lib/capybara/spec/session/attach_file_spec.rb +144 -69
- data/lib/capybara/spec/session/body_spec.rb +12 -13
- data/lib/capybara/spec/session/check_spec.rb +117 -55
- data/lib/capybara/spec/session/choose_spec.rb +64 -31
- data/lib/capybara/spec/session/click_button_spec.rb +231 -173
- data/lib/capybara/spec/session/click_link_or_button_spec.rb +55 -35
- data/lib/capybara/spec/session/click_link_spec.rb +82 -58
- data/lib/capybara/spec/session/current_scope_spec.rb +12 -11
- data/lib/capybara/spec/session/current_url_spec.rb +57 -39
- data/lib/capybara/spec/session/dismiss_confirm_spec.rb +4 -4
- data/lib/capybara/spec/session/dismiss_prompt_spec.rb +3 -2
- data/lib/capybara/spec/session/element/{assert_match_selector.rb → assert_match_selector_spec.rb} +11 -9
- data/lib/capybara/spec/session/element/match_css_spec.rb +18 -10
- data/lib/capybara/spec/session/element/match_xpath_spec.rb +9 -7
- data/lib/capybara/spec/session/element/matches_selector_spec.rb +71 -57
- data/lib/capybara/spec/session/evaluate_async_script_spec.rb +8 -7
- data/lib/capybara/spec/session/evaluate_script_spec.rb +29 -8
- data/lib/capybara/spec/session/execute_script_spec.rb +10 -8
- data/lib/capybara/spec/session/fill_in_spec.rb +134 -43
- data/lib/capybara/spec/session/find_button_spec.rb +25 -24
- data/lib/capybara/spec/session/find_by_id_spec.rb +10 -9
- data/lib/capybara/spec/session/find_field_spec.rb +37 -41
- data/lib/capybara/spec/session/find_link_spec.rb +36 -17
- data/lib/capybara/spec/session/find_spec.rb +251 -144
- data/lib/capybara/spec/session/first_spec.rb +79 -51
- data/lib/capybara/spec/session/frame/frame_title_spec.rb +23 -0
- data/lib/capybara/spec/session/frame/frame_url_spec.rb +23 -0
- data/lib/capybara/spec/session/frame/switch_to_frame_spec.rb +33 -20
- data/lib/capybara/spec/session/frame/within_frame_spec.rb +50 -32
- data/lib/capybara/spec/session/go_back_spec.rb +2 -1
- data/lib/capybara/spec/session/go_forward_spec.rb +2 -1
- data/lib/capybara/spec/session/has_all_selectors_spec.rb +31 -31
- data/lib/capybara/spec/session/has_ancestor_spec.rb +46 -0
- data/lib/capybara/spec/session/has_any_selectors_spec.rb +29 -0
- data/lib/capybara/spec/session/has_button_spec.rb +100 -13
- data/lib/capybara/spec/session/has_css_spec.rb +272 -137
- data/lib/capybara/spec/session/has_current_path_spec.rb +59 -60
- data/lib/capybara/spec/session/has_field_spec.rb +139 -59
- data/lib/capybara/spec/session/has_link_spec.rb +43 -6
- data/lib/capybara/spec/session/has_none_selectors_spec.rb +42 -40
- data/lib/capybara/spec/session/has_select_spec.rb +107 -72
- data/lib/capybara/spec/session/has_selector_spec.rb +120 -71
- data/lib/capybara/spec/session/has_sibling_spec.rb +50 -0
- data/lib/capybara/spec/session/has_table_spec.rb +172 -5
- data/lib/capybara/spec/session/has_text_spec.rb +106 -62
- data/lib/capybara/spec/session/has_title_spec.rb +20 -14
- data/lib/capybara/spec/session/has_xpath_spec.rb +57 -38
- data/lib/capybara/spec/session/{headers.rb → headers_spec.rb} +3 -2
- data/lib/capybara/spec/session/html_spec.rb +14 -6
- data/lib/capybara/spec/session/matches_style_spec.rb +35 -0
- data/lib/capybara/spec/session/node_spec.rb +1002 -153
- data/lib/capybara/spec/session/node_wrapper_spec.rb +39 -0
- data/lib/capybara/spec/session/refresh_spec.rb +12 -6
- data/lib/capybara/spec/session/reset_session_spec.rb +82 -35
- data/lib/capybara/spec/session/{response_code.rb → response_code_spec.rb} +2 -1
- data/lib/capybara/spec/session/save_and_open_page_spec.rb +3 -2
- data/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +8 -12
- data/lib/capybara/spec/session/save_page_spec.rb +42 -55
- data/lib/capybara/spec/session/save_screenshot_spec.rb +16 -14
- data/lib/capybara/spec/session/screenshot_spec.rb +2 -2
- data/lib/capybara/spec/session/scroll_spec.rb +117 -0
- data/lib/capybara/spec/session/select_spec.rb +107 -81
- data/lib/capybara/spec/session/selectors_spec.rb +52 -19
- data/lib/capybara/spec/session/sibling_spec.rb +10 -10
- data/lib/capybara/spec/session/text_spec.rb +37 -21
- data/lib/capybara/spec/session/title_spec.rb +17 -5
- data/lib/capybara/spec/session/uncheck_spec.rb +42 -22
- data/lib/capybara/spec/session/unselect_spec.rb +39 -38
- data/lib/capybara/spec/session/visit_spec.rb +85 -53
- data/lib/capybara/spec/session/window/become_closed_spec.rb +24 -20
- data/lib/capybara/spec/session/window/current_window_spec.rb +5 -3
- data/lib/capybara/spec/session/window/open_new_window_spec.rb +5 -3
- data/lib/capybara/spec/session/window/switch_to_window_spec.rb +27 -22
- data/lib/capybara/spec/session/window/window_opened_by_spec.rb +12 -6
- data/lib/capybara/spec/session/window/window_spec.rb +97 -63
- data/lib/capybara/spec/session/window/windows_spec.rb +12 -10
- data/lib/capybara/spec/session/window/within_window_spec.rb +31 -86
- data/lib/capybara/spec/session/within_spec.rb +83 -44
- data/lib/capybara/spec/spec_helper.rb +53 -43
- data/lib/capybara/spec/test_app.rb +158 -43
- data/lib/capybara/spec/views/animated.erb +49 -0
- data/lib/capybara/spec/views/form.erb +154 -42
- data/lib/capybara/spec/views/frame_child.erb +4 -3
- data/lib/capybara/spec/views/frame_one.erb +2 -1
- data/lib/capybara/spec/views/frame_parent.erb +1 -1
- data/lib/capybara/spec/views/frame_two.erb +1 -1
- data/lib/capybara/spec/views/initial_alert.erb +2 -1
- data/lib/capybara/spec/views/layout.erb +10 -0
- data/lib/capybara/spec/views/obscured.erb +47 -0
- data/lib/capybara/spec/views/offset.erb +33 -0
- data/lib/capybara/spec/views/path.erb +2 -2
- data/lib/capybara/spec/views/popup_one.erb +1 -1
- data/lib/capybara/spec/views/popup_two.erb +1 -1
- data/lib/capybara/spec/views/react.erb +45 -0
- data/lib/capybara/spec/views/scroll.erb +21 -0
- data/lib/capybara/spec/views/spatial.erb +31 -0
- data/lib/capybara/spec/views/tables.erb +68 -1
- data/lib/capybara/spec/views/with_animation.erb +81 -0
- data/lib/capybara/spec/views/with_base_tag.erb +2 -2
- data/lib/capybara/spec/views/with_dragula.erb +24 -0
- data/lib/capybara/spec/views/with_fixed_header_footer.erb +2 -1
- data/lib/capybara/spec/views/with_hover.erb +3 -2
- data/lib/capybara/spec/views/with_hover1.erb +10 -0
- data/lib/capybara/spec/views/with_html.erb +67 -12
- data/lib/capybara/spec/views/with_html5_svg.erb +20 -0
- data/lib/capybara/spec/views/with_jquery_animation.erb +24 -0
- data/lib/capybara/spec/views/with_js.erb +30 -5
- data/lib/capybara/spec/views/with_jstree.erb +26 -0
- data/lib/capybara/spec/views/with_namespace.erb +21 -0
- data/lib/capybara/spec/views/with_scope.erb +2 -2
- data/lib/capybara/spec/views/with_scope_other.erb +6 -0
- data/lib/capybara/spec/views/with_shadow.erb +31 -0
- data/lib/capybara/spec/views/with_slow_unload.erb +2 -1
- data/lib/capybara/spec/views/with_sortable_js.erb +21 -0
- data/lib/capybara/spec/views/with_unload_alert.erb +1 -0
- data/lib/capybara/spec/views/with_windows.erb +1 -1
- data/lib/capybara/spec/views/within_frames.erb +5 -2
- data/lib/capybara/version.rb +2 -1
- data/lib/capybara/window.rb +36 -34
- data/lib/capybara.rb +129 -103
- data/spec/basic_node_spec.rb +60 -34
- data/spec/capybara_spec.rb +63 -88
- data/spec/counter_spec.rb +35 -0
- data/spec/css_builder_spec.rb +101 -0
- data/spec/css_splitter_spec.rb +38 -0
- data/spec/dsl_spec.rb +85 -64
- data/spec/filter_set_spec.rb +27 -9
- data/spec/fixtures/certificate.pem +25 -0
- data/spec/fixtures/key.pem +27 -0
- data/spec/fixtures/selenium_driver_rspec_failure.rb +6 -5
- data/spec/fixtures/selenium_driver_rspec_success.rb +6 -5
- data/spec/minitest_spec.rb +45 -7
- data/spec/minitest_spec_spec.rb +94 -63
- data/spec/per_session_config_spec.rb +14 -13
- data/spec/rack_test_spec.rb +194 -125
- data/spec/regexp_dissassembler_spec.rb +250 -0
- data/spec/result_spec.rb +102 -50
- data/spec/rspec/features_spec.rb +37 -31
- data/spec/rspec/scenarios_spec.rb +9 -7
- data/spec/rspec/shared_spec_matchers.rb +449 -422
- data/spec/rspec/views_spec.rb +5 -3
- data/spec/rspec_matchers_spec.rb +27 -11
- data/spec/rspec_spec.rb +109 -89
- data/spec/sauce_spec_chrome.rb +43 -0
- data/spec/selector_spec.rb +397 -68
- data/spec/selenium_spec_chrome.rb +186 -40
- data/spec/selenium_spec_chrome_remote.rb +103 -0
- data/spec/selenium_spec_edge.rb +49 -0
- data/spec/selenium_spec_firefox.rb +194 -41
- data/spec/selenium_spec_firefox_remote.rb +82 -0
- data/spec/selenium_spec_ie.rb +149 -0
- data/spec/selenium_spec_safari.rb +162 -0
- data/spec/server_spec.rb +201 -102
- data/spec/session_spec.rb +53 -16
- data/spec/shared_selenium_node.rb +79 -0
- data/spec/shared_selenium_session.rb +474 -122
- data/spec/spec_helper.rb +93 -7
- data/spec/xpath_builder_spec.rb +93 -0
- metadata +360 -73
- data/.yard/templates_custom/default/class/html/selectors.erb +0 -38
- data/.yard/templates_custom/default/class/html/setup.rb +0 -17
- data/.yard/yard_extensions.rb +0 -78
- data/lib/capybara/query.rb +0 -7
- data/lib/capybara/rspec/compound.rb +0 -95
- data/lib/capybara/spec/session/assert_current_path.rb +0 -72
- data/lib/capybara/spec/session/assert_selector.rb +0 -148
- data/lib/capybara/spec/session/assert_text.rb +0 -234
- data/lib/capybara/spec/session/source_spec.rb +0 -0
- data/lib/capybara/spec/views/with_title.erb +0 -5
- data/spec/selenium_spec_marionette.rb +0 -127
data/License.txt
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# Capybara
|
2
2
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/teamcapybara/capybara.svg)](https://travis-ci.org/teamcapybara/capybara)
|
4
|
-
[![
|
4
|
+
[![Build Status](https://ci.appveyor.com/api/projects/status/github/teamcapybara/capybara?svg=true)](https://ci.appveyor.com/api/projects/github/teamcapybara/capybara)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/teamcapybara/capybara.svg)](https://codeclimate.com/github/teamcapybara/capybara)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/github/teamcapybara/capybara/badge.svg?branch=master)](https://coveralls.io/github/teamcapybara/capybara?branch=master)
|
6
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
|
+
[![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)
|
7
9
|
|
8
10
|
Capybara helps you test web applications by simulating how a real user would
|
9
11
|
interact with your app. It is agnostic about the driver running your tests and
|
@@ -32,8 +34,7 @@ GitHub): http://groups.google.com/group/ruby-capybara
|
|
32
34
|
- [Selecting the Driver](#selecting-the-driver)
|
33
35
|
- [RackTest](#racktest)
|
34
36
|
- [Selenium](#selenium)
|
35
|
-
- [
|
36
|
-
- [Poltergeist](#poltergeist)
|
37
|
+
- [Apparition](#apparition)
|
37
38
|
- [The DSL](#the-dsl)
|
38
39
|
- [Navigating](#navigating)
|
39
40
|
- [Clicking links and buttons](#clicking-links-and-buttons)
|
@@ -53,11 +54,13 @@ GitHub): http://groups.google.com/group/ruby-capybara
|
|
53
54
|
- [Using the DSL elsewhere](#using-the-dsl-elsewhere)
|
54
55
|
- [Calling remote servers](#calling-remote-servers)
|
55
56
|
- [Using sessions](#using-sessions)
|
57
|
+
- [Named sessions](#named-sessions)
|
58
|
+
- [Using sessions manually](#using-sessions-manually)
|
56
59
|
- [XPath, CSS and selectors](#xpath-css-and-selectors)
|
57
60
|
- [Beware the XPath // trap](#beware-the-xpath--trap)
|
58
61
|
- [Configuring and adding drivers](#configuring-and-adding-drivers)
|
59
62
|
- [Gotchas:](#gotchas)
|
60
|
-
- ["Threadsafe" mode](#threadsafe)
|
63
|
+
- ["Threadsafe" mode](#threadsafe-mode)
|
61
64
|
- [Development](#development)
|
62
65
|
|
63
66
|
## <a name="key-benefits"></a>Key benefits
|
@@ -71,24 +74,19 @@ GitHub): http://groups.google.com/group/ruby-capybara
|
|
71
74
|
|
72
75
|
## <a name="setup"></a>Setup
|
73
76
|
|
74
|
-
Capybara requires Ruby
|
77
|
+
Capybara requires Ruby 2.7.0 or later. To install, add this line to your
|
75
78
|
`Gemfile` and run `bundle install`:
|
76
79
|
|
77
80
|
```ruby
|
78
81
|
gem 'capybara'
|
79
82
|
```
|
80
83
|
|
81
|
-
**Note:** If using Ruby < 2.0 you will also need to limit the version of rack to < 2.0
|
82
|
-
|
83
84
|
If the application that you are testing is a Rails app, add this line to your test helper file:
|
84
85
|
|
85
86
|
```ruby
|
86
87
|
require 'capybara/rails'
|
87
88
|
```
|
88
89
|
|
89
|
-
**Note:** In Rails 4.0/4.1 the default test environment (`config/environments/test.rb`) is [not threadsafe](https://github.com/rails/rails/issues/15089).
|
90
|
-
If you experience random errors about missing constants, add `config.allow_concurrency = false` to `config/environments/test.rb`.
|
91
|
-
|
92
90
|
If the application that you are testing is a Rack app, but not Rails, set Capybara.app to your Rack app:
|
93
91
|
|
94
92
|
```ruby
|
@@ -140,28 +138,30 @@ There are also explicit tags for each registered driver set up for you (`@seleni
|
|
140
138
|
|
141
139
|
## <a name="using-capybara-with-rspec"></a>Using Capybara with RSpec
|
142
140
|
|
143
|
-
Load RSpec
|
141
|
+
Load RSpec 3.5+ support by adding the following line (typically to your
|
144
142
|
`spec_helper.rb` file):
|
145
143
|
|
146
144
|
```ruby
|
147
145
|
require 'capybara/rspec'
|
148
146
|
```
|
149
147
|
|
150
|
-
If you are using Rails, put your Capybara specs in `spec/features` (only works
|
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://
|
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
|
-
example groups with
|
152
|
+
example groups with `type: :feature` or `type: :system` depending on which type of test you're writing.
|
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
155
|
|
156
156
|
If you are not using Rails, tag all the example groups in which you want to use
|
157
|
-
Capybara with
|
157
|
+
Capybara with `type: :feature`.
|
158
158
|
|
159
159
|
You can now write your specs like so:
|
160
160
|
|
161
161
|
```ruby
|
162
|
-
describe "the signin process", :
|
162
|
+
describe "the signin process", type: :feature do
|
163
163
|
before :each do
|
164
|
-
User.
|
164
|
+
User.create(email: 'user@example.com', password: 'password')
|
165
165
|
end
|
166
166
|
|
167
167
|
it "signs me in" do
|
@@ -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', :
|
186
|
+
it 'will switch to one specific driver', driver: :apparition
|
187
187
|
end
|
188
188
|
```
|
189
189
|
|
@@ -192,7 +192,7 @@ Capybara also comes with a built in DSL for creating descriptive acceptance test
|
|
192
192
|
```ruby
|
193
193
|
feature "Signing in" do
|
194
194
|
background do
|
195
|
-
User.
|
195
|
+
User.create(email: 'user@example.com', password: 'caplin')
|
196
196
|
end
|
197
197
|
|
198
198
|
scenario "Signing in with correct credentials" do
|
@@ -205,7 +205,7 @@ feature "Signing in" do
|
|
205
205
|
expect(page).to have_content 'Success'
|
206
206
|
end
|
207
207
|
|
208
|
-
given(:other_user) { User.
|
208
|
+
given(:other_user) { User.create(email: 'other@example.com', password: 'rous') }
|
209
209
|
|
210
210
|
scenario "Signing in as another user" do
|
211
211
|
visit '/sessions/new'
|
@@ -219,11 +219,11 @@ feature "Signing in" do
|
|
219
219
|
end
|
220
220
|
```
|
221
221
|
|
222
|
-
`feature` is in fact just an alias for `describe ..., :
|
222
|
+
`feature` is in fact just an alias for `describe ..., type: :feature`,
|
223
223
|
`background` is an alias for `before`, `scenario` for `it`, and
|
224
224
|
`given`/`given!` aliases for `let`/`let!`, respectively.
|
225
225
|
|
226
|
-
Finally, Capybara matchers are supported in view specs:
|
226
|
+
Finally, Capybara matchers are also supported in view specs:
|
227
227
|
|
228
228
|
```ruby
|
229
229
|
RSpec.describe "todos/show.html.erb", type: :view do
|
@@ -260,7 +260,9 @@ end
|
|
260
260
|
|
261
261
|
## <a name="using-capybara-with-minitest"></a>Using Capybara with Minitest
|
262
262
|
|
263
|
-
* If you are using Rails
|
263
|
+
* If you are using Rails system tests please see their documentation for information on selecting the driver you wish to use.
|
264
|
+
|
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`:
|
266
268
|
|
@@ -275,8 +277,7 @@ end
|
|
275
277
|
include Capybara::Minitest::Assertions
|
276
278
|
|
277
279
|
# Reset sessions and driver between tests
|
278
|
-
|
279
|
-
def teardown
|
280
|
+
teardown do
|
280
281
|
Capybara.reset_sessions!
|
281
282
|
Capybara.use_default_driver
|
282
283
|
end
|
@@ -335,15 +336,15 @@ By default, Capybara uses the `:rack_test` driver, which is fast but limited: it
|
|
335
336
|
does not support JavaScript, nor is it able to access HTTP resources outside of
|
336
337
|
your Rack application, such as remote APIs and OAuth services. To get around
|
337
338
|
these limitations, you can set up a different default driver for your features.
|
338
|
-
For example if you'd prefer to run everything in Selenium, you could do:
|
339
|
+
For example, if you'd prefer to run everything in Selenium, you could do:
|
339
340
|
|
340
341
|
```ruby
|
341
342
|
Capybara.default_driver = :selenium # :selenium_chrome and :selenium_chrome_headless are also registered
|
342
343
|
```
|
343
344
|
|
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
|
345
|
+
However, if you are using RSpec or Cucumber (and your app runs correctly without JS),
|
346
|
+
you may instead want to consider leaving the faster `:rack_test` as the __default_driver__, and
|
347
|
+
marking only those tests that require a JavaScript-capable driver using `js: true` or
|
347
348
|
`@javascript`, respectively. By default, JavaScript tests are run using the
|
348
349
|
`:selenium` driver. You can change this by setting
|
349
350
|
`Capybara.javascript_driver`.
|
@@ -352,7 +353,7 @@ You can also change the driver temporarily (typically in the Before/setup and
|
|
352
353
|
After/teardown blocks):
|
353
354
|
|
354
355
|
```ruby
|
355
|
-
Capybara.current_driver = :
|
356
|
+
Capybara.current_driver = :apparition # temporarily select different driver
|
356
357
|
# tests here
|
357
358
|
Capybara.use_default_driver # switch back to default driver
|
358
359
|
```
|
@@ -387,42 +388,35 @@ See the section on adding and configuring drivers.
|
|
387
388
|
|
388
389
|
### <a name="selenium"></a>Selenium
|
389
390
|
|
390
|
-
|
391
|
-
(Webdriver)](
|
392
|
-
|
393
|
-
|
394
|
-
Provided Firefox is installed, everything is set up for you, and you should be
|
395
|
-
able to start using Selenium right away.
|
391
|
+
Capybara supports [Selenium 3.5+
|
392
|
+
(Webdriver)](https://www.seleniumhq.org/projects/webdriver/).
|
393
|
+
In order to use Selenium, you'll need to install the `selenium-webdriver` gem,
|
394
|
+
and add it to your Gemfile if you're using bundler.
|
396
395
|
|
397
|
-
|
398
|
-
same transaction as your tests, causing data not to be shared between your test
|
399
|
-
and test server, see "Transactions and database setup" below.
|
400
|
-
|
401
|
-
### <a name="capybara-webkit"></a>Capybara-webkit
|
402
|
-
|
403
|
-
The [capybara-webkit driver](https://github.com/thoughtbot/capybara-webkit) is for true headless
|
404
|
-
testing. It uses QtWebKit to start a rendering engine process. It can execute JavaScript as well.
|
405
|
-
It is significantly faster than drivers like Selenium since it does not load an entire browser.
|
396
|
+
Capybara pre-registers a number of named drivers that use Selenium - they are:
|
406
397
|
|
407
|
-
|
398
|
+
* :selenium => Selenium driving Firefox
|
399
|
+
* :selenium_headless => Selenium driving Firefox in a headless configuration
|
400
|
+
* :selenium_chrome => Selenium driving Chrome
|
401
|
+
* :selenium_chrome_headless => Selenium driving Chrome in a headless configuration
|
408
402
|
|
409
|
-
|
410
|
-
|
411
|
-
|
403
|
+
These should work (with relevant software installation) in a local desktop configuration but you may
|
404
|
+
need to customize them if using in a CI environment where additional options may need to be passed
|
405
|
+
to the browsers. See the section on adding and configuring drivers.
|
412
406
|
|
413
|
-
And you can use it by:
|
414
407
|
|
415
|
-
|
416
|
-
|
417
|
-
|
408
|
+
**Note**: drivers which run the server in a different thread may not share the
|
409
|
+
same transaction as your tests, causing data not to be shared between your test
|
410
|
+
and test server, see [Transactions and database setup](#transactions-and-database-setup) below.
|
418
411
|
|
419
|
-
### <a name="
|
412
|
+
### <a name="apparition"></a>Apparition
|
420
413
|
|
421
|
-
[
|
422
|
-
|
423
|
-
[
|
424
|
-
|
425
|
-
|
414
|
+
The [apparition driver](https://github.com/twalpole/apparition) is a new driver that allows you to run tests using Chrome in a headless
|
415
|
+
or headed configuration. It attempts to provide backwards compatibility with the [Poltergeist driver API](https://github.com/teampoltergeist/poltergeist)
|
416
|
+
and [capybara-webkit API](https://github.com/thoughtbot/capybara-webkit) while allowing for the use of modern JS/CSS. It
|
417
|
+
uses CDP to communicate with Chrome, thereby obviating the need for chromedriver. This driver is being developed by the
|
418
|
+
current developer of Capybara and will attempt to keep up to date with new Capybara releases. It will probably be moved into the
|
419
|
+
teamcapybara repo once it reaches v1.0.
|
426
420
|
|
427
421
|
## <a name="the-dsl"></a>The DSL
|
428
422
|
|
@@ -617,16 +611,26 @@ In drivers which support it, you can easily execute JavaScript:
|
|
617
611
|
page.execute_script("$('body').empty()")
|
618
612
|
```
|
619
613
|
|
620
|
-
For simple expressions, you can return the result of the script.
|
621
|
-
that this may break with more complicated expressions:
|
614
|
+
For simple expressions, you can return the result of the script.
|
622
615
|
|
623
616
|
```ruby
|
624
617
|
result = page.evaluate_script('4 + 4');
|
625
618
|
```
|
626
619
|
|
620
|
+
For more complicated scripts you'll need to write them as one expression.
|
621
|
+
|
622
|
+
```ruby
|
623
|
+
result = page.evaluate_script(<<~JS, 3, element)
|
624
|
+
(function(n, el){
|
625
|
+
var val = parseInt(el.value, 10);
|
626
|
+
return n+val;
|
627
|
+
})(arguments[0], arguments[1])
|
628
|
+
JS
|
629
|
+
```
|
630
|
+
|
627
631
|
### <a name="modals"></a>Modals
|
628
632
|
|
629
|
-
In drivers which support it, you can accept, dismiss and respond to alerts, confirms and prompts.
|
633
|
+
In drivers which support it, you can accept, dismiss and respond to alerts, confirms, and prompts.
|
630
634
|
|
631
635
|
You can accept or dismiss alert messages by wrapping the code that produces an alert in a block:
|
632
636
|
|
@@ -742,7 +746,7 @@ Capybara 1.x, set `Capybara.match` to `:prefer_exact`.
|
|
742
746
|
|
743
747
|
## <a name="transactions-and-database-setup"></a>Transactions and database setup
|
744
748
|
|
745
|
-
**Note:** Rails 5.1+
|
749
|
+
**Note:** Rails 5.1+ "safely" shares the database connection between the app and test threads. Therefore,
|
746
750
|
if using Rails 5.1+ you SHOULD be able to ignore this section.
|
747
751
|
|
748
752
|
Some Capybara drivers need to run against an actual HTTP server. Capybara takes
|
@@ -777,7 +781,7 @@ expect(page).to have_content('baz')
|
|
777
781
|
If clicking on the *foo* link triggers an asynchronous process, such as
|
778
782
|
an Ajax request, which, when complete will add the *bar* link to the page,
|
779
783
|
clicking on the *bar* link would be expected to fail, since that link doesn't
|
780
|
-
exist yet. However Capybara is smart enough to retry finding the link for a
|
784
|
+
exist yet. However, Capybara is smart enough to retry finding the link for a
|
781
785
|
brief period of time before giving up and throwing an error. The same is true of
|
782
786
|
the next line, which looks for the content *baz* on the page; it will retry
|
783
787
|
looking for that content for a brief time. You can adjust how long this period
|
@@ -791,13 +795,25 @@ Be aware that because of this behaviour, the following two statements are **not*
|
|
791
795
|
equivalent, and you should **always** use the latter!
|
792
796
|
|
793
797
|
```ruby
|
794
|
-
|
795
|
-
|
798
|
+
# Given use of a driver where the page is loaded when visit returns
|
799
|
+
# and that Capybara.predicates_wait is `true`
|
800
|
+
# consider a page where the `a` tag is removed through AJAX after 1s
|
801
|
+
visit(some_path)
|
802
|
+
!page.has_xpath?('a') # is false
|
803
|
+
page.has_no_xpath?('a') # is true
|
796
804
|
```
|
797
805
|
|
798
|
-
|
799
|
-
|
800
|
-
|
806
|
+
First expression:
|
807
|
+
- `has_xpath?('a')` is called right after `visit` returns. It is `true` because the link has not yet been removed
|
808
|
+
- Capybara does not wait upon successful predicates/assertions, therefore **has_xpath? returns `true` immediately**
|
809
|
+
- The expression returns `false` (because it is negated with the leading `!`)
|
810
|
+
|
811
|
+
Second expression:
|
812
|
+
- `has_no_xpath?('a')` is called right after `visit` returns. It is `false` because the link has not yet been removed.
|
813
|
+
- Capybara waits upon failed predicates/assertions, therefore **has_no_xpath? does not return `false` immediately**
|
814
|
+
- Capybara will periodically re-check the predicate/assertion up to the `default_max_wait_time` defined
|
815
|
+
- after 1s, the predicate becomes `true` (because the link has been removed)
|
816
|
+
- The expression returns `true`
|
801
817
|
|
802
818
|
Capybara's RSpec matchers, however, are smart enough to handle either form.
|
803
819
|
The two following statements are functionally equivalent:
|
@@ -932,12 +948,17 @@ Capybara.default_selector = :xpath
|
|
932
948
|
find('.//ul/li').text
|
933
949
|
```
|
934
950
|
|
935
|
-
Capybara
|
936
|
-
|
951
|
+
Capybara provides a number of other built-in selector types. The full list, along
|
952
|
+
with applicable filters, can be seen at [built-in selectors](https://www.rubydoc.info/github/teamcapybara/capybara/Capybara/Selector)
|
953
|
+
|
954
|
+
Capybara also allows you to add custom selectors, which can be very useful if you
|
955
|
+
find yourself using the same kinds of selectors very often. The examples below are very
|
956
|
+
simple, and there are many available features not demonstrated. For more in-depth examples
|
957
|
+
please see Capybaras built-in selector definitions.
|
937
958
|
|
938
959
|
```ruby
|
939
|
-
Capybara.add_selector(:
|
940
|
-
xpath { |id| XPath.descendant[XPath.attr(:
|
960
|
+
Capybara.add_selector(:my_attribute) do
|
961
|
+
xpath { |id| XPath.descendant[XPath.attr(:my_attribute) == id.to_s] }
|
941
962
|
end
|
942
963
|
|
943
964
|
Capybara.add_selector(:row) do
|
@@ -954,9 +975,9 @@ an XPath expression generated through the XPath gem. You can now use these
|
|
954
975
|
selectors like this:
|
955
976
|
|
956
977
|
```ruby
|
957
|
-
find(:
|
958
|
-
find(:row, 3)
|
959
|
-
find(:flash_type, :notice)
|
978
|
+
find(:my_attribute, 'post_123') # find element with matching attribute
|
979
|
+
find(:row, 3) # find 3rd row in table body
|
980
|
+
find(:flash_type, :notice) # find element with id of 'flash' and class of 'notice'
|
960
981
|
```
|
961
982
|
|
962
983
|
## <a name="beware-the-xpath--trap"></a>Beware the XPath // trap
|
@@ -1002,6 +1023,7 @@ end
|
|
1002
1023
|
However, it's also possible to give this configuration a different name.
|
1003
1024
|
|
1004
1025
|
```ruby
|
1026
|
+
# Note: Capybara registers this by default
|
1005
1027
|
Capybara.register_driver :selenium_chrome do |app|
|
1006
1028
|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
|
1007
1029
|
end
|
@@ -1047,7 +1069,14 @@ additional info about how the underlying driver can be configured.
|
|
1047
1069
|
are testing for specific server errors and using multiple sessions make sure to test for the
|
1048
1070
|
errors using the initial session (usually :default)
|
1049
1071
|
|
1050
|
-
|
1072
|
+
* If WebMock is enabled, you may encounter a "Too many open files"
|
1073
|
+
error. A simple `page.find` call may cause thousands of HTTP requests
|
1074
|
+
until the timeout occurs. By default, WebMock will cause each of these
|
1075
|
+
requests to spawn a new connection. To work around this problem, you
|
1076
|
+
may need to [enable WebMock's `net_http_connect_on_start: true`
|
1077
|
+
parameter](https://github.com/bblimke/webmock/blob/master/README.md#connecting-on-nethttpstart).
|
1078
|
+
|
1079
|
+
## <a name="threadsafe"></a>"Threadsafe" mode
|
1051
1080
|
|
1052
1081
|
In normal mode most of Capybara's configuration options are global settings which can cause issues
|
1053
1082
|
if using multiple sessions and wanting to change a setting for only one of the sessions. To provide
|
@@ -1082,7 +1111,8 @@ To set up a development environment, simply do:
|
|
1082
1111
|
|
1083
1112
|
```bash
|
1084
1113
|
bundle install
|
1085
|
-
bundle exec rake # run the test suite
|
1114
|
+
bundle exec rake # run the test suite with Firefox - requires `geckodriver` to be installed
|
1115
|
+
bundle exec rake spec_chrome # run the test suite with Chrome - require `chromedriver` to be installed
|
1086
1116
|
```
|
1087
1117
|
|
1088
1118
|
See
|
data/lib/capybara/config.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'forwardable'
|
3
4
|
require 'capybara/session/config'
|
4
5
|
|
@@ -6,11 +7,12 @@ module Capybara
|
|
6
7
|
class Config
|
7
8
|
extend Forwardable
|
8
9
|
|
9
|
-
OPTIONS = [
|
10
|
+
OPTIONS = %i[
|
11
|
+
app reuse_server threadsafe server default_driver javascript_driver use_html5_parsing allow_gumbo
|
12
|
+
].freeze
|
10
13
|
|
11
|
-
attr_accessor :app
|
12
|
-
attr_reader :reuse_server, :threadsafe
|
13
|
-
attr_reader :session_options
|
14
|
+
attr_accessor :app, :use_html5_parsing
|
15
|
+
attr_reader :reuse_server, :threadsafe, :session_options # rubocop:disable Style/BisectedAttrAccessor
|
14
16
|
attr_writer :default_driver, :javascript_driver
|
15
17
|
|
16
18
|
SessionConfig::OPTIONS.each do |method|
|
@@ -19,15 +21,16 @@ module Capybara
|
|
19
21
|
|
20
22
|
def initialize
|
21
23
|
@session_options = Capybara::SessionConfig.new
|
24
|
+
@javascript_driver = nil
|
22
25
|
end
|
23
26
|
|
24
|
-
|
25
|
-
@reuse_server = bool
|
26
|
-
end
|
27
|
+
attr_writer :reuse_server # rubocop:disable Style/BisectedAttrAccessor
|
27
28
|
|
28
29
|
def threadsafe=(bool)
|
29
|
-
|
30
|
-
|
30
|
+
if (bool != threadsafe) && Session.instance_created?
|
31
|
+
raise 'Threadsafe setting cannot be changed once a session is created'
|
32
|
+
end
|
33
|
+
|
31
34
|
@threadsafe = bool
|
32
35
|
end
|
33
36
|
|
@@ -35,16 +38,9 @@ module Capybara
|
|
35
38
|
#
|
36
39
|
# Return the proc that Capybara will call to run the Rack application.
|
37
40
|
# The block returned receives a rack app, port, and host/ip and should run a Rack handler
|
38
|
-
# By default, Capybara will try to
|
41
|
+
# By default, Capybara will try to use puma.
|
39
42
|
#
|
40
|
-
|
41
|
-
if block_given?
|
42
|
-
warn "DEPRECATED: Passing a block to Capybara::server is deprecated, please use Capybara::register_server instead"
|
43
|
-
@server = block
|
44
|
-
else
|
45
|
-
@server
|
46
|
-
end
|
47
|
-
end
|
43
|
+
attr_reader :server
|
48
44
|
|
49
45
|
##
|
50
46
|
#
|
@@ -64,12 +60,10 @@ module Capybara
|
|
64
60
|
name, options = *name if name.is_a? Array
|
65
61
|
@server = if name.respond_to? :call
|
66
62
|
name
|
63
|
+
elsif options
|
64
|
+
proc { |app, port, host| Capybara.servers[name.to_sym].call(app, port, host, **options) }
|
67
65
|
else
|
68
|
-
|
69
|
-
Proc.new { |app, port, host| Capybara.servers[name.to_sym].call(app,port,host,options) }
|
70
|
-
else
|
71
|
-
Capybara.servers[name.to_sym]
|
72
|
-
end
|
66
|
+
Capybara.servers[name.to_sym]
|
73
67
|
end
|
74
68
|
end
|
75
69
|
|
@@ -89,44 +83,22 @@ module Capybara
|
|
89
83
|
@javascript_driver || :selenium
|
90
84
|
end
|
91
85
|
|
92
|
-
|
93
|
-
def default_wait_time
|
94
|
-
deprecate('default_wait_time', 'default_max_wait_time', true)
|
95
|
-
default_max_wait_time
|
96
|
-
end
|
97
|
-
|
98
|
-
# @deprecated Use default_max_wait_time= instead
|
99
|
-
def default_wait_time=(t)
|
100
|
-
deprecate('default_wait_time=', 'default_max_wait_time=')
|
101
|
-
self.default_max_wait_time = t
|
102
|
-
end
|
103
|
-
|
104
|
-
def deprecate(method, alternate_method, once=false)
|
86
|
+
def deprecate(method, alternate_method, once: false)
|
105
87
|
@deprecation_notified ||= {}
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
# @api private
|
112
|
-
class ConfigureDeprecator
|
113
|
-
def initialize(config)
|
114
|
-
@config = config
|
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
|
91
|
+
@deprecation_notified[method] = true
|
115
92
|
end
|
116
93
|
|
117
|
-
def
|
118
|
-
|
119
|
-
|
120
|
-
elsif Capybara.respond_to?(m)
|
121
|
-
warn "Calling #{m} from Capybara.configure is deprecated - please call it on Capybara directly ( Capybara.#{m}(...) )"
|
122
|
-
Capybara.public_send(m, *args, &block)
|
123
|
-
else
|
124
|
-
super
|
125
|
-
end
|
94
|
+
def allow_gumbo=(val)
|
95
|
+
deprecate('allow_gumbo=', 'use_html5_parsing=')
|
96
|
+
self.use_html5_parsing = val
|
126
97
|
end
|
127
98
|
|
128
|
-
def
|
129
|
-
|
99
|
+
def allow_gumbo
|
100
|
+
deprecate('allow_gumbo', 'use_html5_parsing')
|
101
|
+
use_html5_parsing
|
130
102
|
end
|
131
103
|
end
|
132
|
-
end
|
104
|
+
end
|
data/lib/capybara/cucumber.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'capybara/dsl'
|
3
4
|
require 'capybara/rspec/matchers'
|
4
5
|
require 'capybara/rspec/matcher_proxies'
|
@@ -21,8 +22,6 @@ end
|
|
21
22
|
Before do |scenario|
|
22
23
|
scenario.source_tag_names.each do |tag|
|
23
24
|
driver_name = tag.sub(/^@/, '').to_sym
|
24
|
-
if Capybara.drivers
|
25
|
-
Capybara.current_driver = driver_name
|
26
|
-
end
|
25
|
+
Capybara.current_driver = driver_name if Capybara.drivers[driver_name]
|
27
26
|
end
|
28
27
|
end
|