capybara 3.21.0 → 3.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/History.md +14 -0
  4. data/README.md +13 -8
  5. data/lib/capybara.rb +38 -32
  6. data/lib/capybara/driver/node.rb +2 -2
  7. data/lib/capybara/minitest.rb +14 -1
  8. data/lib/capybara/minitest/spec.rb +20 -7
  9. data/lib/capybara/node/finders.rb +41 -47
  10. data/lib/capybara/node/matchers.rb +161 -72
  11. data/lib/capybara/queries/ancestor_query.rb +9 -7
  12. data/lib/capybara/queries/sibling_query.rb +11 -4
  13. data/lib/capybara/result.rb +2 -0
  14. data/lib/capybara/rspec/matchers.rb +16 -1
  15. data/lib/capybara/rspec/matchers/have_ancestor.rb +30 -0
  16. data/lib/capybara/rspec/matchers/have_sibling.rb +30 -0
  17. data/lib/capybara/selector.rb +153 -171
  18. data/lib/capybara/selector/definition/checkbox.rb +8 -5
  19. data/lib/capybara/selector/definition/radio_button.rb +8 -5
  20. data/lib/capybara/selector/filter_set.rb +4 -2
  21. data/lib/capybara/selenium/driver_specializations/chrome_driver.rb +35 -1
  22. data/lib/capybara/session.rb +74 -71
  23. data/lib/capybara/session/config.rb +1 -1
  24. data/lib/capybara/spec/session/check_spec.rb +6 -0
  25. data/lib/capybara/spec/session/choose_spec.rb +6 -0
  26. data/lib/capybara/spec/session/has_ancestor_spec.rb +44 -0
  27. data/lib/capybara/spec/session/has_sibling_spec.rb +50 -0
  28. data/lib/capybara/spec/session/select_spec.rb +5 -5
  29. data/lib/capybara/spec/views/form.erb +1 -1
  30. data/lib/capybara/version.rb +1 -1
  31. data/lib/capybara/window.rb +10 -10
  32. data/spec/minitest_spec.rb +11 -1
  33. data/spec/minitest_spec_spec.rb +11 -1
  34. data/spec/regexp_dissassembler_spec.rb +1 -1
  35. metadata +7 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 260a1571a7fde6676b4d901b75e17035cd5c1b32b92f6c647e9d8ceadc78ae2a
4
- data.tar.gz: d05339eac382154edea4059cf658c7cd828a75bd8b4570b9e85819f1641fad38
3
+ metadata.gz: 33bde7b48182b5c3dd5679c621882392d87bc8b9303cffabf963fe84186768b1
4
+ data.tar.gz: 4d9ccd2f5c45a87586f87f29f9df888af7102bf6e86042993c36ed858fc07537
5
5
  SHA512:
6
- metadata.gz: ffb2ebe0f747c4519d50138f4575f07c4171b1d2bfaa978dab3f471cac9cf839e0e570b8c25b76185530960d6da42dcdb9a6f45c9ed50ebd605c5cf4da2a4da4
7
- data.tar.gz: 24c034c08f20d051256444c46bb86e0ab8c8468c34e45e27bf95408074ffe1c305603d0034348582d6b719af36a08f3f88365ddcd0336ba14e8216de854034ef
6
+ metadata.gz: a128be647b867602954cc51cf603e020c3eceb938b5761766982a00e91fd0fccbc7aff02c49fc2c3064cdf489cc7a812c25818b5ca675ddf87c6a7a6822bd45a
7
+ data.tar.gz: 40d9831cc35bf0d1af71722718cea81ac2a075b5bbc067a89edb78e56572d8e0ad56455abd47b2b5ba3e0edd5b76ed4eb77de63255773e70cfd261bfa064092f
@@ -0,0 +1 @@
1
+ --markup markdown
data/History.md CHANGED
@@ -1,3 +1,17 @@
1
+ # Version 3.22.0
2
+ Release date: 2019-05-29
3
+
4
+ ### Added
5
+
6
+ * `ancestor`/`sibling` assertions and matchers added
7
+ * Documentation Updates and Fixes - Many thanks again to Masafumi Koba! [Masafumi Koba]
8
+ * Added `:with` alias for `:option` filter on `:checkbox` and `:radio_button` selectors
9
+
10
+ ### Changed
11
+
12
+ * Selenium driver with Chrome >= 73 now resets cookies and local/session storage after navigating
13
+ to 'about:blank' when possible to minimize potential race condition
14
+
1
15
  # Version 3.21.0
2
16
  Release date: 2019-05-24
3
17
 
data/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jnicklas/capybara?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
8
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=capybara&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=capybara&package-manager=bundler&version-scheme=semver)
9
9
 
10
- **Note** You are viewing the README for the 3.21.x version of Capybara.
10
+ **Note** You are viewing the README for the 3.22.x version of Capybara.
11
11
 
12
12
 
13
13
  Capybara helps you test web applications by simulating how a real user would
@@ -925,12 +925,17 @@ Capybara.default_selector = :xpath
925
925
  find('.//ul/li').text
926
926
  ```
927
927
 
928
- Capybara allows you to add custom selectors, which can be very useful if you
929
- find yourself using the same kinds of selectors very often:
928
+ Capybara provides a number of other built-in selector types. The full list, along
929
+ with applicable filters, can be seen at [built-in selectors](https://www.rubydoc.info/github/teamcapybara/capybara/Capybara/Selector)
930
+
931
+ Capybara also allows you to add custom selectors, which can be very useful if you
932
+ find yourself using the same kinds of selectors very often. The examples below are very
933
+ simple, and there are many available features not demonstrated. For more in-depth examples
934
+ please see Capybaras built-in selector definitions.
930
935
 
931
936
  ```ruby
932
- Capybara.add_selector(:id) do
933
- xpath { |id| XPath.descendant[XPath.attr(:id) == id.to_s] }
937
+ Capybara.add_selector(:my_attribute) do
938
+ xpath { |id| XPath.descendant[XPath.attr(:my_attribute) == id.to_s] }
934
939
  end
935
940
 
936
941
  Capybara.add_selector(:row) do
@@ -947,9 +952,9 @@ an XPath expression generated through the XPath gem. You can now use these
947
952
  selectors like this:
948
953
 
949
954
  ```ruby
950
- find(:id, 'post_123')
951
- find(:row, 3)
952
- find(:flash_type, :notice)
955
+ find(:my_attribute, 'post_123') # find element with matching attribute
956
+ find(:row, 3) # find 3rd row in table body
957
+ find(:flash_type, :notice) # find element with id of 'flash' and class of 'notice'
953
958
  ```
954
959
 
955
960
  ## <a name="beware-the-xpath--trap"></a>Beware the XPath // trap
@@ -66,38 +66,44 @@ module Capybara
66
66
  # config.app_host = 'http://www.google.com'
67
67
  # end
68
68
  #
69
- # === Configurable options
70
- #
71
- # [app_host = String/nil] The default host to use when giving a relative URL to visit, must be a valid URL e.g. http://www.example.com
72
- # [always_include_port = Boolean] Whether the Rack server's port should automatically be inserted into every visited URL unless another port is explicitly specified (Default: false)
73
- # [asset_host = String] Where dynamic assets are hosted - will be prepended to relative asset locations if present (Default: nil)
74
- # [run_server = Boolean] Whether to start a Rack server for the given Rack app (Default: true)
75
- # [raise_server_errors = Boolean] Should errors raised in the server be raised in the tests? (Default: true)
76
- # [server_errors = Array\<Class\>] Error classes that should be raised in the tests if they are raised in the server and {configure raise_server_errors} is true (Default: [Exception])
77
- # [default_selector = :css/:xpath] Methods which take a selector use the given type by default (Default: :css)
78
- # [default_max_wait_time = Numeric] The maximum number of seconds to wait for asynchronous processes to finish (Default: 2)
79
- # [ignore_hidden_elements = Boolean] Whether to ignore hidden elements on the page (Default: true)
80
- # [automatic_reload = Boolean] Whether to automatically reload elements as Capybara is waiting (Default: true)
81
- # [save_path = String] Where to put pages saved through save_(page|screenshot), save_and_open_(page|screenshot) (Default: Dir.pwd)
82
- # [automatic_label_click = Boolean] Whether {Capybara::Node::Element#choose Element#choose}, {Capybara::Node::Element#check Element#check}, {Capybara::Node::Element#uncheck Element#uncheck} will attempt to click the associated label element if the checkbox/radio button are non-visible (Default: false)
83
- # [enable_aria_label = Boolean] Whether fields, links, and buttons will match against aria-label attribute (Default: false)
84
- # [reuse_server = Boolean] Reuse the server thread between multiple sessions using the same app object (Default: true)
85
- # [threadsafe = Boolean] Whether sessions can be configured individually (Default: false)
86
- # [server = Symbol] The name of the registered server to use when running the app under test (Default: :default which uses puma)
87
- # [default_set_options = Hash] The default options passed to {Capybara::Node::Element#set Element#set} (Default: {})
88
- # [test_id = Symbol/String/nil] Optional attribute to match locator aginst with builtin selectors along with id (Default: nil)
89
- # [predicates_wait = Boolean] Whether Capybara's predicate matchers use waiting behavior by default (Default: true)
90
- # [default_normalize_ws = Boolean] Whether text predicates and matchers use normalize whitespace behaviour (Default: false)
91
- # [allow_gumbo = Boolean] When `nokogumbo` is available, whether it will be used to parse HTML strings (Default: false)
92
- # [match = :one/:first/:prefer_exact/:smart] The matching strategy to find nodes (Default: :smart)
93
- # [exact_text = Boolean] Whether the text matchers and `:text` filter match exactly or on substrings (Default: false)
94
- #
95
- # === DSL Options
96
- #
97
- # when using capybara/dsl, the following options are also available:
98
- #
99
- # [default_driver = Symbol] The name of the driver to use by default. (Default: :rack_test)
100
- # [javascript_driver = Symbol] The name of a driver to use for JavaScript enabled tests. (Default: :selenium)
69
+ # #### Configurable options
70
+ #
71
+ # - **allow_gumbo** (Boolean = `false`) - When `nokogumbo` is available, whether it will be used to parse HTML strings.
72
+ # - **always_include_port** (Boolean = `false`) - Whether the Rack server's port should automatically be inserted into every visited URL
73
+ # unless another port is explicitly specified.
74
+ # - **app_host** (String, `nil`) - The default host to use when giving a relative URL to visit, must be a valid URL e.g. `http://www.example.com`.
75
+ # - **asset_host** (String = `nil`) - Where dynamic assets are hosted - will be prepended to relative asset locations if present.
76
+ # - **automatic_label_click** (Boolean = `false`) - Whether {Capybara::Node::Element#choose Element#choose}, {Capybara::Node::Element#check Element#check},
77
+ # {Capybara::Node::Element#uncheck Element#uncheck} will attempt to click the associated `<label>` element if the checkbox/radio button are non-visible.
78
+ # - **automatic_reload** (Boolean = `true`) - Whether to automatically reload elements as Capybara is waiting.
79
+ # - **default_max_wait_time** (Numeric = `2`) - The maximum number of seconds to wait for asynchronous processes to finish.
80
+ # - **default_normalize_ws** (Boolean = `false`) - Whether text predicates and matchers use normalize whitespace behavior.
81
+ # - **default_selector** (`:css`, `:xpath` = `:css`) - Methods which take a selector use the given type by default. See also {Capybara::Selector}.
82
+ # - **default_set_options** (Hash = `{}`) - The default options passed to {Capybara::Node::Element#set Element#set}.
83
+ # - **enable_aria_label** (Boolean = `false`) - Whether fields, links, and buttons will match against `aria-label` attribute.
84
+ # - **exact** (Boolean = `false`) - Whether locators are matched exactly or with substrings. Only affects selector conditions
85
+ # written using the `XPath#is` method.
86
+ # - **exact_text** (Boolean = `false`) - Whether the text matchers and `:text` filter match exactly or on substrings.
87
+ # - **ignore_hidden_elements** (Boolean = `true`) - Whether to ignore hidden elements on the page.
88
+ # - **match** (`:one`, `:first`, `:prefer_exact`, `:smart` = `:smart`) - The matching strategy to find nodes.
89
+ # - **predicates_wait** (Boolean = `true`) - Whether Capybara's predicate matchers use waiting behavior by default.
90
+ # - **raise_server_errors** (Boolean = `true`) - Should errors raised in the server be raised in the tests?
91
+ # - **reuse_server** (Boolean = `true`) - Whether to reuse the server thread between multiple sessions using the same app object.
92
+ # - **run_server** (Boolean = `true`) - Whether to start a Rack server for the given Rack app.
93
+ # - **save_path** (String = `Dir.pwd`) - Where to put pages saved through {Capybara::Session#save_page save_page}, {Capybara::Session#save_screenshot save_screenshot},
94
+ # {Capybara::Session#save_and_open_page save_and_open_page}, or {Capybara::Session#save_and_open_screenshot save_and_open_screenshot}.
95
+ # - **server** (Symbol = `:default` (which uses puma)) - The name of the registered server to use when running the app under test.
96
+ # - **server_errors** (Array\<Class> = `[Exception]`) - Error classes that should be raised in the tests if they are raised in the server
97
+ # and {configure raise_server_errors} is `true`.
98
+ # - **test_id** (`Symbol`, `String`, `nil` = `nil`) - Optional attribute to match locator against with built-in selectors along with id.
99
+ # - **threadsafe** (Boolean = `false`) - Whether sessions can be configured individually.
100
+ #
101
+ # #### DSL Options
102
+ #
103
+ # When using `capybara/dsl`, the following options are also available:
104
+ #
105
+ # - **default_driver** (Symbol = `:rack_test`) - The name of the driver to use by default.
106
+ # - **javascript_driver** (Symbol = `:selenium`) - The name of a driver to use for JavaScript enabled tests.
101
107
  #
102
108
  def configure
103
109
  yield config
@@ -31,8 +31,8 @@ module Capybara
31
31
  raise NotImplementedError
32
32
  end
33
33
 
34
- # @param value String or Array. Array is only allowed if node has 'multiple' attribute
35
- # @param options [Hash{}] Driver specific options for how to set a value on a node
34
+ # @param value [String, Array] Array is only allowed if node has 'multiple' attribute
35
+ # @param options [Hash] Driver specific options for how to set a value on a node
36
36
  def set(value, **options)
37
37
  raise NotImplementedError
38
38
  end
@@ -86,9 +86,20 @@ module Capybara
86
86
  # @!method assert_matches_style
87
87
  # see {Capybara::Node::Matchers#assert_matches_style}
88
88
 
89
+ ## Assert element has a matching sibling
90
+ #
91
+ # @!method assert_sibling
92
+ # see {Capybara::Node::Matchers#assert_sibling}
93
+
94
+ ## Assert element has a matching ancestor
95
+ #
96
+ # @!method assert_ancestor
97
+ # see {Capybara::Node::Matchers#assert_ancestor}
98
+
89
99
  %w[selector no_selector matches_style
90
100
  all_of_selectors none_of_selectors any_of_selectors
91
- matches_selector not_matches_selector].each do |assertion_name|
101
+ matches_selector not_matches_selector
102
+ sibling no_sibling ancestor no_ancestor].each do |assertion_name|
92
103
  class_eval <<-ASSERTION, __FILE__, __LINE__ + 1
93
104
  def assert_#{assertion_name} *args, &optional_filter_block
94
105
  self.assertions +=1
@@ -102,6 +113,8 @@ module Capybara
102
113
 
103
114
  alias_method :refute_selector, :assert_no_selector
104
115
  alias_method :refute_matches_selector, :assert_not_matches_selector
116
+ alias_method :refute_ancestor, :assert_no_ancestor
117
+ alias_method :refute_sibling, :assert_no_sibling
105
118
 
106
119
  %w[xpath css link button field select table].each do |selector_type|
107
120
  define_method "assert_#{selector_type}" do |*args, &optional_filter_block|
@@ -11,13 +11,14 @@ module Capybara
11
11
  end
12
12
 
13
13
  # rubocop:disable Style/MultilineBlockChain
14
- (%w[selector xpath css link button field select table checked_field unchecked_field].flat_map do |assertion|
15
- [%W[assert_#{assertion} must_have_#{assertion}],
16
- %W[refute_#{assertion} wont_have_#{assertion}]]
17
- end + [%w[assert_all_of_selectors must_have_all_of_selectors],
18
- %w[assert_none_of_selectors must_have_none_of_selectors],
19
- %w[assert_any_of_selectors must_have_any_of_selectors],
20
- %w[assert_matches_style must_match_style]] +
14
+ (%w[selector xpath css link button field select table checked_field unchecked_field
15
+ ancestor sibling].flat_map do |assertion|
16
+ [%W[assert_#{assertion} must_have_#{assertion}],
17
+ %W[refute_#{assertion} wont_have_#{assertion}]]
18
+ end + [%w[assert_all_of_selectors must_have_all_of_selectors],
19
+ %w[assert_none_of_selectors must_have_none_of_selectors],
20
+ %w[assert_any_of_selectors must_have_any_of_selectors],
21
+ %w[assert_matches_style must_match_style]] +
21
22
  %w[selector xpath css].flat_map do |assertion|
22
23
  [%W[assert_matches_#{assertion} must_match_#{assertion}],
23
24
  %W[refute_matches_#{assertion} wont_match_#{assertion}]]
@@ -178,6 +179,18 @@ module Capybara
178
179
  #
179
180
  # @!method must_match_style
180
181
  # see {Capybara::Node::Matchers#assert_matches_style}
182
+
183
+ ##
184
+ # Expectation that there is an ancestor
185
+ #
186
+ # @!method must_have_ancestor
187
+ # see Capybara::Node::Matchers#has_ancestor?
188
+
189
+ ##
190
+ # Expectation that there is a sibling
191
+ #
192
+ # @!method must_have_sibling
193
+ # see Capybara::Node::Matchers#has_sibling?
181
194
  end
182
195
  end
183
196
  end
@@ -5,21 +5,25 @@ module Capybara
5
5
  module Finders
6
6
  ##
7
7
  #
8
- # Find an {Capybara::Node::Element} based on the given arguments. +find+ will raise an error if the element
8
+ # Find an {Capybara::Node::Element} based on the given arguments. {#find} will raise an error if the element
9
9
  # is not found.
10
10
  #
11
- # page.find('#foo').find('.bar')
12
- # page.find(:xpath, './/div[contains(., "bar")]')
13
- # page.find('li', text: 'Quox').click_link('Delete')
11
+ # page.find('#foo').find('.bar')
12
+ # page.find(:xpath, './/div[contains(., "bar")]')
13
+ # page.find('li', text: 'Quox').click_link('Delete')
14
14
  #
15
- # @param (see Capybara::Node::Finders#all)
15
+ # @param (see #all)
16
16
  #
17
17
  # @macro waiting_behavior
18
18
  #
19
19
  # @!macro system_filters
20
20
  # @option options [String, Regexp] text Only find elements which contain this text or match this regexp
21
- # @option options [String, Boolean] exact_text (Capybara.exact_text) When String the elements contained text must match exactly, when Boolean controls whether the :text option must match exactly
22
- # @option options [Boolean] normalize_ws (Capybara.default_normalize_ws) Whether the `text`/`exact_text` options are compared against elment text with whitespace normalized or as returned by the driver
21
+ # @option options [String, Boolean] exact_text
22
+ # When String the elements contained text must match exactly, when Boolean controls whether the `text` option must match exactly.
23
+ # Defaults to {Capybara.configure exact_text}.
24
+ # @option options [Boolean] normalize_ws
25
+ # Whether the `text`/`exact_text` options are compared against elment text with whitespace normalized or as returned by the driver.
26
+ # Defaults to {Capybara.configure default_normalize_ws}.
23
27
  # @option options [Boolean, Symbol] visible Only find elements with the specified visibility:
24
28
  # * true - only finds visible elements.
25
29
  # * false - finds invisible _and_ visible elements.
@@ -31,12 +35,14 @@ module Capybara
31
35
  # * false - only find elements whose centerpoint is in the viewport and is not obscured by other non-descendant elements.
32
36
  # @option options [String, Regexp] id Only find elements with an id that matches the value passed
33
37
  # @option options [String, Array<String>, Regexp] class Only find elements with matching class/classes.
34
- # + Absence of a class can be checked by prefixing the class name with !
35
- # + If you need to check for existence of a class name that starts with ! then prefix with !!
36
- # + ```class:['a', '!b', '!!!c'] # limit to elements with class 'a' and '!c' but not class 'b'```
38
+ # * Absence of a class can be checked by prefixing the class name with `!`
39
+ # * If you need to check for existence of a class name that starts with `!` then prefix with `!!`
40
+ #
41
+ # class:['a', '!b', '!!!c'] # limit to elements with class 'a' and '!c' but not class 'b'
42
+ #
37
43
  # @option options [String, Regexp, Hash] style Only find elements with matching style. String and Regexp will be checked against text of the elements `style` attribute, while a Hash will be compared against the elements full style
38
- # @option options [Boolean] exact Control whether `is` expressions in the given XPath match exactly or partially
39
- # @option options [Symbol] match The matching strategy to use.
44
+ # @option options [Boolean] exact Control whether `is` expressions in the given XPath match exactly or partially. Defaults to {Capybara.configure exact}.
45
+ # @option options [Symbol] match The matching strategy to use. Defaults to {Capybara.configure match}.
40
46
  #
41
47
  # @return [Capybara::Node::Element] The found element
42
48
  # @raise [Capybara::ElementNotFound] If the element can't be found before time expires
@@ -48,21 +54,19 @@ module Capybara
48
54
 
49
55
  ##
50
56
  #
51
- # Find an {Capybara::Node::Element} based on the given arguments that is also an ancestor of the element called on. +ancestor+ will raise an error if the element
52
- # is not found.
57
+ # Find an {Capybara::Node::Element} based on the given arguments that is also an ancestor of the element called on.
58
+ # {#ancestor} will raise an error if the element is not found.
53
59
  #
54
- # +ancestor+ takes the same options as +find+.
60
+ # {#ancestor} takes the same options as {#find}.
55
61
  #
56
62
  # element.ancestor('#foo').find('.bar')
57
63
  # element.ancestor(:xpath, './/div[contains(., "bar")]')
58
64
  # element.ancestor('ul', text: 'Quox').click_link('Delete')
59
65
  #
60
- # @param (see Capybara::Node::Finders#find)
66
+ # @param (see #find)
61
67
  #
62
68
  # @macro waiting_behavior
63
69
  #
64
- # @option options [Symbol] match The matching strategy to use.
65
- #
66
70
  # @return [Capybara::Node::Element] The found element
67
71
  # @raise [Capybara::ElementNotFound] If the element can't be found before time expires
68
72
  #
@@ -73,22 +77,19 @@ module Capybara
73
77
 
74
78
  ##
75
79
  #
76
- # Find an {Capybara::Node::Element} based on the given arguments that is also a sibling of the element called on. +sibling+ will raise an error if the element
77
- # is not found.
78
- #
80
+ # Find an {Capybara::Node::Element} based on the given arguments that is also a sibling of the element called on.
81
+ # {#sibling} will raise an error if the element is not found.
79
82
  #
80
- # +sibling+ takes the same options as +find+.
83
+ # {#sibling} takes the same options as {#find}.
81
84
  #
82
85
  # element.sibling('#foo').find('.bar')
83
86
  # element.sibling(:xpath, './/div[contains(., "bar")]')
84
87
  # element.sibling('ul', text: 'Quox').click_link('Delete')
85
88
  #
86
- # @param (see Capybara::Node::Finders#find)
89
+ # @param (see #find)
87
90
  #
88
91
  # @macro waiting_behavior
89
92
  #
90
- # @option options [Symbol] match The matching strategy to use.
91
- #
92
93
  # @return [Capybara::Node::Element] The found element
93
94
  # @raise [Capybara::ElementNotFound] If the element can't be found before time expires
94
95
  #
@@ -102,7 +103,7 @@ module Capybara
102
103
  # Find a form field on the page. The field can be found by its name, id or label text.
103
104
  #
104
105
  # @overload find_field([locator], **options)
105
- # @param [String] locator name, id, Capybara.test_id attribute, placeholder or text of associated label element
106
+ # @param [String] locator name, id, {Capybara.configure test_id} attribute, placeholder or text of associated label element
106
107
  #
107
108
  # @macro waiting_behavior
108
109
  #
@@ -117,13 +118,12 @@ module Capybara
117
118
  # @option options [String, Regexp] with Value of field to match on
118
119
  # @option options [String] type Type of field to match on
119
120
  # @option options [Boolean] multiple Match fields that can have multiple values?
120
- # @option options [String, Regexp] id Match fields that match the id attribute
121
+ # @option options [String, Regexp] id Match fields that match the id attribute
121
122
  # @option options [String] name Match fields that match the name attribute
122
123
  # @option options [String] placeholder Match fields that match the placeholder attribute
123
124
  # @option options [String, Array<String>, Regexp] class Match fields that match the class(es) passed
124
125
  # @return [Capybara::Node::Element] The found element
125
126
  #
126
-
127
127
  def find_field(locator = nil, **options, &optional_filter_block)
128
128
  find(:field, locator, options, &optional_filter_block)
129
129
  end
@@ -133,12 +133,12 @@ module Capybara
133
133
  # Find a link on the page. The link can be found by its id or text.
134
134
  #
135
135
  # @overload find_link([locator], **options)
136
- # @param [String] locator id, Capybara.test_id attribute, title, text, or alt of enclosed img element
136
+ # @param [String] locator id, {Capybara.configure test_id} attribute, title, text, or alt of enclosed img element
137
137
  #
138
138
  # @macro waiting_behavior
139
139
  #
140
- # @option options [String,Regexp,nil] href Value to match against the links href, if nil finds link placeholders (<a> elements with no href attribute), if false ignores the href
141
- # @option options [String, Regexp] id Match links with the id provided
140
+ # @option options [String,Regexp,nil] href Value to match against the links href, if `nil` finds link placeholders (`<a>` elements with no href attribute), if `false` ignores the href
141
+ # @option options [String, Regexp] id Match links with the id provided
142
142
  # @option options [String] title Match links with the title provided
143
143
  # @option options [String] alt Match links with a contained img element whose alt matches
144
144
  # @option options [String, Array<String>, Regexp] class Match links that match the class(es) provided
@@ -151,14 +151,12 @@ module Capybara
151
151
  ##
152
152
  #
153
153
  # Find a button on the page.
154
- # This can be any \<input> element of type submit, reset, image, button or it can be a
155
- # \<button> element. All buttons can be found by their id, name, Capbyara.test_id attribute, value, or title. \<button> elements can also be found
156
- # by their text content, and image \<input> elements by their alt attribute
154
+ # This can be any `<input>` element of type submit, reset, image, button or it can be a
155
+ # `<button>` element. All buttons can be found by their id, name, {Capybara.configure test_id} attribute, value, or title.
156
+ # `<button>` elements can also be found by their text content, and image `<input>` elements by their alt attribute.
157
157
  #
158
158
  # @overload find_button([locator], **options)
159
- # @param [String] locator id, name, Capybara.test_id attribute, value, title, text content, alt of image
160
- #
161
- # @overload find_button(**options)
159
+ # @param [String] locator id, name, {Capybara.configure test_id} attribute, value, title, text content, alt of image
162
160
  #
163
161
  # @macro waiting_behavior
164
162
  #
@@ -204,9 +202,8 @@ module Capybara
204
202
  # page.all(:css, 'a#person_123')
205
203
  # page.all(:xpath, './/a[@id="person_123"]')
206
204
  #
207
- #
208
205
  # If the type of selector is left out, Capybara uses
209
- # {Capybara.default_selector}. It's set to :css by default.
206
+ # {Capybara.configure default_selector}. It's set to `:css` by default.
210
207
  #
211
208
  # page.all("a#person_123")
212
209
  #
@@ -219,28 +216,25 @@ module Capybara
219
216
  # page.all('a', text: 'Home')
220
217
  # page.all('#menu li', visible: true)
221
218
  #
222
- # By default Capybara's waiting behavior will wait up to `Capybara.default_max_wait_time`
219
+ # By default Capybara's waiting behavior will wait up to {Capybara.configure default_max_wait_time}
223
220
  # seconds for matching elements to be available and then return an empty result if none
224
221
  # are available. It is possible to set expectations on the number of results located and
225
222
  # Capybara will raise an exception if the number of elements located don't satisfy the
226
- # specified conditions. The expectations can be set using
223
+ # specified conditions. The expectations can be set using:
227
224
  #
228
225
  # page.assert_selector('p#foo', count: 4)
229
226
  # page.assert_selector('p#foo', maximum: 10)
230
227
  # page.assert_selector('p#foo', minimum: 1)
231
228
  # page.assert_selector('p#foo', between: 1..10)
232
229
  #
233
- # See {Capybara::Helpers#matches_count?} for additional information about
234
- # count matching.
235
- #
236
- # @param [Symbol] kind Optional selector type (:css, :xpath, :field, etc.) - Defaults to Capybara.default_selector
230
+ # @param [Symbol] kind Optional selector type (:css, :xpath, :field, etc.). Defaults to {Capybara.configure default_selector}.
237
231
  # @param [String] locator The locator for the specified selector
238
232
  # @macro system_filters
233
+ # @macro waiting_behavior
239
234
  # @option options [Integer] count Exact number of matches that are expected to be found
240
235
  # @option options [Integer] maximum Maximum number of matches that are expected to be found
241
236
  # @option options [Integer] minimum Minimum number of matches that are expected to be found
242
237
  # @option options [Range] between Number of matches found must be within the given range
243
- # @option options [false, true, Numeric] wait (Capybara.default_max_wait_time) Maximum time to wait for matching element to appear.
244
238
  # @overload all([kind = Capybara.default_selector], locator = nil, **options)
245
239
  # @overload all([kind = Capybara.default_selector], locator = nil, **options, &filter_block)
246
240
  # @yieldparam element [Capybara::Node::Element] The element being considered for inclusion in the results
@@ -271,7 +265,7 @@ module Capybara
271
265
  ##
272
266
  #
273
267
  # Find the first element on the page matching the given selector
274
- # and options. By default `first` will wait up to `Capybara.default_max_wait_time`
268
+ # and options. By default {#first} will wait up to {Capybara.configure default_max_wait_time}
275
269
  # seconds for matching elements to appear and then raise an error if no matching
276
270
  # element is found, or `nil` if the provided count options allow for empty results.
277
271
  #