hardbap-webrat 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (211) hide show
  1. data/.document +4 -0
  2. data/.gitignore +15 -0
  3. data/History.txt +377 -0
  4. data/MIT-LICENSE.txt +19 -0
  5. data/README.rdoc +85 -0
  6. data/Rakefile +173 -0
  7. data/VERSION +1 -0
  8. data/install.rb +1 -0
  9. data/lib/webrat/core/configuration.rb +102 -0
  10. data/lib/webrat/core/elements/area.rb +31 -0
  11. data/lib/webrat/core/elements/element.rb +33 -0
  12. data/lib/webrat/core/elements/field.rb +411 -0
  13. data/lib/webrat/core/elements/form.rb +103 -0
  14. data/lib/webrat/core/elements/label.rb +31 -0
  15. data/lib/webrat/core/elements/link.rb +93 -0
  16. data/lib/webrat/core/elements/select_option.rb +35 -0
  17. data/lib/webrat/core/locators/area_locator.rb +38 -0
  18. data/lib/webrat/core/locators/button_locator.rb +54 -0
  19. data/lib/webrat/core/locators/field_by_id_locator.rb +37 -0
  20. data/lib/webrat/core/locators/field_labeled_locator.rb +56 -0
  21. data/lib/webrat/core/locators/field_locator.rb +25 -0
  22. data/lib/webrat/core/locators/field_named_locator.rb +41 -0
  23. data/lib/webrat/core/locators/form_locator.rb +19 -0
  24. data/lib/webrat/core/locators/label_locator.rb +34 -0
  25. data/lib/webrat/core/locators/link_locator.rb +74 -0
  26. data/lib/webrat/core/locators/locator.rb +20 -0
  27. data/lib/webrat/core/locators/select_option_locator.rb +59 -0
  28. data/lib/webrat/core/locators.rb +20 -0
  29. data/lib/webrat/core/logging.rb +24 -0
  30. data/lib/webrat/core/matchers/have_content.rb +73 -0
  31. data/lib/webrat/core/matchers/have_selector.rb +74 -0
  32. data/lib/webrat/core/matchers/have_tag.rb +21 -0
  33. data/lib/webrat/core/matchers/have_xpath.rb +147 -0
  34. data/lib/webrat/core/matchers.rb +4 -0
  35. data/lib/webrat/core/methods.rb +63 -0
  36. data/lib/webrat/core/mime.rb +18 -0
  37. data/lib/webrat/core/save_and_open_page.rb +48 -0
  38. data/lib/webrat/core/scope.rb +350 -0
  39. data/lib/webrat/core/session.rb +299 -0
  40. data/lib/webrat/core/xml/hpricot.rb +19 -0
  41. data/lib/webrat/core/xml/nokogiri.rb +76 -0
  42. data/lib/webrat/core/xml/rexml.rb +24 -0
  43. data/lib/webrat/core/xml.rb +115 -0
  44. data/lib/webrat/core.rb +14 -0
  45. data/lib/webrat/core_extensions/blank.rb +58 -0
  46. data/lib/webrat/core_extensions/deprecate.rb +8 -0
  47. data/lib/webrat/core_extensions/detect_mapped.rb +12 -0
  48. data/lib/webrat/core_extensions/meta_class.rb +6 -0
  49. data/lib/webrat/core_extensions/nil_to_param.rb +5 -0
  50. data/lib/webrat/core_extensions/tcp_socket.rb +27 -0
  51. data/lib/webrat/mechanize.rb +74 -0
  52. data/lib/webrat/merb.rb +9 -0
  53. data/lib/webrat/merb_multipart_support.rb +27 -0
  54. data/lib/webrat/merb_session.rb +82 -0
  55. data/lib/webrat/rack.rb +25 -0
  56. data/lib/webrat/rails.rb +106 -0
  57. data/lib/webrat/rspec-rails.rb +10 -0
  58. data/lib/webrat/selenium/application_server_factory.rb +40 -0
  59. data/lib/webrat/selenium/application_servers/base.rb +46 -0
  60. data/lib/webrat/selenium/application_servers/external.rb +26 -0
  61. data/lib/webrat/selenium/application_servers/merb.rb +50 -0
  62. data/lib/webrat/selenium/application_servers/rails.rb +44 -0
  63. data/lib/webrat/selenium/application_servers/sinatra.rb +37 -0
  64. data/lib/webrat/selenium/application_servers.rb +5 -0
  65. data/lib/webrat/selenium/location_strategy_javascript/button.js +19 -0
  66. data/lib/webrat/selenium/location_strategy_javascript/label.js +16 -0
  67. data/lib/webrat/selenium/location_strategy_javascript/webrat.js +5 -0
  68. data/lib/webrat/selenium/location_strategy_javascript/webratlink.js +12 -0
  69. data/lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js +15 -0
  70. data/lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js +5 -0
  71. data/lib/webrat/selenium/matchers/have_content.rb +66 -0
  72. data/lib/webrat/selenium/matchers/have_selector.rb +49 -0
  73. data/lib/webrat/selenium/matchers/have_tag.rb +72 -0
  74. data/lib/webrat/selenium/matchers/have_xpath.rb +45 -0
  75. data/lib/webrat/selenium/matchers.rb +4 -0
  76. data/lib/webrat/selenium/selenium_extensions.js +6 -0
  77. data/lib/webrat/selenium/selenium_rc_server.rb +86 -0
  78. data/lib/webrat/selenium/selenium_session.rb +248 -0
  79. data/lib/webrat/selenium/silence_stream.rb +18 -0
  80. data/lib/webrat/selenium.rb +80 -0
  81. data/lib/webrat/sinatra.rb +11 -0
  82. data/lib/webrat.rb +10 -0
  83. data/spec/fakes/test_session.rb +34 -0
  84. data/spec/integration/merb/.gitignore +21 -0
  85. data/spec/integration/merb/Rakefile +35 -0
  86. data/spec/integration/merb/app/controllers/application.rb +2 -0
  87. data/spec/integration/merb/app/controllers/exceptions.rb +13 -0
  88. data/spec/integration/merb/app/controllers/testing.rb +27 -0
  89. data/spec/integration/merb/app/views/exceptions/not_acceptable.html.erb +63 -0
  90. data/spec/integration/merb/app/views/exceptions/not_found.html.erb +47 -0
  91. data/spec/integration/merb/app/views/layout/application.html.erb +12 -0
  92. data/spec/integration/merb/app/views/testing/show_form.html.erb +27 -0
  93. data/spec/integration/merb/app/views/testing/upload.html.erb +9 -0
  94. data/spec/integration/merb/config/environments/development.rb +15 -0
  95. data/spec/integration/merb/config/environments/rake.rb +11 -0
  96. data/spec/integration/merb/config/environments/test.rb +14 -0
  97. data/spec/integration/merb/config/init.rb +25 -0
  98. data/spec/integration/merb/config/rack.rb +11 -0
  99. data/spec/integration/merb/config/router.rb +34 -0
  100. data/spec/integration/merb/spec/spec.opts +1 -0
  101. data/spec/integration/merb/spec/spec_helper.rb +24 -0
  102. data/spec/integration/merb/spec/webrat_spec.rb +39 -0
  103. data/spec/integration/merb/tasks/merb.thor/app_script.rb +31 -0
  104. data/spec/integration/merb/tasks/merb.thor/common.rb +64 -0
  105. data/spec/integration/merb/tasks/merb.thor/gem_ext.rb +124 -0
  106. data/spec/integration/merb/tasks/merb.thor/main.thor +150 -0
  107. data/spec/integration/merb/tasks/merb.thor/ops.rb +93 -0
  108. data/spec/integration/merb/tasks/merb.thor/utils.rb +40 -0
  109. data/spec/integration/rack/Rakefile +5 -0
  110. data/spec/integration/rack/app.rb +89 -0
  111. data/spec/integration/rack/test/helper.rb +20 -0
  112. data/spec/integration/rack/test/webrat_rack_test.rb +73 -0
  113. data/spec/integration/rails/.gitignore +3 -0
  114. data/spec/integration/rails/Rakefile +30 -0
  115. data/spec/integration/rails/app/controllers/application.rb +15 -0
  116. data/spec/integration/rails/app/controllers/buttons_controller.rb +7 -0
  117. data/spec/integration/rails/app/controllers/fields_controller.rb +4 -0
  118. data/spec/integration/rails/app/controllers/links_controller.rb +7 -0
  119. data/spec/integration/rails/app/controllers/webrat_controller.rb +43 -0
  120. data/spec/integration/rails/app/helpers/buttons_helper.rb +2 -0
  121. data/spec/integration/rails/app/helpers/fields_helper.rb +2 -0
  122. data/spec/integration/rails/app/helpers/links_helper.rb +2 -0
  123. data/spec/integration/rails/app/views/buttons/show.html.erb +11 -0
  124. data/spec/integration/rails/app/views/fields/show.html.erb +9 -0
  125. data/spec/integration/rails/app/views/links/show.html.erb +5 -0
  126. data/spec/integration/rails/app/views/webrat/before_redirect_form.html.erb +4 -0
  127. data/spec/integration/rails/app/views/webrat/buttons.html.erb +11 -0
  128. data/spec/integration/rails/app/views/webrat/form.html.erb +28 -0
  129. data/spec/integration/rails/config/boot.rb +109 -0
  130. data/spec/integration/rails/config/environment.rb +12 -0
  131. data/spec/integration/rails/config/environments/development.rb +17 -0
  132. data/spec/integration/rails/config/environments/selenium.rb +22 -0
  133. data/spec/integration/rails/config/environments/test.rb +22 -0
  134. data/spec/integration/rails/config/initializers/inflections.rb +10 -0
  135. data/spec/integration/rails/config/initializers/mime_types.rb +5 -0
  136. data/spec/integration/rails/config/initializers/new_rails_defaults.rb +17 -0
  137. data/spec/integration/rails/config/locales/en.yml +5 -0
  138. data/spec/integration/rails/config/routes.rb +18 -0
  139. data/spec/integration/rails/public/404.html +30 -0
  140. data/spec/integration/rails/public/422.html +30 -0
  141. data/spec/integration/rails/public/500.html +33 -0
  142. data/spec/integration/rails/script/about +4 -0
  143. data/spec/integration/rails/script/console +3 -0
  144. data/spec/integration/rails/script/dbconsole +3 -0
  145. data/spec/integration/rails/script/destroy +3 -0
  146. data/spec/integration/rails/script/generate +3 -0
  147. data/spec/integration/rails/script/performance/benchmarker +3 -0
  148. data/spec/integration/rails/script/performance/profiler +3 -0
  149. data/spec/integration/rails/script/performance/request +3 -0
  150. data/spec/integration/rails/script/plugin +3 -0
  151. data/spec/integration/rails/script/process/inspector +3 -0
  152. data/spec/integration/rails/script/process/reaper +3 -0
  153. data/spec/integration/rails/script/process/spawner +3 -0
  154. data/spec/integration/rails/script/runner +3 -0
  155. data/spec/integration/rails/script/server +3 -0
  156. data/spec/integration/rails/test/integration/button_click_test.rb +80 -0
  157. data/spec/integration/rails/test/integration/fill_in_test.rb +24 -0
  158. data/spec/integration/rails/test/integration/link_click_test.rb +27 -0
  159. data/spec/integration/rails/test/integration/webrat_test.rb +97 -0
  160. data/spec/integration/rails/test/test_helper.rb +25 -0
  161. data/spec/integration/sinatra/Rakefile +5 -0
  162. data/spec/integration/sinatra/classic_app.rb +64 -0
  163. data/spec/integration/sinatra/modular_app.rb +16 -0
  164. data/spec/integration/sinatra/test/classic_app_test.rb +37 -0
  165. data/spec/integration/sinatra/test/modular_app_test.rb +18 -0
  166. data/spec/integration/sinatra/test/test_helper.rb +16 -0
  167. data/spec/private/core/configuration_spec.rb +116 -0
  168. data/spec/private/core/field_spec.rb +85 -0
  169. data/spec/private/core/link_spec.rb +24 -0
  170. data/spec/private/core/logging_spec.rb +10 -0
  171. data/spec/private/core/session_spec.rb +200 -0
  172. data/spec/private/mechanize/mechanize_session_spec.rb +81 -0
  173. data/spec/private/merb/attaches_file_spec.rb +93 -0
  174. data/spec/private/merb/merb_session_spec.rb +61 -0
  175. data/spec/private/nokogiri_spec.rb +77 -0
  176. data/spec/private/rails/attaches_file_spec.rb +81 -0
  177. data/spec/private/rails/rails_session_spec.rb +112 -0
  178. data/spec/private/selenium/application_servers/rails_spec.rb +26 -0
  179. data/spec/public/basic_auth_spec.rb +24 -0
  180. data/spec/public/check_spec.rb +191 -0
  181. data/spec/public/choose_spec.rb +118 -0
  182. data/spec/public/click_area_spec.rb +106 -0
  183. data/spec/public/click_button_spec.rb +496 -0
  184. data/spec/public/click_link_spec.rb +511 -0
  185. data/spec/public/fill_in_spec.rb +209 -0
  186. data/spec/public/locators/field_by_xpath_spec.rb +19 -0
  187. data/spec/public/locators/field_labeled_spec.rb +172 -0
  188. data/spec/public/locators/field_with_id_spec.rb +16 -0
  189. data/spec/public/matchers/contain_spec.rb +114 -0
  190. data/spec/public/matchers/have_selector_spec.rb +142 -0
  191. data/spec/public/matchers/have_tag_spec.rb +39 -0
  192. data/spec/public/matchers/have_xpath_spec.rb +136 -0
  193. data/spec/public/reload_spec.rb +10 -0
  194. data/spec/public/save_and_open_spec.rb +70 -0
  195. data/spec/public/select_date_spec.rb +112 -0
  196. data/spec/public/select_datetime_spec.rb +137 -0
  197. data/spec/public/select_spec.rb +249 -0
  198. data/spec/public/select_time_spec.rb +100 -0
  199. data/spec/public/selenium/application_server_factory_spec.rb +49 -0
  200. data/spec/public/selenium/application_servers/external_spec.rb +12 -0
  201. data/spec/public/selenium/selenium_session_spec.rb +37 -0
  202. data/spec/public/set_hidden_field_spec.rb +5 -0
  203. data/spec/public/submit_form_spec.rb +5 -0
  204. data/spec/public/visit_spec.rb +58 -0
  205. data/spec/public/within_spec.rb +177 -0
  206. data/spec/rcov.opts +1 -0
  207. data/spec/spec.opts +2 -0
  208. data/spec/spec_helper.rb +52 -0
  209. data/vendor/selenium-server.jar +0 -0
  210. data/webrat.gemspec +345 -0
  211. metadata +360 -0
data/.document ADDED
@@ -0,0 +1,4 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ History.txt
4
+ MIT-LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ coverage
2
+ .DS_Store
3
+ pkg
4
+ doc
5
+ ri
6
+ email.txt
7
+ .svn
8
+ log
9
+ .project
10
+ .loadpath
11
+ *.swp
12
+ results
13
+ test_apps
14
+ *.tmproj
15
+ *.log
data/History.txt ADDED
@@ -0,0 +1,377 @@
1
+ == Git
2
+
3
+ Minor enhancements
4
+
5
+ * Base Webrat::MIME on Rack::Mime (Simon Rozet)
6
+ * Support file uploads in Rack mode (Simon Rozet)
7
+
8
+ == 0.5.0 / 2009-08-12
9
+
10
+ * Major enhancements
11
+
12
+ * Depreacate :rack_test and :sinatra in favor of :rack, which uses Rack::Test (Simon Rozet)
13
+
14
+ * Minor enhancements
15
+
16
+ * Don't require rubygems at runtime (Simon Rozet)
17
+
18
+ == 0.4.5 / 2009-08-10
19
+
20
+ * Major enhancements
21
+
22
+ * Ruby 1.9 compatibility (Michael Fellinger, Jakub Kuźma)
23
+ * Improve performance (~2x) on JRuby by supporting Nokogiri
24
+ * Added support for external app servers in selenium mode (basically don't start one) (Mike Gaffney)
25
+ * Added support for uploading files for Merb (Ryan Carver)
26
+
27
+ * Minor enhancements
28
+
29
+ * Upgrade to selenium-client to 1.2.16 (Brian Landau)
30
+ * Upgrade selenium-server.jar to 1.0.1 (Brian Landau)
31
+ * Make redirect detection work in the face of rational maths (like when ruby-units is active) (Piers Cawley)
32
+ * Use Launchy to handle opening pages in the browser with cross-platform compatibility (Bryan Helmkamp)
33
+ * Added support for field_labeled_locators ending in non word characters
34
+ lh 148 (Zach Dennis)
35
+ * Filled in tests on click link lh 195 (diabolo)
36
+ * Added current_url to selenium session lh 215 (Luke Amdor)
37
+ * Added silence spec to selenium lh 238 (Martin Gamsjaeger aka snusnu)
38
+ * Added ability to configure the browser startup timeout for selenium lh 242 (Mike Gaffney, Mark Dodwell)
39
+ * Added delegation for field_named lh194 (pivotal labs)
40
+ * Added fix to keep from escaping field values in mechanize mode lh256 (jish)
41
+ * Adding fixes for click button/link and made the integration specs pass for the same in selenium lh254 (Ldiehl, Matthias Marschall)
42
+ * Adding clicking link by id in selenium mode lh221 (larrytheliquid)
43
+ * Adding fix for have_selector and have_xpath in descendent blocks lh234 (Thomas Jack)
44
+ * Adding fix for fields with labels with special characters (Thomas Jack, Mike Gaffney, Bryan Hemlkamp)
45
+ * Deprecated current_page lh50 (Mike Gaffney)
46
+ * Fixed issue with redirects and multiple hosts lh168 (Mutwin Kraus)
47
+
48
+ * Bug fixes
49
+
50
+ * Wait for application servers socket on 0.0.0.0 instead of the application_address
51
+ * Translate CSS and image paths with single quotes in save_and_open_page (Erin Staniland)
52
+
53
+ == 0.4.4 / 2009-04-06
54
+
55
+ * Major enhancements
56
+
57
+ * Make selenium process management code more robust and informative
58
+
59
+ * Minor enhancements
60
+
61
+ * Add support for Rails javascript post links (Mark Menard)
62
+ * Upgrade selenium-client dependency to 1.2.14, and update for new waiting
63
+ API (Balint Erdi)
64
+ * Change default app environment from "selenium" to "test"
65
+
66
+ * Bug fixes
67
+
68
+ * Don't create a new instance of WWW::Mechanize for each request
69
+ (Mark Menard)
70
+ * Select fields with duplicate selected options sent an incorrect value (Noah Davis)
71
+
72
+ == 0.4.3 / 2009-03-17
73
+
74
+ * Minor enhancements
75
+
76
+ * Support Rails 2.3. Use Rack::Utils to parse params (Matthew Ford)
77
+ * Support for "modular" Sinatra app style (Simon Rozet)
78
+ * Initial Merb and Sinatra compatibility for Selenium mode (Corey Donohoe)
79
+ * When faced with a label with no for attribute, that contains a hidden field
80
+ and another field, as can be the case in Rails 2.3's checkbox view,
81
+ webrat now locates the non-hidden field. (Luke Melia)
82
+ * Add application_framework config for Selenium mode to determine how to
83
+ start and stop the app server (Corey Donohoe)
84
+
85
+ * Bug fixes
86
+
87
+ * Fix following of absolute redirect URL in Sinatra (Simon Rozet)
88
+
89
+ == 0.4.2 / 2009-02-24
90
+
91
+ * Major enhancements
92
+
93
+ * Significant improvements to have_selector. It now supports specifying
94
+ attributes in a hash and :count and :content options. See
95
+ have_selector_spec.rb for more.
96
+ * Add the same functionality mentioned above to have_xpath
97
+
98
+ * Minor enhancements
99
+
100
+ * Squeeze extra whitespace out of failures messages from contain
101
+ matcher
102
+ * Detect infinite redirects and raise a Webrat::InfiniteRedirectError
103
+ (Daniel Lucraft)
104
+
105
+ * Bug fixes
106
+
107
+ * Properly quote single and double quotes strings in XPath
108
+ * Fix warning caused by Nokogiri deprecating CSS::Parser.parse
109
+ (Aaron Patterson)
110
+ * Accept do/end blocks in matchers. [#157] (Peter Jaros)
111
+ * Quote --chdir option to mongrel_rails to support RAILS_ROOTs with spaces
112
+ (T.J. VanSlyke)
113
+
114
+ == 0.4.1 / 2009-01-31
115
+
116
+ * Minor enhancements
117
+
118
+ * Support Sinatra 0.9 (Harry Vangberg)
119
+ * Update query param parsing to work with latest Edge Rails
120
+ * Added #redirected_to method to easily check where an external redirect was
121
+ redirected to (Adam Greene)
122
+ * Recognize input tags with type button (Lena Herrmann)
123
+ * Add uncheck method to Selenium mode (Lee Bankewitz)
124
+
125
+ * Bug fixes
126
+
127
+ * Make requests to a Rails app using a full URL instead of a relative path. This change
128
+ is helpful for Rails apps that use subdomains. (John Hwang and Zach Dennis)
129
+ * Follow redirects that are on the same domain but a different subdomain
130
+ (Adam Greene)
131
+ * rescue from Webrat::TimeoutError in selenium matchers which allows NegativeMatchers
132
+ to behave correctly (Noah Davis)
133
+ * Switch to using selenium.click instead of .check when checking a checkbox
134
+ (Noah Davis)
135
+ * Create tmp/pids directory if directory does not exist. (Amos King and Mike Gaffney)
136
+ * Setup deprecated writers for the selenium_environment= and selenium_port= config
137
+ * Ensure the previous pages params aren't passed through redirect (Daniel Lucraft and
138
+ Bryan Helmkamp)
139
+ * Labels should only search for fields within the current scope (Kyle Hargraves)
140
+
141
+ == 0.4.0 / 2009-01-18
142
+
143
+ * _IMPORTANT_ Breaking change:
144
+
145
+ * Removed init.rb auto-require of webrat/rails
146
+ * Removed auto-require of webrat/rails when requiring webrat when RAILS_ENV is
147
+ defined
148
+
149
+ In your env.rb or test_helper.rb file, ensure you have something like:
150
+
151
+ require "webrat"
152
+
153
+ Webrat.configure do |config|
154
+ config.mode = :rails
155
+ end
156
+
157
+ * Major enhancements
158
+
159
+ * Major improvements to Webrat::Selenium (Many contributors listed here)
160
+ * Add assert_* methods for using Webrat's matchers w/o RSpec (Mike Gaffney, Amos King)
161
+ * Added Webrat.configure method for Webrat configuration [#33] (Mike Gaffney)
162
+ * Added select_time, select_date, and select_datetime to API. [#36] (Ben Mabey)
163
+ * Use Hpricot and REXML when not parsing with Nokogiri (on JRuby, for example)
164
+
165
+ * Minor enhancements
166
+
167
+ * Added Selenium grid configuration and support. (Amos King && Cornel Borcean)
168
+ * Support passing an ActiveRecord model to #within when in Rails mode [#68] (Luke Melia)
169
+ * Make assert_* matchers in rails mode increment the assertions count [#123] (Amos King)
170
+ * Added assert_* matchers to selenium matchers [#110] (Amos King)
171
+ * Added assert_contain, assert_not_contain [#86] (Mike Gaffney, Amos King)
172
+ * Add configuration options for the Selenium environment and port (Kieran Pilkington)
173
+ * Maximize the browser window after initializing Selenium (Luke Melia)
174
+ * Better inspect output for Webrat elements
175
+ * Sets the Webrat mode with Configuration#mode= in the config block [#85] (Mike Gaffney)
176
+ * Detect if the document is XML or HTML using the Content-Type when in Rails mode
177
+ * Expose #selenium method for direct access to Selenium client
178
+ * Check nokogiri gem version before requiring nokogiri
179
+ * Include the Selenium server jar file in the gem (Bryan Helmkamp, Ben Schwarz)
180
+ * Added key_down, key_up and fire_event to Selenium session (Fernando Garcia)
181
+ * Fix outputing README during Rails plugin install (Fernando Garcia)
182
+ * Strip newlines when matching label text (Miha Filej)
183
+ * Add simple support for accessing Webrat's matchers from RSpec by requiring
184
+ "webrat/rspec-rails" (David Chelimsky)
185
+ * Support save_and_open_page in Windows and Cygwin (Mike Gaffney)
186
+ * Added RadioField#checked? to indicated whether or not a radio button is checked
187
+ (Luke Melia)
188
+ * Add spec:jruby rake task for running Webrat's spec suite with JRuby
189
+ * Added field_by_xpath to locate a Webrat::Field using arbitrary XPath expressions
190
+ * Helpful error message for missing option values [#40] (Ben Mabey)
191
+ * Add set_hidden_field method (Noah Davis, Bryan Helmkamp)
192
+ * Add submit_form method for submitting a form by ID (Noah Davis, Bryan Helmkamp)
193
+ * Switch to using Nokogiri.parse for simple XML/XHTML autodetection [#66]
194
+ * Removed Webrat.root method, which seemed to be unused
195
+ * Added automatic starting and stopping of the Selenium server and a Mongrel Rails
196
+ app server when using webrat/selenium
197
+ * Switch to using selenium-client gem and vendor selenium-server.jar (Luke Melia)
198
+ * Added gemspec so the gem builds on GitHub now
199
+ * Deprecate old style methods (fills_in is deprecated in favor of fill_in, etc.)
200
+ * Improvements to the README and RDoc (Bryan Helmkamp, Mike Gaffney)
201
+ * Allow clicking links by id and id regexp (Mike Gaffney)
202
+ * Raise Webrat::DisabledFieldError when attempting to manipulate a disabled field
203
+ * Raise Webrat::NotFoundErrors when an element is not found
204
+ * Raise Webrat::PageLoadError when a failure occurs so that application exceptions
205
+ can be more accurately tested (Ryan Briones)
206
+ * Helpful error message for missing option in select box. [#40] (Ben Mabey)
207
+ * Extracted save_and_open page to make it usable in Selenium mode (Luke Melia)
208
+ * Added save_and_open_screengrab for Selenium mode (Luke Melia)
209
+
210
+ * Bug fixes
211
+
212
+ * field_labeled should disregard labels without matching fields (Kyle Hargraves)
213
+ * Fixed bug where Scope was creating a new DOM rather than re-using the existing DOM.
214
+ [#105] (Zach Dennis)
215
+ * Support Rails > v2.2 by using ActionController::RequestParser for param parsing [#107]
216
+ (Marcello Nuccio)
217
+ * Raise a Webrat::NotFoundError if the scope passed to #within doesn't exist [#90]
218
+ * Match against link _text_ which decodes character references.
219
+ Useful for multibyte languages like Japanese (moronatural@gmail.com)
220
+ * Fix params hash generation for Mechanize when Merb is not defined [#62]
221
+ * Expose some Webrat methods that were missing from the Webrat::Methods module
222
+ (Low Chin Chau)
223
+ * Allow mechanize session to pass through basic auth (Ryan Briones)
224
+ * Improvements to the Mechanize support (Jeremy Burks)
225
+ * Fix following fully qualified local links (Lawrence Pit)
226
+ * Fixed bug where Webrat would lose complex parameters (like foo[bar[baz]][])
227
+ in Merb due to not correctly merging Mashes. (Drew Colthorp)
228
+ * Extend Rails' ActionController::IntegrationTest instead of
229
+ ActionController::Integration::Session (Fixes using Webrat's #select method and
230
+ avoids usage of method_missing)
231
+ * Ensure that Webrat::MechanizeSession.request_page always uses an absolute
232
+ URL. (Graham Ashton)
233
+ * Strip anchor tags from URIs before passing to Rails integration session
234
+ (Noah Davis)
235
+ * Treat text and regexp when matching Selenium buttons (Ross Kaffenberger)
236
+ * Allow SeleniumSession's click_button to be called without an argument without
237
+ blowing up (Luke Melia)
238
+
239
+ == 0.3.4 / 2008-12-29
240
+
241
+ * 1 Minor enhancement
242
+
243
+ * Fix compatibility with Nokogiri 1.1.0 on JRuby
244
+
245
+ * 1 Bug fix
246
+
247
+ * Correct version for Nokogiri dependency in gem
248
+
249
+ == 0.3.3 / 2008-12-28
250
+
251
+ * 1 Minor enhancement
252
+
253
+ * Fix compatibility with Nokogiri 1.1.0 on MRI
254
+
255
+ == 0.3.2 / 2008-11-08
256
+
257
+ * 1 Minor enhancement
258
+
259
+ * Fixes behavior or have_tag when a block is passed. It passes the matched node(s)
260
+ to the block for further specs again. (Carl Lerche)
261
+
262
+ == 0.3.1 / 2008-11-07
263
+
264
+ * 1 Minor enhancement
265
+
266
+ * Use @_webrat_session instance variable instead of @session for Merb integration
267
+ to avoid collisions
268
+
269
+ == 0.3.0 / 2008-11-07
270
+
271
+ * 4 Major enhancements
272
+
273
+ * Added Merb support (Gwyn Morfey, Jeremy Burks, Rob Kaufman, Yehuda Katz)
274
+ * Added experimental Selenium support (Luke Melia)
275
+ * Add have_selector, have_xpath, have_tag and contain matchers from Merb
276
+ * Switch from Hpricot to Nokogiri for XML parsing (thanks, Aaron Patterson)
277
+
278
+ * 37 Minor enhancements
279
+
280
+ * Added #within for manipulating the current page within a selector scope
281
+ * Add support for file fields via #attaches_file method (Rails only at the moment)
282
+ (Kyle Hargraves)
283
+ * Add support for simulating SSL requests (Luke Melia)
284
+ * Added #basic_auth(user, pass) to support HTTP Basic Auth (Aslak Hellesøy)
285
+ * Added support for Sinatra and Rack (Aslak Hellesøy)
286
+ * Rename visits to visit, fills_in to fill_in, etc.
287
+ * Add #field_labeled for looking up form fields by label (David Chelimsky)
288
+ * Add #field_named and #field_with_id locators
289
+ * Don't depend on hoe anymore
290
+ * Return responses after sending requests
291
+ * Allow clicking links and buttons by a regular expression in Selenium (Luke Melia)
292
+ * Allow clicking links by a regular expression
293
+ * Add #http_accept for including MIME type HTTP "Accept" headers (Ryan Briones)
294
+ * Add #header to support inclusion of custom HTTP headers (Ryan Briones)
295
+ * Consider response codes 200-499 as successful enough to not raise a Webrat error
296
+ (David Leal)
297
+ * Add support for clicking areas of an image map (Alex Lang)
298
+ * Support relative links, including href="?foo=bar" (Kyle Hargraves)
299
+ * Separated Rails-specific code from the Webrat core to make it easier to use
300
+ Webrat with other environments
301
+ * Alias visits as visit, clicks_link as click_link, etc. for better readability
302
+ * Raise error when trying to interact with a disabled form element (Luke Melia)
303
+ * Don't send disabled form elements to the server (Nicholas A. Evans)
304
+ * Display response body when the page load is not successful (David Leal)
305
+ * CGI escape form field values (Miha Filej)
306
+ * Add support for redirect_to :back by sending HTTP_REFERER headers
307
+ (Hendrik Volkmer)
308
+ * Expose current DOM (as an Hpricot object) as #current_dom
309
+ * Add support for disabling JavaScript when clicking a link to enable testing of
310
+ both JS and non-JS implementations (Luke Melia and Bryan Helmkamp)
311
+ * Support &nbsp's as spaces in matching link text (Luke Melia)
312
+ * Support button elements (Nick Sieger)
313
+ * Support matching select options by regexp (Kyle Hargraves)
314
+ * save_and_open_page rewrites css and image references to provide a friendlier
315
+ debugging experience (Luke Melia)
316
+ * Added support for matching alt attributes in fields (primarly for clicks_button)
317
+ (Aaron Quint)
318
+ * Support '&' in submitted values (Kyle Hargraves)
319
+ * Support clicking links by title (Dan Barry)
320
+ * Added missing spec for clicking image buttons (Tim Harper)
321
+ * Switched tests to specs, and from Mocha to RSpec's mocking library
322
+ * Add support to click_button for IDs (Gwyn Morfey)
323
+ * Miscellaneous core refactorings (Jan Suchal)
324
+
325
+ * 8 Bug fixes
326
+
327
+ * Fix initialization of WWW::Mechanize (Derek Kastner)
328
+ * Don't open blank pages in the browser (Kyle Hargraves)
329
+ * Support radio buttons with multiple labels (Dan Barry)
330
+ * Fix load order bug on some platforms (Ismael Celis)
331
+ * Fix bug with empty select list option (Kyle Hargraves)
332
+ * Fix regression of not sending default values in password fields
333
+ * Don't explode if encountering inputs with no type attribute (assume text)
334
+ * Fix bug where choosing a radio button in a series with a default submitted the
335
+ incorrect field value (Luke Melia)
336
+
337
+ == 0.2.0 / 2008-04-04
338
+
339
+ * 4 Major enhancements
340
+
341
+ * Add save_and_open_page to aid in debugging
342
+ * Add radio button support via #chooses method
343
+ * Add basic support for Rails-generated JavaScript link tags
344
+ * Add support for checkboxes (Patches from Kyle Hargraves and Jarkko Laine)
345
+ * Add support for textarea fields (Sacha Schlegel)
346
+
347
+ * 8 Minor enhancements
348
+
349
+ * Added reloads method to reload the page (Kamal Fariz Mahyuddi)
350
+ * Prevent making a request if clicking on local anchor link (Kamal Fariz Mahyuddi)
351
+ * Added clicks_link_within(selector, link_text), allowing restricting link search
352
+ to within a given css selector (Luke Melia)
353
+ * Allow specifying the input name/label when doing a select (David Chelimsky)
354
+ * Raise a specific exception if the developer tries to manipulate form elements
355
+ before loading a page (James Deville)
356
+ * Add support for alternate POST, PUT and DELETE link clicking (Kyle Hargraves)
357
+ * Change clicks_link to find the shortest matching link (Luke Melia)
358
+ * Improve matching for labels in potentially ambiguous cases
359
+
360
+ * 7 Bug fixes
361
+
362
+ * Fix incorrect serializing of collection inputs, i.e. name contains []
363
+ (Kamal Fariz Mahyuddi)
364
+ * Serialize empty text field values just like browsers (Kamal Fariz Mahyuddi)
365
+ * Quick fix to avoid @dom not initialized warnings (Kamal Fariz Mahyuddi)
366
+ * Docfix: bad reference to #select method in README (Luke Melia)
367
+ * Ensure Rails-style checkboxes work properly (checkboxes followed by a hidden
368
+ input with the same name)
369
+ * Fix Edge Rails (a.k.a. 2.0 RC) compatibility (David Chelimsky)
370
+ * Support param hashes nested more than one level (David Chelimsky)
371
+
372
+ == 0.1.0 / 2007-11-28
373
+
374
+ * 1 major enhancement
375
+
376
+ * Birthday!
377
+
data/MIT-LICENSE.txt ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2007 Bryan Helmkamp, Seth Fitzsimmons
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,85 @@
1
+ = Webrat - Ruby Acceptance Testing for Web applications
2
+
3
+ - http://gitrdoc.com/brynary/webrat
4
+ - http://groups.google.com/group/webrat
5
+ - http://webrat.lighthouseapp.com/
6
+ - http://github.com/brynary/webrat
7
+ - #webrat on Freenode
8
+
9
+ == Description
10
+
11
+ Webrat lets you quickly write expressive and robust acceptance tests for a Ruby
12
+ web application.
13
+
14
+ == Features
15
+
16
+ * Browser Simulator for expressive, high level acceptance testing without the
17
+ performance hit and browser dependency of Selenium or Watir (See Webrat::Session)
18
+ * Use the same API for Browser Simulator and real Selenium tests using
19
+ Webrat::Selenium when necessary (eg. for testing AJAX interactions)
20
+ * Supports multiple Ruby web frameworks: Rails, Merb and Sinatra
21
+ * Supports popular test frameworks: RSpec, Cucumber, Test::Unit and Shoulda
22
+ * Webrat::Matchers API for verifying rendered HTML using CSS, XPath, etc.
23
+
24
+ == Example
25
+
26
+ class SignupTest < ActionController::IntegrationTest
27
+
28
+ def test_trial_account_sign_up
29
+ visit home_path
30
+ click_link "Sign up"
31
+ fill_in "Email", :with => "good@example.com"
32
+ select "Free account"
33
+ click_button "Register"
34
+ end
35
+
36
+ end
37
+
38
+ Behind the scenes, Webrat will ensure:
39
+
40
+ * If a link, form field or button is missing, the test will fail.
41
+ * If a URL is invalid, the test will fail.
42
+ * If a page load or form submission is unsuccessful, the test will fail.
43
+
44
+ == Installing Nokogiri
45
+
46
+ Users of Debian Linux (e.g. Ubuntu) need to run:
47
+
48
+ sudo apt-get install libxslt1-dev libxml2-dev.
49
+
50
+ Otherwise the Nokogiri gem, which Webrat depends on, won't install properly.
51
+
52
+ == Install for Rails
53
+
54
+ To install the latest release as a gem:
55
+
56
+ sudo gem install webrat
57
+
58
+ To install the latest code as a plugin: (_Note:_ This may be less stable than using a released version)
59
+
60
+ script/plugin install git://github.com/brynary/webrat.git
61
+
62
+ In your test_helper.rb or env.rb (for Cucumber) add:
63
+
64
+ require "webrat"
65
+
66
+ Webrat.configure do |config|
67
+ config.mode = :rails
68
+ end
69
+
70
+ == Install with Merb
71
+
72
+ Merb 1.0 has built-in, seamless Webrat support. Just start using
73
+ methods from Webrat::Session in your specs.
74
+
75
+ == Authors
76
+
77
+ - Maintained by {Bryan Helmkamp}[mailto:bryan@brynary.com]
78
+ - Original code written by {Seth Fitzsimmons}[mailto:seth@mojodna.net]
79
+ - Initial development was sponsored by EastMedia[http://www.eastmedia.com]
80
+ - Many other contributors. See attributions in History.txt
81
+
82
+ == License
83
+
84
+ Copyright (c) 2007-2008 Bryan Helmkamp, Seth Fitzsimmons.
85
+ See MIT-LICENSE.txt in this directory.
data/Rakefile ADDED
@@ -0,0 +1,173 @@
1
+ begin
2
+ require 'jeweler'
3
+
4
+ Jeweler::Tasks.new do |s|
5
+ s.name = "webrat"
6
+ s.author = "Bryan Helmkamp"
7
+ s.email = "bryan" + "@" + "brynary.com"
8
+ s.homepage = "http://github.com/brynary/webrat"
9
+ s.summary = "Ruby Acceptance Testing for Web applications"
10
+ s.description = <<-EOS.strip
11
+ Webrat lets you quickly write expressive and robust acceptance tests
12
+ for a Ruby web application. It supports simulating a browser inside
13
+ a Ruby process to avoid the performance hit and browser dependency of
14
+ Selenium or Watir, but the same API can also be used to drive real
15
+ Selenium tests when necessary (eg. for testing AJAX interactions).
16
+ Most Ruby web frameworks and testing frameworks are supported.
17
+ EOS
18
+
19
+ s.rubyforge_project = "webrat"
20
+ s.extra_rdoc_files = %w[README.rdoc MIT-LICENSE.txt History.txt]
21
+
22
+ # Dependencies
23
+ s.add_dependency "nokogiri", ">= 1.2.0"
24
+ s.add_dependency "rack", ">= 1.0"
25
+
26
+ # TODO: Add development dependencies
27
+ end
28
+
29
+ Jeweler::RubyforgeTasks.new
30
+ rescue LoadError
31
+ puts "Jeweler not available. Install it with: gem install jeweler"
32
+ end
33
+
34
+ # require 'spec'
35
+ require 'spec/rake/spectask'
36
+ require 'spec/rake/verify_rcov'
37
+
38
+ desc "Run API and Core specs"
39
+ Spec::Rake::SpecTask.new do |t|
40
+ t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
41
+ t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
42
+ end
43
+
44
+ desc "Run all specs in spec directory with RCov"
45
+ Spec::Rake::SpecTask.new(:rcov) do |t|
46
+ t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
47
+ t.spec_files = FileList['spec/public/**/*_spec.rb'] + FileList['spec/private/**/*_spec.rb']
48
+ t.rcov = true
49
+ t.rcov_opts = lambda do
50
+ IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
51
+ end
52
+ end
53
+
54
+ RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
55
+ t.threshold = 96.2 # Make sure you have rcov 0.7 or higher!
56
+ end
57
+
58
+ desc "Run everything against multiruby"
59
+ task :multiruby do
60
+ result = system "multiruby -S rake spec"
61
+ raise "Multiruby tests failed" unless result
62
+ result = system "jruby -S rake spec"
63
+ raise "JRuby tests failed" unless result
64
+
65
+ Dir.chdir "spec/integration/rails" do
66
+ result = system "multiruby -S rake test_unit:rails"
67
+ raise "Rails integration tests failed" unless result
68
+
69
+ result = system "jruby -S rake test_unit:rails"
70
+ raise "Rails integration tests failed" unless result
71
+ end
72
+
73
+ Dir.chdir "spec/integration/merb" do
74
+ result = system "multiruby -S rake spec"
75
+ raise "Merb integration tests failed" unless result
76
+
77
+ result = system "jruby -S rake spec"
78
+ raise "Rails integration tests failed" unless result
79
+ end
80
+
81
+ Dir.chdir "spec/integration/sinatra" do
82
+ result = system "multiruby -S rake test"
83
+ raise "Sinatra integration tests failed" unless result
84
+
85
+ result = system "jruby -S rake test"
86
+ raise "Sinatra integration tests failed" unless result
87
+ end
88
+
89
+ Dir.chdir "spec/integration/rack" do
90
+ result = system "multiruby -S rake test"
91
+ raise "Rack integration tests failed" unless result
92
+
93
+ result = system "jruby -S rake test"
94
+ raise "Rack integration tests failed" unless result
95
+ end
96
+
97
+ puts
98
+ puts "Multiruby OK!"
99
+ end
100
+
101
+ desc "Run each spec in isolation to test for dependency issues"
102
+ task :spec_deps do
103
+ Dir["spec/**/*_spec.rb"].each do |test|
104
+ if !system("spec #{test} &> /dev/null")
105
+ puts "Dependency Issues: #{test}"
106
+ end
107
+ end
108
+ end
109
+
110
+ task :prepare do
111
+ system "ln -s ../../../../.. ./spec/integration/rails/vendor/plugins/webrat"
112
+ end
113
+
114
+ namespace :spec do
115
+ desc "Run the integration specs"
116
+ task :integration => ["integration:rails", "integration:merb", "integration:sinatra", "integration:rack"]
117
+
118
+ namespace :integration do
119
+ desc "Run the Rails integration specs"
120
+ task :rails => ['rails:webrat'] #,'rails:selenium'] currently not running selenium as it doesn't pass.
121
+
122
+ namespace :rails do
123
+ task :selenium do
124
+ Dir.chdir "spec/integration/rails" do
125
+ result = system "rake test_unit:selenium"
126
+ raise "Rails integration tests failed" unless result
127
+ end
128
+ end
129
+
130
+ task :webrat do
131
+ Dir.chdir "spec/integration/rails" do
132
+ result = system "rake test_unit:rails"
133
+ raise "Rails integration tests failed" unless result
134
+ end
135
+ end
136
+ end
137
+
138
+ desc "Run the Merb integration specs"
139
+ task :merb do
140
+ Dir.chdir "spec/integration/merb" do
141
+ result = system "rake spec"
142
+ raise "Merb integration tests failed" unless result
143
+ end
144
+ end
145
+
146
+ desc "Run the Sinatra integration specs"
147
+ task :sinatra do
148
+ Dir.chdir "spec/integration/sinatra" do
149
+ result = system "rake test"
150
+ raise "Sinatra integration tests failed" unless result
151
+ end
152
+ end
153
+
154
+ desc "Run the Sinatra integration specs"
155
+ task :rack do
156
+ Dir.chdir "spec/integration/rack" do
157
+ result = system "rake test"
158
+ raise "Rack integration tests failed" unless result
159
+ end
160
+ end
161
+ end
162
+ end
163
+
164
+ desc 'Removes trailing whitespace'
165
+ task :whitespace do
166
+ sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
167
+ end
168
+
169
+ if defined?(Jeweler)
170
+ task :spec => :check_dependencies
171
+ end
172
+
173
+ task :default => :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.5.0
data/install.rb ADDED
@@ -0,0 +1 @@
1
+ puts IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))