mega-max-rb 0.0.1
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 +7 -0
- data/capybara-3.40.0/History.md +2043 -0
- data/capybara-3.40.0/License.txt +22 -0
- data/capybara-3.40.0/README.md +1264 -0
- data/capybara-3.40.0/lib/capybara/config.rb +104 -0
- data/capybara-3.40.0/lib/capybara/cucumber.rb +27 -0
- data/capybara-3.40.0/lib/capybara/driver/base.rb +178 -0
- data/capybara-3.40.0/lib/capybara/driver/node.rb +143 -0
- data/capybara-3.40.0/lib/capybara/dsl.rb +59 -0
- data/capybara-3.40.0/lib/capybara/helpers.rb +127 -0
- data/capybara-3.40.0/lib/capybara/minitest/spec.rb +279 -0
- data/capybara-3.40.0/lib/capybara/minitest.rb +398 -0
- data/capybara-3.40.0/lib/capybara/node/actions.rb +420 -0
- data/capybara-3.40.0/lib/capybara/node/base.rb +144 -0
- data/capybara-3.40.0/lib/capybara/node/document.rb +48 -0
- data/capybara-3.40.0/lib/capybara/node/document_matchers.rb +67 -0
- data/capybara-3.40.0/lib/capybara/node/element.rb +613 -0
- data/capybara-3.40.0/lib/capybara/node/finders.rb +335 -0
- data/capybara-3.40.0/lib/capybara/node/matchers.rb +908 -0
- data/capybara-3.40.0/lib/capybara/node/simple.rb +216 -0
- data/capybara-3.40.0/lib/capybara/node/whitespace_normalizer.rb +81 -0
- data/capybara-3.40.0/lib/capybara/queries/active_element_query.rb +18 -0
- data/capybara-3.40.0/lib/capybara/queries/ancestor_query.rb +28 -0
- data/capybara-3.40.0/lib/capybara/queries/base_query.rb +106 -0
- data/capybara-3.40.0/lib/capybara/queries/current_path_query.rb +61 -0
- data/capybara-3.40.0/lib/capybara/queries/match_query.rb +26 -0
- data/capybara-3.40.0/lib/capybara/queries/selector_query.rb +761 -0
- data/capybara-3.40.0/lib/capybara/queries/sibling_query.rb +27 -0
- data/capybara-3.40.0/lib/capybara/queries/style_query.rb +45 -0
- data/capybara-3.40.0/lib/capybara/queries/text_query.rb +116 -0
- data/capybara-3.40.0/lib/capybara/queries/title_query.rb +39 -0
- data/capybara-3.40.0/lib/capybara/rack_test/browser.rb +200 -0
- data/capybara-3.40.0/lib/capybara/rack_test/css_handlers.rb +13 -0
- data/capybara-3.40.0/lib/capybara/rack_test/driver.rb +110 -0
- data/capybara-3.40.0/lib/capybara/rack_test/errors.rb +6 -0
- data/capybara-3.40.0/lib/capybara/rack_test/form.rb +149 -0
- data/capybara-3.40.0/lib/capybara/rack_test/node.rb +324 -0
- data/capybara-3.40.0/lib/capybara/rails.rb +16 -0
- data/capybara-3.40.0/lib/capybara/registration_container.rb +41 -0
- data/capybara-3.40.0/lib/capybara/registrations/drivers.rb +42 -0
- data/capybara-3.40.0/lib/capybara/registrations/patches/puma_ssl.rb +29 -0
- data/capybara-3.40.0/lib/capybara/registrations/servers.rb +66 -0
- data/capybara-3.40.0/lib/capybara/result.rb +186 -0
- data/capybara-3.40.0/lib/capybara/rspec/features.rb +23 -0
- data/capybara-3.40.0/lib/capybara/rspec/matcher_proxies.rb +82 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/base.rb +113 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/become_closed.rb +33 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/compound.rb +88 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/count_sugar.rb +37 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/have_ancestor.rb +28 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/have_current_path.rb +29 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/have_selector.rb +69 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/have_sibling.rb +27 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/have_text.rb +33 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/have_title.rb +29 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/match_selector.rb +27 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/match_style.rb +43 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers/spatial_sugar.rb +39 -0
- data/capybara-3.40.0/lib/capybara/rspec/matchers.rb +207 -0
- data/capybara-3.40.0/lib/capybara/rspec.rb +31 -0
- data/capybara-3.40.0/lib/capybara/selector/builders/css_builder.rb +84 -0
- data/capybara-3.40.0/lib/capybara/selector/builders/xpath_builder.rb +71 -0
- data/capybara-3.40.0/lib/capybara/selector/css.rb +102 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/button.rb +68 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/checkbox.rb +26 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/css.rb +10 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/datalist_input.rb +35 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/datalist_option.rb +25 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/element.rb +28 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/field.rb +40 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/fieldset.rb +14 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/file_field.rb +13 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/fillable_field.rb +33 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/frame.rb +17 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/id.rb +6 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/label.rb +62 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/link.rb +55 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/link_or_button.rb +16 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/option.rb +27 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/radio_button.rb +27 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/select.rb +81 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/table.rb +109 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/table_row.rb +21 -0
- data/capybara-3.40.0/lib/capybara/selector/definition/xpath.rb +5 -0
- data/capybara-3.40.0/lib/capybara/selector/definition.rb +280 -0
- data/capybara-3.40.0/lib/capybara/selector/filter.rb +5 -0
- data/capybara-3.40.0/lib/capybara/selector/filter_set.rb +121 -0
- data/capybara-3.40.0/lib/capybara/selector/filters/base.rb +77 -0
- data/capybara-3.40.0/lib/capybara/selector/filters/expression_filter.rb +22 -0
- data/capybara-3.40.0/lib/capybara/selector/filters/locator_filter.rb +29 -0
- data/capybara-3.40.0/lib/capybara/selector/filters/node_filter.rb +31 -0
- data/capybara-3.40.0/lib/capybara/selector/regexp_disassembler.rb +211 -0
- data/capybara-3.40.0/lib/capybara/selector/selector.rb +159 -0
- data/capybara-3.40.0/lib/capybara/selector/xpath_extensions.rb +17 -0
- data/capybara-3.40.0/lib/capybara/selector.rb +494 -0
- data/capybara-3.40.0/lib/capybara/selenium/atoms/getAttribute.min.js +1 -0
- data/capybara-3.40.0/lib/capybara/selenium/atoms/isDisplayed.min.js +1 -0
- data/capybara-3.40.0/lib/capybara/selenium/atoms/src/getAttribute.js +161 -0
- data/capybara-3.40.0/lib/capybara/selenium/atoms/src/isDisplayed.js +454 -0
- data/capybara-3.40.0/lib/capybara/selenium/driver.rb +517 -0
- data/capybara-3.40.0/lib/capybara/selenium/driver_specializations/chrome_driver.rb +117 -0
- data/capybara-3.40.0/lib/capybara/selenium/driver_specializations/edge_driver.rb +128 -0
- data/capybara-3.40.0/lib/capybara/selenium/driver_specializations/firefox_driver.rb +84 -0
- data/capybara-3.40.0/lib/capybara/selenium/driver_specializations/internet_explorer_driver.rb +26 -0
- data/capybara-3.40.0/lib/capybara/selenium/driver_specializations/safari_driver.rb +24 -0
- data/capybara-3.40.0/lib/capybara/selenium/extensions/file_input_click_emulation.rb +34 -0
- data/capybara-3.40.0/lib/capybara/selenium/extensions/find.rb +110 -0
- data/capybara-3.40.0/lib/capybara/selenium/extensions/html5_drag.rb +229 -0
- data/capybara-3.40.0/lib/capybara/selenium/extensions/modifier_keys_stack.rb +28 -0
- data/capybara-3.40.0/lib/capybara/selenium/extensions/scroll.rb +76 -0
- data/capybara-3.40.0/lib/capybara/selenium/node.rb +636 -0
- data/capybara-3.40.0/lib/capybara/selenium/nodes/chrome_node.rb +125 -0
- data/capybara-3.40.0/lib/capybara/selenium/nodes/edge_node.rb +110 -0
- data/capybara-3.40.0/lib/capybara/selenium/nodes/firefox_node.rb +136 -0
- data/capybara-3.40.0/lib/capybara/selenium/nodes/ie_node.rb +22 -0
- data/capybara-3.40.0/lib/capybara/selenium/nodes/safari_node.rb +118 -0
- data/capybara-3.40.0/lib/capybara/selenium/patches/atoms.rb +18 -0
- data/capybara-3.40.0/lib/capybara/selenium/patches/is_displayed.rb +16 -0
- data/capybara-3.40.0/lib/capybara/selenium/patches/logs.rb +45 -0
- data/capybara-3.40.0/lib/capybara/selenium/patches/pause_duration_fix.rb +9 -0
- data/capybara-3.40.0/lib/capybara/selenium/patches/persistent_client.rb +20 -0
- data/capybara-3.40.0/lib/capybara/server/animation_disabler.rb +80 -0
- data/capybara-3.40.0/lib/capybara/server/checker.rb +44 -0
- data/capybara-3.40.0/lib/capybara/server/middleware.rb +71 -0
- data/capybara-3.40.0/lib/capybara/server.rb +126 -0
- data/capybara-3.40.0/lib/capybara/session/config.rb +128 -0
- data/capybara-3.40.0/lib/capybara/session/matchers.rb +87 -0
- data/capybara-3.40.0/lib/capybara/session.rb +951 -0
- data/capybara-3.40.0/lib/capybara/spec/fixtures/another_test_file.txt +1 -0
- data/capybara-3.40.0/lib/capybara/spec/fixtures/capybara.jpg +3 -0
- data/capybara-3.40.0/lib/capybara/spec/fixtures/no_extension +1 -0
- data/capybara-3.40.0/lib/capybara/spec/fixtures/test_file.txt +1 -0
- data/capybara-3.40.0/lib/capybara/spec/public/jquery-ui.js +13 -0
- data/capybara-3.40.0/lib/capybara/spec/public/jquery.js +5 -0
- data/capybara-3.40.0/lib/capybara/spec/public/offset.js +6 -0
- data/capybara-3.40.0/lib/capybara/spec/public/test.js +284 -0
- data/capybara-3.40.0/lib/capybara/spec/session/accept_alert_spec.rb +81 -0
- data/capybara-3.40.0/lib/capybara/spec/session/accept_confirm_spec.rb +32 -0
- data/capybara-3.40.0/lib/capybara/spec/session/accept_prompt_spec.rb +78 -0
- data/capybara-3.40.0/lib/capybara/spec/session/active_element_spec.rb +31 -0
- data/capybara-3.40.0/lib/capybara/spec/session/all_spec.rb +274 -0
- data/capybara-3.40.0/lib/capybara/spec/session/ancestor_spec.rb +88 -0
- data/capybara-3.40.0/lib/capybara/spec/session/assert_all_of_selectors_spec.rb +140 -0
- data/capybara-3.40.0/lib/capybara/spec/session/assert_current_path_spec.rb +75 -0
- data/capybara-3.40.0/lib/capybara/spec/session/assert_selector_spec.rb +143 -0
- data/capybara-3.40.0/lib/capybara/spec/session/assert_style_spec.rb +26 -0
- data/capybara-3.40.0/lib/capybara/spec/session/assert_text_spec.rb +258 -0
- data/capybara-3.40.0/lib/capybara/spec/session/assert_title_spec.rb +93 -0
- data/capybara-3.40.0/lib/capybara/spec/session/attach_file_spec.rb +222 -0
- data/capybara-3.40.0/lib/capybara/spec/session/body_spec.rb +23 -0
- data/capybara-3.40.0/lib/capybara/spec/session/check_spec.rb +251 -0
- data/capybara-3.40.0/lib/capybara/spec/session/choose_spec.rb +127 -0
- data/capybara-3.40.0/lib/capybara/spec/session/click_button_spec.rb +517 -0
- data/capybara-3.40.0/lib/capybara/spec/session/click_link_or_button_spec.rb +138 -0
- data/capybara-3.40.0/lib/capybara/spec/session/click_link_spec.rb +240 -0
- data/capybara-3.40.0/lib/capybara/spec/session/current_scope_spec.rb +31 -0
- data/capybara-3.40.0/lib/capybara/spec/session/current_url_spec.rb +125 -0
- data/capybara-3.40.0/lib/capybara/spec/session/dismiss_confirm_spec.rb +36 -0
- data/capybara-3.40.0/lib/capybara/spec/session/dismiss_prompt_spec.rb +21 -0
- data/capybara-3.40.0/lib/capybara/spec/session/element/assert_match_selector_spec.rb +38 -0
- data/capybara-3.40.0/lib/capybara/spec/session/element/match_css_spec.rb +31 -0
- data/capybara-3.40.0/lib/capybara/spec/session/element/match_xpath_spec.rb +25 -0
- data/capybara-3.40.0/lib/capybara/spec/session/element/matches_selector_spec.rb +120 -0
- data/capybara-3.40.0/lib/capybara/spec/session/evaluate_async_script_spec.rb +23 -0
- data/capybara-3.40.0/lib/capybara/spec/session/evaluate_script_spec.rb +49 -0
- data/capybara-3.40.0/lib/capybara/spec/session/execute_script_spec.rb +28 -0
- data/capybara-3.40.0/lib/capybara/spec/session/fill_in_spec.rb +292 -0
- data/capybara-3.40.0/lib/capybara/spec/session/find_button_spec.rb +74 -0
- data/capybara-3.40.0/lib/capybara/spec/session/find_by_id_spec.rb +33 -0
- data/capybara-3.40.0/lib/capybara/spec/session/find_field_spec.rb +113 -0
- data/capybara-3.40.0/lib/capybara/spec/session/find_link_spec.rb +80 -0
- data/capybara-3.40.0/lib/capybara/spec/session/find_spec.rb +545 -0
- data/capybara-3.40.0/lib/capybara/spec/session/first_spec.rb +156 -0
- data/capybara-3.40.0/lib/capybara/spec/session/frame/frame_title_spec.rb +23 -0
- data/capybara-3.40.0/lib/capybara/spec/session/frame/frame_url_spec.rb +23 -0
- data/capybara-3.40.0/lib/capybara/spec/session/frame/switch_to_frame_spec.rb +116 -0
- data/capybara-3.40.0/lib/capybara/spec/session/frame/within_frame_spec.rb +114 -0
- data/capybara-3.40.0/lib/capybara/spec/session/go_back_spec.rb +12 -0
- data/capybara-3.40.0/lib/capybara/spec/session/go_forward_spec.rb +14 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_all_selectors_spec.rb +69 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_ancestor_spec.rb +46 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_any_selectors_spec.rb +29 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_button_spec.rb +150 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_css_spec.rb +375 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_current_path_spec.rb +151 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_element_spec.rb +47 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_field_spec.rb +389 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_link_spec.rb +79 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_none_selectors_spec.rb +78 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_select_spec.rb +316 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_selector_spec.rb +217 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_sibling_spec.rb +50 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_table_spec.rb +209 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_text_spec.rb +375 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_title_spec.rb +71 -0
- data/capybara-3.40.0/lib/capybara/spec/session/has_xpath_spec.rb +149 -0
- data/capybara-3.40.0/lib/capybara/spec/session/headers_spec.rb +8 -0
- data/capybara-3.40.0/lib/capybara/spec/session/html_spec.rb +47 -0
- data/capybara-3.40.0/lib/capybara/spec/session/matches_style_spec.rb +37 -0
- data/capybara-3.40.0/lib/capybara/spec/session/node_spec.rb +1399 -0
- data/capybara-3.40.0/lib/capybara/spec/session/node_wrapper_spec.rb +39 -0
- data/capybara-3.40.0/lib/capybara/spec/session/refresh_spec.rb +34 -0
- data/capybara-3.40.0/lib/capybara/spec/session/reset_session_spec.rb +161 -0
- data/capybara-3.40.0/lib/capybara/spec/session/response_code_spec.rb +8 -0
- data/capybara-3.40.0/lib/capybara/spec/session/save_and_open_page_spec.rb +21 -0
- data/capybara-3.40.0/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +43 -0
- data/capybara-3.40.0/lib/capybara/spec/session/save_page_spec.rb +110 -0
- data/capybara-3.40.0/lib/capybara/spec/session/save_screenshot_spec.rb +55 -0
- data/capybara-3.40.0/lib/capybara/spec/session/screenshot_spec.rb +18 -0
- data/capybara-3.40.0/lib/capybara/spec/session/scroll_spec.rb +119 -0
- data/capybara-3.40.0/lib/capybara/spec/session/select_spec.rb +229 -0
- data/capybara-3.40.0/lib/capybara/spec/session/selectors_spec.rb +98 -0
- data/capybara-3.40.0/lib/capybara/spec/session/sibling_spec.rb +52 -0
- data/capybara-3.40.0/lib/capybara/spec/session/text_spec.rb +74 -0
- data/capybara-3.40.0/lib/capybara/spec/session/title_spec.rb +29 -0
- data/capybara-3.40.0/lib/capybara/spec/session/uncheck_spec.rb +100 -0
- data/capybara-3.40.0/lib/capybara/spec/session/unselect_spec.rb +116 -0
- data/capybara-3.40.0/lib/capybara/spec/session/visit_spec.rb +224 -0
- data/capybara-3.40.0/lib/capybara/spec/session/window/become_closed_spec.rb +89 -0
- data/capybara-3.40.0/lib/capybara/spec/session/window/current_window_spec.rb +28 -0
- data/capybara-3.40.0/lib/capybara/spec/session/window/open_new_window_spec.rb +31 -0
- data/capybara-3.40.0/lib/capybara/spec/session/window/switch_to_window_spec.rb +132 -0
- data/capybara-3.40.0/lib/capybara/spec/session/window/window_opened_by_spec.rb +99 -0
- data/capybara-3.40.0/lib/capybara/spec/session/window/window_spec.rb +203 -0
- data/capybara-3.40.0/lib/capybara/spec/session/window/windows_spec.rb +34 -0
- data/capybara-3.40.0/lib/capybara/spec/session/window/within_window_spec.rb +157 -0
- data/capybara-3.40.0/lib/capybara/spec/session/within_spec.rb +212 -0
- data/capybara-3.40.0/lib/capybara/spec/spec_helper.rb +141 -0
- data/capybara-3.40.0/lib/capybara/spec/test_app.rb +305 -0
- data/capybara-3.40.0/lib/capybara/spec/views/animated.erb +49 -0
- data/capybara-3.40.0/lib/capybara/spec/views/buttons.erb +5 -0
- data/capybara-3.40.0/lib/capybara/spec/views/fieldsets.erb +30 -0
- data/capybara-3.40.0/lib/capybara/spec/views/form.erb +738 -0
- data/capybara-3.40.0/lib/capybara/spec/views/frame_child.erb +18 -0
- data/capybara-3.40.0/lib/capybara/spec/views/frame_one.erb +10 -0
- data/capybara-3.40.0/lib/capybara/spec/views/frame_parent.erb +9 -0
- data/capybara-3.40.0/lib/capybara/spec/views/frame_two.erb +9 -0
- data/capybara-3.40.0/lib/capybara/spec/views/header_links.erb +8 -0
- data/capybara-3.40.0/lib/capybara/spec/views/host_links.erb +13 -0
- data/capybara-3.40.0/lib/capybara/spec/views/initial_alert.erb +11 -0
- data/capybara-3.40.0/lib/capybara/spec/views/layout.erb +10 -0
- data/capybara-3.40.0/lib/capybara/spec/views/obscured.erb +47 -0
- data/capybara-3.40.0/lib/capybara/spec/views/offset.erb +33 -0
- data/capybara-3.40.0/lib/capybara/spec/views/path.erb +13 -0
- data/capybara-3.40.0/lib/capybara/spec/views/popup_one.erb +9 -0
- data/capybara-3.40.0/lib/capybara/spec/views/popup_two.erb +9 -0
- data/capybara-3.40.0/lib/capybara/spec/views/postback.erb +14 -0
- data/capybara-3.40.0/lib/capybara/spec/views/react.erb +45 -0
- data/capybara-3.40.0/lib/capybara/spec/views/scroll.erb +21 -0
- data/capybara-3.40.0/lib/capybara/spec/views/spatial.erb +31 -0
- data/capybara-3.40.0/lib/capybara/spec/views/tables.erb +130 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_animation.erb +81 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_base_tag.erb +11 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_count.erb +8 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_dragula.erb +24 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_fixed_header_footer.erb +18 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_hover.erb +24 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_hover1.erb +10 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_html.erb +210 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_html5_svg.erb +20 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_html_entities.erb +2 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_jquery_animation.erb +24 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_js.erb +162 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_jstree.erb +26 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_namespace.erb +21 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_scope.erb +42 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_scope_other.erb +6 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_shadow.erb +31 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_simple_html.erb +2 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_slow_unload.erb +18 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_sortable_js.erb +21 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_unload_alert.erb +15 -0
- data/capybara-3.40.0/lib/capybara/spec/views/with_windows.erb +54 -0
- data/capybara-3.40.0/lib/capybara/spec/views/within_frames.erb +15 -0
- data/capybara-3.40.0/lib/capybara/version.rb +5 -0
- data/capybara-3.40.0/lib/capybara/window.rb +142 -0
- data/capybara-3.40.0/lib/capybara.rb +521 -0
- data/capybara-3.40.0/spec/basic_node_spec.rb +168 -0
- data/capybara-3.40.0/spec/capybara_spec.rb +124 -0
- data/capybara-3.40.0/spec/counter_spec.rb +35 -0
- data/capybara-3.40.0/spec/css_builder_spec.rb +101 -0
- data/capybara-3.40.0/spec/css_splitter_spec.rb +38 -0
- data/capybara-3.40.0/spec/dsl_spec.rb +291 -0
- data/capybara-3.40.0/spec/filter_set_spec.rb +46 -0
- data/capybara-3.40.0/spec/fixtures/capybara.csv +1 -0
- data/capybara-3.40.0/spec/fixtures/certificate.pem +25 -0
- data/capybara-3.40.0/spec/fixtures/key.pem +27 -0
- data/capybara-3.40.0/spec/fixtures/selenium_driver_rspec_failure.rb +13 -0
- data/capybara-3.40.0/spec/fixtures/selenium_driver_rspec_success.rb +13 -0
- data/capybara-3.40.0/spec/minitest_spec.rb +175 -0
- data/capybara-3.40.0/spec/minitest_spec_spec.rb +166 -0
- data/capybara-3.40.0/spec/per_session_config_spec.rb +68 -0
- data/capybara-3.40.0/spec/rack_test_spec.rb +297 -0
- data/capybara-3.40.0/spec/regexp_dissassembler_spec.rb +250 -0
- data/capybara-3.40.0/spec/result_spec.rb +202 -0
- data/capybara-3.40.0/spec/rspec/features_spec.rb +101 -0
- data/capybara-3.40.0/spec/rspec/scenarios_spec.rb +23 -0
- data/capybara-3.40.0/spec/rspec/shared_spec_matchers.rb +983 -0
- data/capybara-3.40.0/spec/rspec/views_spec.rb +14 -0
- data/capybara-3.40.0/spec/rspec_matchers_spec.rb +87 -0
- data/capybara-3.40.0/spec/rspec_spec.rb +149 -0
- data/capybara-3.40.0/spec/sauce_spec_chrome.rb +43 -0
- data/capybara-3.40.0/spec/selector_spec.rb +528 -0
- data/capybara-3.40.0/spec/selenium_spec_chrome.rb +209 -0
- data/capybara-3.40.0/spec/selenium_spec_chrome_remote.rb +96 -0
- data/capybara-3.40.0/spec/selenium_spec_edge.rb +60 -0
- data/capybara-3.40.0/spec/selenium_spec_firefox.rb +228 -0
- data/capybara-3.40.0/spec/selenium_spec_firefox_remote.rb +94 -0
- data/capybara-3.40.0/spec/selenium_spec_ie.rb +149 -0
- data/capybara-3.40.0/spec/selenium_spec_safari.rb +162 -0
- data/capybara-3.40.0/spec/server_spec.rb +315 -0
- data/capybara-3.40.0/spec/session_spec.rb +91 -0
- data/capybara-3.40.0/spec/shared_selenium_node.rb +79 -0
- data/capybara-3.40.0/spec/shared_selenium_session.rb +566 -0
- data/capybara-3.40.0/spec/spec_helper.rb +133 -0
- data/capybara-3.40.0/spec/whitespace_normalizer_spec.rb +54 -0
- data/capybara-3.40.0/spec/xpath_builder_spec.rb +93 -0
- data/mega-max-rb.gemspec +12 -0
- metadata +358 -0
|
@@ -0,0 +1,908 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Capybara
|
|
4
|
+
module Node
|
|
5
|
+
module Matchers
|
|
6
|
+
##
|
|
7
|
+
#
|
|
8
|
+
# Checks if a given selector is on the page or a descendant of the current node.
|
|
9
|
+
#
|
|
10
|
+
# page.has_selector?('p#foo')
|
|
11
|
+
# page.has_selector?(:xpath, './/p[@id="foo"]')
|
|
12
|
+
# page.has_selector?(:foo)
|
|
13
|
+
#
|
|
14
|
+
# By default it will check if the expression occurs at least once,
|
|
15
|
+
# but a different number can be specified.
|
|
16
|
+
#
|
|
17
|
+
# page.has_selector?('p.foo', count: 4)
|
|
18
|
+
#
|
|
19
|
+
# This will check if the expression occurs exactly 4 times.
|
|
20
|
+
#
|
|
21
|
+
# It also accepts all options that {Capybara::Node::Finders#all} accepts,
|
|
22
|
+
# such as `:text` and `:visible`.
|
|
23
|
+
#
|
|
24
|
+
# page.has_selector?('li', text: 'Horse', visible: true)
|
|
25
|
+
#
|
|
26
|
+
# {#has_selector?} can also accept XPath expressions generated by the
|
|
27
|
+
# XPath gem:
|
|
28
|
+
#
|
|
29
|
+
# page.has_selector?(:xpath, XPath.descendant(:p))
|
|
30
|
+
#
|
|
31
|
+
# @param (see Capybara::Node::Finders#all)
|
|
32
|
+
# @option options [Integer] :count (nil) Number of matching elements that should exist
|
|
33
|
+
# @option options [Integer] :minimum (nil) Minimum number of matching elements that should exist
|
|
34
|
+
# @option options [Integer] :maximum (nil) Maximum number of matching elements that should exist
|
|
35
|
+
# @option options [Range] :between (nil) Range of number of matching elements that should exist
|
|
36
|
+
# @return [Boolean] If the expression exists
|
|
37
|
+
#
|
|
38
|
+
def has_selector?(*args, **options, &optional_filter_block)
|
|
39
|
+
make_predicate(options) { assert_selector(*args, options, &optional_filter_block) }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
##
|
|
43
|
+
#
|
|
44
|
+
# Checks if a given selector is not on the page or a descendant of the current node.
|
|
45
|
+
# Usage is identical to {#has_selector?}.
|
|
46
|
+
#
|
|
47
|
+
# @param (see #has_selector?)
|
|
48
|
+
# @return [Boolean]
|
|
49
|
+
#
|
|
50
|
+
def has_no_selector?(*args, **options, &optional_filter_block)
|
|
51
|
+
make_predicate(options) { assert_no_selector(*args, options, &optional_filter_block) }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
##
|
|
55
|
+
#
|
|
56
|
+
# Checks if a an element has the specified CSS styles.
|
|
57
|
+
#
|
|
58
|
+
# element.matches_style?( 'color' => 'rgb(0,0,255)', 'font-size' => /px/ )
|
|
59
|
+
#
|
|
60
|
+
# @param styles [Hash]
|
|
61
|
+
# @return [Boolean] If the styles match
|
|
62
|
+
#
|
|
63
|
+
def matches_style?(styles = nil, **options)
|
|
64
|
+
styles, options = options, {} if styles.nil?
|
|
65
|
+
make_predicate(options) { assert_matches_style(styles, **options) }
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
##
|
|
69
|
+
# @deprecated Use {#matches_style?} instead.
|
|
70
|
+
#
|
|
71
|
+
def has_style?(styles = nil, **options)
|
|
72
|
+
Capybara::Helpers.warn "DEPRECATED: has_style? is deprecated, please use matches_style? : #{Capybara::Helpers.filter_backtrace(caller)}"
|
|
73
|
+
matches_style?(styles, **options)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
##
|
|
77
|
+
#
|
|
78
|
+
# Asserts that a given selector is on the page or a descendant of the current node.
|
|
79
|
+
#
|
|
80
|
+
# page.assert_selector('p#foo')
|
|
81
|
+
# page.assert_selector(:xpath, './/p[@id="foo"]')
|
|
82
|
+
# page.assert_selector(:foo)
|
|
83
|
+
#
|
|
84
|
+
# By default it will check if the expression occurs at least once,
|
|
85
|
+
# but a different number can be specified.
|
|
86
|
+
#
|
|
87
|
+
# page.assert_selector('p#foo', count: 4)
|
|
88
|
+
#
|
|
89
|
+
# This will check if the expression occurs exactly 4 times. See
|
|
90
|
+
# {Capybara::Node::Finders#all} for other available result size options.
|
|
91
|
+
#
|
|
92
|
+
# If a `:count` of 0 is specified, it will behave like {#assert_no_selector};
|
|
93
|
+
# however, use of that method is preferred over this one.
|
|
94
|
+
#
|
|
95
|
+
# It also accepts all options that {Capybara::Node::Finders#all} accepts,
|
|
96
|
+
# such as `:text` and `:visible`.
|
|
97
|
+
#
|
|
98
|
+
# page.assert_selector('li', text: 'Horse', visible: true)
|
|
99
|
+
#
|
|
100
|
+
# {#assert_selector} can also accept XPath expressions generated by the
|
|
101
|
+
# XPath gem:
|
|
102
|
+
#
|
|
103
|
+
# page.assert_selector(:xpath, XPath.descendant(:p))
|
|
104
|
+
#
|
|
105
|
+
# @param (see Capybara::Node::Finders#all)
|
|
106
|
+
# @option options [Integer] :count (nil) Number of times the expression should occur
|
|
107
|
+
# @raise [Capybara::ExpectationNotMet] If the selector does not exist
|
|
108
|
+
#
|
|
109
|
+
def assert_selector(*args, &optional_filter_block)
|
|
110
|
+
_verify_selector_result(args, optional_filter_block) do |result, query|
|
|
111
|
+
unless result.matches_count? && (result.any? || query.expects_none?)
|
|
112
|
+
raise Capybara::ExpectationNotMet, result.failure_message
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
##
|
|
118
|
+
#
|
|
119
|
+
# Asserts that an element has the specified CSS styles.
|
|
120
|
+
#
|
|
121
|
+
# element.assert_matches_style( 'color' => 'rgb(0,0,255)', 'font-size' => /px/ )
|
|
122
|
+
#
|
|
123
|
+
# @param styles [Hash]
|
|
124
|
+
# @raise [Capybara::ExpectationNotMet] If the element doesn't have the specified styles
|
|
125
|
+
#
|
|
126
|
+
def assert_matches_style(styles = nil, **options)
|
|
127
|
+
styles, options = options, {} if styles.nil?
|
|
128
|
+
query_args, query_opts = _set_query_session_options(styles, options)
|
|
129
|
+
query = Capybara::Queries::StyleQuery.new(*query_args, **query_opts)
|
|
130
|
+
synchronize(query.wait) do
|
|
131
|
+
raise Capybara::ExpectationNotMet, query.failure_message unless query.resolves_for?(self)
|
|
132
|
+
end
|
|
133
|
+
true
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
##
|
|
137
|
+
# @deprecated Use {#assert_matches_style} instead.
|
|
138
|
+
#
|
|
139
|
+
def assert_style(styles = nil, **options)
|
|
140
|
+
warn 'assert_style is deprecated, please use assert_matches_style instead'
|
|
141
|
+
assert_matches_style(styles, **options)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Asserts that all of the provided selectors are present on the given page
|
|
145
|
+
# or descendants of the current node. If options are provided, the assertion
|
|
146
|
+
# will check that each locator is present with those options as well (other than `:wait`).
|
|
147
|
+
#
|
|
148
|
+
# page.assert_all_of_selectors(:custom, 'Tom', 'Joe', visible: all)
|
|
149
|
+
# page.assert_all_of_selectors(:css, '#my_div', 'a.not_clicked')
|
|
150
|
+
#
|
|
151
|
+
# It accepts all options that {Capybara::Node::Finders#all} accepts,
|
|
152
|
+
# such as `:text` and `:visible`.
|
|
153
|
+
#
|
|
154
|
+
# The `:wait` option applies to all of the selectors as a group, so all of the locators must be present
|
|
155
|
+
# within `:wait` (defaults to {Capybara.configure default_max_wait_time}) seconds.
|
|
156
|
+
#
|
|
157
|
+
# @overload assert_all_of_selectors([kind = Capybara.default_selector], *locators, **options)
|
|
158
|
+
#
|
|
159
|
+
def assert_all_of_selectors(*args, **options, &optional_filter_block)
|
|
160
|
+
_verify_multiple(*args, **options) do |selector, locator, opts|
|
|
161
|
+
assert_selector(selector, locator, opts, &optional_filter_block)
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Asserts that none of the provided selectors are present on the given page
|
|
166
|
+
# or descendants of the current node. If options are provided, the assertion
|
|
167
|
+
# will check that each locator is not present with those options as well (other than `:wait`).
|
|
168
|
+
#
|
|
169
|
+
# page.assert_none_of_selectors(:custom, 'Tom', 'Joe', visible: all)
|
|
170
|
+
# page.assert_none_of_selectors(:css, '#my_div', 'a.not_clicked')
|
|
171
|
+
#
|
|
172
|
+
# It accepts all options that {Capybara::Node::Finders#all} accepts,
|
|
173
|
+
# such as `:text` and `:visible`.
|
|
174
|
+
#
|
|
175
|
+
# The `:wait` option applies to all of the selectors as a group, so none of the locators must be present
|
|
176
|
+
# within `:wait` (defaults to {Capybara.configure default_max_wait_time}) seconds.
|
|
177
|
+
#
|
|
178
|
+
# @overload assert_none_of_selectors([kind = Capybara.default_selector], *locators, **options)
|
|
179
|
+
#
|
|
180
|
+
def assert_none_of_selectors(*args, **options, &optional_filter_block)
|
|
181
|
+
_verify_multiple(*args, **options) do |selector, locator, opts|
|
|
182
|
+
assert_no_selector(selector, locator, opts, &optional_filter_block)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Asserts that any of the provided selectors are present on the given page
|
|
187
|
+
# or descendants of the current node. If options are provided, the assertion
|
|
188
|
+
# will check that each locator is present with those options as well (other than `:wait`).
|
|
189
|
+
#
|
|
190
|
+
# page.assert_any_of_selectors(:custom, 'Tom', 'Joe', visible: all)
|
|
191
|
+
# page.assert_any_of_selectors(:css, '#my_div', 'a.not_clicked')
|
|
192
|
+
#
|
|
193
|
+
# It accepts all options that {Capybara::Node::Finders#all} accepts,
|
|
194
|
+
# such as `:text` and `:visible`.
|
|
195
|
+
#
|
|
196
|
+
# The `:wait` option applies to all of the selectors as a group, so any of the locators must be present
|
|
197
|
+
# within `:wait` (defaults to {Capybara.configure default_max_wait_time}) seconds.
|
|
198
|
+
#
|
|
199
|
+
# @overload assert_any_of_selectors([kind = Capybara.default_selector], *locators, **options)
|
|
200
|
+
#
|
|
201
|
+
def assert_any_of_selectors(*args, wait: nil, **options, &optional_filter_block)
|
|
202
|
+
wait = session_options.default_max_wait_time if wait.nil?
|
|
203
|
+
selector = extract_selector(args)
|
|
204
|
+
synchronize(wait) do
|
|
205
|
+
res = args.map do |locator|
|
|
206
|
+
assert_selector(selector, locator, options, &optional_filter_block)
|
|
207
|
+
break nil
|
|
208
|
+
rescue Capybara::ExpectationNotMet => e
|
|
209
|
+
e.message
|
|
210
|
+
end
|
|
211
|
+
raise Capybara::ExpectationNotMet, res.join(' or ') if res
|
|
212
|
+
|
|
213
|
+
true
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
##
|
|
218
|
+
#
|
|
219
|
+
# Asserts that a given selector is not on the page or a descendant of the current node.
|
|
220
|
+
# Usage is identical to {#assert_selector}.
|
|
221
|
+
#
|
|
222
|
+
# Query options such as `:count`, `:minimum`, `:maximum`, and `:between` are
|
|
223
|
+
# considered to be an integral part of the selector. This will return
|
|
224
|
+
# `true`, for example, if a page contains 4 anchors but the query expects 5:
|
|
225
|
+
#
|
|
226
|
+
# page.assert_no_selector('a', minimum: 1) # Found, raises Capybara::ExpectationNotMet
|
|
227
|
+
# page.assert_no_selector('a', count: 4) # Found, raises Capybara::ExpectationNotMet
|
|
228
|
+
# page.assert_no_selector('a', count: 5) # Not Found, returns true
|
|
229
|
+
#
|
|
230
|
+
# @param (see #assert_selector)
|
|
231
|
+
# @raise [Capybara::ExpectationNotMet] If the selector exists
|
|
232
|
+
#
|
|
233
|
+
def assert_no_selector(*args, &optional_filter_block)
|
|
234
|
+
_verify_selector_result(args, optional_filter_block) do |result, query|
|
|
235
|
+
if result.matches_count? && (!result.empty? || query.expects_none?)
|
|
236
|
+
raise Capybara::ExpectationNotMet, result.negative_failure_message
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
##
|
|
242
|
+
#
|
|
243
|
+
# Checks if a given XPath expression is on the page or a descendant of the current node.
|
|
244
|
+
#
|
|
245
|
+
# page.has_xpath?('.//p[@id="foo"]')
|
|
246
|
+
#
|
|
247
|
+
# By default it will check if the expression occurs at least once,
|
|
248
|
+
# but a different number can be specified.
|
|
249
|
+
#
|
|
250
|
+
# page.has_xpath?('.//p[@id="foo"]', count: 4)
|
|
251
|
+
#
|
|
252
|
+
# This will check if the expression occurs exactly 4 times.
|
|
253
|
+
#
|
|
254
|
+
# It also accepts all options that {Capybara::Node::Finders#all} accepts,
|
|
255
|
+
# such as `:text` and `:visible`.
|
|
256
|
+
#
|
|
257
|
+
# page.has_xpath?('.//li', text: 'Horse', visible: true)
|
|
258
|
+
#
|
|
259
|
+
# {#has_xpath?} can also accept XPath expressions generated by the
|
|
260
|
+
# XPath gem:
|
|
261
|
+
#
|
|
262
|
+
# xpath = XPath.generate { |x| x.descendant(:p) }
|
|
263
|
+
# page.has_xpath?(xpath)
|
|
264
|
+
#
|
|
265
|
+
# @param [String] path An XPath expression
|
|
266
|
+
# @param options (see Capybara::Node::Finders#all)
|
|
267
|
+
# @option options [Integer] :count (nil) Number of times the expression should occur
|
|
268
|
+
# @return [Boolean] If the expression exists
|
|
269
|
+
#
|
|
270
|
+
def has_xpath?(path, **options, &optional_filter_block)
|
|
271
|
+
has_selector?(:xpath, path, **options, &optional_filter_block)
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
##
|
|
275
|
+
#
|
|
276
|
+
# Checks if a given XPath expression is not on the page or a descendant of the current node.
|
|
277
|
+
# Usage is identical to {#has_xpath?}.
|
|
278
|
+
#
|
|
279
|
+
# @param (see #has_xpath?)
|
|
280
|
+
# @return [Boolean]
|
|
281
|
+
#
|
|
282
|
+
def has_no_xpath?(path, **options, &optional_filter_block)
|
|
283
|
+
has_no_selector?(:xpath, path, **options, &optional_filter_block)
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
##
|
|
287
|
+
#
|
|
288
|
+
# Checks if a given CSS selector is on the page or a descendant of the current node.
|
|
289
|
+
#
|
|
290
|
+
# page.has_css?('p#foo')
|
|
291
|
+
#
|
|
292
|
+
# By default it will check if the selector occurs at least once,
|
|
293
|
+
# but a different number can be specified.
|
|
294
|
+
#
|
|
295
|
+
# page.has_css?('p#foo', count: 4)
|
|
296
|
+
#
|
|
297
|
+
# This will check if the selector occurs exactly 4 times.
|
|
298
|
+
#
|
|
299
|
+
# It also accepts all options that {Capybara::Node::Finders#all} accepts,
|
|
300
|
+
# such as `:text` and `:visible`.
|
|
301
|
+
#
|
|
302
|
+
# page.has_css?('li', text: 'Horse', visible: true)
|
|
303
|
+
#
|
|
304
|
+
# @param [String] path A CSS selector
|
|
305
|
+
# @param options (see Capybara::Node::Finders#all)
|
|
306
|
+
# @option options [Integer] :count (nil) Number of times the selector should occur
|
|
307
|
+
# @return [Boolean] If the selector exists
|
|
308
|
+
#
|
|
309
|
+
def has_css?(path, **options, &optional_filter_block)
|
|
310
|
+
has_selector?(:css, path, **options, &optional_filter_block)
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
##
|
|
314
|
+
#
|
|
315
|
+
# Checks if a given CSS selector is not on the page or a descendant of the current node.
|
|
316
|
+
# Usage is identical to {#has_css?}.
|
|
317
|
+
#
|
|
318
|
+
# @param (see #has_css?)
|
|
319
|
+
# @return [Boolean]
|
|
320
|
+
#
|
|
321
|
+
def has_no_css?(path, **options, &optional_filter_block)
|
|
322
|
+
has_no_selector?(:css, path, **options, &optional_filter_block)
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
##
|
|
326
|
+
#
|
|
327
|
+
# Checks if the page or current node has a element with the given
|
|
328
|
+
# local name.
|
|
329
|
+
#
|
|
330
|
+
# @param [String] locator The local name of a element to check for
|
|
331
|
+
# @option options [String, Regexp] The attributes values of matching elements
|
|
332
|
+
# @return [Boolean] Whether it exists
|
|
333
|
+
#
|
|
334
|
+
def has_element?(locator = nil, **options, &optional_filter_block)
|
|
335
|
+
has_selector?(:element, locator, **options, &optional_filter_block)
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
##
|
|
339
|
+
#
|
|
340
|
+
# Checks if the page or current node has no element with the given
|
|
341
|
+
# local name.
|
|
342
|
+
#
|
|
343
|
+
# @param (see #has_element?)
|
|
344
|
+
# @return [Boolean] Whether it doesn't exist
|
|
345
|
+
#
|
|
346
|
+
def has_no_element?(locator = nil, **options, &optional_filter_block)
|
|
347
|
+
has_no_selector?(:element, locator, **options, &optional_filter_block)
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
##
|
|
351
|
+
#
|
|
352
|
+
# Checks if the page or current node has a link with the given
|
|
353
|
+
# text or id.
|
|
354
|
+
#
|
|
355
|
+
# @param [String] locator The text or id of a link to check for
|
|
356
|
+
# @option options [String, Regexp] :href The value the href attribute must be
|
|
357
|
+
# @return [Boolean] Whether it exists
|
|
358
|
+
#
|
|
359
|
+
def has_link?(locator = nil, **options, &optional_filter_block)
|
|
360
|
+
has_selector?(:link, locator, **options, &optional_filter_block)
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
##
|
|
364
|
+
#
|
|
365
|
+
# Checks if the page or current node has no link with the given
|
|
366
|
+
# text or id.
|
|
367
|
+
#
|
|
368
|
+
# @param (see #has_link?)
|
|
369
|
+
# @return [Boolean] Whether it doesn't exist
|
|
370
|
+
#
|
|
371
|
+
def has_no_link?(locator = nil, **options, &optional_filter_block)
|
|
372
|
+
has_no_selector?(:link, locator, **options, &optional_filter_block)
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
##
|
|
376
|
+
#
|
|
377
|
+
# Checks if the page or current node has a button with the given
|
|
378
|
+
# text, value or id.
|
|
379
|
+
#
|
|
380
|
+
# @param [String] locator The text, value or id of a button to check for
|
|
381
|
+
# @return [Boolean] Whether it exists
|
|
382
|
+
#
|
|
383
|
+
def has_button?(locator = nil, **options, &optional_filter_block)
|
|
384
|
+
has_selector?(:button, locator, **options, &optional_filter_block)
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
##
|
|
388
|
+
#
|
|
389
|
+
# Checks if the page or current node has no button with the given
|
|
390
|
+
# text, value or id.
|
|
391
|
+
#
|
|
392
|
+
# @param [String] locator The text, value or id of a button to check for
|
|
393
|
+
# @return [Boolean] Whether it doesn't exist
|
|
394
|
+
#
|
|
395
|
+
def has_no_button?(locator = nil, **options, &optional_filter_block)
|
|
396
|
+
has_no_selector?(:button, locator, **options, &optional_filter_block)
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
##
|
|
400
|
+
#
|
|
401
|
+
# Checks if the page or current node has a form field with the given
|
|
402
|
+
# label, name or id.
|
|
403
|
+
#
|
|
404
|
+
# For text fields and other textual fields, such as textareas and
|
|
405
|
+
# HTML5 email/url/etc. fields, it's possible to specify a `:with`
|
|
406
|
+
# option to specify the text the field should contain:
|
|
407
|
+
#
|
|
408
|
+
# page.has_field?('Name', with: 'Jonas')
|
|
409
|
+
#
|
|
410
|
+
# It is also possible to filter by the field type attribute:
|
|
411
|
+
#
|
|
412
|
+
# page.has_field?('Email', type: 'email')
|
|
413
|
+
#
|
|
414
|
+
# NOTE: 'textarea' and 'select' are valid type values, matching the associated tag names.
|
|
415
|
+
#
|
|
416
|
+
# @param [String] locator The label, name or id of a field to check for
|
|
417
|
+
# @option options [String, Regexp] :with The text content of the field or a Regexp to match
|
|
418
|
+
# @option options [String] :type The type attribute of the field
|
|
419
|
+
# @return [Boolean] Whether it exists
|
|
420
|
+
#
|
|
421
|
+
def has_field?(locator = nil, **options, &optional_filter_block)
|
|
422
|
+
has_selector?(:field, locator, **options, &optional_filter_block)
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
##
|
|
426
|
+
#
|
|
427
|
+
# Checks if the page or current node has no form field with the given
|
|
428
|
+
# label, name or id. See {#has_field?}.
|
|
429
|
+
#
|
|
430
|
+
# @param [String] locator The label, name or id of a field to check for
|
|
431
|
+
# @option options [String, Regexp] :with The text content of the field or a Regexp to match
|
|
432
|
+
# @option options [String] :type The type attribute of the field
|
|
433
|
+
# @return [Boolean] Whether it doesn't exist
|
|
434
|
+
#
|
|
435
|
+
def has_no_field?(locator = nil, **options, &optional_filter_block)
|
|
436
|
+
has_no_selector?(:field, locator, **options, &optional_filter_block)
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
##
|
|
440
|
+
#
|
|
441
|
+
# Checks if the page or current node has a radio button or
|
|
442
|
+
# checkbox with the given label, value, id, or {Capybara.configure test_id} attribute that is currently
|
|
443
|
+
# checked.
|
|
444
|
+
#
|
|
445
|
+
# @param [String] locator The label, name or id of a checked field
|
|
446
|
+
# @return [Boolean] Whether it exists
|
|
447
|
+
#
|
|
448
|
+
def has_checked_field?(locator = nil, **options, &optional_filter_block)
|
|
449
|
+
has_selector?(:field, locator, **options.merge(checked: true), &optional_filter_block)
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
##
|
|
453
|
+
#
|
|
454
|
+
# Checks if the page or current node has no radio button or
|
|
455
|
+
# checkbox with the given label, value or id, or {Capybara.configure test_id} attribute that is currently
|
|
456
|
+
# checked.
|
|
457
|
+
#
|
|
458
|
+
# @param [String] locator The label, name or id of a checked field
|
|
459
|
+
# @return [Boolean] Whether it doesn't exist
|
|
460
|
+
#
|
|
461
|
+
def has_no_checked_field?(locator = nil, **options, &optional_filter_block)
|
|
462
|
+
has_no_selector?(:field, locator, **options.merge(checked: true), &optional_filter_block)
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
##
|
|
466
|
+
#
|
|
467
|
+
# Checks if the page or current node has a radio button or
|
|
468
|
+
# checkbox with the given label, value or id, or {Capybara.configure test_id} attribute that is currently
|
|
469
|
+
# unchecked.
|
|
470
|
+
#
|
|
471
|
+
# @param [String] locator The label, name or id of an unchecked field
|
|
472
|
+
# @return [Boolean] Whether it exists
|
|
473
|
+
#
|
|
474
|
+
def has_unchecked_field?(locator = nil, **options, &optional_filter_block)
|
|
475
|
+
has_selector?(:field, locator, **options.merge(unchecked: true), &optional_filter_block)
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
##
|
|
479
|
+
#
|
|
480
|
+
# Checks if the page or current node has no radio button or
|
|
481
|
+
# checkbox with the given label, value or id, or {Capybara.configure test_id} attribute that is currently
|
|
482
|
+
# unchecked.
|
|
483
|
+
#
|
|
484
|
+
# @param [String] locator The label, name or id of an unchecked field
|
|
485
|
+
# @return [Boolean] Whether it doesn't exist
|
|
486
|
+
#
|
|
487
|
+
def has_no_unchecked_field?(locator = nil, **options, &optional_filter_block)
|
|
488
|
+
has_no_selector?(:field, locator, **options.merge(unchecked: true), &optional_filter_block)
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
##
|
|
492
|
+
#
|
|
493
|
+
# Checks if the page or current node has a select field with the
|
|
494
|
+
# given label, name or id.
|
|
495
|
+
#
|
|
496
|
+
# It can be specified which option should currently be selected:
|
|
497
|
+
#
|
|
498
|
+
# page.has_select?('Language', selected: 'German')
|
|
499
|
+
#
|
|
500
|
+
# For multiple select boxes, several options may be specified:
|
|
501
|
+
#
|
|
502
|
+
# page.has_select?('Language', selected: ['English', 'German'])
|
|
503
|
+
#
|
|
504
|
+
# It's also possible to check if the exact set of options exists for
|
|
505
|
+
# this select box:
|
|
506
|
+
#
|
|
507
|
+
# page.has_select?('Language', options: ['English', 'German', 'Spanish'])
|
|
508
|
+
#
|
|
509
|
+
# You can also check for a partial set of options:
|
|
510
|
+
#
|
|
511
|
+
# page.has_select?('Language', with_options: ['English', 'German'])
|
|
512
|
+
#
|
|
513
|
+
# @param [String] locator The label, name or id of a select box
|
|
514
|
+
# @option options [Array] :options Options which should be contained in this select box
|
|
515
|
+
# @option options [Array] :with_options Partial set of options which should be contained in this select box
|
|
516
|
+
# @option options [String, Array] :selected Options which should be selected
|
|
517
|
+
# @option options [String, Array] :with_selected Partial set of options which should minimally be selected
|
|
518
|
+
# @return [Boolean] Whether it exists
|
|
519
|
+
#
|
|
520
|
+
def has_select?(locator = nil, **options, &optional_filter_block)
|
|
521
|
+
has_selector?(:select, locator, **options, &optional_filter_block)
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
##
|
|
525
|
+
#
|
|
526
|
+
# Checks if the page or current node has no select field with the
|
|
527
|
+
# given label, name or id. See {#has_select?}.
|
|
528
|
+
#
|
|
529
|
+
# @param (see #has_select?)
|
|
530
|
+
# @return [Boolean] Whether it doesn't exist
|
|
531
|
+
#
|
|
532
|
+
def has_no_select?(locator = nil, **options, &optional_filter_block)
|
|
533
|
+
has_no_selector?(:select, locator, **options, &optional_filter_block)
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
##
|
|
537
|
+
#
|
|
538
|
+
# Checks if the page or current node has a table with the given id
|
|
539
|
+
# or caption:
|
|
540
|
+
#
|
|
541
|
+
# page.has_table?('People')
|
|
542
|
+
#
|
|
543
|
+
# @param [String] locator The id or caption of a table
|
|
544
|
+
# @option options [Array<Array<String>>] :rows
|
|
545
|
+
# Text which should be contained in the tables `<td>` elements organized by row (`<td>` visibility is not considered)
|
|
546
|
+
# @option options [Array<Array<String>>, Array<Hash<String,String>>] :with_rows
|
|
547
|
+
# Partial set of text which should be contained in the tables `<td>` elements organized by row (`<td>` visibility is not considered)
|
|
548
|
+
# @option options [Array<Array<String>>] :cols
|
|
549
|
+
# Text which should be contained in the tables `<td>` elements organized by column (`<td>` visibility is not considered)
|
|
550
|
+
# @option options [Array<Array<String>>, Array<Hash<String,String>>] :with_cols
|
|
551
|
+
# Partial set of text which should be contained in the tables `<td>` elements organized by column (`<td>` visibility is not considered)
|
|
552
|
+
# @return [Boolean] Whether it exists
|
|
553
|
+
#
|
|
554
|
+
def has_table?(locator = nil, **options, &optional_filter_block)
|
|
555
|
+
has_selector?(:table, locator, **options, &optional_filter_block)
|
|
556
|
+
end
|
|
557
|
+
|
|
558
|
+
##
|
|
559
|
+
#
|
|
560
|
+
# Checks if the page or current node has no table with the given id
|
|
561
|
+
# or caption. See {#has_table?}.
|
|
562
|
+
#
|
|
563
|
+
# @param (see #has_table?)
|
|
564
|
+
# @return [Boolean] Whether it doesn't exist
|
|
565
|
+
#
|
|
566
|
+
def has_no_table?(locator = nil, **options, &optional_filter_block)
|
|
567
|
+
has_no_selector?(:table, locator, **options, &optional_filter_block)
|
|
568
|
+
end
|
|
569
|
+
|
|
570
|
+
##
|
|
571
|
+
#
|
|
572
|
+
# Asserts that the current node matches a given selector.
|
|
573
|
+
#
|
|
574
|
+
# node.assert_matches_selector('p#foo')
|
|
575
|
+
# node.assert_matches_selector(:xpath, '//p[@id="foo"]')
|
|
576
|
+
# node.assert_matches_selector(:foo)
|
|
577
|
+
#
|
|
578
|
+
# It also accepts all options that {Capybara::Node::Finders#all} accepts,
|
|
579
|
+
# such as `:text` and `:visible`.
|
|
580
|
+
#
|
|
581
|
+
# node.assert_matches_selector('li', text: 'Horse', visible: true)
|
|
582
|
+
#
|
|
583
|
+
# @param (see Capybara::Node::Finders#all)
|
|
584
|
+
# @raise [Capybara::ExpectationNotMet] If the selector does not match
|
|
585
|
+
#
|
|
586
|
+
def assert_matches_selector(*args, &optional_filter_block)
|
|
587
|
+
_verify_match_result(args, optional_filter_block) do |result|
|
|
588
|
+
raise Capybara::ExpectationNotMet, 'Item does not match the provided selector' unless result.include? self
|
|
589
|
+
end
|
|
590
|
+
end
|
|
591
|
+
|
|
592
|
+
##
|
|
593
|
+
#
|
|
594
|
+
# Asserts that the current node does not match a given selector.
|
|
595
|
+
# Usage is identical to {#assert_matches_selector}.
|
|
596
|
+
#
|
|
597
|
+
# @param (see #assert_matches_selector)
|
|
598
|
+
# @raise [Capybara::ExpectationNotMet] If the selector matches
|
|
599
|
+
#
|
|
600
|
+
def assert_not_matches_selector(*args, &optional_filter_block)
|
|
601
|
+
_verify_match_result(args, optional_filter_block) do |result|
|
|
602
|
+
raise Capybara::ExpectationNotMet, 'Item matched the provided selector' if result.include? self
|
|
603
|
+
end
|
|
604
|
+
end
|
|
605
|
+
|
|
606
|
+
##
|
|
607
|
+
#
|
|
608
|
+
# Checks if the current node matches given selector.
|
|
609
|
+
#
|
|
610
|
+
# @param (see #has_selector?)
|
|
611
|
+
# @return [Boolean]
|
|
612
|
+
#
|
|
613
|
+
def matches_selector?(*args, **options, &optional_filter_block)
|
|
614
|
+
make_predicate(options) { assert_matches_selector(*args, options, &optional_filter_block) }
|
|
615
|
+
end
|
|
616
|
+
|
|
617
|
+
##
|
|
618
|
+
#
|
|
619
|
+
# Checks if the current node matches given XPath expression.
|
|
620
|
+
#
|
|
621
|
+
# @param [String, XPath::Expression] xpath The XPath expression to match against the current code
|
|
622
|
+
# @return [Boolean]
|
|
623
|
+
#
|
|
624
|
+
def matches_xpath?(xpath, **options, &optional_filter_block)
|
|
625
|
+
matches_selector?(:xpath, xpath, **options, &optional_filter_block)
|
|
626
|
+
end
|
|
627
|
+
|
|
628
|
+
##
|
|
629
|
+
#
|
|
630
|
+
# Checks if the current node matches given CSS selector.
|
|
631
|
+
#
|
|
632
|
+
# @param [String] css The CSS selector to match against the current code
|
|
633
|
+
# @return [Boolean]
|
|
634
|
+
#
|
|
635
|
+
def matches_css?(css, **options, &optional_filter_block)
|
|
636
|
+
matches_selector?(:css, css, **options, &optional_filter_block)
|
|
637
|
+
end
|
|
638
|
+
|
|
639
|
+
##
|
|
640
|
+
#
|
|
641
|
+
# Checks if the current node does not match given selector.
|
|
642
|
+
# Usage is identical to {#has_selector?}.
|
|
643
|
+
#
|
|
644
|
+
# @param (see #has_selector?)
|
|
645
|
+
# @return [Boolean]
|
|
646
|
+
#
|
|
647
|
+
def not_matches_selector?(*args, **options, &optional_filter_block)
|
|
648
|
+
make_predicate(options) { assert_not_matches_selector(*args, options, &optional_filter_block) }
|
|
649
|
+
end
|
|
650
|
+
|
|
651
|
+
##
|
|
652
|
+
#
|
|
653
|
+
# Checks if the current node does not match given XPath expression.
|
|
654
|
+
#
|
|
655
|
+
# @param [String, XPath::Expression] xpath The XPath expression to match against the current code
|
|
656
|
+
# @return [Boolean]
|
|
657
|
+
#
|
|
658
|
+
def not_matches_xpath?(xpath, **options, &optional_filter_block)
|
|
659
|
+
not_matches_selector?(:xpath, xpath, **options, &optional_filter_block)
|
|
660
|
+
end
|
|
661
|
+
|
|
662
|
+
##
|
|
663
|
+
#
|
|
664
|
+
# Checks if the current node does not match given CSS selector.
|
|
665
|
+
#
|
|
666
|
+
# @param [String] css The CSS selector to match against the current code
|
|
667
|
+
# @return [Boolean]
|
|
668
|
+
#
|
|
669
|
+
def not_matches_css?(css, **options, &optional_filter_block)
|
|
670
|
+
not_matches_selector?(:css, css, **options, &optional_filter_block)
|
|
671
|
+
end
|
|
672
|
+
|
|
673
|
+
##
|
|
674
|
+
# Asserts that the page or current node has the given text content,
|
|
675
|
+
# ignoring any HTML tags.
|
|
676
|
+
#
|
|
677
|
+
# @!macro text_query_params
|
|
678
|
+
# @overload $0(type, text, **options)
|
|
679
|
+
# @param [:all, :visible] type Whether to check for only visible or all text. If this parameter is missing or nil then we use the value of {Capybara.configure ignore_hidden_elements}, which defaults to `true`, corresponding to `:visible`.
|
|
680
|
+
# @param [String, Regexp] text The string/regexp to check for. If it's a string, text is expected to include it. If it's a regexp, text is expected to match it.
|
|
681
|
+
# @option options [Integer] :count (nil) Number of times the text is expected to occur
|
|
682
|
+
# @option options [Integer] :minimum (nil) Minimum number of times the text is expected to occur
|
|
683
|
+
# @option options [Integer] :maximum (nil) Maximum number of times the text is expected to occur
|
|
684
|
+
# @option options [Range] :between (nil) Range of times that is expected to contain number of times text occurs
|
|
685
|
+
# @option options [Numeric] :wait Maximum time that Capybara will wait for text to eq/match given string/regexp argument. Defaults to {Capybara.configure default_max_wait_time}.
|
|
686
|
+
# @option options [Boolean] :exact Whether text must be an exact match or just substring. Defaults to {Capybara.configure exact_text}.
|
|
687
|
+
# @option options [Boolean] :normalize_ws (false) When `true` replace all whitespace with standard spaces and collapse consecutive whitespace to a single space
|
|
688
|
+
# @overload $0(text, **options)
|
|
689
|
+
# @param [String, Regexp] text The string/regexp to check for. If it's a string, text is expected to include it. If it's a regexp, text is expected to match it.
|
|
690
|
+
# @option options [Integer] :count (nil) Number of times the text is expected to occur
|
|
691
|
+
# @option options [Integer] :minimum (nil) Minimum number of times the text is expected to occur
|
|
692
|
+
# @option options [Integer] :maximum (nil) Maximum number of times the text is expected to occur
|
|
693
|
+
# @option options [Range] :between (nil) Range of times that is expected to contain number of times text occurs
|
|
694
|
+
# @option options [Numeric] :wait Maximum time that Capybara will wait for text to eq/match given string/regexp argument. Defaults to {Capybara.configure default_max_wait_time}.
|
|
695
|
+
# @option options [Boolean] :exact Whether text must be an exact match or just substring. Defaults to {Capybara.configure exact_text}.
|
|
696
|
+
# @option options [Boolean] :normalize_ws (false) When `true` replace all whitespace with standard spaces and collapse consecutive whitespace to a single space
|
|
697
|
+
# @raise [Capybara::ExpectationNotMet] if the assertion hasn't succeeded during wait time
|
|
698
|
+
# @return [true]
|
|
699
|
+
#
|
|
700
|
+
def assert_text(type_or_text, *args, **opts)
|
|
701
|
+
_verify_text(type_or_text, *args, **opts) do |count, query|
|
|
702
|
+
unless query.matches_count?(count) && (count.positive? || query.expects_none?)
|
|
703
|
+
raise Capybara::ExpectationNotMet, query.failure_message
|
|
704
|
+
end
|
|
705
|
+
end
|
|
706
|
+
end
|
|
707
|
+
|
|
708
|
+
##
|
|
709
|
+
# Asserts that the page or current node doesn't have the given text content,
|
|
710
|
+
# ignoring any HTML tags.
|
|
711
|
+
#
|
|
712
|
+
# @macro text_query_params
|
|
713
|
+
# @raise [Capybara::ExpectationNotMet] if the assertion hasn't succeeded during wait time
|
|
714
|
+
# @return [true]
|
|
715
|
+
#
|
|
716
|
+
def assert_no_text(type_or_text, *args, **opts)
|
|
717
|
+
_verify_text(type_or_text, *args, **opts) do |count, query|
|
|
718
|
+
if query.matches_count?(count) && (count.positive? || query.expects_none?)
|
|
719
|
+
raise Capybara::ExpectationNotMet, query.negative_failure_message
|
|
720
|
+
end
|
|
721
|
+
end
|
|
722
|
+
end
|
|
723
|
+
|
|
724
|
+
##
|
|
725
|
+
# Checks if the page or current node has the given text content,
|
|
726
|
+
# ignoring any HTML tags.
|
|
727
|
+
#
|
|
728
|
+
# By default it will check if the text occurs at least once,
|
|
729
|
+
# but a different number can be specified.
|
|
730
|
+
#
|
|
731
|
+
# page.has_text?('lorem ipsum', between: 2..4)
|
|
732
|
+
#
|
|
733
|
+
# This will check if the text occurs from 2 to 4 times.
|
|
734
|
+
#
|
|
735
|
+
# @macro text_query_params
|
|
736
|
+
# @return [Boolean] Whether it exists
|
|
737
|
+
#
|
|
738
|
+
def has_text?(*args, **options)
|
|
739
|
+
make_predicate(options) { assert_text(*args, **options) }
|
|
740
|
+
end
|
|
741
|
+
alias_method :has_content?, :has_text?
|
|
742
|
+
|
|
743
|
+
##
|
|
744
|
+
# Checks if the page or current node does not have the given text
|
|
745
|
+
# content, ignoring any HTML tags and normalizing whitespace.
|
|
746
|
+
#
|
|
747
|
+
# @macro text_query_params
|
|
748
|
+
# @return [Boolean] Whether it doesn't exist
|
|
749
|
+
#
|
|
750
|
+
def has_no_text?(*args, **options)
|
|
751
|
+
make_predicate(options) { assert_no_text(*args, **options) }
|
|
752
|
+
end
|
|
753
|
+
alias_method :has_no_content?, :has_no_text?
|
|
754
|
+
|
|
755
|
+
##
|
|
756
|
+
#
|
|
757
|
+
# Asserts that a given selector matches an ancestor of the current node.
|
|
758
|
+
#
|
|
759
|
+
# element.assert_ancestor('p#foo')
|
|
760
|
+
#
|
|
761
|
+
# Accepts the same options as {#assert_selector}
|
|
762
|
+
#
|
|
763
|
+
# @param (see Capybara::Node::Finders#find)
|
|
764
|
+
# @raise [Capybara::ExpectationNotMet] If the selector does not exist
|
|
765
|
+
#
|
|
766
|
+
def assert_ancestor(*args, &optional_filter_block)
|
|
767
|
+
_verify_selector_result(args, optional_filter_block, Capybara::Queries::AncestorQuery) do |result, query|
|
|
768
|
+
unless result.matches_count? && (result.any? || query.expects_none?)
|
|
769
|
+
raise Capybara::ExpectationNotMet, result.failure_message
|
|
770
|
+
end
|
|
771
|
+
end
|
|
772
|
+
end
|
|
773
|
+
|
|
774
|
+
def assert_no_ancestor(*args, &optional_filter_block)
|
|
775
|
+
_verify_selector_result(args, optional_filter_block, Capybara::Queries::AncestorQuery) do |result, query|
|
|
776
|
+
if result.matches_count? && (!result.empty? || query.expects_none?)
|
|
777
|
+
raise Capybara::ExpectationNotMet, result.negative_failure_message
|
|
778
|
+
end
|
|
779
|
+
end
|
|
780
|
+
end
|
|
781
|
+
|
|
782
|
+
##
|
|
783
|
+
#
|
|
784
|
+
# Predicate version of {#assert_ancestor}
|
|
785
|
+
#
|
|
786
|
+
def has_ancestor?(*args, **options, &optional_filter_block)
|
|
787
|
+
make_predicate(options) { assert_ancestor(*args, options, &optional_filter_block) }
|
|
788
|
+
end
|
|
789
|
+
|
|
790
|
+
##
|
|
791
|
+
#
|
|
792
|
+
# Predicate version of {#assert_no_ancestor}
|
|
793
|
+
#
|
|
794
|
+
def has_no_ancestor?(*args, **options, &optional_filter_block)
|
|
795
|
+
make_predicate(options) { assert_no_ancestor(*args, options, &optional_filter_block) }
|
|
796
|
+
end
|
|
797
|
+
|
|
798
|
+
##
|
|
799
|
+
#
|
|
800
|
+
# Asserts that a given selector matches a sibling of the current node.
|
|
801
|
+
#
|
|
802
|
+
# element.assert_sibling('p#foo')
|
|
803
|
+
#
|
|
804
|
+
# Accepts the same options as {#assert_selector}
|
|
805
|
+
#
|
|
806
|
+
# @param (see Capybara::Node::Finders#find)
|
|
807
|
+
# @raise [Capybara::ExpectationNotMet] If the selector does not exist
|
|
808
|
+
#
|
|
809
|
+
def assert_sibling(*args, &optional_filter_block)
|
|
810
|
+
_verify_selector_result(args, optional_filter_block, Capybara::Queries::SiblingQuery) do |result, query|
|
|
811
|
+
unless result.matches_count? && (result.any? || query.expects_none?)
|
|
812
|
+
raise Capybara::ExpectationNotMet, result.failure_message
|
|
813
|
+
end
|
|
814
|
+
end
|
|
815
|
+
end
|
|
816
|
+
|
|
817
|
+
def assert_no_sibling(*args, &optional_filter_block)
|
|
818
|
+
_verify_selector_result(args, optional_filter_block, Capybara::Queries::SiblingQuery) do |result, query|
|
|
819
|
+
if result.matches_count? && (!result.empty? || query.expects_none?)
|
|
820
|
+
raise Capybara::ExpectationNotMet, result.negative_failure_message
|
|
821
|
+
end
|
|
822
|
+
end
|
|
823
|
+
end
|
|
824
|
+
|
|
825
|
+
##
|
|
826
|
+
#
|
|
827
|
+
# Predicate version of {#assert_sibling}
|
|
828
|
+
#
|
|
829
|
+
def has_sibling?(*args, **options, &optional_filter_block)
|
|
830
|
+
make_predicate(options) { assert_sibling(*args, options, &optional_filter_block) }
|
|
831
|
+
end
|
|
832
|
+
|
|
833
|
+
##
|
|
834
|
+
#
|
|
835
|
+
# Predicate version of {#assert_no_sibling}
|
|
836
|
+
#
|
|
837
|
+
def has_no_sibling?(*args, **options, &optional_filter_block)
|
|
838
|
+
make_predicate(options) { assert_no_sibling(*args, options, &optional_filter_block) }
|
|
839
|
+
end
|
|
840
|
+
|
|
841
|
+
def ==(other)
|
|
842
|
+
eql?(other) || (other.respond_to?(:base) && base == other.base)
|
|
843
|
+
end
|
|
844
|
+
|
|
845
|
+
private
|
|
846
|
+
|
|
847
|
+
def extract_selector(args)
|
|
848
|
+
args.first.is_a?(Symbol) ? args.shift : session_options.default_selector
|
|
849
|
+
end
|
|
850
|
+
|
|
851
|
+
def _verify_multiple(*args, wait: nil, **options)
|
|
852
|
+
wait = session_options.default_max_wait_time if wait.nil?
|
|
853
|
+
selector = extract_selector(args)
|
|
854
|
+
synchronize(wait) do
|
|
855
|
+
args.each { |locator| yield(selector, locator, options) }
|
|
856
|
+
end
|
|
857
|
+
end
|
|
858
|
+
|
|
859
|
+
def _verify_selector_result(query_args, optional_filter_block, query_type = Capybara::Queries::SelectorQuery)
|
|
860
|
+
# query_args, query_opts = if query_args[0].is_a? Symbol
|
|
861
|
+
# a,o = _set_query_session_options(*query_args.slice(2..))
|
|
862
|
+
# [query_args.slice(0..1).concat(a), o]
|
|
863
|
+
# else
|
|
864
|
+
# _set_query_session_options(*query_args)
|
|
865
|
+
# end
|
|
866
|
+
query_args, query_opts = _set_query_session_options(*query_args)
|
|
867
|
+
query = query_type.new(*query_args, **query_opts, &optional_filter_block)
|
|
868
|
+
synchronize(query.wait) do
|
|
869
|
+
yield query.resolve_for(self), query
|
|
870
|
+
end
|
|
871
|
+
true
|
|
872
|
+
end
|
|
873
|
+
|
|
874
|
+
def _verify_match_result(query_args, optional_filter_block)
|
|
875
|
+
query_args, query_opts = _set_query_session_options(*query_args)
|
|
876
|
+
query = Capybara::Queries::MatchQuery.new(*query_args, **query_opts, &optional_filter_block)
|
|
877
|
+
synchronize(query.wait) do
|
|
878
|
+
yield query.resolve_for(parent || session&.document || query_scope)
|
|
879
|
+
end
|
|
880
|
+
true
|
|
881
|
+
end
|
|
882
|
+
|
|
883
|
+
def _verify_text(type = nil, expected_text, **query_options) # rubocop:disable Style/OptionalArguments
|
|
884
|
+
query_options[:session_options] = session_options
|
|
885
|
+
query = Capybara::Queries::TextQuery.new(type, expected_text, **query_options)
|
|
886
|
+
synchronize(query.wait) do
|
|
887
|
+
yield query.resolve_for(self), query
|
|
888
|
+
end
|
|
889
|
+
true
|
|
890
|
+
end
|
|
891
|
+
|
|
892
|
+
def _set_query_session_options(*query_args)
|
|
893
|
+
query_args, query_options = query_args.dup, {}
|
|
894
|
+
# query_options = query_args.pop if query_options.empty? && query_args.last.is_a?(Hash)
|
|
895
|
+
query_options = query_args.pop if query_args.last.is_a?(Hash)
|
|
896
|
+
query_options[:session_options] = session_options
|
|
897
|
+
[query_args, query_options]
|
|
898
|
+
end
|
|
899
|
+
|
|
900
|
+
def make_predicate(options)
|
|
901
|
+
options[:wait] = 0 unless options.key?(:wait) || session_options.predicates_wait
|
|
902
|
+
yield
|
|
903
|
+
rescue Capybara::ExpectationNotMet
|
|
904
|
+
false
|
|
905
|
+
end
|
|
906
|
+
end
|
|
907
|
+
end
|
|
908
|
+
end
|