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,240 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Capybara::SpecHelper.spec '#click_link' do
|
|
4
|
+
before do
|
|
5
|
+
@session.visit('/with_html')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it 'should wait for asynchronous load', requires: [:js] do
|
|
9
|
+
Capybara.default_max_wait_time = 2
|
|
10
|
+
@session.visit('/with_js')
|
|
11
|
+
@session.click_link('Click me')
|
|
12
|
+
@session.click_link('Has been clicked')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'casts to string' do
|
|
16
|
+
@session.click_link(:foo)
|
|
17
|
+
expect(@session).to have_content('Another World')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'raises any errors caught inside the server', requires: [:server] do
|
|
21
|
+
quietly { @session.visit('/error') }
|
|
22
|
+
expect do
|
|
23
|
+
@session.click_link('foo')
|
|
24
|
+
end.to raise_error(TestApp::TestAppError)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
context 'with id given' do
|
|
28
|
+
it 'should take user to the linked page' do
|
|
29
|
+
@session.click_link('foo')
|
|
30
|
+
expect(@session).to have_content('Another World')
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
context 'with text given' do
|
|
35
|
+
it 'should take user to the linked page' do
|
|
36
|
+
@session.click_link('labore')
|
|
37
|
+
expect(@session).to have_content('Bar')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'should accept partial matches', :exact_false do
|
|
41
|
+
@session.click_link('abo')
|
|
42
|
+
expect(@session).to have_content('Bar')
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
context 'with title given' do
|
|
47
|
+
it 'should take user to the linked page' do
|
|
48
|
+
@session.click_link('awesome title')
|
|
49
|
+
expect(@session).to have_content('Bar')
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'should accept partial matches', :exact_false do
|
|
53
|
+
@session.click_link('some titl')
|
|
54
|
+
expect(@session).to have_content('Bar')
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
context 'with alternative text given to a contained image' do
|
|
59
|
+
it 'should take user to the linked page' do
|
|
60
|
+
@session.click_link('awesome image')
|
|
61
|
+
expect(@session).to have_content('Bar')
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'should accept partial matches', :exact_false do
|
|
65
|
+
@session.click_link('some imag')
|
|
66
|
+
expect(@session).to have_content('Bar')
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
context "with a locator that doesn't exist" do
|
|
71
|
+
it 'should raise an error' do
|
|
72
|
+
msg = 'Unable to find link "does not exist"'
|
|
73
|
+
expect do
|
|
74
|
+
@session.click_link('does not exist')
|
|
75
|
+
end.to raise_error(Capybara::ElementNotFound, msg)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
context 'with :href option given' do
|
|
80
|
+
it 'should find links with valid href' do
|
|
81
|
+
@session.click_link('labore', href: '/with_simple_html')
|
|
82
|
+
expect(@session).to have_content('Bar')
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
it "should raise error if link wasn't found" do
|
|
86
|
+
expect { @session.click_link('labore', href: 'invalid_href') }.to raise_error(Capybara::ElementNotFound, /with href "invalid_href/)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
context 'with a regex :href option given' do
|
|
91
|
+
it 'should find a link matching an all-matching regex pattern' do
|
|
92
|
+
@session.click_link('labore', href: /.+/)
|
|
93
|
+
expect(@session).to have_content('Bar')
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it 'should find a link matching an exact regex pattern' do
|
|
97
|
+
@session.click_link('labore', href: %r{/with_simple_html})
|
|
98
|
+
expect(@session).to have_content('Bar')
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it 'should find a link matching a partial regex pattern' do
|
|
102
|
+
@session.click_link('labore', href: %r{/with_simple})
|
|
103
|
+
expect(@session).to have_content('Bar')
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it "should raise an error if no link's href matched the pattern" do
|
|
107
|
+
expect { @session.click_link('labore', href: /invalid_pattern/) }.to raise_error(Capybara::ElementNotFound, %r{with href matching /invalid_pattern/})
|
|
108
|
+
expect { @session.click_link('labore', href: /.+d+/) }.to raise_error(Capybara::ElementNotFound, /#{Regexp.quote 'with href matching /.+d+/'}/)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
context 'href: nil' do
|
|
112
|
+
it 'should not raise an error on links with no href attribute' do
|
|
113
|
+
expect { @session.click_link('No Href', href: nil) }.not_to raise_error
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
it 'should raise an error if href attribute exists' do
|
|
117
|
+
expect { @session.click_link('Blank Href', href: nil) }.to raise_error(Capybara::ElementNotFound, /with no href attribute/)
|
|
118
|
+
expect { @session.click_link('Normal Anchor', href: nil) }.to raise_error(Capybara::ElementNotFound, /with no href attribute/)
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
context 'href: false' do
|
|
123
|
+
it 'should not raise an error on links with no href attribute' do
|
|
124
|
+
expect { @session.click_link('No Href', href: false) }.not_to raise_error
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it 'should not raise an error if href attribute exists' do
|
|
128
|
+
expect { @session.click_link('Blank Href', href: false) }.not_to raise_error
|
|
129
|
+
expect { @session.click_link('Normal Anchor', href: false) }.not_to raise_error
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
context 'with :target option given' do
|
|
135
|
+
it 'should find links with valid target' do
|
|
136
|
+
@session.click_link('labore', target: '_self')
|
|
137
|
+
expect(@session).to have_content('Bar')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
it "should raise error if link wasn't found" do
|
|
141
|
+
expect { @session.click_link('labore', target: '_blank') }.to raise_error(Capybara::ElementNotFound, /Unable to find link "labore"/)
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
it 'should follow relative links' do
|
|
146
|
+
@session.visit('/')
|
|
147
|
+
@session.click_link('Relative')
|
|
148
|
+
expect(@session).to have_content('This is a test')
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
it 'should follow protocol relative links' do
|
|
152
|
+
@session.click_link('Protocol')
|
|
153
|
+
expect(@session).to have_content('Another World')
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
it 'should follow redirects' do
|
|
157
|
+
@session.click_link('Redirect')
|
|
158
|
+
expect(@session).to have_content('You landed')
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
it 'should follow redirects back to itself' do
|
|
162
|
+
@session.click_link('BackToMyself')
|
|
163
|
+
expect(@session).to have_css('#referrer', text: %r{/with_html$})
|
|
164
|
+
expect(@session).to have_content('This is a test')
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
it 'should add query string to current URL with naked query string' do
|
|
168
|
+
@session.click_link('Naked Query String')
|
|
169
|
+
expect(@session).to have_content('Query String sent')
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
it 'should do nothing on anchor links' do
|
|
173
|
+
@session.fill_in('test_field', with: 'blah')
|
|
174
|
+
@session.click_link('Normal Anchor')
|
|
175
|
+
expect(@session.find_field('test_field').value).to eq('blah')
|
|
176
|
+
@session.click_link('Blank Anchor')
|
|
177
|
+
expect(@session.find_field('test_field').value).to eq('blah')
|
|
178
|
+
@session.click_link('Blank JS Anchor')
|
|
179
|
+
expect(@session.find_field('test_field').value).to eq('blah')
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
it 'should do nothing on URL+anchor links for the same page' do
|
|
183
|
+
@session.fill_in('test_field', with: 'blah')
|
|
184
|
+
@session.click_link('Anchor on same page')
|
|
185
|
+
expect(@session.find_field('test_field').value).to eq('blah')
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
it 'should follow link on URL+anchor links for a different page' do
|
|
189
|
+
@session.click_link('Anchor on different page')
|
|
190
|
+
expect(@session).to have_content('Bar')
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
it 'should follow link on anchor if the path has regex special characters' do
|
|
194
|
+
@session.visit('/with.*html')
|
|
195
|
+
@session.click_link('Anchor on different page')
|
|
196
|
+
expect(@session).to have_content('Bar')
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
it 'should raise an error with links with no href' do
|
|
200
|
+
expect do
|
|
201
|
+
@session.click_link('No Href')
|
|
202
|
+
end.to raise_error(Capybara::ElementNotFound)
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
context 'with :exact option' do
|
|
206
|
+
it 'should accept partial matches when false' do
|
|
207
|
+
@session.click_link('abo', exact: false)
|
|
208
|
+
expect(@session).to have_content('Bar')
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
it 'should not accept partial matches when true' do
|
|
212
|
+
expect do
|
|
213
|
+
@session.click_link('abo', exact: true)
|
|
214
|
+
end.to raise_error(Capybara::ElementNotFound)
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
context 'without locator' do
|
|
219
|
+
it 'uses options' do
|
|
220
|
+
@session.click_link(href: '/foo')
|
|
221
|
+
expect(@session).to have_content('Another World')
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
it 'should return element clicked' do
|
|
226
|
+
el = @session.find(:link, 'Normal Anchor')
|
|
227
|
+
expect(@session.click_link('Normal Anchor')).to eq el
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
it 'can download a file', requires: [:download] do
|
|
231
|
+
# This requires the driver used for the test to be configured
|
|
232
|
+
# to download documents with the mime type "text/csv"
|
|
233
|
+
download_file = File.join(Capybara.save_path, 'download.csv')
|
|
234
|
+
expect(File).not_to exist(download_file)
|
|
235
|
+
@session.click_link('Download Me')
|
|
236
|
+
sleep 2 # allow time for file to download
|
|
237
|
+
expect(File).to exist(download_file)
|
|
238
|
+
FileUtils.rm_rf download_file
|
|
239
|
+
end
|
|
240
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Capybara::SpecHelper.spec '#current_scope' do
|
|
4
|
+
before do
|
|
5
|
+
@session.visit('/with_scope')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
context 'when not in a #within block' do
|
|
9
|
+
it 'should return the document' do
|
|
10
|
+
expect(@session.current_scope).to be_a Capybara::Node::Document
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
context 'when in a #within block' do
|
|
15
|
+
it 'should return the element in scope' do
|
|
16
|
+
@session.within(:css, '#simple_first_name') do
|
|
17
|
+
expect(@session.current_scope[:name]).to eq 'first_name'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
context 'when in a nested #within block' do
|
|
23
|
+
it 'should return the element in scope' do
|
|
24
|
+
@session.within("//div[@id='for_bar']") do
|
|
25
|
+
@session.within(".//input[@value='Peter']") do
|
|
26
|
+
expect(@session.current_scope[:name]).to eq 'form[first_name]'
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'capybara/spec/test_app'
|
|
4
|
+
|
|
5
|
+
Capybara::SpecHelper.spec '#current_url, #current_path, #current_host' do
|
|
6
|
+
before :all do # rubocop:disable RSpec/BeforeAfterAll
|
|
7
|
+
@servers = Array.new(2) { Capybara::Server.new(TestApp.new).boot }
|
|
8
|
+
# sanity check
|
|
9
|
+
expect(@servers[0].port).not_to eq(@servers[1].port) # rubocop:disable RSpec/ExpectInHook
|
|
10
|
+
expect(@servers.map(&:port)).not_to include 80 # rubocop:disable RSpec/ExpectInHook
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def bases
|
|
14
|
+
@servers.map { |s| "http://#{s.host}:#{s.port}" }
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def should_be_on(server_index, path = '/host', scheme = 'http')
|
|
18
|
+
# Check that we are on /host on the given server
|
|
19
|
+
s = @servers[server_index]
|
|
20
|
+
|
|
21
|
+
expect(@session).to have_current_path("#{scheme}://#{s.host}:#{s.port}#{path}", url: true)
|
|
22
|
+
|
|
23
|
+
expect(@session.current_url.chomp('?')).to eq("#{scheme}://#{s.host}:#{s.port}#{path}")
|
|
24
|
+
expect(@session.current_host).to eq("#{scheme}://#{s.host}") # no port
|
|
25
|
+
expect(@session.current_path).to eq(path.split('#')[0])
|
|
26
|
+
# Server should agree with us
|
|
27
|
+
expect(@session).to have_content("Current host is #{scheme}://#{s.host}:#{s.port}") if path == '/host'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def visit_host_links
|
|
31
|
+
@session.visit("#{bases[0]}/host_links?absolute_host=#{bases[1]}")
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'is affected by visiting a page directly' do
|
|
35
|
+
@session.visit("#{bases[0]}/host")
|
|
36
|
+
should_be_on 0
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it 'returns to the app host when visiting a relative url' do
|
|
40
|
+
Capybara.app_host = bases[1]
|
|
41
|
+
@session.visit("#{bases[0]}/host")
|
|
42
|
+
should_be_on 0
|
|
43
|
+
@session.visit('/host')
|
|
44
|
+
should_be_on 1
|
|
45
|
+
Capybara.app_host = nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it 'is affected by setting Capybara.app_host' do
|
|
49
|
+
Capybara.app_host = bases[0]
|
|
50
|
+
@session.visit('/host')
|
|
51
|
+
should_be_on 0
|
|
52
|
+
Capybara.app_host = bases[1]
|
|
53
|
+
@session.visit('/host')
|
|
54
|
+
should_be_on 1
|
|
55
|
+
Capybara.app_host = nil
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'is unaffected by following a relative link' do
|
|
59
|
+
visit_host_links
|
|
60
|
+
@session.click_link('Relative Host')
|
|
61
|
+
should_be_on 0
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
it 'is affected by following an absolute link' do
|
|
65
|
+
visit_host_links
|
|
66
|
+
@session.click_link('Absolute Host')
|
|
67
|
+
should_be_on 1
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'is unaffected by posting through a relative form' do
|
|
71
|
+
visit_host_links
|
|
72
|
+
@session.click_button('Relative Host')
|
|
73
|
+
should_be_on 0
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it 'is affected by posting through an absolute form' do
|
|
77
|
+
visit_host_links
|
|
78
|
+
@session.click_button('Absolute Host')
|
|
79
|
+
should_be_on 1
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'is affected by following a redirect' do
|
|
83
|
+
@session.visit("#{bases[0]}/redirect")
|
|
84
|
+
should_be_on 0, '/landed'
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
it 'maintains fragment' do
|
|
88
|
+
@session.visit("#{bases[0]}/redirect#fragment")
|
|
89
|
+
should_be_on 0, '/landed#fragment'
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
it 'redirects to a fragment' do
|
|
93
|
+
@session.visit("#{bases[0]}/redirect_with_fragment")
|
|
94
|
+
should_be_on 0, '/landed#with_fragment'
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it 'is affected by pushState', requires: [:js] do
|
|
98
|
+
@session.visit('/with_js')
|
|
99
|
+
@session.execute_script("window.history.pushState({}, '', '/pushed')")
|
|
100
|
+
expect(@session.current_path).to eq('/pushed')
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it 'is affected by replaceState', requires: [:js] do
|
|
104
|
+
@session.visit('/with_js')
|
|
105
|
+
@session.execute_script("window.history.replaceState({}, '', '/replaced')")
|
|
106
|
+
expect(@session.current_path).to eq('/replaced')
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it "doesn't raise exception on a nil current_url", requires: [:driver] do
|
|
110
|
+
allow(@session.driver).to receive(:current_url).and_return(nil)
|
|
111
|
+
@session.visit('/')
|
|
112
|
+
expect { @session.current_url }.not_to raise_exception
|
|
113
|
+
expect { @session.current_path }.not_to raise_exception
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
context 'within iframe', requires: [:frames] do
|
|
117
|
+
it 'should get the url of the top level browsing context' do
|
|
118
|
+
@session.visit('/within_frames')
|
|
119
|
+
expect(@session.current_url).to match(/within_frames\z/)
|
|
120
|
+
@session.within_frame('frameOne') do
|
|
121
|
+
expect(@session.current_url).to match(/within_frames\z/)
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Capybara::SpecHelper.spec '#dismiss_confirm', requires: [:modals] do
|
|
4
|
+
before do
|
|
5
|
+
@session.visit('/with_js')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it 'should dismiss the confirm' do
|
|
9
|
+
@session.dismiss_confirm do
|
|
10
|
+
@session.click_link('Open confirm')
|
|
11
|
+
end
|
|
12
|
+
expect(@session).to have_xpath("//a[@id='open-confirm' and @confirmed='false']")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'should dismiss the confirm if the message matches' do
|
|
16
|
+
@session.dismiss_confirm 'Confirm opened' do
|
|
17
|
+
@session.click_link('Open confirm')
|
|
18
|
+
end
|
|
19
|
+
expect(@session).to have_xpath("//a[@id='open-confirm' and @confirmed='false']")
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it "should not dismiss the confirm if the message doesn't match" do
|
|
23
|
+
expect do
|
|
24
|
+
@session.dismiss_confirm 'Incorrect Text' do
|
|
25
|
+
@session.click_link('Open confirm')
|
|
26
|
+
end
|
|
27
|
+
end.to raise_error(Capybara::ModalNotFound)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'should return the message presented' do
|
|
31
|
+
message = @session.dismiss_confirm do
|
|
32
|
+
@session.click_link('Open confirm')
|
|
33
|
+
end
|
|
34
|
+
expect(message).to eq('Confirm opened')
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Capybara::SpecHelper.spec '#dismiss_prompt', requires: [:modals] do
|
|
4
|
+
before do
|
|
5
|
+
@session.visit('/with_js')
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it 'should dismiss the prompt' do
|
|
9
|
+
@session.dismiss_prompt do
|
|
10
|
+
@session.click_link('Open prompt')
|
|
11
|
+
end
|
|
12
|
+
expect(@session).to have_xpath("//a[@id='open-prompt' and @response='dismissed']")
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'should return the message presented' do
|
|
16
|
+
message = @session.dismiss_prompt do
|
|
17
|
+
@session.click_link('Open prompt')
|
|
18
|
+
end
|
|
19
|
+
expect(message).to eq('Prompt opened')
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Capybara::SpecHelper.spec '#assert_matches_selector' do
|
|
4
|
+
before do
|
|
5
|
+
@session.visit('/with_html')
|
|
6
|
+
@element = @session.find(:css, 'span', text: '42')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'should be true if the given selector matches the element' do
|
|
10
|
+
expect(@element.assert_matches_selector(:css, '.number')).to be true
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'should be false if the given selector does not match the element' do
|
|
14
|
+
expect { @element.assert_matches_selector(:css, '.not_number') }.to raise_error(Capybara::ElementNotFound)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it 'should not be callable on the session' do
|
|
18
|
+
expect { @session.assert_matches_selector(:css, '.number') }.to raise_error(NoMethodError)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it 'should wait for match to occur', requires: [:js] do
|
|
22
|
+
@session.visit('/with_js')
|
|
23
|
+
input = @session.find(:css, '#disable-on-click')
|
|
24
|
+
|
|
25
|
+
expect(input.assert_matches_selector(:css, 'input:enabled')).to be true
|
|
26
|
+
input.click
|
|
27
|
+
expect(input.assert_matches_selector(:css, 'input:disabled')).to be true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'should not accept count options' do
|
|
31
|
+
expect { @element.assert_matches_selector(:css, '.number', count: 1) }.to raise_error(ArgumentError, /count/)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'should accept a filter block' do
|
|
35
|
+
@element.assert_matches_selector(:css, 'span') { |el| el[:class] == 'number' }
|
|
36
|
+
@element.assert_not_matches_selector(:css, 'span') { |el| el[:class] == 'not_number' }
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Capybara::SpecHelper.spec '#match_css?' do
|
|
4
|
+
before do
|
|
5
|
+
@session.visit('/with_html')
|
|
6
|
+
@element = @session.find(:css, 'span', text: '42')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'should be true if the given selector matches the element' do
|
|
10
|
+
expect(@element).to match_css('span')
|
|
11
|
+
expect(@element).to match_css('span.number')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'should be false if the given selector does not match' do
|
|
15
|
+
expect(@element).not_to match_css('div')
|
|
16
|
+
expect(@element).not_to match_css('p a#doesnotexist')
|
|
17
|
+
expect(@element).not_to match_css('p.nosuchclass')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'should accept an optional filter block' do
|
|
21
|
+
# This would be better done with
|
|
22
|
+
expect(@element).to match_css('span') { |el| el[:class] == 'number' }
|
|
23
|
+
expect(@element).not_to match_css('span') { |el| el[:class] == 'not_number' }
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'should work with root element found via ancestor' do
|
|
27
|
+
el = @session.find(:css, 'body').find(:xpath, '..')
|
|
28
|
+
expect(el).to match_css('html')
|
|
29
|
+
expect { expect(el).to not_match_css('html') }.to raise_exception(RSpec::Expectations::ExpectationNotMetError)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Capybara::SpecHelper.spec '#match_xpath?' do
|
|
4
|
+
before do
|
|
5
|
+
@session.visit('/with_html')
|
|
6
|
+
@element = @session.find(:css, 'span.number')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it 'should be true if the given selector is on the page' do
|
|
10
|
+
expect(@element).to match_xpath('//span')
|
|
11
|
+
expect(@element).to match_xpath("//span[@class='number']")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'should be false if the given selector is not on the page' do
|
|
15
|
+
expect(@element).not_to match_xpath('//abbr')
|
|
16
|
+
expect(@element).not_to match_xpath('//div')
|
|
17
|
+
expect(@element).not_to match_xpath("//span[@class='not_a_number']")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'should use xpath even if default selector is CSS' do
|
|
21
|
+
Capybara.default_selector = :css
|
|
22
|
+
expect(@element).not_to have_xpath("//span[@class='not_a_number']")
|
|
23
|
+
expect(@element).not_to have_xpath("//div[@class='number']")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Capybara::SpecHelper.spec '#match_selector?' do
|
|
4
|
+
let(:element) { @session.find(:xpath, '//span', text: '42') }
|
|
5
|
+
|
|
6
|
+
before do
|
|
7
|
+
@session.visit('/with_html')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
it 'should be true if the element matches the given selector' do
|
|
11
|
+
expect(element).to match_selector(:xpath, '//span')
|
|
12
|
+
expect(element).to match_selector(:css, 'span.number')
|
|
13
|
+
expect(element.matches_selector?(:css, 'span.number')).to be true
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'should be false if the element does not match the given selector' do
|
|
17
|
+
expect(element).not_to match_selector(:xpath, '//div')
|
|
18
|
+
expect(element).not_to match_selector(:css, 'span.not_a_number')
|
|
19
|
+
expect(element.matches_selector?(:css, 'span.not_a_number')).to be false
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'should use default selector' do
|
|
23
|
+
Capybara.default_selector = :css
|
|
24
|
+
expect(element).not_to match_selector('span.not_a_number')
|
|
25
|
+
expect(element).to match_selector('span.number')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it 'should work with elements located via a sibling selector' do
|
|
29
|
+
sibling = element.sibling(:css, 'span', text: 'Other span')
|
|
30
|
+
expect(sibling).to match_selector(:xpath, '//span')
|
|
31
|
+
expect(sibling).to match_selector(:css, 'span')
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'should work with the html element' do
|
|
35
|
+
html = @session.find('/html')
|
|
36
|
+
expect(html).to match_selector(:css, 'html')
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
context 'with text' do
|
|
40
|
+
it 'should discard all matches where the given string is not contained' do
|
|
41
|
+
expect(element).to match_selector('//span', text: '42')
|
|
42
|
+
expect(element).not_to match_selector('//span', text: 'Doesnotexist')
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'should have css sugar' do
|
|
47
|
+
expect(element.matches_css?('span.number')).to be true
|
|
48
|
+
expect(element.matches_css?('span.not_a_number')).to be false
|
|
49
|
+
expect(element.matches_css?('span.number', text: '42')).to be true
|
|
50
|
+
expect(element.matches_css?('span.number', text: 'Nope')).to be false
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
it 'should have xpath sugar' do
|
|
54
|
+
expect(element.matches_xpath?('//span')).to be true
|
|
55
|
+
expect(element.matches_xpath?('//div')).to be false
|
|
56
|
+
expect(element.matches_xpath?('//span', text: '42')).to be true
|
|
57
|
+
expect(element.matches_xpath?('//span', text: 'Nope')).to be false
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it 'should accept selector filters' do
|
|
61
|
+
@session.visit('/form')
|
|
62
|
+
cbox = @session.find(:css, '#form_pets_dog')
|
|
63
|
+
expect(cbox.matches_selector?(:checkbox, id: 'form_pets_dog', option: 'dog', name: 'form[pets][]', checked: true)).to be true
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'should accept a custom filter block' do
|
|
67
|
+
@session.visit('/form')
|
|
68
|
+
cbox = @session.find(:css, '#form_pets_dog')
|
|
69
|
+
expect(cbox).to match_selector(:checkbox) { |node| node[:id] == 'form_pets_dog' }
|
|
70
|
+
expect(cbox).not_to match_selector(:checkbox) { |node| node[:id] != 'form_pets_dog' }
|
|
71
|
+
expect(cbox.matches_selector?(:checkbox) { |node| node[:id] == 'form_pets_dog' }).to be true
|
|
72
|
+
expect(cbox.matches_selector?(:checkbox) { |node| node[:id] != 'form_pets_dog' }).to be false
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
Capybara::SpecHelper.spec '#not_matches_selector?' do
|
|
77
|
+
let(:element) { @session.find(:css, 'span', text: 42) }
|
|
78
|
+
before do
|
|
79
|
+
@session.visit('/with_html')
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'should be false if the given selector matches the element' do
|
|
83
|
+
expect(element).not_to not_match_selector(:xpath, '//span')
|
|
84
|
+
expect(element).not_to not_match_selector(:css, 'span.number')
|
|
85
|
+
expect(element.not_matches_selector?(:css, 'span.number')).to be false
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it 'should be true if the given selector does not match the element' do
|
|
89
|
+
expect(element).to not_match_selector(:xpath, '//abbr')
|
|
90
|
+
expect(element).to not_match_selector(:css, 'p a#doesnotexist')
|
|
91
|
+
expect(element.not_matches_selector?(:css, 'p a#doesnotexist')).to be true
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
it 'should use default selector' do
|
|
95
|
+
Capybara.default_selector = :css
|
|
96
|
+
expect(element).to not_match_selector('p a#doesnotexist')
|
|
97
|
+
expect(element).not_to not_match_selector('span.number')
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
context 'with text' do
|
|
101
|
+
it 'should discard all matches where the given string is contained' do
|
|
102
|
+
expect(element).not_to not_match_selector(:css, 'span.number', text: '42')
|
|
103
|
+
expect(element).to not_match_selector(:css, 'span.number', text: 'Doesnotexist')
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'should have CSS sugar' do
|
|
108
|
+
expect(element.not_matches_css?('span.number')).to be false
|
|
109
|
+
expect(element.not_matches_css?('p a#doesnotexist')).to be true
|
|
110
|
+
expect(element.not_matches_css?('span.number', text: '42')).to be false
|
|
111
|
+
expect(element.not_matches_css?('span.number', text: 'Doesnotexist')).to be true
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it 'should have xpath sugar' do
|
|
115
|
+
expect(element.not_matches_xpath?('//span')).to be false
|
|
116
|
+
expect(element.not_matches_xpath?('//div')).to be true
|
|
117
|
+
expect(element.not_matches_xpath?('//span', text: '42')).to be false
|
|
118
|
+
expect(element.not_matches_xpath?('//span', text: 'Doesnotexist')).to be true
|
|
119
|
+
end
|
|
120
|
+
end
|