diabolo-webrat 0.4.4.2 → 0.5.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 (148) hide show
  1. data/.document +4 -0
  2. data/.gitignore +15 -0
  3. data/History.txt +60 -9
  4. data/Rakefile +90 -75
  5. data/VERSION +1 -0
  6. data/lib/webrat.rb +8 -23
  7. data/lib/webrat/{mechanize.rb → adapters/mechanize.rb} +6 -2
  8. data/lib/webrat/adapters/merb.rb +11 -0
  9. data/lib/webrat/adapters/rack.rb +25 -0
  10. data/lib/webrat/{rails.rb → adapters/rails.rb} +9 -18
  11. data/lib/webrat/adapters/sinatra.rb +9 -0
  12. data/lib/webrat/core.rb +0 -1
  13. data/lib/webrat/core/configuration.rb +7 -17
  14. data/lib/webrat/core/elements/area.rb +2 -2
  15. data/lib/webrat/core/elements/element.rb +3 -3
  16. data/lib/webrat/core/elements/field.rb +33 -30
  17. data/lib/webrat/core/elements/form.rb +4 -4
  18. data/lib/webrat/core/elements/label.rb +4 -4
  19. data/lib/webrat/core/elements/link.rb +7 -6
  20. data/lib/webrat/core/elements/select_option.rb +2 -2
  21. data/lib/webrat/core/locators.rb +1 -1
  22. data/lib/webrat/core/locators/area_locator.rb +3 -3
  23. data/lib/webrat/core/locators/button_locator.rb +6 -6
  24. data/lib/webrat/core/locators/field_by_id_locator.rb +3 -3
  25. data/lib/webrat/core/locators/field_labeled_locator.rb +2 -2
  26. data/lib/webrat/core/locators/field_named_locator.rb +3 -3
  27. data/lib/webrat/core/locators/form_locator.rb +1 -1
  28. data/lib/webrat/core/locators/label_locator.rb +2 -2
  29. data/lib/webrat/core/locators/link_locator.rb +20 -12
  30. data/lib/webrat/core/locators/select_option_locator.rb +5 -5
  31. data/lib/webrat/core/logging.rb +1 -1
  32. data/lib/webrat/core/matchers/have_content.rb +2 -7
  33. data/lib/webrat/core/matchers/have_xpath.rb +2 -27
  34. data/lib/webrat/core/methods.rb +4 -4
  35. data/lib/webrat/core/mime.rb +11 -22
  36. data/lib/webrat/core/save_and_open_page.rb +5 -7
  37. data/lib/webrat/core/scope.rb +2 -2
  38. data/lib/webrat/core/session.rb +30 -14
  39. data/lib/webrat/core/xml.rb +41 -84
  40. data/lib/webrat/integrations/merb.rb +10 -0
  41. data/lib/webrat/integrations/rails.rb +9 -0
  42. data/lib/webrat/integrations/rspec-rails.rb +10 -0
  43. data/lib/webrat/integrations/selenium.rb +11 -0
  44. data/lib/webrat/rspec-rails.rb +2 -13
  45. data/lib/webrat/selenium.rb +0 -11
  46. data/lib/webrat/selenium/application_server_factory.rb +40 -0
  47. data/lib/webrat/selenium/application_servers.rb +5 -0
  48. data/lib/webrat/selenium/application_servers/base.rb +46 -0
  49. data/lib/webrat/selenium/application_servers/external.rb +26 -0
  50. data/lib/webrat/selenium/application_servers/merb.rb +50 -0
  51. data/lib/webrat/selenium/application_servers/rails.rb +44 -0
  52. data/lib/webrat/selenium/application_servers/sinatra.rb +37 -0
  53. data/lib/webrat/selenium/location_strategy_javascript/label.js +2 -1
  54. data/lib/webrat/selenium/selenium_rc_server.rb +7 -5
  55. data/lib/webrat/selenium/selenium_session.rb +20 -7
  56. data/lib/webrat/selenium/silence_stream.rb +1 -1
  57. data/spec/fakes/{test_session.rb → test_adapter.rb} +6 -3
  58. data/spec/integration/mechanize/Rakefile +7 -0
  59. data/spec/integration/mechanize/config.ru +2 -0
  60. data/spec/integration/mechanize/sample_app.rb +20 -0
  61. data/spec/integration/mechanize/spec/mechanize_spec.rb +22 -0
  62. data/spec/integration/mechanize/spec/spec_helper.rb +27 -0
  63. data/spec/integration/merb/.gitignore +21 -0
  64. data/spec/integration/merb/Rakefile +35 -0
  65. data/spec/integration/merb/app/controllers/testing.rb +9 -0
  66. data/spec/integration/merb/app/views/exceptions/not_acceptable.html.erb +63 -0
  67. data/spec/integration/merb/app/views/exceptions/not_found.html.erb +47 -0
  68. data/spec/integration/merb/app/views/layout/application.html.erb +12 -0
  69. data/spec/integration/merb/app/views/testing/show_form.html.erb +27 -0
  70. data/spec/integration/merb/app/views/testing/upload.html.erb +9 -0
  71. data/spec/integration/merb/config/router.rb +1 -0
  72. data/spec/integration/merb/spec/spec.opts +1 -0
  73. data/spec/integration/merb/spec/spec_helper.rb +2 -0
  74. data/spec/integration/merb/spec/webrat_spec.rb +7 -0
  75. data/spec/integration/merb/tasks/merb.thor/main.thor +150 -0
  76. data/spec/integration/rack/Rakefile +5 -0
  77. data/spec/integration/rack/app.rb +89 -0
  78. data/spec/integration/rack/test/helper.rb +21 -0
  79. data/spec/integration/rack/test/webrat_rack_test.rb +57 -51
  80. data/spec/integration/rails/.gitignore +3 -0
  81. data/spec/integration/rails/Rakefile +30 -0
  82. data/spec/integration/rails/app/controllers/webrat_controller.rb +13 -9
  83. data/spec/integration/rails/app/views/buttons/show.html.erb +11 -0
  84. data/spec/integration/rails/app/views/fields/show.html.erb +9 -0
  85. data/spec/integration/rails/app/views/links/show.html.erb +5 -0
  86. data/spec/integration/rails/app/views/webrat/before_redirect_form.html.erb +4 -0
  87. data/spec/integration/rails/app/views/webrat/buttons.html.erb +11 -0
  88. data/spec/integration/rails/app/views/webrat/form.html.erb +28 -0
  89. data/spec/integration/rails/config/locales/en.yml +5 -0
  90. data/spec/integration/rails/config/routes.rb +1 -0
  91. data/spec/integration/rails/public/404.html +30 -0
  92. data/spec/integration/rails/public/422.html +30 -0
  93. data/spec/integration/rails/public/500.html +33 -0
  94. data/spec/integration/rails/script/about +4 -0
  95. data/spec/integration/rails/script/console +3 -0
  96. data/spec/integration/rails/script/dbconsole +3 -0
  97. data/spec/integration/rails/script/destroy +3 -0
  98. data/spec/integration/rails/script/generate +3 -0
  99. data/spec/integration/rails/script/performance/benchmarker +3 -0
  100. data/spec/integration/rails/script/performance/profiler +3 -0
  101. data/spec/integration/rails/script/performance/request +3 -0
  102. data/spec/integration/rails/script/plugin +3 -0
  103. data/spec/integration/rails/script/process/inspector +3 -0
  104. data/spec/integration/rails/script/process/reaper +3 -0
  105. data/spec/integration/rails/script/process/spawner +3 -0
  106. data/spec/integration/rails/script/runner +3 -0
  107. data/spec/integration/rails/script/server +3 -0
  108. data/spec/integration/rails/test/integration/button_click_test.rb +2 -2
  109. data/spec/integration/rails/test/integration/link_click_test.rb +7 -1
  110. data/spec/integration/rails/test/integration/webrat_test.rb +22 -0
  111. data/spec/integration/rails/test/test_helper.rb +6 -5
  112. data/spec/integration/sinatra/Rakefile +5 -0
  113. data/spec/integration/sinatra/test/test_helper.rb +3 -2
  114. data/spec/private/core/configuration_spec.rb +8 -27
  115. data/spec/private/core/field_spec.rb +7 -7
  116. data/spec/private/core/link_spec.rb +1 -1
  117. data/spec/private/core/session_spec.rb +23 -21
  118. data/spec/private/mechanize/{mechanize_session_spec.rb → mechanize_adapter_spec.rb} +4 -12
  119. data/spec/private/nokogiri_spec.rb +2 -2
  120. data/spec/private/rails/{rails_session_spec.rb → rails_adapter_spec.rb} +16 -16
  121. data/spec/private/selenium/application_servers/rails_spec.rb +26 -0
  122. data/spec/public/matchers/contain_spec.rb +4 -4
  123. data/spec/public/matchers/have_selector_spec.rb +2 -2
  124. data/spec/public/matchers/have_xpath_spec.rb +3 -3
  125. data/spec/public/save_and_open_spec.rb +25 -6
  126. data/spec/public/selenium/application_server_factory_spec.rb +49 -0
  127. data/spec/public/selenium/application_servers/external_spec.rb +12 -0
  128. data/spec/public/selenium/selenium_session_spec.rb +37 -0
  129. data/spec/rcov.opts +1 -0
  130. data/spec/spec.opts +2 -0
  131. data/spec/spec_helper.rb +5 -1
  132. data/vendor/selenium-server.jar +0 -0
  133. data/webrat.gemspec +348 -0
  134. metadata +176 -23
  135. data/lib/webrat/core/xml/hpricot.rb +0 -19
  136. data/lib/webrat/core/xml/nokogiri.rb +0 -76
  137. data/lib/webrat/core/xml/rexml.rb +0 -24
  138. data/lib/webrat/merb_session.rb +0 -65
  139. data/lib/webrat/rack.rb +0 -24
  140. data/lib/webrat/rack_test.rb +0 -32
  141. data/lib/webrat/selenium/application_server.rb +0 -73
  142. data/lib/webrat/selenium/merb_application_server.rb +0 -48
  143. data/lib/webrat/selenium/rails_application_server.rb +0 -42
  144. data/lib/webrat/selenium/sinatra_application_server.rb +0 -35
  145. data/lib/webrat/sinatra.rb +0 -44
  146. data/spec/integration/rack/rack_app.rb +0 -16
  147. data/spec/integration/rack/test/test_helper.rb +0 -20
  148. data/spec/private/merb/merb_session_spec.rb +0 -42
@@ -0,0 +1,3 @@
1
+ vendor/plugins/webrat
2
+ tmp/pids/*.pid
3
+ log/*.log
@@ -0,0 +1,30 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
+
6
+ require 'rake'
7
+ require 'rake/testtask'
8
+ require 'rake/rdoctask'
9
+
10
+ require 'tasks/rails'
11
+
12
+
13
+
14
+
15
+ namespace :test_unit do
16
+ desc "runs the test::unit based tests in webrat mode"
17
+ task :rails do
18
+ ENV['WEBRAT_INTEGRATION_MODE'] = 'rails'
19
+ Rake::Task['test:integration'].execute
20
+ end
21
+
22
+ desc "runs the test::unit based tests in selenium mode"
23
+ task :selenium do
24
+ ENV['WEBRAT_INTEGRATION_MODE'] = 'selenium'
25
+ Rake::Task['test:integration'].execute
26
+ end
27
+
28
+ desc "run both selenium and rails mode Test::Unit suites"
29
+ task :all => [:rails, :selenium]
30
+ end
@@ -5,35 +5,39 @@ class FakeModel
5
5
  end
6
6
 
7
7
  class WebratController < ApplicationController
8
-
8
+
9
9
  def form
10
10
  end
11
-
11
+
12
12
  def submit
13
13
  render :text => "OK <a href='/' id='link_id'>Test Link Text</a>"
14
14
  end
15
-
15
+
16
16
  def internal_redirect
17
17
  redirect_to submit_path
18
18
  end
19
-
19
+
20
20
  def infinite_redirect
21
21
  redirect_to infinite_redirect_path
22
22
  end
23
-
23
+
24
24
  def external_redirect
25
25
  redirect_to "http://google.com"
26
26
  end
27
-
27
+
28
+ def host_redirect
29
+ redirect_to submit_url
30
+ end
31
+
28
32
  def before_redirect_form
29
33
  end
30
-
34
+
31
35
  def redirect_to_show_params
32
36
  redirect_to show_params_path(:custom_param => "123")
33
37
  end
34
-
38
+
35
39
  def show_params
36
40
  render :text => params.to_json
37
41
  end
38
-
42
+
39
43
  end
@@ -0,0 +1,11 @@
1
+ <h1 id='form_title' class='form title'>Webrat Buttons Form</h1>
2
+
3
+ <% form_tag "/buttons" do %>
4
+ <input type="button" id="input_button_id" value="input_button_value" />
5
+ <input type="submit" id="input_submit_id" value="input_submit_value" />
6
+ <input type="image" id="input_image_id" value="input_image_value" alt="input_image_alt" src="" />
7
+
8
+ <button type="button" id="button_button_id" value="button_button_value">button_button_text</button>
9
+ <button type="submit" id="button_submit_id" value="button_submit_value">button_submit_text</button>
10
+ <button type="image" id="button_image_id" value="button_image_value">button_image_text</button>
11
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <h1>Webrat Fields Page</h1>
2
+ <h2>Filling In</h2>
3
+ <ul>
4
+ <li><input type="text" name="field_by_name" value="" /></li>
5
+ <li><input type="text" name="rails[naming]" value="" /></li>
6
+ <li><input type="text" id="field_by_id" value="" /></li>
7
+ <li><label for="field_by_label_id">FieldByLabelId</label><input type="text" id="field_by_label_id" /></li>
8
+ <li><label for="field_by_label_with_special_characters">[Field]:</label><input type="text" id="field_by_label_with_special_characters" /></li>
9
+ </ul>
@@ -0,0 +1,5 @@
1
+ <h1>Webrat Links Page</h1>
2
+ <a href="/links?value=LinkByText">LinkByText</a><br />
3
+ <a href="/links?value=link_by_id" id="link_by_id">id</a><br />
4
+ <a href="/links?value=LinkByTitle" title="LinkByTitle">title</a><br />
5
+ <a href="/links?value=link_with_parens">Link With (parens)</a><br />
@@ -0,0 +1,4 @@
1
+ <% form_tag redirect_to_show_params_path do %>
2
+ <%= label_tag 'text_field', 'Text Field' %><%= text_field_tag "text_field" %>
3
+ <%= submit_tag "Test" %>
4
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <h1 id='form_title' class='form title'>Webrat Buttons Form</h1>
2
+
3
+ <% form_tag submit_path do %>
4
+ <input type="button" id="input_button_id" value="input_button_value">
5
+ <input type="submit" id="input_submit_id" value="input_submit_value">
6
+ <input type="image" id="input_image_id" value="input_image_value" alt="input_image_alt" src="">
7
+
8
+ <button type="button" id="button_button_id" value="button_button_value">button_button_text</button>
9
+ <button type="submit" id="button_submit_id" value="button_submit_value">button_submit_text</button>
10
+ <button type="image" id="button_image_id" value="button_image_value">button_image_text</button>
11
+ <% end %>
@@ -0,0 +1,28 @@
1
+ <h1 id='form_title' class='form title'>Webrat Form</h1>
2
+
3
+ <% form_tag submit_path do %>
4
+ <label>
5
+ Text field <%= text_field_tag "text_field" %>
6
+ </label>
7
+
8
+ <label>
9
+ TOS <%= check_box_tag "tos" %>
10
+ </label>
11
+
12
+ <label>
13
+ Prefilled
14
+ <input type="text" name="prefilled" value="text" />
15
+ </label>
16
+
17
+ <label>
18
+ <%= select_tag "month", "<option></option><option>January</option>" %>
19
+ </label>
20
+
21
+ <% div_for FakeModel.new do %>
22
+ <label>
23
+ Object field <%= text_field_tag "object_field" %>
24
+ </label>
25
+ <% end %>
26
+
27
+ <%= submit_tag "Test" %>
28
+ <% end %>
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -7,6 +7,7 @@ ActionController::Routing::Routes.draw do |map|
7
7
  webrat.internal_redirect "/internal_redirect", :action => "internal_redirect"
8
8
  webrat.external_redirect "/external_redirect", :action => "external_redirect"
9
9
  webrat.infinite_redirect "/infinite_redirect", :action => "infinite_redirect"
10
+ webrat.host_redirect "/host_redirect", :action => "host_redirect"
10
11
 
11
12
  webrat.before_redirect_form "/before_redirect_form", :action => "before_redirect_form"
12
13
  webrat.redirect_to_show_params "/redirect_to_show_params", :action => "redirect_to_show_params"
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>The page you were looking for doesn't exist (404)</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/404.html -->
25
+ <div class="dialog">
26
+ <h1>The page you were looking for doesn't exist.</h1>
27
+ <p>You may have mistyped the address or the page may have moved.</p>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>The change you wanted was rejected (422)</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/422.html -->
25
+ <div class="dialog">
26
+ <h1>The change you wanted was rejected.</h1>
27
+ <p>Maybe you tried to change something you didn't have access to.</p>
28
+ </div>
29
+ </body>
30
+ </html>
@@ -0,0 +1,33 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
8
+ <title>We're sorry, but something went wrong (500)</title>
9
+ <style type="text/css">
10
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
11
+ div.dialog {
12
+ width: 25em;
13
+ padding: 0 4em;
14
+ margin: 4em auto 0 auto;
15
+ border: 1px solid #ccc;
16
+ border-right-color: #999;
17
+ border-bottom-color: #999;
18
+ }
19
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
20
+ </style>
21
+ </head>
22
+
23
+ <body>
24
+ <!-- This file lives in public/500.html -->
25
+ <div class="dialog">
26
+ <h1>We're sorry, but something went wrong.</h1>
27
+ <p>We've been notified about this issue and we'll take a look at it shortly.</p>
28
+ <p><small>(If you're the administrator of this website, then please read
29
+ the log file "<%=h RAILS_ENV %>.log"
30
+ to find out what went wrong.)</small></p>
31
+ </div>
32
+ </body>
33
+ </html>
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ $LOAD_PATH.unshift "#{RAILTIES_PATH}/builtin/rails_info"
4
+ require 'commands/about'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/console'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/dbconsole'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/destroy'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/generate'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/benchmarker'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/profiler'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/performance/request'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/plugin'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/inspector'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/reaper'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../../config/boot'
3
+ require 'commands/process/spawner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/runner'
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'commands/server'
@@ -42,7 +42,7 @@ class ButtonClickTest < ActionController::IntegrationTest
42
42
  visit buttons_path
43
43
  click_button "button_image_text"
44
44
  end
45
-
45
+
46
46
  # <input type="button" ...>
47
47
  test "should click image with type button by id" do
48
48
  visit buttons_path
@@ -76,5 +76,5 @@ class ButtonClickTest < ActionController::IntegrationTest
76
76
  visit buttons_path
77
77
  click_button "input_image_alt"
78
78
  end
79
-
79
+
80
80
  end
@@ -12,10 +12,16 @@ class LinkClickTest < ActionController::IntegrationTest
12
12
  click_link "link_by_id"
13
13
  assert_contain("Link:link_by_id")
14
14
  end
15
-
15
+
16
16
  test "should click link by title" do
17
17
  visit links_path
18
18
  click_link "LinkByTitle"
19
19
  assert_contain("Link:LinkByTitle")
20
20
  end
21
+
22
+ test "should be able to click links with non letter characters" do
23
+ visit links_path
24
+ click_link "Link With (parens)"
25
+ assert_contain("Link:link_with_parens")
26
+ end
21
27
  end
@@ -34,6 +34,9 @@ class WebratTest < ActionController::IntegrationTest
34
34
  fill_in "Text field", :with => "value"
35
35
  click_button
36
36
 
37
+ automate do
38
+ selenium.wait_for_page_to_load
39
+ end
37
40
  assert response.body !~ /value/
38
41
  assert response.body =~ /custom_param/
39
42
  end
@@ -49,6 +52,25 @@ class WebratTest < ActionController::IntegrationTest
49
52
  assert response.redirect?
50
53
  end
51
54
 
55
+ test "should recognize the host header to follow redirects properly" do
56
+ header "Host", "foo.bar"
57
+ visit host_redirect_path
58
+ assert !response.redirect?
59
+ assert response.body.include?("OK")
60
+ end
61
+
62
+ test "should click link by text" do
63
+ visit internal_redirect_path
64
+ click_link "Test Link Text"
65
+ assert_contain("Webrat Form")
66
+ end
67
+
68
+ test "should click link by id" do
69
+ visit internal_redirect_path
70
+ click_link "link_id"
71
+ assert_contain("Webrat Form")
72
+ end
73
+
52
74
  test "should be able to assert xpath" do
53
75
  visit root_path
54
76
  assert_have_xpath "//h1"
@@ -2,12 +2,13 @@ ENV["RAILS_ENV"] = "test"
2
2
  require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
3
3
  require 'test_help'
4
4
 
5
- begin
6
- require "redgreen"
7
- rescue MissingSourceFile
8
- end
5
+ # begin
6
+ # require "redgreen"
7
+ # rescue MissingSourceFile
8
+ # end
9
9
 
10
- require File.dirname(__FILE__) + "/../../../../lib/webrat"
10
+ $LOAD_PATH.unshift File.dirname(__FILE__) + "/../../../../lib"
11
+ require "webrat"
11
12
 
12
13
  Webrat.configure do |config|
13
14
  config.mode = ENV['WEBRAT_INTEGRATION_MODE'].to_sym