webrat 0.4.4 → 0.4.5
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.
- data/.document +4 -0
- data/.gitignore +15 -0
- data/History.txt +44 -8
- data/Rakefile +80 -66
- data/VERSION +1 -0
- data/lib/webrat.rb +7 -12
- data/lib/webrat/core/configuration.rb +7 -3
- data/lib/webrat/core/elements/area.rb +7 -7
- data/lib/webrat/core/elements/element.rb +11 -11
- data/lib/webrat/core/elements/field.rb +63 -55
- data/lib/webrat/core/elements/form.rb +17 -17
- data/lib/webrat/core/elements/label.rb +6 -6
- data/lib/webrat/core/elements/link.rb +13 -12
- data/lib/webrat/core/elements/select_option.rb +9 -9
- data/lib/webrat/core/locators.rb +2 -2
- data/lib/webrat/core/locators/area_locator.rb +10 -10
- data/lib/webrat/core/locators/button_locator.rb +13 -13
- data/lib/webrat/core/locators/field_by_id_locator.rb +8 -8
- data/lib/webrat/core/locators/field_labeled_locator.rb +11 -11
- data/lib/webrat/core/locators/field_locator.rb +7 -7
- data/lib/webrat/core/locators/field_named_locator.rb +10 -10
- data/lib/webrat/core/locators/form_locator.rb +6 -6
- data/lib/webrat/core/locators/label_locator.rb +9 -9
- data/lib/webrat/core/locators/link_locator.rb +21 -13
- data/lib/webrat/core/locators/locator.rb +5 -5
- data/lib/webrat/core/locators/select_option_locator.rb +11 -11
- data/lib/webrat/core/logging.rb +7 -4
- data/lib/webrat/core/matchers/have_content.rb +12 -12
- data/lib/webrat/core/matchers/have_selector.rb +9 -9
- data/lib/webrat/core/matchers/have_tag.rb +4 -4
- data/lib/webrat/core/matchers/have_xpath.rb +26 -26
- data/lib/webrat/core/methods.rb +13 -11
- data/lib/webrat/core/mime.rb +3 -3
- data/lib/webrat/core/save_and_open_page.rb +14 -16
- data/lib/webrat/core/scope.rb +53 -53
- data/lib/webrat/core/session.rb +23 -14
- data/lib/webrat/core/xml.rb +16 -16
- data/lib/webrat/core/xml/hpricot.rb +3 -3
- data/lib/webrat/core/xml/nokogiri.rb +11 -11
- data/lib/webrat/core/xml/rexml.rb +3 -3
- data/lib/webrat/core_extensions/blank.rb +1 -1
- data/lib/webrat/core_extensions/deprecate.rb +1 -1
- data/lib/webrat/core_extensions/detect_mapped.rb +4 -4
- data/lib/webrat/core_extensions/meta_class.rb +1 -1
- data/lib/webrat/core_extensions/tcp_socket.rb +8 -8
- data/lib/webrat/mechanize.rb +9 -9
- data/lib/webrat/merb.rb +1 -1
- data/lib/webrat/merb_multipart_support.rb +27 -0
- data/lib/webrat/merb_session.rb +39 -24
- data/lib/webrat/rack_test.rb +32 -0
- data/lib/webrat/rails.rb +2 -2
- data/lib/webrat/rspec-rails.rb +3 -6
- data/lib/webrat/selenium.rb +2 -1
- data/lib/webrat/selenium/application_server_factory.rb +40 -0
- data/lib/webrat/selenium/application_servers.rb +5 -0
- data/lib/webrat/selenium/application_servers/base.rb +46 -0
- data/lib/webrat/selenium/application_servers/external.rb +26 -0
- data/lib/webrat/selenium/application_servers/merb.rb +50 -0
- data/lib/webrat/selenium/application_servers/rails.rb +44 -0
- data/lib/webrat/selenium/application_servers/sinatra.rb +37 -0
- data/lib/webrat/selenium/location_strategy_javascript/button.js +14 -7
- data/lib/webrat/selenium/location_strategy_javascript/webratlink.js +4 -1
- data/lib/webrat/selenium/matchers.rb +1 -1
- data/lib/webrat/selenium/matchers/have_content.rb +4 -4
- data/lib/webrat/selenium/matchers/have_selector.rb +4 -4
- data/lib/webrat/selenium/matchers/have_tag.rb +16 -16
- data/lib/webrat/selenium/matchers/have_xpath.rb +4 -4
- data/lib/webrat/selenium/selenium_rc_server.rb +25 -19
- data/lib/webrat/selenium/selenium_session.rb +24 -17
- data/lib/webrat/selenium/silence_stream.rb +18 -0
- data/spec/fakes/test_session.rb +34 -0
- data/spec/integration/merb/.gitignore +21 -0
- data/spec/integration/merb/Rakefile +35 -0
- data/spec/integration/merb/app/controllers/application.rb +2 -0
- data/spec/integration/merb/app/controllers/exceptions.rb +13 -0
- data/spec/integration/merb/app/controllers/testing.rb +27 -0
- data/spec/integration/merb/app/views/exceptions/not_acceptable.html.erb +63 -0
- data/spec/integration/merb/app/views/exceptions/not_found.html.erb +47 -0
- data/spec/integration/merb/app/views/layout/application.html.erb +12 -0
- data/spec/integration/merb/app/views/testing/show_form.html.erb +27 -0
- data/spec/integration/merb/app/views/testing/upload.html.erb +9 -0
- data/spec/integration/merb/config/environments/development.rb +15 -0
- data/spec/integration/merb/config/environments/rake.rb +11 -0
- data/spec/integration/merb/config/environments/test.rb +14 -0
- data/spec/integration/merb/config/init.rb +25 -0
- data/spec/integration/merb/config/rack.rb +11 -0
- data/spec/integration/merb/config/router.rb +34 -0
- data/spec/integration/merb/spec/spec.opts +1 -0
- data/spec/integration/merb/spec/spec_helper.rb +24 -0
- data/spec/integration/merb/spec/webrat_spec.rb +39 -0
- data/spec/integration/merb/tasks/merb.thor/app_script.rb +31 -0
- data/spec/integration/merb/tasks/merb.thor/common.rb +64 -0
- data/spec/integration/merb/tasks/merb.thor/gem_ext.rb +124 -0
- data/spec/integration/merb/tasks/merb.thor/main.thor +150 -0
- data/spec/integration/merb/tasks/merb.thor/ops.rb +93 -0
- data/spec/integration/merb/tasks/merb.thor/utils.rb +40 -0
- data/spec/integration/rack/Rakefile +5 -0
- data/spec/integration/rack/rack_app.rb +16 -0
- data/spec/integration/rack/test/test_helper.rb +20 -0
- data/spec/integration/rack/test/webrat_rack_test.rb +67 -0
- data/spec/integration/rails/.gitignore +3 -0
- data/spec/integration/rails/Rakefile +30 -0
- data/spec/integration/rails/app/controllers/application.rb +15 -0
- data/spec/integration/rails/app/controllers/buttons_controller.rb +7 -0
- data/spec/integration/rails/app/controllers/fields_controller.rb +4 -0
- data/spec/integration/rails/app/controllers/links_controller.rb +7 -0
- data/spec/integration/rails/app/controllers/webrat_controller.rb +43 -0
- data/spec/integration/rails/app/helpers/buttons_helper.rb +2 -0
- data/spec/integration/rails/app/helpers/fields_helper.rb +2 -0
- data/spec/integration/rails/app/helpers/links_helper.rb +2 -0
- data/spec/integration/rails/app/views/buttons/show.html.erb +11 -0
- data/spec/integration/rails/app/views/fields/show.html.erb +9 -0
- data/spec/integration/rails/app/views/links/show.html.erb +5 -0
- data/spec/integration/rails/app/views/webrat/before_redirect_form.html.erb +4 -0
- data/spec/integration/rails/app/views/webrat/buttons.html.erb +11 -0
- data/spec/integration/rails/app/views/webrat/form.html.erb +28 -0
- data/spec/integration/rails/config/boot.rb +109 -0
- data/spec/integration/rails/config/environment.rb +12 -0
- data/spec/integration/rails/config/environments/development.rb +17 -0
- data/spec/integration/rails/config/environments/selenium.rb +22 -0
- data/spec/integration/rails/config/environments/test.rb +22 -0
- data/spec/integration/rails/config/initializers/inflections.rb +10 -0
- data/spec/integration/rails/config/initializers/mime_types.rb +5 -0
- data/spec/integration/rails/config/initializers/new_rails_defaults.rb +17 -0
- data/spec/integration/rails/config/locales/en.yml +5 -0
- data/spec/integration/rails/config/routes.rb +18 -0
- data/spec/integration/rails/public/404.html +30 -0
- data/spec/integration/rails/public/422.html +30 -0
- data/spec/integration/rails/public/500.html +33 -0
- data/spec/integration/rails/script/about +4 -0
- data/spec/integration/rails/script/console +3 -0
- data/spec/integration/rails/script/dbconsole +3 -0
- data/spec/integration/rails/script/destroy +3 -0
- data/spec/integration/rails/script/generate +3 -0
- data/spec/integration/rails/script/performance/benchmarker +3 -0
- data/spec/integration/rails/script/performance/profiler +3 -0
- data/spec/integration/rails/script/performance/request +3 -0
- data/spec/integration/rails/script/plugin +3 -0
- data/spec/integration/rails/script/process/inspector +3 -0
- data/spec/integration/rails/script/process/reaper +3 -0
- data/spec/integration/rails/script/process/spawner +3 -0
- data/spec/integration/rails/script/runner +3 -0
- data/spec/integration/rails/script/server +3 -0
- data/spec/integration/rails/test/integration/button_click_test.rb +80 -0
- data/spec/integration/rails/test/integration/fill_in_test.rb +24 -0
- data/spec/integration/rails/test/integration/link_click_test.rb +27 -0
- data/spec/integration/rails/test/integration/webrat_test.rb +97 -0
- data/spec/integration/rails/test/test_helper.rb +25 -0
- data/spec/integration/sinatra/Rakefile +5 -0
- data/spec/integration/sinatra/classic_app.rb +64 -0
- data/spec/integration/sinatra/modular_app.rb +16 -0
- data/spec/integration/sinatra/test/classic_app_test.rb +37 -0
- data/spec/integration/sinatra/test/modular_app_test.rb +18 -0
- data/spec/integration/sinatra/test/test_helper.rb +16 -0
- data/spec/private/core/configuration_spec.rb +116 -0
- data/spec/private/core/field_spec.rb +85 -0
- data/spec/private/core/link_spec.rb +24 -0
- data/spec/private/core/logging_spec.rb +10 -0
- data/spec/private/core/session_spec.rb +195 -0
- data/spec/private/mechanize/mechanize_session_spec.rb +81 -0
- data/spec/private/merb/attaches_file_spec.rb +93 -0
- data/spec/private/merb/merb_session_spec.rb +61 -0
- data/spec/private/nokogiri_spec.rb +77 -0
- data/spec/private/rails/attaches_file_spec.rb +81 -0
- data/spec/private/rails/rails_session_spec.rb +110 -0
- data/spec/private/selenium/application_servers/rails_spec.rb +26 -0
- data/spec/public/basic_auth_spec.rb +24 -0
- data/spec/public/check_spec.rb +191 -0
- data/spec/public/choose_spec.rb +118 -0
- data/spec/public/click_area_spec.rb +106 -0
- data/spec/public/click_button_spec.rb +496 -0
- data/spec/public/click_link_spec.rb +511 -0
- data/spec/public/fill_in_spec.rb +209 -0
- data/spec/public/locators/field_by_xpath_spec.rb +19 -0
- data/spec/public/locators/field_labeled_spec.rb +172 -0
- data/spec/public/locators/field_with_id_spec.rb +16 -0
- data/spec/public/matchers/contain_spec.rb +114 -0
- data/spec/public/matchers/have_selector_spec.rb +142 -0
- data/spec/public/matchers/have_tag_spec.rb +39 -0
- data/spec/public/matchers/have_xpath_spec.rb +136 -0
- data/spec/public/reload_spec.rb +10 -0
- data/spec/public/save_and_open_spec.rb +70 -0
- data/spec/public/select_date_spec.rb +112 -0
- data/spec/public/select_datetime_spec.rb +137 -0
- data/spec/public/select_spec.rb +249 -0
- data/spec/public/select_time_spec.rb +100 -0
- data/spec/public/selenium/application_server_factory_spec.rb +49 -0
- data/spec/public/selenium/application_servers/external_spec.rb +12 -0
- data/spec/public/selenium/selenium_session_spec.rb +37 -0
- data/spec/public/set_hidden_field_spec.rb +5 -0
- data/spec/public/submit_form_spec.rb +5 -0
- data/spec/public/visit_spec.rb +58 -0
- data/spec/public/within_spec.rb +177 -0
- data/spec/rcov.opts +1 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +50 -0
- data/vendor/selenium-server.jar +0 -0
- data/webrat.gemspec +340 -0
- metadata +248 -33
- data/lib/webrat/selenium/application_server.rb +0 -71
- data/lib/webrat/selenium/merb_application_server.rb +0 -48
- data/lib/webrat/selenium/rails_application_server.rb +0 -42
- data/lib/webrat/selenium/sinatra_application_server.rb +0 -35
data/.document
ADDED
data/.gitignore
ADDED
data/History.txt
CHANGED
|
@@ -1,11 +1,46 @@
|
|
|
1
|
+
== 0.4.5 / 2009-08-10
|
|
2
|
+
|
|
3
|
+
* Major enhancements
|
|
4
|
+
|
|
5
|
+
* Ruby 1.9 compatibility (Michael Fellinger, Jakub Kuźma)
|
|
6
|
+
* Improve performance (~2x) on JRuby by supporting Nokogiri
|
|
7
|
+
* Added support for external app servers in selenium mode (basically don't start one) (Mike Gaffney)
|
|
8
|
+
* Added support for uploading files for Merb (Ryan Carver)
|
|
9
|
+
|
|
10
|
+
* Minor enhancements
|
|
11
|
+
|
|
12
|
+
* Upgrade to selenium-client to 1.2.16 (Brian Landau)
|
|
13
|
+
* Upgrade selenium-server.jar to 1.0.1 (Brian Landau)
|
|
14
|
+
* Make redirect detection work in the face of rational maths (like when ruby-units is active) (Piers Cawley)
|
|
15
|
+
* Use Launchy to handle opening pages in the browser with cross-platform compatibility (Bryan Helmkamp)
|
|
16
|
+
* Added support for field_labeled_locators ending in non word characters
|
|
17
|
+
lh 148 (Zach Dennis)
|
|
18
|
+
* Filled in tests on click link lh 195 (diabolo)
|
|
19
|
+
* Added current_url to selenium session lh 215 (Luke Amdor)
|
|
20
|
+
* Added silence spec to selenium lh 238 (Martin Gamsjaeger aka snusnu)
|
|
21
|
+
* Added ability to configure the browser startup timeout for selenium lh 242 (Mike Gaffney, Mark Dodwell)
|
|
22
|
+
* Added delegation for field_named lh194 (pivotal labs)
|
|
23
|
+
* Added fix to keep from escaping field values in mechanize mode lh256 (jish)
|
|
24
|
+
* Adding fixes for click button/link and made the integration specs pass for the same in selenium lh254 (Ldiehl, Matthias Marschall)
|
|
25
|
+
* Adding clicking link by id in selenium mode lh221 (larrytheliquid)
|
|
26
|
+
* Adding fix for have_selector and have_xpath in descendent blocks lh234 (Thomas Jack)
|
|
27
|
+
* Adding fix for fields with labels with special characters (Thomas Jack, Mike Gaffney, Bryan Hemlkamp)
|
|
28
|
+
* Deprecated current_page lh50 (Mike Gaffney)
|
|
29
|
+
* Fixed issue with redirects and multiple hosts lh168 (Mutwin Kraus)
|
|
30
|
+
|
|
31
|
+
* Bug fixes
|
|
32
|
+
|
|
33
|
+
* Wait for application servers socket on 0.0.0.0 instead of the application_address
|
|
34
|
+
* Translate CSS and image paths with single quotes in save_and_open_page (Erin Staniland)
|
|
35
|
+
|
|
1
36
|
== 0.4.4 / 2009-04-06
|
|
2
37
|
|
|
3
38
|
* Major enhancements
|
|
4
39
|
|
|
5
40
|
* Make selenium process management code more robust and informative
|
|
6
|
-
|
|
41
|
+
|
|
7
42
|
* Minor enhancements
|
|
8
|
-
|
|
43
|
+
|
|
9
44
|
* Add support for Rails javascript post links (Mark Menard)
|
|
10
45
|
* Upgrade selenium-client dependency to 1.2.14, and update for new waiting
|
|
11
46
|
API (Balint Erdi)
|
|
@@ -15,7 +50,8 @@
|
|
|
15
50
|
|
|
16
51
|
* Don't create a new instance of WWW::Mechanize for each request
|
|
17
52
|
(Mark Menard)
|
|
18
|
-
|
|
53
|
+
* Select fields with duplicate selected options sent an incorrect value (Noah Davis)
|
|
54
|
+
|
|
19
55
|
== 0.4.3 / 2009-03-17
|
|
20
56
|
|
|
21
57
|
* Minor enhancements
|
|
@@ -25,7 +61,7 @@
|
|
|
25
61
|
* Initial Merb and Sinatra compatibility for Selenium mode (Corey Donohoe)
|
|
26
62
|
* When faced with a label with no for attribute, that contains a hidden field
|
|
27
63
|
and another field, as can be the case in Rails 2.3's checkbox view,
|
|
28
|
-
webrat now locates the non-hidden field. (Luke Melia)
|
|
64
|
+
webrat now locates the non-hidden field. (Luke Melia)
|
|
29
65
|
* Add application_framework config for Selenium mode to determine how to
|
|
30
66
|
start and stop the app server (Corey Donohoe)
|
|
31
67
|
|
|
@@ -41,7 +77,7 @@
|
|
|
41
77
|
attributes in a hash and :count and :content options. See
|
|
42
78
|
have_selector_spec.rb for more.
|
|
43
79
|
* Add the same functionality mentioned above to have_xpath
|
|
44
|
-
|
|
80
|
+
|
|
45
81
|
* Minor enhancements
|
|
46
82
|
|
|
47
83
|
* Squeeze extra whitespace out of failures messages from contain
|
|
@@ -68,7 +104,7 @@
|
|
|
68
104
|
redirected to (Adam Greene)
|
|
69
105
|
* Recognize input tags with type button (Lena Herrmann)
|
|
70
106
|
* Add uncheck method to Selenium mode (Lee Bankewitz)
|
|
71
|
-
|
|
107
|
+
|
|
72
108
|
* Bug fixes
|
|
73
109
|
|
|
74
110
|
* Make requests to a Rails app using a full URL instead of a relative path. This change
|
|
@@ -79,7 +115,7 @@
|
|
|
79
115
|
to behave correctly (Noah Davis)
|
|
80
116
|
* Switch to using selenium.click instead of .check when checking a checkbox
|
|
81
117
|
(Noah Davis)
|
|
82
|
-
* Create tmp/pids directory if directory does not exist. (Amos King and Mike Gaffney)
|
|
118
|
+
* Create tmp/pids directory if directory does not exist. (Amos King and Mike Gaffney)
|
|
83
119
|
* Setup deprecated writers for the selenium_environment= and selenium_port= config
|
|
84
120
|
* Ensure the previous pages params aren't passed through redirect (Daniel Lucraft and
|
|
85
121
|
Bryan Helmkamp)
|
|
@@ -155,7 +191,7 @@
|
|
|
155
191
|
* Added save_and_open_screengrab for Selenium mode (Luke Melia)
|
|
156
192
|
|
|
157
193
|
* Bug fixes
|
|
158
|
-
|
|
194
|
+
|
|
159
195
|
* field_labeled should disregard labels without matching fields (Kyle Hargraves)
|
|
160
196
|
* Fixed bug where Scope was creating a new DOM rather than re-using the existing DOM.
|
|
161
197
|
[#105] (Zach Dennis)
|
data/Rakefile
CHANGED
|
@@ -1,54 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
require
|
|
3
|
-
require 'rake/rdoctask'
|
|
4
|
-
require "rake/clean"
|
|
5
|
-
require 'spec'
|
|
6
|
-
require 'spec/rake/spectask'
|
|
7
|
-
require 'spec/rake/verify_rcov'
|
|
8
|
-
require File.expand_path('./lib/webrat.rb')
|
|
9
|
-
|
|
10
|
-
##############################################################################
|
|
11
|
-
# Package && release
|
|
12
|
-
##############################################################################
|
|
13
|
-
spec = Gem::Specification.new do |s|
|
|
14
|
-
s.name = "webrat"
|
|
15
|
-
s.version = Webrat::VERSION
|
|
16
|
-
s.platform = Gem::Platform::RUBY
|
|
17
|
-
s.author = "Bryan Helmkamp"
|
|
18
|
-
s.email = "bryan" + "@" + "brynary.com"
|
|
19
|
-
s.homepage = "http://github.com/brynary/webrat"
|
|
20
|
-
s.summary = "Webrat. Ruby Acceptance Testing for Web applications"
|
|
21
|
-
s.bindir = "bin"
|
|
22
|
-
s.description = s.summary
|
|
23
|
-
s.require_path = "lib"
|
|
24
|
-
s.files = %w(History.txt install.rb MIT-LICENSE.txt README.rdoc Rakefile) + Dir["lib/**/*"] + Dir["vendor/**/*"]
|
|
25
|
-
|
|
26
|
-
# rdoc
|
|
27
|
-
s.has_rdoc = true
|
|
28
|
-
s.extra_rdoc_files = %w(README.rdoc MIT-LICENSE.txt)
|
|
29
|
-
|
|
30
|
-
# Dependencies
|
|
31
|
-
s.add_dependency "nokogiri", ">= 1.2.0"
|
|
32
|
-
|
|
33
|
-
s.rubyforge_project = "webrat"
|
|
34
|
-
end
|
|
1
|
+
begin
|
|
2
|
+
require 'jeweler'
|
|
35
3
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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 = "TODO"
|
|
39
11
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
puts spec.to_ruby
|
|
43
|
-
end
|
|
12
|
+
s.rubyforge_project = "webrat"
|
|
13
|
+
s.extra_rdoc_files = %w[README.rdoc MIT-LICENSE.txt History.txt]
|
|
44
14
|
|
|
45
|
-
|
|
15
|
+
# Dependencies
|
|
16
|
+
s.add_dependency "nokogiri", ">= 1.2.0"
|
|
46
17
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
18
|
+
# TODO: Add development dependencies
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Jeweler::RubyforgeTasks.new
|
|
22
|
+
rescue LoadError
|
|
23
|
+
puts "Jeweler not available. Install it with: gem install jeweler"
|
|
50
24
|
end
|
|
51
25
|
|
|
26
|
+
# require 'spec'
|
|
27
|
+
require 'spec/rake/spectask'
|
|
28
|
+
require 'spec/rake/verify_rcov'
|
|
29
|
+
|
|
52
30
|
desc "Run API and Core specs"
|
|
53
31
|
Spec::Rake::SpecTask.new do |t|
|
|
54
32
|
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
|
@@ -69,26 +47,47 @@ RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
|
|
|
69
47
|
t.threshold = 96.2 # Make sure you have rcov 0.7 or higher!
|
|
70
48
|
end
|
|
71
49
|
|
|
72
|
-
desc
|
|
73
|
-
task :
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
50
|
+
desc "Run everything against multiruby"
|
|
51
|
+
task :multiruby do
|
|
52
|
+
result = system "multiruby -S rake spec"
|
|
53
|
+
raise "Multiruby tests failed" unless result
|
|
54
|
+
result = system "jruby -S rake spec"
|
|
55
|
+
raise "JRuby tests failed" unless result
|
|
77
56
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
end
|
|
57
|
+
Dir.chdir "spec/integration/rails" do
|
|
58
|
+
result = system "multiruby -S rake test_unit:rails"
|
|
59
|
+
raise "Rails integration tests failed" unless result
|
|
82
60
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
end
|
|
61
|
+
result = system "jruby -S rake test_unit:rails"
|
|
62
|
+
raise "Rails integration tests failed" unless result
|
|
63
|
+
end
|
|
87
64
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
65
|
+
Dir.chdir "spec/integration/merb" do
|
|
66
|
+
result = system "multiruby -S rake spec"
|
|
67
|
+
raise "Merb integration tests failed" unless result
|
|
68
|
+
|
|
69
|
+
result = system "jruby -S rake spec"
|
|
70
|
+
raise "Rails integration tests failed" unless result
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
Dir.chdir "spec/integration/sinatra" do
|
|
74
|
+
result = system "multiruby -S rake test"
|
|
75
|
+
raise "Sinatra integration tests failed" unless result
|
|
76
|
+
|
|
77
|
+
result = system "jruby -S rake test"
|
|
78
|
+
raise "Sinatra integration tests failed" unless result
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
Dir.chdir "spec/integration/rack" do
|
|
82
|
+
result = system "multiruby -S rake test"
|
|
83
|
+
raise "Rack integration tests failed" unless result
|
|
84
|
+
|
|
85
|
+
result = system "jruby -S rake test"
|
|
86
|
+
raise "Rack integration tests failed" unless result
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
puts
|
|
90
|
+
puts "Multiruby OK!"
|
|
92
91
|
end
|
|
93
92
|
|
|
94
93
|
desc "Run each spec in isolation to test for dependency issues"
|
|
@@ -106,7 +105,7 @@ end
|
|
|
106
105
|
|
|
107
106
|
namespace :spec do
|
|
108
107
|
desc "Run the integration specs"
|
|
109
|
-
task :integration => ["integration:rails", "integration:merb", "integration:sinatra"]
|
|
108
|
+
task :integration => ["integration:rails", "integration:merb", "integration:sinatra", "integration:rack"]
|
|
110
109
|
|
|
111
110
|
namespace :integration do
|
|
112
111
|
desc "Run the Rails integration specs"
|
|
@@ -140,12 +139,27 @@ namespace :spec do
|
|
|
140
139
|
task :sinatra do
|
|
141
140
|
Dir.chdir "spec/integration/sinatra" do
|
|
142
141
|
result = system "rake test"
|
|
143
|
-
raise "Sinatra
|
|
142
|
+
raise "Sinatra integration tests failed" unless result
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
desc "Run the Sinatra integration specs"
|
|
147
|
+
task :rack do
|
|
148
|
+
Dir.chdir "spec/integration/rack" do
|
|
149
|
+
result = system "rake test"
|
|
150
|
+
raise "Rack integration tests failed" unless result
|
|
144
151
|
end
|
|
145
152
|
end
|
|
146
153
|
end
|
|
147
154
|
end
|
|
148
155
|
|
|
149
|
-
|
|
156
|
+
desc 'Removes trailing whitespace'
|
|
157
|
+
task :whitespace do
|
|
158
|
+
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if defined?(Jeweler)
|
|
162
|
+
task :spec => :check_dependencies
|
|
163
|
+
end
|
|
150
164
|
|
|
151
|
-
task :
|
|
165
|
+
task :default => :spec
|
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.4.5
|
data/lib/webrat.rb
CHANGED
|
@@ -7,26 +7,21 @@ module Webrat
|
|
|
7
7
|
class WebratError < StandardError
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
VERSION = '0.4.4'
|
|
11
|
-
|
|
12
10
|
def self.require_xml
|
|
13
|
-
gem "nokogiri", ">= 1.0.6"
|
|
14
|
-
|
|
15
11
|
if on_java?
|
|
16
|
-
|
|
17
|
-
require "nokogiri/css"
|
|
18
|
-
require "hpricot"
|
|
19
|
-
require "rexml/document"
|
|
12
|
+
gem "nokogiri", ">= 1.2.4"
|
|
20
13
|
else
|
|
21
|
-
|
|
22
|
-
require "webrat/core/xml/nokogiri"
|
|
14
|
+
gem "nokogiri", ">= 1.0.6"
|
|
23
15
|
end
|
|
16
|
+
|
|
17
|
+
require "nokogiri"
|
|
18
|
+
require "webrat/core/xml/nokogiri"
|
|
24
19
|
end
|
|
25
|
-
|
|
20
|
+
|
|
26
21
|
def self.on_java?
|
|
27
22
|
RUBY_PLATFORM =~ /java/
|
|
28
23
|
end
|
|
29
|
-
|
|
24
|
+
|
|
30
25
|
end
|
|
31
26
|
|
|
32
27
|
Webrat.require_xml
|
|
@@ -54,13 +54,16 @@ module Webrat
|
|
|
54
54
|
# Set the key that Selenium uses to determine the browser running. Default *firefox
|
|
55
55
|
attr_accessor :selenium_browser_key
|
|
56
56
|
|
|
57
|
+
# Set the timeout for waiting for the browser process to start
|
|
58
|
+
attr_accessor :selenium_browser_startup_timeout
|
|
59
|
+
|
|
57
60
|
# How many redirects to the same URL should be halted as an infinite redirect
|
|
58
61
|
# loop? Defaults to 10
|
|
59
62
|
attr_accessor :infinite_redirect_limit
|
|
60
|
-
|
|
63
|
+
|
|
61
64
|
def initialize # :nodoc:
|
|
62
65
|
self.open_error_files = true
|
|
63
|
-
self.parse_with_nokogiri =
|
|
66
|
+
self.parse_with_nokogiri = true
|
|
64
67
|
self.application_environment = :test
|
|
65
68
|
self.application_port = 3001
|
|
66
69
|
self.application_address = 'localhost'
|
|
@@ -68,6 +71,7 @@ module Webrat
|
|
|
68
71
|
self.selenium_server_port = 4444
|
|
69
72
|
self.infinite_redirect_limit = 10
|
|
70
73
|
self.selenium_browser_key = '*firefox'
|
|
74
|
+
self.selenium_browser_startup_timeout = 5
|
|
71
75
|
end
|
|
72
76
|
|
|
73
77
|
def parse_with_nokogiri? #:nodoc:
|
|
@@ -82,7 +86,7 @@ module Webrat
|
|
|
82
86
|
# :rails, :selenium, :rack, :sinatra, :mechanize, :merb
|
|
83
87
|
def mode=(mode)
|
|
84
88
|
@mode = mode.to_sym
|
|
85
|
-
|
|
89
|
+
|
|
86
90
|
# This is a temporary hack to support backwards compatibility
|
|
87
91
|
# with Merb 1.0.8 until it's updated to use the new Webrat.configure
|
|
88
92
|
# syntax
|
|
@@ -2,21 +2,21 @@ require "webrat/core/elements/element"
|
|
|
2
2
|
|
|
3
3
|
module Webrat
|
|
4
4
|
class Area < Element #:nodoc:
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
def self.xpath_search
|
|
7
7
|
".//area"
|
|
8
8
|
end
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
def click(method = nil, options = {})
|
|
11
11
|
@session.request_page(absolute_href, :get, {})
|
|
12
12
|
end
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
protected
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
def href
|
|
17
17
|
Webrat::XML.attribute(@element, "href")
|
|
18
18
|
end
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
def absolute_href
|
|
21
21
|
if href =~ /^\?/
|
|
22
22
|
"#{@session.current_url}#{href}"
|
|
@@ -26,6 +26,6 @@ module Webrat
|
|
|
26
26
|
href
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
end
|
|
31
|
-
end
|
|
31
|
+
end
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
module Webrat
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
class Element # :nodoc:
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
def self.load_all(session, dom)
|
|
6
|
-
Webrat::XML.xpath_search(dom, xpath_search).map do |element|
|
|
6
|
+
Webrat::XML.xpath_search(dom, xpath_search).map do |element|
|
|
7
7
|
load(session, element)
|
|
8
8
|
end
|
|
9
9
|
end
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
def self.load(session, element)
|
|
12
12
|
return nil if element.nil?
|
|
13
13
|
session.elements[Webrat::XML.xpath_to(element)] ||= self.new(session, element)
|
|
14
14
|
end
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
attr_reader :element
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
def initialize(session, element)
|
|
19
19
|
@session = session
|
|
20
20
|
@element = element
|
|
21
21
|
end
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
def path
|
|
24
24
|
Webrat::XML.xpath_to(@element)
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
def inspect
|
|
28
28
|
"#<#{self.class} @element=#{element.inspect}>"
|
|
29
29
|
end
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
end
|
|
32
|
-
|
|
33
|
-
end
|
|
32
|
+
|
|
33
|
+
end
|