aslakhellesoy-webrat 0.3.2.2 → 0.4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. data/History.txt +158 -19
  2. data/Rakefile +36 -11
  3. data/lib/webrat.rb +8 -11
  4. data/lib/webrat/core/configuration.rb +67 -25
  5. data/lib/webrat/core/elements/area.rb +7 -7
  6. data/lib/webrat/core/elements/element.rb +11 -11
  7. data/lib/webrat/core/elements/field.rb +70 -51
  8. data/lib/webrat/core/elements/form.rb +17 -17
  9. data/lib/webrat/core/elements/label.rb +8 -8
  10. data/lib/webrat/core/elements/link.rb +13 -11
  11. data/lib/webrat/core/elements/select_option.rb +9 -9
  12. data/lib/webrat/core/locators.rb +2 -2
  13. data/lib/webrat/core/locators/area_locator.rb +10 -10
  14. data/lib/webrat/core/locators/button_locator.rb +13 -13
  15. data/lib/webrat/core/locators/field_by_id_locator.rb +8 -8
  16. data/lib/webrat/core/locators/field_labeled_locator.rb +19 -13
  17. data/lib/webrat/core/locators/field_locator.rb +7 -7
  18. data/lib/webrat/core/locators/field_named_locator.rb +10 -10
  19. data/lib/webrat/core/locators/form_locator.rb +6 -6
  20. data/lib/webrat/core/locators/label_locator.rb +9 -9
  21. data/lib/webrat/core/locators/link_locator.rb +12 -12
  22. data/lib/webrat/core/locators/locator.rb +5 -5
  23. data/lib/webrat/core/locators/select_option_locator.rb +11 -11
  24. data/lib/webrat/core/logging.rb +7 -4
  25. data/lib/webrat/core/matchers/have_content.rb +19 -15
  26. data/lib/webrat/core/matchers/have_selector.rb +44 -22
  27. data/lib/webrat/core/matchers/have_tag.rb +11 -61
  28. data/lib/webrat/core/matchers/have_xpath.rb +89 -35
  29. data/lib/webrat/core/methods.rb +13 -11
  30. data/lib/webrat/core/mime.rb +3 -3
  31. data/lib/webrat/core/save_and_open_page.rb +9 -9
  32. data/lib/webrat/core/scope.rb +82 -62
  33. data/lib/webrat/core/session.rb +61 -18
  34. data/lib/webrat/core/xml.rb +16 -16
  35. data/lib/webrat/core/xml/hpricot.rb +3 -3
  36. data/lib/webrat/core/xml/nokogiri.rb +14 -14
  37. data/lib/webrat/core/xml/rexml.rb +3 -3
  38. data/lib/webrat/core_extensions/blank.rb +1 -1
  39. data/lib/webrat/core_extensions/deprecate.rb +1 -1
  40. data/lib/webrat/core_extensions/detect_mapped.rb +4 -4
  41. data/lib/webrat/core_extensions/meta_class.rb +1 -1
  42. data/lib/webrat/core_extensions/tcp_socket.rb +27 -0
  43. data/lib/webrat/mechanize.rb +9 -9
  44. data/lib/webrat/merb.rb +5 -61
  45. data/lib/webrat/merb_session.rb +67 -0
  46. data/lib/webrat/rack.rb +45 -14
  47. data/lib/webrat/rails.rb +31 -11
  48. data/lib/webrat/rspec-rails.rb +2 -2
  49. data/lib/webrat/selenium.rb +27 -39
  50. data/lib/webrat/selenium/application_server_factory.rb +40 -0
  51. data/lib/webrat/selenium/application_servers.rb +5 -0
  52. data/lib/webrat/selenium/application_servers/base.rb +44 -0
  53. data/lib/webrat/selenium/application_servers/external.rb +24 -0
  54. data/lib/webrat/selenium/application_servers/merb.rb +48 -0
  55. data/lib/webrat/selenium/application_servers/rails.rb +42 -0
  56. data/lib/webrat/selenium/application_servers/sinatra.rb +35 -0
  57. data/lib/webrat/selenium/location_strategy_javascript/button.js +14 -7
  58. data/lib/webrat/selenium/location_strategy_javascript/label.js +1 -2
  59. data/lib/webrat/selenium/location_strategy_javascript/webratlink.js +4 -1
  60. data/lib/webrat/selenium/matchers.rb +4 -108
  61. data/lib/webrat/selenium/matchers/have_content.rb +66 -0
  62. data/lib/webrat/selenium/matchers/have_selector.rb +49 -0
  63. data/lib/webrat/selenium/matchers/have_tag.rb +72 -0
  64. data/lib/webrat/selenium/matchers/have_xpath.rb +45 -0
  65. data/lib/webrat/selenium/selenium_rc_server.rb +84 -0
  66. data/lib/webrat/selenium/selenium_session.rb +86 -68
  67. data/lib/webrat/selenium/silence_stream.rb +18 -0
  68. metadata +21 -16
  69. data/lib/webrat/core_extensions/hash_with_indifferent_access.rb +0 -131
  70. data/lib/webrat/sinatra.rb +0 -29
@@ -1,25 +1,144 @@
1
- == Trunk (Git)
1
+ == 0.4.5 / ?
2
+
3
+ * Major enhancements
4
+
5
+ * Improve performance (~2x) on JRuby by supporting Nokogiri
6
+ * Added support for external app servers in selenium mode (basically don't start one) (Mike Gaffney)
7
+
8
+ * Minor enhancements
9
+
10
+ * Added support for field_labeled_locators ending in non word characters
11
+ lh 148 (Zach Dennis)
12
+ * Filled in tests on click link lh 195 (diabolo)
13
+ * Added current_url to selenium session lh 215 (Luke Amdor)
14
+ * Added silence spec to selenium lh 238 (Martin Gamsjaeger aka snusnu)
15
+ * Added ability to configure the browser startup timeout for selenium lh 242 (Mike Gaffney, Mark Dodwell)
16
+ * Added delegation for field_named lh194 (pivotal labs)
17
+ * Added fix to keep from escaping field values in mechanize mode lh256 (jish)
18
+ * Adding fixes for click button/link and made the integration specs pass for the same in selenium lh254 (Ldiehl, Matthias Marschall)
19
+ * Adding clicking link by id in selenium mode lh221 (larrytheliquid)
20
+ * Adding fix for have_selector and have_xpath in descendent blocks lh234 (Thomas Jack)
21
+ * Adding fix for fields with labels with special characters (Thomas Jack, Mike Gaffney, Bryan Hemlkamp)
22
+ * Deprecated current_page lh50 (Mike Gaffney)
23
+
24
+ == 0.4.4 / 2009-04-06
25
+
26
+ * Major enhancements
27
+
28
+ * Make selenium process management code more robust and informative
29
+
30
+ * Minor enhancements
31
+
32
+ * Add support for Rails javascript post links (Mark Menard)
33
+ * Upgrade selenium-client dependency to 1.2.14, and update for new waiting
34
+ API (Balint Erdi)
35
+ * Change default app environment from "selenium" to "test"
36
+
37
+ * Bug fixes
38
+
39
+ * Don't create a new instance of WWW::Mechanize for each request
40
+ (Mark Menard)
41
+ * Select fields with duplicate selected options sent an incorrect value (Noah Davis)
42
+
43
+ == 0.4.3 / 2009-03-17
44
+
45
+ * Minor enhancements
46
+
47
+ * Support Rails 2.3. Use Rack::Utils to parse params (Matthew Ford)
48
+ * Support for "modular" Sinatra app style (Simon Rozet)
49
+ * Initial Merb and Sinatra compatibility for Selenium mode (Corey Donohoe)
50
+ * When faced with a label with no for attribute, that contains a hidden field
51
+ and another field, as can be the case in Rails 2.3's checkbox view,
52
+ webrat now locates the non-hidden field. (Luke Melia)
53
+ * Add application_framework config for Selenium mode to determine how to
54
+ start and stop the app server (Corey Donohoe)
55
+
56
+ * Bug fixes
57
+
58
+ * Fix following of absolute redirect URL in Sinatra (Simon Rozet)
59
+
60
+ == 0.4.2 / 2009-02-24
61
+
62
+ * Major enhancements
63
+
64
+ * Significant improvements to have_selector. It now supports specifying
65
+ attributes in a hash and :count and :content options. See
66
+ have_selector_spec.rb for more.
67
+ * Add the same functionality mentioned above to have_xpath
68
+
69
+ * Minor enhancements
70
+
71
+ * Squeeze extra whitespace out of failures messages from contain
72
+ matcher
73
+ * Detect infinite redirects and raise a Webrat::InfiniteRedirectError
74
+ (Daniel Lucraft)
75
+
76
+ * Bug fixes
77
+
78
+ * Properly quote single and double quotes strings in XPath
79
+ * Fix warning caused by Nokogiri deprecating CSS::Parser.parse
80
+ (Aaron Patterson)
81
+ * Accept do/end blocks in matchers. [#157] (Peter Jaros)
82
+ * Quote --chdir option to mongrel_rails to support RAILS_ROOTs with spaces
83
+ (T.J. VanSlyke)
84
+
85
+ == 0.4.1 / 2009-01-31
86
+
87
+ * Minor enhancements
88
+
89
+ * Support Sinatra 0.9 (Harry Vangberg)
90
+ * Update query param parsing to work with latest Edge Rails
91
+ * Added #redirected_to method to easily check where an external redirect was
92
+ redirected to (Adam Greene)
93
+ * Recognize input tags with type button (Lena Herrmann)
94
+ * Add uncheck method to Selenium mode (Lee Bankewitz)
95
+
96
+ * Bug fixes
97
+
98
+ * Make requests to a Rails app using a full URL instead of a relative path. This change
99
+ is helpful for Rails apps that use subdomains. (John Hwang and Zach Dennis)
100
+ * Follow redirects that are on the same domain but a different subdomain
101
+ (Adam Greene)
102
+ * rescue from Webrat::TimeoutError in selenium matchers which allows NegativeMatchers
103
+ to behave correctly (Noah Davis)
104
+ * Switch to using selenium.click instead of .check when checking a checkbox
105
+ (Noah Davis)
106
+ * Create tmp/pids directory if directory does not exist. (Amos King and Mike Gaffney)
107
+ * Setup deprecated writers for the selenium_environment= and selenium_port= config
108
+ * Ensure the previous pages params aren't passed through redirect (Daniel Lucraft and
109
+ Bryan Helmkamp)
110
+ * Labels should only search for fields within the current scope (Kyle Hargraves)
111
+
112
+ == 0.4.0 / 2009-01-18
2
113
 
3
114
  * _IMPORTANT_ Breaking change:
4
115
 
5
116
  * Removed init.rb auto-require of webrat/rails
6
117
  * Removed auto-require of webrat/rails when requiring webrat when RAILS_ENV is
7
118
  defined
8
-
119
+
9
120
  In your env.rb or test_helper.rb file, ensure you have something like:
10
-
121
+
11
122
  require "webrat"
12
-
123
+
13
124
  Webrat.configure do |config|
14
125
  config.mode = :rails
15
126
  end
16
-
127
+
17
128
  * Major enhancements
18
129
 
130
+ * Major improvements to Webrat::Selenium (Many contributors listed here)
131
+ * Add assert_* methods for using Webrat's matchers w/o RSpec (Mike Gaffney, Amos King)
132
+ * Added Webrat.configure method for Webrat configuration [#33] (Mike Gaffney)
19
133
  * Added select_time, select_date, and select_datetime to API. [#36] (Ben Mabey)
20
134
  * Use Hpricot and REXML when not parsing with Nokogiri (on JRuby, for example)
21
135
 
22
136
  * Minor enhancements
137
+
138
+ * Added Selenium grid configuration and support. (Amos King && Cornel Borcean)
139
+ * Support passing an ActiveRecord model to #within when in Rails mode [#68] (Luke Melia)
140
+ * Make assert_* matchers in rails mode increment the assertions count [#123] (Amos King)
141
+ * Added assert_* matchers to selenium matchers [#110] (Amos King)
23
142
  * Added assert_contain, assert_not_contain [#86] (Mike Gaffney, Amos King)
24
143
  * Add configuration options for the Selenium environment and port (Kieran Pilkington)
25
144
  * Maximize the browser window after initializing Selenium (Luke Melia)
@@ -44,14 +163,12 @@
44
163
  * Add submit_form method for submitting a form by ID (Noah Davis, Bryan Helmkamp)
45
164
  * Switch to using Nokogiri.parse for simple XML/XHTML autodetection [#66]
46
165
  * Removed Webrat.root method, which seemed to be unused
47
- * Added Webrat.configure method for global Webrat configuration [#33]
48
- (Mike Gaffney)
49
166
  * Added automatic starting and stopping of the Selenium server and a Mongrel Rails
50
167
  app server when using webrat/selenium
51
168
  * Switch to using selenium-client gem and vendor selenium-server.jar (Luke Melia)
52
169
  * Added gemspec so the gem builds on GitHub now
53
170
  * Deprecate old style methods (fills_in is deprecated in favor of fill_in, etc.)
54
- * Improcements to the README and RDoc (Bryan Helmkamp, Mike Gaffney)
171
+ * Improvements to the README and RDoc (Bryan Helmkamp, Mike Gaffney)
55
172
  * Allow clicking links by id and id regexp (Mike Gaffney)
56
173
  * Raise Webrat::DisabledFieldError when attempting to manipulate a disabled field
57
174
  * Raise Webrat::NotFoundErrors when an element is not found
@@ -63,6 +180,12 @@
63
180
 
64
181
  * Bug fixes
65
182
 
183
+ * field_labeled should disregard labels without matching fields (Kyle Hargraves)
184
+ * Fixed bug where Scope was creating a new DOM rather than re-using the existing DOM.
185
+ [#105] (Zach Dennis)
186
+ * Support Rails > v2.2 by using ActionController::RequestParser for param parsing [#107]
187
+ (Marcello Nuccio)
188
+ * Raise a Webrat::NotFoundError if the scope passed to #within doesn't exist [#90]
66
189
  * Match against link _text_ which decodes character references.
67
190
  Useful for multibyte languages like Japanese (moronatural@gmail.com)
68
191
  * Fix params hash generation for Mechanize when Merb is not defined [#62]
@@ -74,23 +197,39 @@
74
197
  * Fixed bug where Webrat would lose complex parameters (like foo[bar[baz]][])
75
198
  in Merb due to not correctly merging Mashes. (Drew Colthorp)
76
199
  * Extend Rails' ActionController::IntegrationTest instead of
77
- ActionController::Integration::Session (Fixes using Webrat's #select method and
200
+ ActionController::Integration::Session (Fixes using Webrat's #select method and
78
201
  avoids usage of method_missing)
79
- * Ensure that Webrat::MechanizeSession.request_page always uses an absolute
202
+ * Ensure that Webrat::MechanizeSession.request_page always uses an absolute
80
203
  URL. (Graham Ashton)
81
204
  * Strip anchor tags from URIs before passing to Rails integration session
82
205
  (Noah Davis)
83
206
  * Treat text and regexp when matching Selenium buttons (Ross Kaffenberger)
84
207
  * Allow SeleniumSession's click_button to be called without an argument without
85
208
  blowing up (Luke Melia)
86
-
209
+
210
+ == 0.3.4 / 2008-12-29
211
+
212
+ * 1 Minor enhancement
213
+
214
+ * Fix compatibility with Nokogiri 1.1.0 on JRuby
215
+
216
+ * 1 Bug fix
217
+
218
+ * Correct version for Nokogiri dependency in gem
219
+
220
+ == 0.3.3 / 2008-12-28
221
+
222
+ * 1 Minor enhancement
223
+
224
+ * Fix compatibility with Nokogiri 1.1.0 on MRI
225
+
87
226
  == 0.3.2 / 2008-11-08
88
227
 
89
228
  * 1 Minor enhancement
90
229
 
91
230
  * Fixes behavior or have_tag when a block is passed. It passes the matched node(s)
92
231
  to the block for further specs again. (Carl Lerche)
93
-
232
+
94
233
  == 0.3.1 / 2008-11-07
95
234
 
96
235
  * 1 Minor enhancement
@@ -106,7 +245,7 @@
106
245
  * Added experimental Selenium support (Luke Melia)
107
246
  * Add have_selector, have_xpath, have_tag and contain matchers from Merb
108
247
  * Switch from Hpricot to Nokogiri for XML parsing (thanks, Aaron Patterson)
109
-
248
+
110
249
  * 37 Minor enhancements
111
250
 
112
251
  * Added #within for manipulating the current page within a selector scope
@@ -153,7 +292,7 @@
153
292
  * Switched tests to specs, and from Mocha to RSpec's mocking library
154
293
  * Add support to click_button for IDs (Gwyn Morfey)
155
294
  * Miscellaneous core refactorings (Jan Suchal)
156
-
295
+
157
296
  * 8 Bug fixes
158
297
 
159
298
  * Fix initialization of WWW::Mechanize (Derek Kastner)
@@ -165,7 +304,7 @@
165
304
  * Don't explode if encountering inputs with no type attribute (assume text)
166
305
  * Fix bug where choosing a radio button in a series with a default submitted the
167
306
  incorrect field value (Luke Melia)
168
-
307
+
169
308
  == 0.2.0 / 2008-04-04
170
309
 
171
310
  * 4 Major enhancements
@@ -175,12 +314,12 @@
175
314
  * Add basic support for Rails-generated JavaScript link tags
176
315
  * Add support for checkboxes (Patches from Kyle Hargraves and Jarkko Laine)
177
316
  * Add support for textarea fields (Sacha Schlegel)
178
-
317
+
179
318
  * 8 Minor enhancements
180
-
319
+
181
320
  * Added reloads method to reload the page (Kamal Fariz Mahyuddi)
182
321
  * Prevent making a request if clicking on local anchor link (Kamal Fariz Mahyuddi)
183
- * Added clicks_link_within(selector, link_text), allowing restricting link search
322
+ * Added clicks_link_within(selector, link_text), allowing restricting link search
184
323
  to within a given css selector (Luke Melia)
185
324
  * Allow specifying the input name/label when doing a select (David Chelimsky)
186
325
  * Raise a specific exception if the developer tries to manipulate form elements
@@ -188,7 +327,7 @@
188
327
  * Add support for alternate POST, PUT and DELETE link clicking (Kyle Hargraves)
189
328
  * Change clicks_link to find the shortest matching link (Luke Melia)
190
329
  * Improve matching for labels in potentially ambiguous cases
191
-
330
+
192
331
  * 7 Bug fixes
193
332
 
194
333
  * Fix incorrect serializing of collection inputs, i.e. name contains []
data/Rakefile CHANGED
@@ -28,7 +28,7 @@ spec = Gem::Specification.new do |s|
28
28
  s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
29
29
 
30
30
  # Dependencies
31
- s.add_dependency "nokogiri", ">= 1.1.0"
31
+ s.add_dependency "nokogiri", ">= 1.2.0"
32
32
 
33
33
  s.rubyforge_project = "webrat"
34
34
  end
@@ -72,7 +72,7 @@ end
72
72
  desc 'Install the package as a gem.'
73
73
  task :install_gem => [:clean, :package] do
74
74
  gem_filename = Dir['pkg/*.gem'].first
75
- sh "sudo gem install --local #{gem_filename}"
75
+ sh "sudo gem install --no-rdoc --no-ri --local #{gem_filename}"
76
76
  end
77
77
 
78
78
  desc "Delete generated RDoc"
@@ -87,7 +87,8 @@ end
87
87
 
88
88
  desc "Run specs using jruby"
89
89
  task "spec:jruby" do
90
- system "jruby -S rake spec"
90
+ result = system "jruby -S rake spec"
91
+ raise "JRuby tests failed" unless result
91
92
  end
92
93
 
93
94
  desc "Run each spec in isolation to test for dependency issues"
@@ -105,14 +106,25 @@ end
105
106
 
106
107
  namespace :spec do
107
108
  desc "Run the integration specs"
108
- task :integration => ["integration:rails", "integration:merb", "integration:sinatra"]
109
+ task :integration => ["integration:rails", "integration:merb", "integration:sinatra", "integration:rack"]
109
110
 
110
111
  namespace :integration do
111
112
  desc "Run the Rails integration specs"
112
- task :rails do
113
- Dir.chdir "spec/integration/rails" do
114
- result = system "rake test:integration"
115
- raise "Rails integration tests failed" unless result
113
+ task :rails => ['rails:webrat'] #,'rails:selenium'] currently not running selenium as it doesn't pass.
114
+
115
+ namespace :rails do
116
+ task :selenium do
117
+ Dir.chdir "spec/integration/rails" do
118
+ result = system "rake test_unit:selenium"
119
+ raise "Rails integration tests failed" unless result
120
+ end
121
+ end
122
+
123
+ task :webrat do
124
+ Dir.chdir "spec/integration/rails" do
125
+ result = system "rake test_unit:rails"
126
+ raise "Rails integration tests failed" unless result
127
+ end
116
128
  end
117
129
  end
118
130
 
@@ -128,12 +140,25 @@ namespace :spec do
128
140
  task :sinatra do
129
141
  Dir.chdir "spec/integration/sinatra" do
130
142
  result = system "rake test"
131
- raise "Sinatra tntegration tests failed" unless result
143
+ raise "Sinatra integration tests failed" unless result
144
+ end
145
+ end
146
+
147
+ desc "Run the Sinatra integration specs"
148
+ task :rack do
149
+ Dir.chdir "spec/integration/rack" do
150
+ result = system "rake test"
151
+ raise "Rack integration tests failed" unless result
132
152
  end
133
153
  end
134
154
  end
135
155
  end
136
156
 
137
- task :default => :spec
157
+ task :default => [:"spec:integration", :spec]
158
+
159
+ task :precommit => ["spec", "spec:jruby", "spec:integration"]
138
160
 
139
- task :precommit => ["spec", "spec:jruby", "spec:integration"]
161
+ desc 'Removes trailing whitespace'
162
+ task :whitespace do
163
+ sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
164
+ end
@@ -7,26 +7,23 @@ module Webrat
7
7
  class WebratError < StandardError
8
8
  end
9
9
 
10
- VERSION = '0.3.2.2'
10
+ VERSION = '0.4.4.1'
11
11
 
12
12
  def self.require_xml
13
- gem "nokogiri", ">= 1.0.6"
14
-
15
13
  if on_java?
16
- # We need Nokogiri's CSS to XPath support, even if using REXML and Hpricot for parsing and searching
17
- require "nokogiri/css"
18
- require "hpricot"
19
- require "rexml/document"
14
+ gem "nokogiri", ">= 1.2.4"
20
15
  else
21
- require "nokogiri"
22
- require "webrat/core/xml/nokogiri"
16
+ gem "nokogiri", ">= 1.0.6"
23
17
  end
18
+
19
+ require "nokogiri"
20
+ require "webrat/core/xml/nokogiri"
24
21
  end
25
-
22
+
26
23
  def self.on_java?
27
24
  RUBY_PLATFORM =~ /java/
28
25
  end
29
-
26
+
30
27
  end
31
28
 
32
29
  Webrat.require_xml
@@ -1,60 +1,102 @@
1
+ require "webrat/core_extensions/deprecate"
2
+
1
3
  module Webrat
2
-
4
+
3
5
  # Configures Webrat. If this is not done, Webrat will be created
4
- # with all of the default settings.
5
- def self.configure(configuration = Webrat::Configuration.new)
6
+ # with all of the default settings.
7
+ def self.configure(configuration = Webrat.configuration)
6
8
  yield configuration if block_given?
7
9
  @@configuration = configuration
8
10
  end
9
-
11
+
10
12
  def self.configuration # :nodoc:
11
13
  @@configuration ||= Webrat::Configuration.new
12
14
  end
13
15
 
14
16
  # Webrat can be configured using the Webrat.configure method. For example:
15
- #
17
+ #
16
18
  # Webrat.configure do |config|
17
19
  # config.parse_with_nokogiri = false
18
20
  # end
19
21
  class Configuration
20
-
22
+
21
23
  # Should XHTML be parsed with Nokogiri? Defaults to true, except on JRuby. When false, Hpricot and REXML are used
22
24
  attr_writer :parse_with_nokogiri
23
-
25
+
24
26
  # Webrat's mode, set automatically when requiring webrat/rails, webrat/merb, etc.
25
- attr_accessor :mode # :nodoc:
26
-
27
+ attr_reader :mode # :nodoc:
28
+
27
29
  # Save and open pages with error status codes (500-599) in a browser? Defualts to true.
28
30
  attr_writer :open_error_files
29
-
30
- # Which environment should the selenium tests be run in? Defaults to selenium.
31
- attr_accessor :selenium_environment
32
31
 
33
- # Which port should the selenium tests be run on? Defaults to 3001.
34
- attr_accessor :selenium_port
32
+ # Which rails environment should the selenium tests be run in? Defaults to selenium.
33
+ attr_accessor :application_environment
34
+ webrat_deprecate :selenium_environment, :application_environment
35
+ webrat_deprecate :selenium_environment=, :application_environment=
36
+
37
+ # Which port is the application running on for selenium testing? Defaults to 3001.
38
+ attr_accessor :application_port
39
+ webrat_deprecate :selenium_port, :application_port
40
+ webrat_deprecate :selenium_port=, :application_port=
41
+
42
+ # Which underlying app framework we're testing with selenium
43
+ attr_accessor :application_framework
44
+
45
+ # Which server the application is running on for selenium testing? Defaults to localhost
46
+ attr_accessor :application_address
47
+
48
+ # Which server Selenium server is running on. Defaults to nil(server starts in webrat process and runs locally)
49
+ attr_accessor :selenium_server_address
50
+
51
+ # Which server Selenium port is running on. Defaults to 4444
52
+ attr_accessor :selenium_server_port
53
+
54
+ # Set the key that Selenium uses to determine the browser running. Default *firefox
55
+ attr_accessor :selenium_browser_key
56
+
57
+ # Set the timeout for waiting for the browser process to start
58
+ attr_accessor :selenium_browser_startup_timeout
59
+
60
+ # How many redirects to the same URL should be halted as an infinite redirect
61
+ # loop? Defaults to 10
62
+ attr_accessor :infinite_redirect_limit
35
63
 
36
64
  def initialize # :nodoc:
37
65
  self.open_error_files = true
38
- self.parse_with_nokogiri = !Webrat.on_java?
39
- self.selenium_environment = :selenium
40
- self.selenium_port = 3001
66
+ self.parse_with_nokogiri = true
67
+ self.application_environment = :test
68
+ self.application_port = 3001
69
+ self.application_address = 'localhost'
70
+ self.application_framework = :rails
71
+ self.selenium_server_port = 4444
72
+ self.infinite_redirect_limit = 10
73
+ self.selenium_browser_key = '*firefox'
74
+ self.selenium_browser_startup_timeout = 5
41
75
  end
42
-
76
+
43
77
  def parse_with_nokogiri? #:nodoc:
44
78
  @parse_with_nokogiri ? true : false
45
79
  end
46
-
80
+
47
81
  def open_error_files? #:nodoc:
48
82
  @open_error_files ? true : false
49
83
  end
50
-
84
+
51
85
  # Allows setting of webrat's mode, valid modes are:
52
86
  # :rails, :selenium, :rack, :sinatra, :mechanize, :merb
53
87
  def mode=(mode)
54
- @mode = mode
55
- require("webrat/#{mode}")
88
+ @mode = mode.to_sym
89
+
90
+ # This is a temporary hack to support backwards compatibility
91
+ # with Merb 1.0.8 until it's updated to use the new Webrat.configure
92
+ # syntax
93
+ if @mode == :merb
94
+ require("webrat/merb_session")
95
+ else
96
+ require("webrat/#{mode}")
97
+ end
56
98
  end
57
-
99
+
58
100
  end
59
-
60
- end
101
+
102
+ end