capybara 3.20.0 → 3.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '087a3e5a863f14cabebd8344fa0e2f04cb5c48c386014e5fd46eab2e715a8040'
4
- data.tar.gz: 2ea4bc5aec32f6a7bd63856d922264d29d9629f4c6af71867d30b963d2f04697
3
+ metadata.gz: 260a1571a7fde6676b4d901b75e17035cd5c1b32b92f6c647e9d8ceadc78ae2a
4
+ data.tar.gz: d05339eac382154edea4059cf658c7cd828a75bd8b4570b9e85819f1641fad38
5
5
  SHA512:
6
- metadata.gz: cbc11a7fe022eb230aa9e9342d26b88619cb3cb65931b89487ff448575e6cb794e7460679bd1c37c336bdd65229ca72b4e489b5fbe1a5e2ea7ff92945bb1a1ca
7
- data.tar.gz: 0a3103be3113216c40efa1cb22cc261141ed940e205c6e9e9483233c5e672079da5b6950aa4f1bf6871524a6f803eb400ed735f48e13429f57eaa9e8376ae367
6
+ metadata.gz: ffb2ebe0f747c4519d50138f4575f07c4171b1d2bfaa978dab3f471cac9cf839e0e570b8c25b76185530960d6da42dcdb9a6f45c9ed50ebd605c5cf4da2a4da4
7
+ data.tar.gz: 24c034c08f20d051256444c46bb86e0ab8c8468c34e45e27bf95408074ffe1c305603d0034348582d6b719af36a08f3f88365ddcd0336ba14e8216de854034ef
data/History.md CHANGED
@@ -1,5 +1,34 @@
1
+ # Version 3.21.0
2
+ Release date: 2019-05-24
3
+
4
+ ### Added
5
+
6
+ * Element#drop - Chrome and Firefox, via the selenium driver, support dropping files/data on elements
7
+ * Default CSS used for `attach_file` `make_visible: true` now includes auto for
8
+ height and width to handle more ways of hiding the file input element
9
+ * Documentation Updates and Fixes - Many thanks to Masafumi Koba! [Masafumi Koba]
10
+
11
+ ### Changed
12
+
13
+ * Deprecate support for CSS locator being a Symbol
14
+
15
+ # Version 3.20.2
16
+ Release date: 2019-05-19
17
+
18
+ ### Fixed
19
+
20
+ * Move `uglifier` from runtime to development dependency [miyucy]
21
+
22
+ # Version 3.20.1
23
+ Release date: 2019-05-17
24
+
25
+ ### Fixed
26
+
27
+ * RackTest driver considers <template> elements to be non-visible and ignores the contents
28
+
1
29
  # Version 3.20.0
2
30
  Release date: 2019-05-14
31
+
3
32
  ### Added
4
33
 
5
34
  * `Node#obscured?` to check viewport presence and element overlap
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.20.x version of Capybara.
10
+ **Note** You are viewing the README for the 3.21.x version of Capybara.
11
11
 
12
12
 
13
13
  Capybara helps you test web applications by simulating how a real user would
@@ -38,8 +38,6 @@ GitHub): http://groups.google.com/group/ruby-capybara
38
38
  - [RackTest](#racktest)
39
39
  - [Selenium](#selenium)
40
40
  - [Apparition](#apparition)
41
- - [Capybara-webkit](#capybara-webkit)
42
- - [Poltergeist](#poltergeist)
43
41
  - [The DSL](#the-dsl)
44
42
  - [Navigating](#navigating)
45
43
  - [Clicking links and buttons](#clicking-links-and-buttons)
@@ -59,11 +57,13 @@ GitHub): http://groups.google.com/group/ruby-capybara
59
57
  - [Using the DSL elsewhere](#using-the-dsl-elsewhere)
60
58
  - [Calling remote servers](#calling-remote-servers)
61
59
  - [Using sessions](#using-sessions)
60
+ - [Named sessions](#named-sessions)
61
+ - [Using sessions manually](#using-sessions-manually)
62
62
  - [XPath, CSS and selectors](#xpath-css-and-selectors)
63
63
  - [Beware the XPath // trap](#beware-the-xpath--trap)
64
64
  - [Configuring and adding drivers](#configuring-and-adding-drivers)
65
65
  - [Gotchas:](#gotchas)
66
- - ["Threadsafe" mode](#threadsafe)
66
+ - ["Threadsafe" mode](#threadsafe-mode)
67
67
  - [Development](#development)
68
68
 
69
69
  ## <a name="key-benefits"></a>Key benefits
@@ -69,6 +69,10 @@ module Capybara
69
69
  raise NotImplementedError
70
70
  end
71
71
 
72
+ def drop(*args)
73
+ raise NotImplementedError
74
+ end
75
+
72
76
  def scroll_by(x, y)
73
77
  raise NotImplementedError
74
78
  end
@@ -41,7 +41,7 @@ module Capybara
41
41
  ##
42
42
  #
43
43
  # Injects a `<base>` tag into the given HTML code, pointing to
44
- # `Capybara.asset_host`.
44
+ # {Capybara.configure asset_host}.
45
45
  #
46
46
  # @param [String] html HTML code to inject into
47
47
  # @param [URL] host (Capybara.asset_host) The host from which assets should be loaded
@@ -150,27 +150,27 @@ module Capybara
150
150
  # Assertion that there is xpath
151
151
  #
152
152
  # @!method assert_xpath
153
- # see Capybara::Node::Matchers#has_xpath?
153
+ # see {Capybara::Node::Matchers#has_xpath?}
154
154
 
155
155
  ##
156
156
  # Assertion that there is no xpath
157
157
  #
158
158
  # @!method refute_xpath
159
159
  # @!method assert_no_xpath
160
- # see Capybara::Node::Matchers#has_no_xpath?
160
+ # see {Capybara::Node::Matchers#has_no_xpath?}
161
161
 
162
162
  ##
163
163
  # Assertion that there is css
164
164
  #
165
165
  # @!method assert_css
166
- # see Capybara::Node::Matchers#has_css?
166
+ # see {Capybara::Node::Matchers#has_css?}
167
167
 
168
168
  ##
169
169
  # Assertion that there is no css
170
170
  #
171
171
  # @!method refute_css
172
172
  # @!method assert_no_css
173
- # see Capybara::Node::Matchers#has_no_css?
173
+ # see {Capybara::Node::Matchers#has_no_css?}
174
174
 
175
175
  ##
176
176
  # Assertion that there is link
@@ -6,18 +6,19 @@ module Capybara
6
6
  # @!macro waiting_behavior
7
7
  # If the driver is capable of executing JavaScript, this method will wait for a set amount of time
8
8
  # and continuously retry finding the element until either the element is found or the time
9
- # expires. The length of time +find+ will wait is controlled through {Capybara.default_max_wait_time}
9
+ # expires. The length of time this method will wait is controlled through {Capybara.configure default_max_wait_time}.
10
10
  #
11
- # @option options [false, true, Numeric] wait (Capybara.default_max_wait_time) Maximum time to wait for matching element to appear.
11
+ # @option options [false, true, Numeric] wait
12
+ # Maximum time to wait for matching element to appear. Defaults to {Capybara.configure default_max_wait_time}.
12
13
 
13
14
  ##
14
15
  #
15
- # Finds a button or link and clicks it. See {Capybara::Node::Actions#click_button} and
16
- # {Capybara::Node::Actions#click_link} for what locator will match against for each type of element
16
+ # Finds a button or link and clicks it. See {#click_button} and
17
+ # {#click_link} for what locator will match against for each type of element.
17
18
  #
18
19
  # @overload click_link_or_button([locator], **options)
19
20
  # @macro waiting_behavior
20
- # @param [String] locator See {Capybara::Node::Actions#click_button} and {Capybara::Node::Actions#click_link}
21
+ # @param [String] locator See {#click_button} and {#click_link}
21
22
  #
22
23
  # @return [Capybara::Node::Element] The element clicked
23
24
  #
@@ -28,13 +29,13 @@ module Capybara
28
29
 
29
30
  ##
30
31
  #
31
- # Finds a link by id, Capybara.test_id attribute, text or title and clicks it. Also looks at image
32
+ # Finds a link by id, {Capybara.configure test_id} attribute, text or title and clicks it. Also looks at image
32
33
  # alt text inside the link.
33
34
  #
34
35
  # @overload click_link([locator], **options)
35
36
  # @macro waiting_behavior
36
- # @param [String] locator text, id, Capybara.test_id attribute, title or nested image's alt attribute
37
- # @param options See {Capybara::Node::Finders#find_link}
37
+ # @param [String] locator text, id, {Capybara.configure test_id} attribute, title or nested image's alt attribute
38
+ # @param [Hash] options See {Capybara::Node::Finders#find_link}
38
39
  #
39
40
  # @return [Capybara::Node::Element] The element clicked
40
41
  def click_link(locator = nil, **options)
@@ -44,14 +45,14 @@ module Capybara
44
45
  ##
45
46
  #
46
47
  # Finds a button on the page and clicks it.
47
- # This can be any \<input> element of type submit, reset, image, button or it can be a
48
- # \<button> element. All buttons can be found by their id, name, Capybara.test_id attribute, value, or title. \<button> elements can also be found
49
- # by their text content, and image \<input> elements by their alt attribute
48
+ # This can be any `<input>` element of type submit, reset, image, button or it can be a
49
+ # `<button>` element. All buttons can be found by their id, name, {Capybara.configure test_id} attribute, value, or title. `<button>` elements can also be found
50
+ # by their text content, and image `<input>` elements by their alt attribute.
50
51
  #
51
52
  # @overload click_button([locator], **options)
52
53
  # @macro waiting_behavior
53
54
  # @param [String] locator Which button to find
54
- # @param options See {Capybara::Node::Finders#find_button}
55
+ # @param [Hash] options See {Capybara::Node::Finders#find_button}
55
56
  # @return [Capybara::Node::Element] The element clicked
56
57
  def click_button(locator = nil, **options)
57
58
  find(:button, locator, options).click
@@ -59,9 +60,9 @@ module Capybara
59
60
 
60
61
  ##
61
62
  #
62
- # Locate a text field or text area and fill it in with the given text
63
- # The field can be found via its name, id, Capybara.test_id attribute, or label text.
64
- # If no locator is provided will operate on self or a descendant
63
+ # Locate a text field or text area and fill it in with the given text.
64
+ # The field can be found via its name, id, {Capybara.configure test_id} attribute, or label text.
65
+ # If no locator is provided this will operate on self or a descendant.
65
66
  #
66
67
  # # will fill in a descendant fillable field with name, id, or label text matching 'Name'
67
68
  # page.fill_in 'Name', with: 'Bob'
@@ -73,7 +74,7 @@ module Capybara
73
74
  # @overload fill_in([locator], with:, **options)
74
75
  # @param [String] locator Which field to fill in
75
76
  # @param [Hash] options
76
- # @param with: [String] The value to fill_in
77
+ # @param with: [String] The value to fill in
77
78
  # @macro waiting_behavior
78
79
  # @option options [String] currently_with The current value property of the field to fill in
79
80
  # @option options [Boolean] multiple Match fields that can have multiple values?
@@ -81,9 +82,9 @@ module Capybara
81
82
  # @option options [String] name Match fields that match the name attribute
82
83
  # @option options [String] placeholder Match fields that match the placeholder attribute
83
84
  # @option options [String, Array<String>, Regexp] class Match fields that match the class(es) provided
84
- # @option options [Hash] fill_options Driver specific options regarding how to fill fields (Defaults come from Capybara.default_set_options)
85
+ # @option options [Hash] fill_options Driver specific options regarding how to fill fields (Defaults come from {Capybara.configure default_set_options})
85
86
  #
86
- # @return [Capybara::Node::Element] The element filled_in
87
+ # @return [Capybara::Node::Element] The element filled in
87
88
  def fill_in(locator = nil, with:, currently_with: nil, fill_options: {}, **find_options)
88
89
  find_options[:with] = currently_with if currently_with
89
90
  find_options[:allow_self] = true if locator.nil?
@@ -91,7 +92,8 @@ module Capybara
91
92
  end
92
93
 
93
94
  # @!macro label_click
94
- # @option options [Boolean] allow_label_click (Capybara.automatic_label_click) Attempt to click the label to toggle state if element is non-visible.
95
+ # @option options [Boolean] allow_label_click
96
+ # Attempt to click the label to toggle state if element is non-visible. Defaults to {Capybara.configure automatic_label_click}.
95
97
 
96
98
  ##
97
99
  #
@@ -178,10 +180,10 @@ module Capybara
178
180
 
179
181
  ##
180
182
  #
181
- # If `:from` option is present, `select` finds a select box, or text input with associated datalist,
183
+ # If `from` option is present, {#select} finds a select box, or text input with associated datalist,
182
184
  # on the page and selects a particular option from it.
183
185
  # Otherwise it finds an option inside current scope and selects it.
184
- # If the select box is a multiple select, +select+ can be called multiple times to select more than
186
+ # If the select box is a multiple select, {#select} can be called multiple times to select more than
185
187
  # one option.
186
188
  # The select box can be found via its name, id or label text. The option can be found by its text.
187
189
  #
@@ -191,7 +193,7 @@ module Capybara
191
193
  # @macro waiting_behavior
192
194
  #
193
195
  # @param value [String] Which option to select
194
- # @param from [String] The id, Capybara.test_id attribute, name or label of the select box
196
+ # @param from [String] The id, {Capybara.configure test_id} attribute, name or label of the select box
195
197
  #
196
198
  # @return [Capybara::Node::Element] The option element selected
197
199
  def select(value = nil, from: nil, **options)
@@ -209,7 +211,7 @@ module Capybara
209
211
  ##
210
212
  #
211
213
  # Find a select box on the page and unselect a particular option from it. If the select
212
- # box is a multiple select, +unselect+ can be called multiple times to unselect more than
214
+ # box is a multiple select, {#unselect} can be called multiple times to unselect more than
213
215
  # one option. The select box can be found via its name, id or label text.
214
216
  #
215
217
  # page.unselect 'March', from: 'Month'
@@ -218,7 +220,7 @@ module Capybara
218
220
  # @macro waiting_behavior
219
221
  #
220
222
  # @param value [String] Which option to unselect
221
- # @param from [String] The id, Capybara.test_id attribute, name or label of the select box
223
+ # @param from [String] The id, {Capybara.configure test_id} attribute, name or label of the select box
222
224
  #
223
225
  #
224
226
  # @return [Capybara::Node::Element] The option element unselected
@@ -232,7 +234,7 @@ module Capybara
232
234
  ##
233
235
  #
234
236
  # Find a descendant file field on the page and attach a file given its path. There are two ways to use
235
- # `attach_file`, in the first method the file field can be found via its name, id or label text.
237
+ # {#attach_file}, in the first method the file field can be found via its name, id or label text.
236
238
  # In the case of the file field being hidden for
237
239
  # styling reasons the `make_visible` option can be used to temporarily change the CSS of
238
240
  # the file field, attach the file, and then revert the CSS back to original. If no locator is
@@ -257,13 +259,16 @@ module Capybara
257
259
  # @param [String] locator Which field to attach the file to
258
260
  # @param [String, Array<String>] paths The path(s) of the file(s) that will be attached
259
261
  #
260
- # @option options [Symbol] match (Capybara.match) The matching strategy to use (:one, :first, :prefer_exact, :smart).
261
- # @option options [Boolean] exact (Capybara.exact) Match the exact label name/contents or accept a partial match.
262
+ # @option options [Symbol] match
263
+ # The matching strategy to use (:one, :first, :prefer_exact, :smart). Defaults to {Capybara.configure match}.
264
+ # @option options [Boolean] exact
265
+ # Match the exact label name/contents or accept a partial match. Defaults to {Capybara.configure exact}.
262
266
  # @option options [Boolean] multiple Match field which allows multiple file selection
263
267
  # @option options [String, Regexp] id Match fields that match the id attribute
264
268
  # @option options [String] name Match fields that match the name attribute
265
269
  # @option options [String, Array<String>, Regexp] class Match fields that match the class(es) provided
266
- # @option options [true, Hash] make_visible A Hash of CSS styles to change before attempting to attach the file, if `true` { opacity: 1, display: 'block', visibility: 'visible' } is used (may not be supported by all drivers)
270
+ # @option options [true, Hash] make_visible
271
+ # A Hash of CSS styles to change before attempting to attach the file, if `true`, `{ opacity: 1, display: 'block', visibility: 'visible' }` is used (may not be supported by all drivers).
267
272
  # @overload attach_file(paths, &blk)
268
273
  # @param [String, Array<String>] paths The path(s) of the file(s) that will be attached
269
274
  # @yield Block whose actions will trigger the system file chooser to be shown
@@ -326,7 +331,9 @@ module Capybara
326
331
  end
327
332
 
328
333
  def while_visible(element, visible_css)
329
- visible_css = { opacity: 1, display: 'block', visibility: 'visible' } if visible_css == true
334
+ if visible_css == true
335
+ visible_css = { opacity: 1, display: 'block', visibility: 'visible', width: 'auto', height: 'auto' }
336
+ end
330
337
  _update_style(element, visible_css)
331
338
  raise ExpectationNotMet, 'The style changes in :make_visible did not make the file input visible' unless element.visible?
332
339