capybara 1.1.4 → 2.0.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 (111) hide show
  1. data/{History.txt → History.md} +138 -0
  2. data/License.txt +22 -0
  3. data/README.md +850 -0
  4. data/lib/capybara/cucumber.rb +2 -5
  5. data/lib/capybara/driver/base.rb +6 -6
  6. data/lib/capybara/driver/node.rb +3 -2
  7. data/lib/capybara/dsl.rb +13 -124
  8. data/lib/capybara/helpers.rb +33 -0
  9. data/lib/capybara/node/actions.rb +16 -30
  10. data/lib/capybara/node/base.rb +56 -13
  11. data/lib/capybara/node/element.rb +18 -30
  12. data/lib/capybara/node/finders.rb +28 -90
  13. data/lib/capybara/node/matchers.rb +121 -73
  14. data/lib/capybara/node/simple.rb +13 -11
  15. data/lib/capybara/query.rb +78 -0
  16. data/lib/capybara/rack_test/browser.rb +27 -39
  17. data/lib/capybara/rack_test/driver.rb +13 -3
  18. data/lib/capybara/rack_test/node.rb +31 -2
  19. data/lib/capybara/result.rb +72 -0
  20. data/lib/capybara/rspec/features.rb +4 -1
  21. data/lib/capybara/rspec/matchers.rb +33 -63
  22. data/lib/capybara/rspec.rb +7 -4
  23. data/lib/capybara/selector.rb +97 -34
  24. data/lib/capybara/selenium/driver.rb +15 -62
  25. data/lib/capybara/selenium/node.rb +14 -21
  26. data/lib/capybara/server.rb +32 -27
  27. data/lib/capybara/session.rb +90 -50
  28. data/lib/capybara/spec/fixtures/another_test_file.txt +1 -0
  29. data/lib/capybara/spec/public/jquery-ui.js +791 -0
  30. data/lib/capybara/spec/public/jquery.js +9046 -0
  31. data/lib/capybara/spec/public/test.js +3 -0
  32. data/lib/capybara/spec/session/all_spec.rb +61 -59
  33. data/lib/capybara/spec/session/assert_selector.rb +123 -0
  34. data/lib/capybara/spec/session/attach_file_spec.rb +72 -55
  35. data/lib/capybara/spec/session/body_spec.rb +21 -0
  36. data/lib/capybara/spec/session/check_spec.rb +68 -48
  37. data/lib/capybara/spec/session/choose_spec.rb +32 -18
  38. data/lib/capybara/spec/session/click_button_spec.rb +263 -232
  39. data/lib/capybara/spec/session/click_link_or_button_spec.rb +40 -29
  40. data/lib/capybara/spec/session/click_link_spec.rb +96 -96
  41. data/lib/capybara/spec/session/current_url_spec.rb +88 -10
  42. data/lib/capybara/spec/session/evaluate_script_spec.rb +6 -0
  43. data/lib/capybara/spec/session/execute_script_spec.rb +7 -0
  44. data/lib/capybara/spec/session/fill_in_spec.rb +119 -103
  45. data/lib/capybara/spec/session/find_button_spec.rb +16 -14
  46. data/lib/capybara/spec/session/find_by_id_spec.rb +16 -14
  47. data/lib/capybara/spec/session/find_field_spec.rb +23 -21
  48. data/lib/capybara/spec/session/find_link_spec.rb +15 -14
  49. data/lib/capybara/spec/session/find_spec.rb +93 -115
  50. data/lib/capybara/spec/session/first_spec.rb +51 -85
  51. data/lib/capybara/spec/session/has_button_spec.rb +22 -24
  52. data/lib/capybara/spec/session/has_css_spec.rb +190 -205
  53. data/lib/capybara/spec/session/has_field_spec.rb +170 -144
  54. data/lib/capybara/spec/session/has_link_spec.rb +26 -29
  55. data/lib/capybara/spec/session/has_select_spec.rb +161 -109
  56. data/lib/capybara/spec/session/has_selector_spec.rb +94 -100
  57. data/lib/capybara/spec/session/has_table_spec.rb +22 -88
  58. data/lib/capybara/spec/session/has_text_spec.rb +195 -0
  59. data/lib/capybara/spec/session/has_xpath_spec.rb +100 -96
  60. data/lib/capybara/spec/session/headers.rb +4 -17
  61. data/lib/capybara/spec/session/html_spec.rb +15 -0
  62. data/lib/capybara/spec/session/node_spec.rb +205 -0
  63. data/lib/capybara/spec/session/reset_session_spec.rb +42 -0
  64. data/lib/capybara/spec/session/response_code.rb +4 -17
  65. data/lib/capybara/spec/session/save_page_spec.rb +46 -0
  66. data/lib/capybara/spec/session/screenshot.rb +13 -0
  67. data/lib/capybara/spec/session/select_spec.rb +99 -88
  68. data/lib/capybara/spec/session/source_spec.rb +12 -0
  69. data/lib/capybara/spec/session/text_spec.rb +15 -12
  70. data/lib/capybara/spec/session/uncheck_spec.rb +22 -17
  71. data/lib/capybara/spec/session/unselect_spec.rb +69 -58
  72. data/lib/capybara/spec/session/visit_spec.rb +74 -0
  73. data/lib/capybara/spec/session/within_frame_spec.rb +31 -0
  74. data/lib/capybara/spec/session/within_spec.rb +118 -131
  75. data/lib/capybara/spec/session/within_window_spec.rb +38 -0
  76. data/lib/capybara/spec/spec_helper.rb +84 -0
  77. data/lib/capybara/spec/test_app.rb +32 -6
  78. data/lib/capybara/spec/views/form.erb +12 -10
  79. data/lib/capybara/spec/views/host_links.erb +2 -2
  80. data/lib/capybara/spec/views/tables.erb +6 -66
  81. data/lib/capybara/spec/views/with_html.erb +9 -4
  82. data/lib/capybara/spec/views/with_js.erb +11 -7
  83. data/lib/capybara/version.rb +1 -1
  84. data/lib/capybara.rb +125 -6
  85. data/spec/basic_node_spec.rb +17 -5
  86. data/spec/capybara_spec.rb +9 -0
  87. data/spec/dsl_spec.rb +31 -17
  88. data/spec/rack_test_spec.rb +157 -0
  89. data/spec/result_spec.rb +51 -0
  90. data/spec/rspec/features_spec.rb +19 -2
  91. data/spec/rspec/matchers_spec.rb +170 -89
  92. data/spec/rspec_spec.rb +1 -3
  93. data/spec/selenium_spec.rb +53 -0
  94. data/spec/server_spec.rb +37 -25
  95. data/spec/spec_helper.rb +1 -30
  96. metadata +39 -31
  97. data/README.rdoc +0 -722
  98. data/lib/capybara/spec/driver.rb +0 -301
  99. data/lib/capybara/spec/session/current_host_spec.rb +0 -68
  100. data/lib/capybara/spec/session/has_content_spec.rb +0 -106
  101. data/lib/capybara/spec/session/javascript.rb +0 -306
  102. data/lib/capybara/spec/session.rb +0 -154
  103. data/lib/capybara/util/save_and_open_page.rb +0 -44
  104. data/lib/capybara/util/timeout.rb +0 -27
  105. data/spec/driver/rack_test_driver_spec.rb +0 -89
  106. data/spec/driver/selenium_driver_spec.rb +0 -37
  107. data/spec/save_and_open_page_spec.rb +0 -155
  108. data/spec/session/rack_test_session_spec.rb +0 -55
  109. data/spec/session/selenium_session_spec.rb +0 -26
  110. data/spec/string_spec.rb +0 -77
  111. data/spec/timeout_spec.rb +0 -28
@@ -1,3 +1,141 @@
1
+ # Version 2.0.0
2
+
3
+ Release date: 2012-11-05
4
+
5
+ ### Changed
6
+
7
+ * Dropped official support for Ruby 1.8.x. [Jonas Nicklas]
8
+ * `respect_data_method` default to `false` for the RackTest driver in non-rails
9
+ applications. That means that Capybara no longer picks up `data-method="post"`
10
+ et. al. from links by default when you haven't required capybara/rails
11
+ [Jonas Nicklas]
12
+ * `find` now raises an error if more than one element was found. Since `find` is
13
+ used by most actions, like `click_link` under the surface, this means that all
14
+ actions need to unambiguous in the future. [Jonas Nicklas]
15
+ * All methods which find or manipulate fields or buttons now ignore them when
16
+ they are disabled. [Jonas Nicklas]
17
+ * Can no longer find elements by id via `find(:foo)`, use `find("#foo")` or
18
+ `find_by_id("foo")` instead. [Jonas Nicklas]
19
+ * `Element#text` on RackTest now only returns visible text and normalizes
20
+ (strips) whitespace, as with Selenium [Mark Dodwell, Jo Liss]
21
+ * `has_content?` now checks the text value returned by `Element#text`, as opposed to
22
+ querying the DOM. Which means it does not match hidden text.
23
+ [Ryan Montgomery, Mark Dodwell, Jo Liss]
24
+ * #394: `#body` now returns the unmodified source (like `#source`), not the current
25
+ state of the DOM (like `#html`), by popular request [Jonas Nicklas]
26
+ * `Node#all` no longer returns an array, but rather an enumerable `Capybara::Result`
27
+ [Jonas Nicklas]
28
+ * The arguments to `select` and `unselect` needs to be the exact text of an option
29
+ in a select box, substrings are no longer allowed [Jonas Nicklas]
30
+ * The `options` option to `has_select?` must match the exact set of options. Use
31
+ `with_options` for the old behaviour. [Gonzalo Rodriguez]
32
+ * The `selected` option to `has_select?` must match all selected options for multiple
33
+ selects. [Gonzalo Rodriguez]
34
+ * Various internals for running driver specs, this should only affect driver authors
35
+ [Jonas Nicklas]
36
+ * Rename `Driver#body` to `Driver#html` (relevant only for driver authors) [Jo
37
+ Liss]
38
+
39
+ ### Removed
40
+
41
+ * No longer possible to specify `failure_message` for custom selectors. [Jonas Nicklas]
42
+ * #589: `Capybara.server_boot_timeout` has been removed in favor of a higher
43
+ (60-second) hard-coded timeout [Jo Liss]
44
+ * `Capybara.prefer_visible_elements` has been removed, as it is no longer needed
45
+ with the changed find semantics [Jonas Nicklas]
46
+ * `Node#wait_until` and `Session#wait_until` have been removed. See `Node#synchronize`
47
+ for an alternative [Jonas Nicklas]
48
+ * `Capybara.timeout` has been removed [Jonas Nicklas]
49
+ * The `:resynchronize` option has been removed from the Selenium driver [Jonas Nicklas]
50
+ * The `rows` option to `has_table?` has been removed without replacement.
51
+ [Jonas Nicklas]
52
+
53
+ ### Added
54
+
55
+ * Much improved error message [Jonas Nicklas]
56
+ * Errors from inside the session for apps running in a server are raised when
57
+ session is reset [James Tucker, Jonas Nicklas]
58
+ * A ton of new selectors built in out of the box, like `field`, `link`, `button`,
59
+ etc... [Adam McCrea, Jonas Nicklas]
60
+ * `has_text?` has been added as an alias for `has_content?` [Jonas Nicklas]
61
+ * Add `Capybara.server_host` option (default: 127.0.0.1) [David Balatero]
62
+ * Add `:type` option for `page.has_field?` [Gonzalo Rodríguez]
63
+ * Custom matchers can now be specified in CSS in addition to XPath [Jonas Nicklas]
64
+ * `Node#synchronize` method to rerun a block of code if certain errors are raised
65
+ [Jonas Nicklas]
66
+ * `Capybara.always_include_port` config option always includes the server port in
67
+ URLs when using `visit`. Facilitates testing different domain names`. [Douwe Maan]
68
+ * Redirect limit for RackTest driver is configurable [Josh Lane]
69
+ * Server port can be manually specified during initialization of server.
70
+ [Jonas Nicklas, John Wilger]
71
+ * `has_content?` and `has_text?` can be given a regular expression [Vasiliy Ermolovich]
72
+ * Multiple files can be uploaded with `attach_file` [Jarl Friis]
73
+
74
+ ### Fixed
75
+
76
+ * Nodes found via `all` are no longer reloaded. This fixes weird quirks where
77
+ nodes would seemingly randomly replace themselves with other nodes [Jonas Nicklas]
78
+ * Session is only reset if it has been modified, dramatically improves performance if
79
+ only part of the test suite runs Capybara. [Jonas Nicklas]
80
+ * Test suite now passes on Ruby 1.8 [Jo Liss]
81
+ * #565: `require 'capybara/dsl'` is no longer necessary [Jo Liss]
82
+ * `Rack::Test` now respects ports when changing hosts [Jo Liss]
83
+ * #603: `Rack::Test` now preserves the original referer URL when following a
84
+ redirect [Rob van Dijk]
85
+ * Rack::Test now does not send a referer when calling `visit` multiple times
86
+ [Jo Liss]
87
+ * Exceptions during server boot now propagate to main thread [James Tucker]
88
+ * RSpec integration now cleans up before the test instead of after [Darwin]
89
+ * If `respect_data_method` is true, the data-method attribute can be capitalized
90
+ [Marco Antonio]
91
+ * Rack app boot timing out raises an error as opposed to just logging to STDOUT
92
+ [Adrian Irving-Beer]
93
+ * `#source` returns an empty string instead of nil if no pages have been visited
94
+ [Jonas Nicklas]
95
+ * Ignore first leading newline in textareas in RackTest [Vitalii Khustochka]
96
+ * `within_frame` returns the value of the given block [Alistair Hutchison]
97
+ * Running `Node.set` on text fields will not trigger more than one change event
98
+ [Andrew Kasper]
99
+ * Throw an error when an option is given to a finder method, like `all` or
100
+ `has_selector?` which Capybara doesn't understand [Jonas Nicklas]
101
+ * Two references to the node now register as equal when comparing them with `==`
102
+ [Jonas Nicklas]
103
+ * `has_text` (`has_content`) now accepts non-string arguments, like numbers.
104
+ [Jo Liss]
105
+ * `has_text` and `text` now correctly normalize Unicode whitespace, such as
106
+ ` `. [Jo Liss]
107
+ * RackTest allows protocol relative URLs [Jonas Nicklas]
108
+ * Arguments are cast to string where necessary, so that e.g. `click_link(:foo)` works
109
+ as expected. [Jonas Nicklas]
110
+ * `:count => 0` now works as expected [Jarl Friis]
111
+ * Fixed race conditions on negative assertions when removing nodes [Jonas Nicklas]
112
+
113
+ # Version 1.1.3
114
+
115
+ Release date: 2012-10-30
116
+
117
+ ### Fixed:
118
+
119
+ * RackTest driver ignores leading newline in textareas, this is consistent with
120
+ the spec and how browsers behave. [Vitalii Khustochka]
121
+ * Nodes found via `all` and `first` are never reloaded. This fixes issues where
122
+ a node would sometimes magically turn into a completely different node.
123
+ [Jonas Nicklas]
124
+ * Fix race conditions on negative assertions. This fixes issues where removing
125
+ an element and asserting on its non existence could cause
126
+ StaleElementReferenceError and similar to be thrown. [Jonas Nicklas]
127
+ * Options are no longer lost when reloading elements. This fixes issues where
128
+ reloading an element would cause a non-matching element to be found, because
129
+ options to `find` were ignored. [Jonas Nicklas]
130
+
131
+ # Version 1.1.2
132
+
133
+ Release date: 2011-11-15
134
+
135
+ ### Fixed
136
+
137
+ * #541: Make attach_file work with selenium-webdriver >=2.12 [Jonas Nicklas]
138
+
1
139
  # Version 1.1.0
2
140
 
3
141
  Release date: 2011-09-02
data/License.txt ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2009-2012 Jonas Nicklas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.