honkster-webrat 0.6.0 → 0.6.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -1
- data/Gemfile +19 -0
- data/History.txt +4 -1
- data/Rakefile +0 -44
- data/Thorfile +117 -0
- data/honkster-webrat.gemspec +348 -0
- data/lib/webrat/core/configuration.rb +4 -0
- data/lib/webrat/core/elements/link.rb +1 -1
- data/lib/webrat/core/locators/link_locator.rb +15 -2
- data/lib/webrat/core/session.rb +1 -1
- data/lib/webrat/integrations/rspec-rails.rb +2 -1
- data/lib/webrat/selenium/selenium_session.rb +8 -3
- data/lib/webrat.rb +1 -5
- data/spec/integration/mechanize/spec/spec_helper.rb +3 -1
- data/spec/integration/rails/app/controllers/{application.rb → application_controller.rb} +0 -0
- data/spec/integration/rails/app/views/buttons/show.html.erb +0 -2
- data/spec/integration/rails/app/views/webrat/buttons.html.erb +0 -2
- data/spec/integration/rails/config/environment.rb +1 -1
- data/spec/integration/rails/test/integration/button_click_test.rb +11 -25
- data/spec/integration/rails/test/integration/webrat_test.rb +1 -0
- data/spec/integration/rails/test/test_helper.rb +1 -0
- data/spec/private/core/configuration_spec.rb +5 -0
- data/spec/private/core/field_spec.rb +9 -11
- data/spec/private/core/session_spec.rb +1 -0
- data/spec/public/basic_auth_spec.rb +13 -2
- data/spec/public/click_link_spec.rb +105 -56
- data/spec/public/save_and_open_spec.rb +1 -0
- data/spec/public/selenium/application_servers/external_spec.rb +3 -1
- data/spec/public/selenium/selenium_session_spec.rb +3 -3
- metadata +12 -41
- data/VERSION +0 -1
- data/webrat.gemspec +0 -360
data/.gitignore
CHANGED
data/Gemfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
clear_sources
|
2
|
+
source 'http://gemcutter.org'
|
3
|
+
|
4
|
+
disable_system_gems
|
5
|
+
|
6
|
+
gem "git", "1.2.5"
|
7
|
+
gem "rake", "0.8.7"
|
8
|
+
gem "rspec", "1.2.9"
|
9
|
+
gem "diff-lcs", "1.1.2"
|
10
|
+
gem "rack", "1.0.1"
|
11
|
+
gem "nokogiri", "1.4.0"
|
12
|
+
gem "merb-core", "1.0.15"
|
13
|
+
gem "selenium-client", "1.2.17"
|
14
|
+
gem "mechanize", "0.9.3"
|
15
|
+
gem "rails", "2.3.4"
|
16
|
+
gem "launchy", "0.3.3"
|
17
|
+
gem "rack-test", "0.5.2"
|
18
|
+
gem "sinatra", "0.9.4"
|
19
|
+
gem "mongrel", "1.1.5"
|
data/History.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
== 0.6.
|
1
|
+
== 0.6.0 / 2009-11-28
|
2
2
|
|
3
3
|
REMOVED: Support for Hpricot + REXML as an alternative to Nokogiri.
|
4
4
|
|
@@ -12,6 +12,7 @@ CHANGED: Due to a reorganization, if you're currently requiring "webrat/rspec-ra
|
|
12
12
|
|
13
13
|
* Minor enhancements
|
14
14
|
|
15
|
+
* Support Rails 2.3.4 JavaScript form authenticity tokens in simulated mode (Jonathan Weiss)
|
15
16
|
* When a timeout occurs in wait_for, include the HTML from Selenium in the exception
|
16
17
|
* Update the Merb support to be based directly on Rack (Simon Rozet)
|
17
18
|
* Support multiple select fields (Kieran P)
|
@@ -19,6 +20,8 @@ CHANGED: Due to a reorganization, if you're currently requiring "webrat/rspec-ra
|
|
19
20
|
|
20
21
|
* Bug fixes
|
21
22
|
|
23
|
+
* Remove newlines from HTTP Basic authentication credentials (Michael Klett)
|
24
|
+
* Require nokogiri form rspec-rails.rb (David Chelimsky)
|
22
25
|
* Fix logger issue when running inside Cucumber (Damian Janowski)
|
23
26
|
* Fix various issues related to submitting values with HTML entities (Kieran P)
|
24
27
|
* Call #to_i on the :count option in matchers (Michael Christenson II)
|
data/Rakefile
CHANGED
@@ -1,43 +1,5 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
|
3
|
-
begin
|
4
|
-
require 'jeweler'
|
5
|
-
rescue LoadError
|
6
|
-
desc "Install gem using sudo"
|
7
|
-
task(:install) do
|
8
|
-
$stderr.puts "Jeweler not available. `gem install jeweler` to install this gem"
|
9
|
-
end
|
10
|
-
else
|
11
|
-
Jeweler::Tasks.new do |s|
|
12
|
-
s.name = "honkster-webrat"
|
13
|
-
s.author = "Bryan Helmkamp"
|
14
|
-
s.email = "bryan" + "@" + "brynary.com"
|
15
|
-
s.homepage = "http://github.com/brynary/webrat"
|
16
|
-
s.summary = "Ruby Acceptance Testing for Web applications"
|
17
|
-
s.description = <<-EOS.strip
|
18
|
-
Webrat lets you quickly write expressive and robust acceptance tests
|
19
|
-
for a Ruby web application. It supports simulating a browser inside
|
20
|
-
a Ruby process to avoid the performance hit and browser dependency of
|
21
|
-
Selenium or Watir, but the same API can also be used to drive real
|
22
|
-
Selenium tests when necessary (eg. for testing AJAX interactions).
|
23
|
-
Most Ruby web frameworks and testing frameworks are supported.
|
24
|
-
EOS
|
25
|
-
|
26
|
-
s.rubyforge_project = "honkster-webrat"
|
27
|
-
s.extra_rdoc_files = %w[README.rdoc MIT-LICENSE.txt History.txt]
|
28
|
-
|
29
|
-
# Dependencies
|
30
|
-
s.add_dependency "nokogiri", ">= 1.2.0"
|
31
|
-
s.add_dependency "rack", ">= 1.0"
|
32
|
-
|
33
|
-
s.add_development_dependency "rails", ">= 2.3"
|
34
|
-
s.add_development_dependency "merb-core", ">= 1.0"
|
35
|
-
s.add_development_dependency "launchy"
|
36
|
-
end
|
37
|
-
|
38
|
-
Jeweler::RubyforgeTasks.new
|
39
|
-
end
|
40
|
-
|
41
3
|
begin
|
42
4
|
require 'spec/rake/spectask'
|
43
5
|
rescue LoadError
|
@@ -179,10 +141,4 @@ desc 'Removes trailing whitespace'
|
|
179
141
|
task :whitespace do
|
180
142
|
sh %{find . -name '*.rb' -exec sed -i '' 's/ *$//g' {} \\;}
|
181
143
|
end
|
182
|
-
|
183
|
-
if defined?(Jeweler)
|
184
|
-
task :spec => :check_dependencies
|
185
|
-
task :build => :gemspec
|
186
|
-
end
|
187
|
-
|
188
144
|
task :default => :spec
|
data/Thorfile
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
module GemHelpers
|
2
|
+
|
3
|
+
def generate_gemspec
|
4
|
+
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), "lib")))
|
5
|
+
require "webrat"
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "honkster-webrat"
|
9
|
+
s.version = Webrat::VERSION
|
10
|
+
s.author = "Bryan Helmkamp"
|
11
|
+
s.email = "bryan@brynary.com"
|
12
|
+
s.homepage = "http://github.com/brynary/webrat"
|
13
|
+
s.summary = "Ruby Acceptance Testing for Web applications"
|
14
|
+
s.description = <<-EOS.strip
|
15
|
+
Webrat lets you quickly write expressive and robust acceptance tests
|
16
|
+
for a Ruby web application. It supports simulating a browser inside
|
17
|
+
a Ruby process to avoid the performance hit and browser dependency of
|
18
|
+
Selenium or Watir, but the same API can also be used to drive real
|
19
|
+
Selenium tests when necessary (eg. for testing AJAX interactions).
|
20
|
+
Most Ruby web frameworks and testing frameworks are supported.
|
21
|
+
EOS
|
22
|
+
s.rubyforge_project = "webrat"
|
23
|
+
|
24
|
+
require "git"
|
25
|
+
repo = Git.open(".")
|
26
|
+
|
27
|
+
s.files = normalize_files(repo.ls_files.keys - repo.lib.ignored_files)
|
28
|
+
s.test_files = normalize_files(Dir['spec/**/*.rb'] - repo.lib.ignored_files)
|
29
|
+
|
30
|
+
s.has_rdoc = true
|
31
|
+
s.extra_rdoc_files = %w[README.rdoc MIT-LICENSE.txt History.txt]
|
32
|
+
|
33
|
+
s.add_dependency "nokogiri", ">= 1.2.0"
|
34
|
+
s.add_dependency "rack", ">= 1.0"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def normalize_files(array)
|
39
|
+
# only keep files, no directories, and sort
|
40
|
+
array.select do |path|
|
41
|
+
File.file?(path)
|
42
|
+
end.sort
|
43
|
+
end
|
44
|
+
|
45
|
+
# Adds extra space when outputting an array. This helps create better version
|
46
|
+
# control diffs, because otherwise it is all on the same line.
|
47
|
+
def prettyify_array(gemspec_ruby, array_name)
|
48
|
+
gemspec_ruby.gsub(/s\.#{array_name.to_s} = \[.+?\]/) do |match|
|
49
|
+
leadin, files = match[0..-2].split("[")
|
50
|
+
leadin + "[\n #{files.split(",").join(",\n ")}\n ]"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def read_gemspec
|
55
|
+
@read_gemspec ||= eval(File.read("honkster-webrat.gemspec"))
|
56
|
+
end
|
57
|
+
|
58
|
+
def sh(command)
|
59
|
+
puts command
|
60
|
+
system command
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
class Default < Thor
|
65
|
+
include GemHelpers
|
66
|
+
|
67
|
+
desc "gemspec", "Regenerate honkster-webrat.gemspec"
|
68
|
+
def gemspec
|
69
|
+
File.open("honkster-webrat.gemspec", "w") do |file|
|
70
|
+
gemspec_ruby = generate_gemspec.to_ruby
|
71
|
+
gemspec_ruby = prettyify_array(gemspec_ruby, :files)
|
72
|
+
gemspec_ruby = prettyify_array(gemspec_ruby, :test_files)
|
73
|
+
gemspec_ruby = prettyify_array(gemspec_ruby, :extra_rdoc_files)
|
74
|
+
|
75
|
+
file.write gemspec_ruby
|
76
|
+
end
|
77
|
+
|
78
|
+
puts "Wrote gemspec to honkster-webrat.gemspec"
|
79
|
+
read_gemspec.validate
|
80
|
+
end
|
81
|
+
|
82
|
+
desc "build", "Build a webrat gem"
|
83
|
+
def build
|
84
|
+
sh "gem build honkster-webrat.gemspec"
|
85
|
+
FileUtils.mkdir_p "pkg"
|
86
|
+
FileUtils.mv read_gemspec.file_name, "pkg"
|
87
|
+
end
|
88
|
+
|
89
|
+
desc "install", "Install the latest built gem"
|
90
|
+
def install
|
91
|
+
sh "gem install --local pkg/#{read_gemspec.file_name}"
|
92
|
+
end
|
93
|
+
|
94
|
+
desc "release", "Release the current branch to GitHub and Gemcutter"
|
95
|
+
def release
|
96
|
+
gemspec
|
97
|
+
build
|
98
|
+
Release.new.tag
|
99
|
+
Release.new.gem
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
class Release < Thor
|
104
|
+
include GemHelpers
|
105
|
+
|
106
|
+
desc "tag", "Tag the gem on the origin server"
|
107
|
+
def tag
|
108
|
+
release_tag = "v#{read_gemspec.version}"
|
109
|
+
sh "git tag -a #{release_tag} -m 'Tagging #{release_tag}'"
|
110
|
+
sh "git push origin #{release_tag}"
|
111
|
+
end
|
112
|
+
|
113
|
+
desc "gem", "Push the gem to Gemcutter"
|
114
|
+
def gem
|
115
|
+
sh "gem push pkg/#{read_gemspec.file_name}"
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,348 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{honkster-webrat}
|
5
|
+
s.version = "0.6.0.9"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Bryan Helmkamp"]
|
9
|
+
s.date = %q{2009-12-21}
|
10
|
+
s.description = %q{Webrat lets you quickly write expressive and robust acceptance tests
|
11
|
+
for a Ruby web application. It supports simulating a browser inside
|
12
|
+
a Ruby process to avoid the performance hit and browser dependency of
|
13
|
+
Selenium or Watir, but the same API can also be used to drive real
|
14
|
+
Selenium tests when necessary (eg. for testing AJAX interactions).
|
15
|
+
Most Ruby web frameworks and testing frameworks are supported.}
|
16
|
+
s.email = %q{bryan@brynary.com}
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"README.rdoc",
|
19
|
+
"MIT-LICENSE.txt",
|
20
|
+
"History.txt"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".document",
|
24
|
+
".gitignore",
|
25
|
+
"Gemfile",
|
26
|
+
"History.txt",
|
27
|
+
"MIT-LICENSE.txt",
|
28
|
+
"README.rdoc",
|
29
|
+
"Rakefile",
|
30
|
+
"Thorfile",
|
31
|
+
"honkster-webrat.gemspec",
|
32
|
+
"install.rb",
|
33
|
+
"lib/webrat.rb",
|
34
|
+
"lib/webrat/adapters/mechanize.rb",
|
35
|
+
"lib/webrat/adapters/merb.rb",
|
36
|
+
"lib/webrat/adapters/rack.rb",
|
37
|
+
"lib/webrat/adapters/rails.rb",
|
38
|
+
"lib/webrat/adapters/sinatra.rb",
|
39
|
+
"lib/webrat/core.rb",
|
40
|
+
"lib/webrat/core/configuration.rb",
|
41
|
+
"lib/webrat/core/elements/area.rb",
|
42
|
+
"lib/webrat/core/elements/element.rb",
|
43
|
+
"lib/webrat/core/elements/field.rb",
|
44
|
+
"lib/webrat/core/elements/form.rb",
|
45
|
+
"lib/webrat/core/elements/label.rb",
|
46
|
+
"lib/webrat/core/elements/link.rb",
|
47
|
+
"lib/webrat/core/elements/select_option.rb",
|
48
|
+
"lib/webrat/core/locators.rb",
|
49
|
+
"lib/webrat/core/locators/area_locator.rb",
|
50
|
+
"lib/webrat/core/locators/button_locator.rb",
|
51
|
+
"lib/webrat/core/locators/field_by_id_locator.rb",
|
52
|
+
"lib/webrat/core/locators/field_labeled_locator.rb",
|
53
|
+
"lib/webrat/core/locators/field_locator.rb",
|
54
|
+
"lib/webrat/core/locators/field_named_locator.rb",
|
55
|
+
"lib/webrat/core/locators/form_locator.rb",
|
56
|
+
"lib/webrat/core/locators/label_locator.rb",
|
57
|
+
"lib/webrat/core/locators/link_locator.rb",
|
58
|
+
"lib/webrat/core/locators/locator.rb",
|
59
|
+
"lib/webrat/core/locators/select_option_locator.rb",
|
60
|
+
"lib/webrat/core/logging.rb",
|
61
|
+
"lib/webrat/core/matchers.rb",
|
62
|
+
"lib/webrat/core/matchers/have_content.rb",
|
63
|
+
"lib/webrat/core/matchers/have_selector.rb",
|
64
|
+
"lib/webrat/core/matchers/have_tag.rb",
|
65
|
+
"lib/webrat/core/matchers/have_xpath.rb",
|
66
|
+
"lib/webrat/core/methods.rb",
|
67
|
+
"lib/webrat/core/mime.rb",
|
68
|
+
"lib/webrat/core/save_and_open_page.rb",
|
69
|
+
"lib/webrat/core/scope.rb",
|
70
|
+
"lib/webrat/core/session.rb",
|
71
|
+
"lib/webrat/core/xml.rb",
|
72
|
+
"lib/webrat/core_extensions/blank.rb",
|
73
|
+
"lib/webrat/core_extensions/deprecate.rb",
|
74
|
+
"lib/webrat/core_extensions/detect_mapped.rb",
|
75
|
+
"lib/webrat/core_extensions/meta_class.rb",
|
76
|
+
"lib/webrat/core_extensions/nil_to_param.rb",
|
77
|
+
"lib/webrat/core_extensions/tcp_socket.rb",
|
78
|
+
"lib/webrat/integrations/merb.rb",
|
79
|
+
"lib/webrat/integrations/rails.rb",
|
80
|
+
"lib/webrat/integrations/rspec-rails.rb",
|
81
|
+
"lib/webrat/integrations/selenium.rb",
|
82
|
+
"lib/webrat/merb.rb",
|
83
|
+
"lib/webrat/rspec-rails.rb",
|
84
|
+
"lib/webrat/selenium.rb",
|
85
|
+
"lib/webrat/selenium/application_server_factory.rb",
|
86
|
+
"lib/webrat/selenium/application_servers.rb",
|
87
|
+
"lib/webrat/selenium/application_servers/base.rb",
|
88
|
+
"lib/webrat/selenium/application_servers/external.rb",
|
89
|
+
"lib/webrat/selenium/application_servers/merb.rb",
|
90
|
+
"lib/webrat/selenium/application_servers/rails.rb",
|
91
|
+
"lib/webrat/selenium/application_servers/sinatra.rb",
|
92
|
+
"lib/webrat/selenium/location_strategy_javascript/button.js",
|
93
|
+
"lib/webrat/selenium/location_strategy_javascript/label.js",
|
94
|
+
"lib/webrat/selenium/location_strategy_javascript/webrat.js",
|
95
|
+
"lib/webrat/selenium/location_strategy_javascript/webratlink.js",
|
96
|
+
"lib/webrat/selenium/location_strategy_javascript/webratlinkwithin.js",
|
97
|
+
"lib/webrat/selenium/location_strategy_javascript/webratselectwithoption.js",
|
98
|
+
"lib/webrat/selenium/matchers.rb",
|
99
|
+
"lib/webrat/selenium/matchers/have_content.rb",
|
100
|
+
"lib/webrat/selenium/matchers/have_selector.rb",
|
101
|
+
"lib/webrat/selenium/matchers/have_tag.rb",
|
102
|
+
"lib/webrat/selenium/matchers/have_xpath.rb",
|
103
|
+
"lib/webrat/selenium/selenium_extensions.js",
|
104
|
+
"lib/webrat/selenium/selenium_rc_server.rb",
|
105
|
+
"lib/webrat/selenium/selenium_session.rb",
|
106
|
+
"lib/webrat/selenium/silence_stream.rb",
|
107
|
+
"spec/fakes/test_adapter.rb",
|
108
|
+
"spec/integration/mechanize/Rakefile",
|
109
|
+
"spec/integration/mechanize/config.ru",
|
110
|
+
"spec/integration/mechanize/sample_app.rb",
|
111
|
+
"spec/integration/mechanize/spec/mechanize_spec.rb",
|
112
|
+
"spec/integration/mechanize/spec/spec_helper.rb",
|
113
|
+
"spec/integration/merb/.gitignore",
|
114
|
+
"spec/integration/merb/Rakefile",
|
115
|
+
"spec/integration/merb/app/controllers/application.rb",
|
116
|
+
"spec/integration/merb/app/controllers/exceptions.rb",
|
117
|
+
"spec/integration/merb/app/controllers/testing.rb",
|
118
|
+
"spec/integration/merb/app/views/exceptions/not_acceptable.html.erb",
|
119
|
+
"spec/integration/merb/app/views/exceptions/not_found.html.erb",
|
120
|
+
"spec/integration/merb/app/views/layout/application.html.erb",
|
121
|
+
"spec/integration/merb/app/views/testing/show_form.html.erb",
|
122
|
+
"spec/integration/merb/app/views/testing/upload.html.erb",
|
123
|
+
"spec/integration/merb/config/environments/development.rb",
|
124
|
+
"spec/integration/merb/config/environments/rake.rb",
|
125
|
+
"spec/integration/merb/config/environments/test.rb",
|
126
|
+
"spec/integration/merb/config/init.rb",
|
127
|
+
"spec/integration/merb/config/rack.rb",
|
128
|
+
"spec/integration/merb/config/router.rb",
|
129
|
+
"spec/integration/merb/spec/spec.opts",
|
130
|
+
"spec/integration/merb/spec/spec_helper.rb",
|
131
|
+
"spec/integration/merb/spec/webrat_spec.rb",
|
132
|
+
"spec/integration/merb/tasks/merb.thor/app_script.rb",
|
133
|
+
"spec/integration/merb/tasks/merb.thor/common.rb",
|
134
|
+
"spec/integration/merb/tasks/merb.thor/gem_ext.rb",
|
135
|
+
"spec/integration/merb/tasks/merb.thor/main.thor",
|
136
|
+
"spec/integration/merb/tasks/merb.thor/ops.rb",
|
137
|
+
"spec/integration/merb/tasks/merb.thor/utils.rb",
|
138
|
+
"spec/integration/rack/Rakefile",
|
139
|
+
"spec/integration/rack/app.rb",
|
140
|
+
"spec/integration/rack/test/helper.rb",
|
141
|
+
"spec/integration/rack/test/webrat_rack_test.rb",
|
142
|
+
"spec/integration/rails/.gitignore",
|
143
|
+
"spec/integration/rails/Rakefile",
|
144
|
+
"spec/integration/rails/app/controllers/application_controller.rb",
|
145
|
+
"spec/integration/rails/app/controllers/buttons_controller.rb",
|
146
|
+
"spec/integration/rails/app/controllers/fields_controller.rb",
|
147
|
+
"spec/integration/rails/app/controllers/links_controller.rb",
|
148
|
+
"spec/integration/rails/app/controllers/webrat_controller.rb",
|
149
|
+
"spec/integration/rails/app/helpers/buttons_helper.rb",
|
150
|
+
"spec/integration/rails/app/helpers/fields_helper.rb",
|
151
|
+
"spec/integration/rails/app/helpers/links_helper.rb",
|
152
|
+
"spec/integration/rails/app/views/buttons/show.html.erb",
|
153
|
+
"spec/integration/rails/app/views/fields/show.html.erb",
|
154
|
+
"spec/integration/rails/app/views/links/show.html.erb",
|
155
|
+
"spec/integration/rails/app/views/webrat/before_redirect_form.html.erb",
|
156
|
+
"spec/integration/rails/app/views/webrat/buttons.html.erb",
|
157
|
+
"spec/integration/rails/app/views/webrat/form.html.erb",
|
158
|
+
"spec/integration/rails/app/views/webrat/within.html.erb",
|
159
|
+
"spec/integration/rails/config/boot.rb",
|
160
|
+
"spec/integration/rails/config/environment.rb",
|
161
|
+
"spec/integration/rails/config/environments/development.rb",
|
162
|
+
"spec/integration/rails/config/environments/selenium.rb",
|
163
|
+
"spec/integration/rails/config/environments/test.rb",
|
164
|
+
"spec/integration/rails/config/initializers/inflections.rb",
|
165
|
+
"spec/integration/rails/config/initializers/mime_types.rb",
|
166
|
+
"spec/integration/rails/config/initializers/new_rails_defaults.rb",
|
167
|
+
"spec/integration/rails/config/locales/en.yml",
|
168
|
+
"spec/integration/rails/config/routes.rb",
|
169
|
+
"spec/integration/rails/public/404.html",
|
170
|
+
"spec/integration/rails/public/422.html",
|
171
|
+
"spec/integration/rails/public/500.html",
|
172
|
+
"spec/integration/rails/script/about",
|
173
|
+
"spec/integration/rails/script/console",
|
174
|
+
"spec/integration/rails/script/dbconsole",
|
175
|
+
"spec/integration/rails/script/destroy",
|
176
|
+
"spec/integration/rails/script/generate",
|
177
|
+
"spec/integration/rails/script/performance/benchmarker",
|
178
|
+
"spec/integration/rails/script/performance/profiler",
|
179
|
+
"spec/integration/rails/script/performance/request",
|
180
|
+
"spec/integration/rails/script/plugin",
|
181
|
+
"spec/integration/rails/script/process/inspector",
|
182
|
+
"spec/integration/rails/script/process/reaper",
|
183
|
+
"spec/integration/rails/script/process/spawner",
|
184
|
+
"spec/integration/rails/script/runner",
|
185
|
+
"spec/integration/rails/script/server",
|
186
|
+
"spec/integration/rails/test/integration/button_click_test.rb",
|
187
|
+
"spec/integration/rails/test/integration/fill_in_test.rb",
|
188
|
+
"spec/integration/rails/test/integration/link_click_test.rb",
|
189
|
+
"spec/integration/rails/test/integration/webrat_test.rb",
|
190
|
+
"spec/integration/rails/test/test_helper.rb",
|
191
|
+
"spec/integration/sinatra/Rakefile",
|
192
|
+
"spec/integration/sinatra/classic_app.rb",
|
193
|
+
"spec/integration/sinatra/modular_app.rb",
|
194
|
+
"spec/integration/sinatra/test/classic_app_test.rb",
|
195
|
+
"spec/integration/sinatra/test/modular_app_test.rb",
|
196
|
+
"spec/integration/sinatra/test/test_helper.rb",
|
197
|
+
"spec/private/core/configuration_spec.rb",
|
198
|
+
"spec/private/core/field_spec.rb",
|
199
|
+
"spec/private/core/link_spec.rb",
|
200
|
+
"spec/private/core/session_spec.rb",
|
201
|
+
"spec/private/mechanize/mechanize_adapter_spec.rb",
|
202
|
+
"spec/private/nokogiri_spec.rb",
|
203
|
+
"spec/private/rails/attaches_file_spec.rb",
|
204
|
+
"spec/private/rails/rails_adapter_spec.rb",
|
205
|
+
"spec/private/selenium/application_servers/rails_spec.rb",
|
206
|
+
"spec/public/basic_auth_spec.rb",
|
207
|
+
"spec/public/check_spec.rb",
|
208
|
+
"spec/public/choose_spec.rb",
|
209
|
+
"spec/public/click_area_spec.rb",
|
210
|
+
"spec/public/click_button_spec.rb",
|
211
|
+
"spec/public/click_link_spec.rb",
|
212
|
+
"spec/public/fill_in_spec.rb",
|
213
|
+
"spec/public/locators/field_by_xpath_spec.rb",
|
214
|
+
"spec/public/locators/field_labeled_spec.rb",
|
215
|
+
"spec/public/locators/field_with_id_spec.rb",
|
216
|
+
"spec/public/matchers/contain_spec.rb",
|
217
|
+
"spec/public/matchers/have_selector_spec.rb",
|
218
|
+
"spec/public/matchers/have_tag_spec.rb",
|
219
|
+
"spec/public/matchers/have_xpath_spec.rb",
|
220
|
+
"spec/public/reload_spec.rb",
|
221
|
+
"spec/public/save_and_open_spec.rb",
|
222
|
+
"spec/public/select_date_spec.rb",
|
223
|
+
"spec/public/select_datetime_spec.rb",
|
224
|
+
"spec/public/select_spec.rb",
|
225
|
+
"spec/public/select_time_spec.rb",
|
226
|
+
"spec/public/selenium/application_server_factory_spec.rb",
|
227
|
+
"spec/public/selenium/application_servers/external_spec.rb",
|
228
|
+
"spec/public/selenium/selenium_session_spec.rb",
|
229
|
+
"spec/public/set_hidden_field_spec.rb",
|
230
|
+
"spec/public/submit_form_spec.rb",
|
231
|
+
"spec/public/visit_spec.rb",
|
232
|
+
"spec/public/within_spec.rb",
|
233
|
+
"spec/rcov.opts",
|
234
|
+
"spec/spec.opts",
|
235
|
+
"spec/spec_helper.rb",
|
236
|
+
"vendor/selenium-server.jar"
|
237
|
+
]
|
238
|
+
s.homepage = %q{http://github.com/brynary/webrat}
|
239
|
+
s.require_paths = ["lib"]
|
240
|
+
s.rubyforge_project = %q{webrat}
|
241
|
+
s.rubygems_version = %q{1.3.5}
|
242
|
+
s.summary = %q{Ruby Acceptance Testing for Web applications}
|
243
|
+
s.test_files = [
|
244
|
+
"spec/fakes/test_adapter.rb",
|
245
|
+
"spec/integration/mechanize/sample_app.rb",
|
246
|
+
"spec/integration/mechanize/spec/mechanize_spec.rb",
|
247
|
+
"spec/integration/mechanize/spec/spec_helper.rb",
|
248
|
+
"spec/integration/merb/app/controllers/application.rb",
|
249
|
+
"spec/integration/merb/app/controllers/exceptions.rb",
|
250
|
+
"spec/integration/merb/app/controllers/testing.rb",
|
251
|
+
"spec/integration/merb/config/environments/development.rb",
|
252
|
+
"spec/integration/merb/config/environments/rake.rb",
|
253
|
+
"spec/integration/merb/config/environments/test.rb",
|
254
|
+
"spec/integration/merb/config/init.rb",
|
255
|
+
"spec/integration/merb/config/rack.rb",
|
256
|
+
"spec/integration/merb/config/router.rb",
|
257
|
+
"spec/integration/merb/spec/spec_helper.rb",
|
258
|
+
"spec/integration/merb/spec/webrat_spec.rb",
|
259
|
+
"spec/integration/merb/tasks/merb.thor/app_script.rb",
|
260
|
+
"spec/integration/merb/tasks/merb.thor/common.rb",
|
261
|
+
"spec/integration/merb/tasks/merb.thor/gem_ext.rb",
|
262
|
+
"spec/integration/merb/tasks/merb.thor/ops.rb",
|
263
|
+
"spec/integration/merb/tasks/merb.thor/utils.rb",
|
264
|
+
"spec/integration/rack/app.rb",
|
265
|
+
"spec/integration/rack/test/helper.rb",
|
266
|
+
"spec/integration/rack/test/webrat_rack_test.rb",
|
267
|
+
"spec/integration/rails/app/controllers/application_controller.rb",
|
268
|
+
"spec/integration/rails/app/controllers/buttons_controller.rb",
|
269
|
+
"spec/integration/rails/app/controllers/fields_controller.rb",
|
270
|
+
"spec/integration/rails/app/controllers/links_controller.rb",
|
271
|
+
"spec/integration/rails/app/controllers/webrat_controller.rb",
|
272
|
+
"spec/integration/rails/app/helpers/buttons_helper.rb",
|
273
|
+
"spec/integration/rails/app/helpers/fields_helper.rb",
|
274
|
+
"spec/integration/rails/app/helpers/links_helper.rb",
|
275
|
+
"spec/integration/rails/config/boot.rb",
|
276
|
+
"spec/integration/rails/config/environment.rb",
|
277
|
+
"spec/integration/rails/config/environments/development.rb",
|
278
|
+
"spec/integration/rails/config/environments/selenium.rb",
|
279
|
+
"spec/integration/rails/config/environments/test.rb",
|
280
|
+
"spec/integration/rails/config/initializers/inflections.rb",
|
281
|
+
"spec/integration/rails/config/initializers/mime_types.rb",
|
282
|
+
"spec/integration/rails/config/initializers/new_rails_defaults.rb",
|
283
|
+
"spec/integration/rails/config/routes.rb",
|
284
|
+
"spec/integration/rails/test/integration/button_click_test.rb",
|
285
|
+
"spec/integration/rails/test/integration/fill_in_test.rb",
|
286
|
+
"spec/integration/rails/test/integration/link_click_test.rb",
|
287
|
+
"spec/integration/rails/test/integration/webrat_test.rb",
|
288
|
+
"spec/integration/rails/test/test_helper.rb",
|
289
|
+
"spec/integration/sinatra/classic_app.rb",
|
290
|
+
"spec/integration/sinatra/modular_app.rb",
|
291
|
+
"spec/integration/sinatra/test/classic_app_test.rb",
|
292
|
+
"spec/integration/sinatra/test/modular_app_test.rb",
|
293
|
+
"spec/integration/sinatra/test/test_helper.rb",
|
294
|
+
"spec/private/core/configuration_spec.rb",
|
295
|
+
"spec/private/core/field_spec.rb",
|
296
|
+
"spec/private/core/link_spec.rb",
|
297
|
+
"spec/private/core/session_spec.rb",
|
298
|
+
"spec/private/mechanize/mechanize_adapter_spec.rb",
|
299
|
+
"spec/private/nokogiri_spec.rb",
|
300
|
+
"spec/private/rails/attaches_file_spec.rb",
|
301
|
+
"spec/private/rails/rails_adapter_spec.rb",
|
302
|
+
"spec/private/selenium/application_servers/rails_spec.rb",
|
303
|
+
"spec/public/basic_auth_spec.rb",
|
304
|
+
"spec/public/check_spec.rb",
|
305
|
+
"spec/public/choose_spec.rb",
|
306
|
+
"spec/public/click_area_spec.rb",
|
307
|
+
"spec/public/click_button_spec.rb",
|
308
|
+
"spec/public/click_link_spec.rb",
|
309
|
+
"spec/public/fill_in_spec.rb",
|
310
|
+
"spec/public/locators/field_by_xpath_spec.rb",
|
311
|
+
"spec/public/locators/field_labeled_spec.rb",
|
312
|
+
"spec/public/locators/field_with_id_spec.rb",
|
313
|
+
"spec/public/matchers/contain_spec.rb",
|
314
|
+
"spec/public/matchers/have_selector_spec.rb",
|
315
|
+
"spec/public/matchers/have_tag_spec.rb",
|
316
|
+
"spec/public/matchers/have_xpath_spec.rb",
|
317
|
+
"spec/public/reload_spec.rb",
|
318
|
+
"spec/public/save_and_open_spec.rb",
|
319
|
+
"spec/public/select_date_spec.rb",
|
320
|
+
"spec/public/select_datetime_spec.rb",
|
321
|
+
"spec/public/select_spec.rb",
|
322
|
+
"spec/public/select_time_spec.rb",
|
323
|
+
"spec/public/selenium/application_server_factory_spec.rb",
|
324
|
+
"spec/public/selenium/application_servers/external_spec.rb",
|
325
|
+
"spec/public/selenium/selenium_session_spec.rb",
|
326
|
+
"spec/public/set_hidden_field_spec.rb",
|
327
|
+
"spec/public/submit_form_spec.rb",
|
328
|
+
"spec/public/visit_spec.rb",
|
329
|
+
"spec/public/within_spec.rb",
|
330
|
+
"spec/spec_helper.rb"
|
331
|
+
]
|
332
|
+
|
333
|
+
if s.respond_to? :specification_version then
|
334
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
335
|
+
s.specification_version = 3
|
336
|
+
|
337
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
338
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 1.2.0"])
|
339
|
+
s.add_runtime_dependency(%q<rack>, [">= 1.0"])
|
340
|
+
else
|
341
|
+
s.add_dependency(%q<nokogiri>, [">= 1.2.0"])
|
342
|
+
s.add_dependency(%q<rack>, [">= 1.0"])
|
343
|
+
end
|
344
|
+
else
|
345
|
+
s.add_dependency(%q<nokogiri>, [">= 1.2.0"])
|
346
|
+
s.add_dependency(%q<rack>, [">= 1.0"])
|
347
|
+
end
|
348
|
+
end
|
@@ -58,6 +58,9 @@ module Webrat
|
|
58
58
|
# loop? Defaults to 10
|
59
59
|
attr_accessor :infinite_redirect_limit
|
60
60
|
|
61
|
+
# How long to wait for Selenium actions unless overridden. Defaults to 10 seconds.
|
62
|
+
attr_accessor :default_timeout_in_seconds
|
63
|
+
|
61
64
|
def initialize # :nodoc:
|
62
65
|
self.open_error_files = true
|
63
66
|
self.application_environment = :test
|
@@ -66,6 +69,7 @@ module Webrat
|
|
66
69
|
self.application_framework = :rails
|
67
70
|
self.selenium_server_port = 4444
|
68
71
|
self.infinite_redirect_limit = 10
|
72
|
+
self.default_timeout_in_seconds = 10
|
69
73
|
self.selenium_browser_key = '*firefox'
|
70
74
|
self.selenium_browser_startup_timeout = 5
|
71
75
|
end
|
@@ -53,7 +53,7 @@ module Webrat
|
|
53
53
|
|
54
54
|
def authenticity_token
|
55
55
|
return unless onclick && onclick.include?("s.setAttribute('name', 'authenticity_token');") &&
|
56
|
-
onclick =~ /s\.setAttribute\('value', '([a-f0-9]{40})'\);/
|
56
|
+
( onclick =~ /s\.setAttribute\('value', '([a-f0-9]{40})'\);/ || onclick =~ /s\.setAttribute\('value', '(.{44})'\);/ )
|
57
57
|
$LAST_MATCH_INFO.captures.first
|
58
58
|
end
|
59
59
|
|
@@ -16,7 +16,21 @@ module Webrat
|
|
16
16
|
def matching_links
|
17
17
|
@matching_links ||= link_elements.select do |link_element|
|
18
18
|
matches_text?(link_element) ||
|
19
|
-
matches_id?(link_element)
|
19
|
+
matches_id?(link_element) ||
|
20
|
+
matches_img?(link_element)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def matches_img?(link)
|
25
|
+
if @value.is_a?(Regexp)
|
26
|
+
matcher = @value
|
27
|
+
else
|
28
|
+
matcher = /#{Regexp.escape(@value.to_s)}/i
|
29
|
+
end
|
30
|
+
|
31
|
+
link.css("img").any? do |img|
|
32
|
+
img["title"] =~ matcher ||
|
33
|
+
img["src"] =~ matcher
|
20
34
|
end
|
21
35
|
end
|
22
36
|
|
@@ -28,7 +42,6 @@ module Webrat
|
|
28
42
|
end
|
29
43
|
|
30
44
|
replace_nbsp(link.inner_text) =~ matcher ||
|
31
|
-
replace_nbsp_ref(link.inner_html) =~ matcher ||
|
32
45
|
link["title"] =~ matcher
|
33
46
|
end
|
34
47
|
|
data/lib/webrat/core/session.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# Supports using the matchers in controller, helper, and view specs if you're
|
2
2
|
# using rspec-rails. Just add a require statement to spec/spec_helper.rb or env.rb:
|
3
3
|
#
|
4
|
-
# require 'webrat/rspec-rails'
|
4
|
+
# require 'webrat/integrations/rspec-rails'
|
5
5
|
#
|
6
|
+
require "nokogiri"
|
6
7
|
require "webrat/core/matchers"
|
7
8
|
|
8
9
|
Spec::Runner.configure do |config|
|