capybara-webkit 0.7.2 → 0.8.0
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/CONTRIBUTING.md +1 -1
- data/Gemfile +1 -6
- data/Gemfile.lock +15 -13
- data/README.md +9 -8
- data/Rakefile +3 -21
- data/capybara-webkit.gemspec +21 -18
- data/gemfiles/1.0.gemfile.lock +18 -13
- data/gemfiles/1.1.gemfile.lock +18 -13
- data/lib/capybara/driver/webkit.rb +20 -1
- data/lib/capybara/driver/webkit/browser.rb +49 -5
- data/lib/capybara/driver/webkit/cookie_jar.rb +55 -0
- data/lib/capybara/driver/webkit/node.rb +5 -1
- data/lib/capybara/driver/webkit/version.rb +7 -0
- data/lib/capybara/webkit/matchers.rb +39 -0
- data/lib/capybara_webkit_builder.rb +2 -1
- data/spec/browser_spec.rb +150 -2
- data/spec/cookie_jar_spec.rb +48 -0
- data/spec/driver_spec.rb +248 -16
- data/spec/self_signed_ssl_cert.rb +42 -0
- data/src/CommandFactory.cpp +31 -0
- data/src/CommandFactory.h +16 -0
- data/src/CommandParser.cpp +68 -0
- data/src/CommandParser.h +29 -0
- data/src/Connection.cpp +14 -83
- data/src/Connection.h +5 -8
- data/src/ConsoleMessages.cpp +11 -0
- data/src/ConsoleMessages.h +12 -0
- data/src/RequestedUrl.cpp +15 -0
- data/src/RequestedUrl.h +12 -0
- data/src/Reset.cpp +1 -0
- data/src/Server.cpp +2 -1
- data/src/Server.h +1 -1
- data/src/SetProxy.cpp +24 -0
- data/src/SetProxy.h +11 -0
- data/src/UnsupportedContentHandler.cpp +1 -0
- data/src/Visit.cpp +1 -1
- data/src/WebPage.cpp +28 -2
- data/src/WebPage.h +7 -0
- data/src/capybara.js +54 -11
- data/src/find_command.h +4 -0
- data/src/main.cpp +4 -1
- data/src/webkit_server.pro +10 -0
- metadata +67 -47
data/CONTRIBUTING.md
CHANGED
@@ -3,7 +3,7 @@ We love pull requests. Here's a quick guide:
|
|
3
3
|
1. Fork the repo.
|
4
4
|
|
5
5
|
2. Run the tests. We only take pull requests with passing tests, and it's great
|
6
|
-
to know that you have a clean slate: `bundle && rake`
|
6
|
+
to know that you have a clean slate: `bundle && bundle exec rake`
|
7
7
|
|
8
8
|
3. Add a test for your change. Only refactoring and documentation changes
|
9
9
|
require no new tests. If you are adding functionality or fixing a bug, we need
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,30 +1,32 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
capybara-webkit (0.
|
5
|
-
capybara (
|
4
|
+
capybara-webkit (0.8.0)
|
5
|
+
capybara (>= 1.0.0, < 1.2)
|
6
|
+
json
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: http://rubygems.org/
|
9
10
|
specs:
|
10
|
-
appraisal (0.
|
11
|
+
appraisal (0.4.0)
|
11
12
|
bundler
|
12
13
|
rake
|
13
|
-
capybara (1.1.
|
14
|
+
capybara (1.1.2)
|
14
15
|
mime-types (>= 1.16)
|
15
16
|
nokogiri (>= 1.3.3)
|
16
17
|
rack (>= 1.0.0)
|
17
18
|
rack-test (>= 0.5.4)
|
18
19
|
selenium-webdriver (~> 2.0)
|
19
20
|
xpath (~> 0.1.4)
|
20
|
-
childprocess (0.2.
|
21
|
+
childprocess (0.2.3)
|
21
22
|
ffi (~> 1.0.6)
|
22
23
|
diff-lcs (1.1.2)
|
23
|
-
ffi (1.0.
|
24
|
-
|
25
|
-
mime-types (1.
|
24
|
+
ffi (1.0.11)
|
25
|
+
json (1.6.3)
|
26
|
+
mime-types (1.17.2)
|
26
27
|
mini_magick (3.2.1)
|
27
28
|
subexec (~> 0.0.4)
|
29
|
+
multi_json (1.0.4)
|
28
30
|
nokogiri (1.5.0)
|
29
31
|
rack (1.3.2)
|
30
32
|
rack-test (0.6.1)
|
@@ -38,11 +40,11 @@ GEM
|
|
38
40
|
rspec-expectations (2.6.0)
|
39
41
|
diff-lcs (~> 1.1.2)
|
40
42
|
rspec-mocks (2.6.0)
|
41
|
-
rubyzip (0.9.
|
42
|
-
selenium-webdriver (2.
|
43
|
+
rubyzip (0.9.5)
|
44
|
+
selenium-webdriver (2.15.0)
|
43
45
|
childprocess (>= 0.2.1)
|
44
|
-
ffi (
|
45
|
-
|
46
|
+
ffi (~> 1.0.9)
|
47
|
+
multi_json (~> 1.0.4)
|
46
48
|
rubyzip
|
47
49
|
sinatra (1.1.2)
|
48
50
|
rack (~> 1.1)
|
@@ -56,7 +58,7 @@ PLATFORMS
|
|
56
58
|
ruby
|
57
59
|
|
58
60
|
DEPENDENCIES
|
59
|
-
appraisal
|
61
|
+
appraisal (~> 0.4.0)
|
60
62
|
capybara-webkit!
|
61
63
|
mini_magick
|
62
64
|
rake
|
data/README.md
CHANGED
@@ -15,11 +15,13 @@ Reporting Issues
|
|
15
15
|
----------------
|
16
16
|
|
17
17
|
Without access to your application code we can't easily debug most crashes or
|
18
|
-
generic failures, so we've included a debug
|
18
|
+
generic failures, so we've included a debug version of the driver that prints a
|
19
19
|
log of what happened during each test. Before filing a crash bug, please see
|
20
20
|
[Reporting Crashes](https://github.com/thoughtbot/capybara-webkit/wiki/Reporting-Crashes).
|
21
21
|
You're much more likely to get a fix if you follow those instructions.
|
22
22
|
|
23
|
+
If you are having compiling issues please post to the [mailing list](http://groups.google.com/group/capybara-webkit).
|
24
|
+
|
23
25
|
CI
|
24
26
|
--
|
25
27
|
|
@@ -38,7 +40,11 @@ Set your Capybara Javascript driver to webkit:
|
|
38
40
|
|
39
41
|
Capybara.javascript_driver = :webkit
|
40
42
|
|
41
|
-
|
43
|
+
In cucumber, tag scenarios with @javascript to run them using a headless WebKit browser.
|
44
|
+
|
45
|
+
In RSpec, use the :js => true flag.
|
46
|
+
|
47
|
+
Take note of the transactional fixtures section of the [capybara README](https://github.com/jnicklas/capybara/blob/master/README.md).
|
42
48
|
|
43
49
|
Contributing
|
44
50
|
------------
|
@@ -48,7 +54,7 @@ See the CONTRIBUTING document.
|
|
48
54
|
About
|
49
55
|
-----
|
50
56
|
|
51
|
-
The capybara WebKit driver
|
57
|
+
The capybara WebKit driver is maintained by Joe Ferris and Matt Mongeau. It was written by [thoughtbot, inc](http://thoughtbot.com/community) with the help of numerous [contributions from the open source community](https://github.com/thoughtbot/capybara-webkit/contributors).
|
52
58
|
|
53
59
|
Code for rendering the current webpage to a PNG is borrowed from Phantom.js' implementation.
|
54
60
|
|
@@ -56,11 +62,6 @@ Code for rendering the current webpage to a PNG is borrowed from Phantom.js' imp
|
|
56
62
|
|
57
63
|
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
58
64
|
|
59
|
-
Notes
|
60
|
-
-----
|
61
|
-
|
62
|
-
capybara-webkit will listen on port 8200. This may conflict with other services.
|
63
|
-
|
64
65
|
License
|
65
66
|
-------
|
66
67
|
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require '
|
2
|
-
require 'bundler/setup'
|
1
|
+
require 'bundler'
|
3
2
|
require 'rspec/core/rake_task'
|
4
|
-
require 'rake/gempackagetask'
|
5
3
|
require 'capybara_webkit_builder'
|
6
4
|
require 'appraisal'
|
7
5
|
|
6
|
+
Bundler::GemHelper.install_tasks
|
7
|
+
|
8
8
|
desc "Generate a Makefile using qmake"
|
9
9
|
file 'Makefile' do
|
10
10
|
CapybaraWebkitBuilder.makefile or exit(1)
|
@@ -30,24 +30,6 @@ end
|
|
30
30
|
desc "Default: build and run all specs"
|
31
31
|
task :default => [:build, :spec]
|
32
32
|
|
33
|
-
eval("$specification = begin; #{IO.read('capybara-webkit.gemspec')}; end")
|
34
|
-
Rake::GemPackageTask.new($specification) do |package|
|
35
|
-
package.need_zip = true
|
36
|
-
package.need_tar = true
|
37
|
-
end
|
38
|
-
|
39
|
-
gem_file = "pkg/#{$specification.name}-#{$specification.version}.gem"
|
40
|
-
|
41
|
-
desc "Build and install the latest gem"
|
42
|
-
task :install => :gem do
|
43
|
-
sh("gem install --local #{gem_file}")
|
44
|
-
end
|
45
|
-
|
46
|
-
desc "Build and release the latest gem"
|
47
|
-
task :release => :gem do
|
48
|
-
sh("gem push #{gem_file}")
|
49
|
-
end
|
50
|
-
|
51
33
|
desc "Generate a new command called NAME"
|
52
34
|
task :generate_command do
|
53
35
|
name = ENV['NAME'] or raise "Provide a name with NAME="
|
data/capybara-webkit.gemspec
CHANGED
@@ -1,24 +1,27 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require "capybara/driver/webkit/version"
|
3
|
+
|
1
4
|
Gem::Specification.new do |s|
|
2
|
-
s.name
|
3
|
-
s.version
|
4
|
-
s.authors
|
5
|
-
|
6
|
-
"Vasily Reys", "petrushka", "John Bintz", "Chad Pytel",
|
7
|
-
"Christopher Meiklejohn", "John Barker", "Jeremy Wells",
|
8
|
-
"Chris Griego", "Shigeya Suzuki"]
|
9
|
-
s.email = "support@thoughtbot.com"
|
10
|
-
s.files = `git ls-files`.split("\n")
|
11
|
-
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
5
|
+
s.name = "capybara-webkit"
|
6
|
+
s.version = Capybara::Driver::Webkit::VERSION.dup
|
7
|
+
s.authors = ["thoughtbot", "Joe Ferris", "Matt Mongeau", "Mike Burns", "Jason Morrison"]
|
8
|
+
s.email = "support@thoughtbot.com"
|
12
9
|
s.homepage = "http://github.com/thoughtbot/capybara-webkit"
|
10
|
+
s.summary = "Headless Webkit driver for Capybara"
|
11
|
+
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- {spec,features}/*`.split("\n")
|
13
14
|
s.require_path = "lib"
|
14
|
-
|
15
|
-
s.summary = "Headless Webkit driver for Capybara"
|
16
|
-
s.add_runtime_dependency "capybara", [">= 1.0.0", "< 1.2"]
|
17
|
-
s.add_development_dependency "rspec", "~> 2.6.0"
|
18
|
-
s.add_development_dependency "sinatra"
|
19
|
-
s.add_development_dependency "mini_magick"
|
20
|
-
s.add_development_dependency "rake"
|
21
|
-
s.add_development_dependency "appraisal"
|
15
|
+
|
22
16
|
s.extensions = "extconf.rb"
|
17
|
+
|
18
|
+
s.add_runtime_dependency("capybara", [">= 1.0.0", "< 1.2"])
|
19
|
+
s.add_runtime_dependency("json")
|
20
|
+
|
21
|
+
s.add_development_dependency("rspec", "~> 2.6.0")
|
22
|
+
s.add_development_dependency("sinatra")
|
23
|
+
s.add_development_dependency("mini_magick")
|
24
|
+
s.add_development_dependency("rake")
|
25
|
+
s.add_development_dependency("appraisal", "~> 0.4.0")
|
23
26
|
end
|
24
27
|
|
data/gemfiles/1.0.gemfile.lock
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/jferris/Source/capybara-webkit
|
3
3
|
specs:
|
4
|
-
capybara-webkit (0.
|
5
|
-
capybara (
|
4
|
+
capybara-webkit (0.8.0)
|
5
|
+
capybara (>= 1.0.0, < 1.2)
|
6
|
+
json
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: http://rubygems.org/
|
9
10
|
specs:
|
10
|
-
appraisal (0.
|
11
|
+
appraisal (0.4.0)
|
11
12
|
bundler
|
12
13
|
rake
|
13
14
|
capybara (1.0.1)
|
@@ -20,16 +21,19 @@ GEM
|
|
20
21
|
childprocess (0.2.2)
|
21
22
|
ffi (~> 1.0.6)
|
22
23
|
diff-lcs (1.1.3)
|
23
|
-
ffi (1.0.
|
24
|
+
ffi (1.0.10)
|
25
|
+
json (1.6.3)
|
24
26
|
json_pure (1.6.1)
|
25
|
-
mime-types (1.
|
27
|
+
mime-types (1.17.2)
|
26
28
|
mini_magick (3.3)
|
27
29
|
subexec (~> 0.1.0)
|
28
30
|
nokogiri (1.5.0)
|
29
|
-
rack (1.3.
|
31
|
+
rack (1.3.5)
|
32
|
+
rack-protection (1.1.4)
|
33
|
+
rack
|
30
34
|
rack-test (0.6.1)
|
31
35
|
rack (>= 1.0)
|
32
|
-
rake (0.9.2)
|
36
|
+
rake (0.9.2.2)
|
33
37
|
rspec (2.6.0)
|
34
38
|
rspec-core (~> 2.6.0)
|
35
39
|
rspec-expectations (~> 2.6.0)
|
@@ -39,14 +43,15 @@ GEM
|
|
39
43
|
diff-lcs (~> 1.1.2)
|
40
44
|
rspec-mocks (2.6.0)
|
41
45
|
rubyzip (0.9.4)
|
42
|
-
selenium-webdriver (2.
|
46
|
+
selenium-webdriver (2.12.1)
|
43
47
|
childprocess (>= 0.2.1)
|
44
|
-
ffi (
|
48
|
+
ffi (~> 1.0.9)
|
45
49
|
json_pure
|
46
50
|
rubyzip
|
47
|
-
sinatra (1.
|
48
|
-
rack (~> 1.1)
|
49
|
-
|
51
|
+
sinatra (1.3.1)
|
52
|
+
rack (~> 1.3, >= 1.3.4)
|
53
|
+
rack-protection (~> 1.1, >= 1.1.2)
|
54
|
+
tilt (~> 1.3, >= 1.3.3)
|
50
55
|
subexec (0.1.0)
|
51
56
|
tilt (1.3.3)
|
52
57
|
xpath (0.1.4)
|
@@ -56,7 +61,7 @@ PLATFORMS
|
|
56
61
|
ruby
|
57
62
|
|
58
63
|
DEPENDENCIES
|
59
|
-
appraisal
|
64
|
+
appraisal (~> 0.4.0)
|
60
65
|
capybara (~> 1.0.0)
|
61
66
|
capybara-webkit!
|
62
67
|
mini_magick
|
data/gemfiles/1.1.gemfile.lock
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: /Users/jferris/Source/capybara-webkit
|
3
3
|
specs:
|
4
|
-
capybara-webkit (0.
|
5
|
-
capybara (
|
4
|
+
capybara-webkit (0.8.0)
|
5
|
+
capybara (>= 1.0.0, < 1.2)
|
6
|
+
json
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: http://rubygems.org/
|
9
10
|
specs:
|
10
|
-
appraisal (0.
|
11
|
+
appraisal (0.4.0)
|
11
12
|
bundler
|
12
13
|
rake
|
13
14
|
capybara (1.1.1)
|
@@ -20,16 +21,19 @@ GEM
|
|
20
21
|
childprocess (0.2.2)
|
21
22
|
ffi (~> 1.0.6)
|
22
23
|
diff-lcs (1.1.3)
|
23
|
-
ffi (1.0.
|
24
|
+
ffi (1.0.10)
|
25
|
+
json (1.6.3)
|
24
26
|
json_pure (1.6.1)
|
25
|
-
mime-types (1.
|
27
|
+
mime-types (1.17.2)
|
26
28
|
mini_magick (3.3)
|
27
29
|
subexec (~> 0.1.0)
|
28
30
|
nokogiri (1.5.0)
|
29
|
-
rack (1.3.
|
31
|
+
rack (1.3.5)
|
32
|
+
rack-protection (1.1.4)
|
33
|
+
rack
|
30
34
|
rack-test (0.6.1)
|
31
35
|
rack (>= 1.0)
|
32
|
-
rake (0.9.2)
|
36
|
+
rake (0.9.2.2)
|
33
37
|
rspec (2.6.0)
|
34
38
|
rspec-core (~> 2.6.0)
|
35
39
|
rspec-expectations (~> 2.6.0)
|
@@ -39,14 +43,15 @@ GEM
|
|
39
43
|
diff-lcs (~> 1.1.2)
|
40
44
|
rspec-mocks (2.6.0)
|
41
45
|
rubyzip (0.9.4)
|
42
|
-
selenium-webdriver (2.
|
46
|
+
selenium-webdriver (2.12.1)
|
43
47
|
childprocess (>= 0.2.1)
|
44
|
-
ffi (
|
48
|
+
ffi (~> 1.0.9)
|
45
49
|
json_pure
|
46
50
|
rubyzip
|
47
|
-
sinatra (1.
|
48
|
-
rack (~> 1.1)
|
49
|
-
|
51
|
+
sinatra (1.3.1)
|
52
|
+
rack (~> 1.3, >= 1.3.4)
|
53
|
+
rack-protection (~> 1.1, >= 1.1.2)
|
54
|
+
tilt (~> 1.3, >= 1.3.3)
|
50
55
|
subexec (0.1.0)
|
51
56
|
tilt (1.3.3)
|
52
57
|
xpath (0.1.4)
|
@@ -56,7 +61,7 @@ PLATFORMS
|
|
56
61
|
ruby
|
57
62
|
|
58
63
|
DEPENDENCIES
|
59
|
-
appraisal
|
64
|
+
appraisal (~> 0.4.0)
|
60
65
|
capybara (~> 1.1.0)
|
61
66
|
capybara-webkit!
|
62
67
|
mini_magick
|
@@ -1,7 +1,9 @@
|
|
1
1
|
require "capybara"
|
2
|
+
require "capybara/driver/webkit/version"
|
2
3
|
require "capybara/driver/webkit/node"
|
3
4
|
require "capybara/driver/webkit/browser"
|
4
5
|
require "capybara/driver/webkit/socket_debugger"
|
6
|
+
require "capybara/driver/webkit/cookie_jar"
|
5
7
|
|
6
8
|
class Capybara::Driver::Webkit
|
7
9
|
class WebkitInvalidResponseError < StandardError
|
@@ -20,13 +22,18 @@ class Capybara::Driver::Webkit
|
|
20
22
|
@options = options
|
21
23
|
@rack_server = Capybara::Server.new(@app)
|
22
24
|
@rack_server.boot if Capybara.run_server
|
23
|
-
@browser = options[:browser] || Browser.new
|
25
|
+
@browser = options[:browser] || Browser.new(
|
26
|
+
:ignore_ssl_errors => options[:ignore_ssl_errors])
|
24
27
|
end
|
25
28
|
|
26
29
|
def current_url
|
27
30
|
browser.url
|
28
31
|
end
|
29
32
|
|
33
|
+
def requested_url
|
34
|
+
browser.requested_url
|
35
|
+
end
|
36
|
+
|
30
37
|
def visit(path)
|
31
38
|
browser.visit(url(path))
|
32
39
|
end
|
@@ -56,6 +63,14 @@ class Capybara::Driver::Webkit
|
|
56
63
|
browser.evaluate_script script
|
57
64
|
end
|
58
65
|
|
66
|
+
def console_messages
|
67
|
+
browser.console_messages
|
68
|
+
end
|
69
|
+
|
70
|
+
def error_messages
|
71
|
+
browser.error_messages
|
72
|
+
end
|
73
|
+
|
59
74
|
def response_headers
|
60
75
|
browser.response_headers
|
61
76
|
end
|
@@ -103,6 +118,10 @@ class Capybara::Driver::Webkit
|
|
103
118
|
@rack_server.port
|
104
119
|
end
|
105
120
|
|
121
|
+
def cookies
|
122
|
+
@cookie_jar ||= CookieJar.new(browser)
|
123
|
+
end
|
124
|
+
|
106
125
|
private
|
107
126
|
|
108
127
|
def url(path)
|
@@ -12,6 +12,7 @@ class Capybara::Driver::Webkit
|
|
12
12
|
@stdout = options.has_key?(:stdout) ?
|
13
13
|
options[:stdout] :
|
14
14
|
$stdout
|
15
|
+
@ignore_ssl_errors = options[:ignore_ssl_errors]
|
15
16
|
start_server
|
16
17
|
connect
|
17
18
|
end
|
@@ -44,6 +45,19 @@ class Capybara::Driver::Webkit
|
|
44
45
|
command("Status").to_i
|
45
46
|
end
|
46
47
|
|
48
|
+
def console_messages
|
49
|
+
command("ConsoleMessages").split("\n").map do |messages|
|
50
|
+
parts = messages.split("|", 3)
|
51
|
+
{ :source => parts.first, :line_number => Integer(parts[1]), :message => parts.last }
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def error_messages
|
56
|
+
console_messages.select do |message|
|
57
|
+
message[:message] =~ /Error:/
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
47
61
|
def response_headers
|
48
62
|
Hash[command("Headers").split("\n").map { |header| header.split(": ") }]
|
49
63
|
end
|
@@ -52,6 +66,10 @@ class Capybara::Driver::Webkit
|
|
52
66
|
command("Url")
|
53
67
|
end
|
54
68
|
|
69
|
+
def requested_url
|
70
|
+
command("RequestedUrl")
|
71
|
+
end
|
72
|
+
|
55
73
|
def frame_focus(frame_id_or_index=nil)
|
56
74
|
if frame_id_or_index.is_a? Fixnum
|
57
75
|
command("FrameFocus", "", frame_id_or_index.to_s)
|
@@ -98,6 +116,15 @@ class Capybara::Driver::Webkit
|
|
98
116
|
command("GetCookies").lines.map{ |line| line.strip }.select{ |line| !line.empty? }
|
99
117
|
end
|
100
118
|
|
119
|
+
def set_proxy(options = {})
|
120
|
+
options = default_proxy_options.merge(options)
|
121
|
+
command("SetProxy", options[:host], options[:port], options[:user], options[:pass])
|
122
|
+
end
|
123
|
+
|
124
|
+
def clear_proxy
|
125
|
+
command("SetProxy")
|
126
|
+
end
|
127
|
+
|
101
128
|
private
|
102
129
|
|
103
130
|
def start_server
|
@@ -111,16 +138,24 @@ class Capybara::Driver::Webkit
|
|
111
138
|
|
112
139
|
def fork_server
|
113
140
|
server_path = File.expand_path("../../../../../bin/webkit_server", __FILE__)
|
114
|
-
|
115
141
|
pipe, @pid = server_pipe_and_pid(server_path)
|
116
|
-
|
117
|
-
at_exit { Process.kill("INT", @pid) }
|
118
|
-
|
142
|
+
register_shutdown_hook
|
119
143
|
pipe
|
120
144
|
end
|
121
145
|
|
146
|
+
def register_shutdown_hook
|
147
|
+
@owner_pid = Process.pid
|
148
|
+
at_exit do
|
149
|
+
if Process.pid == @owner_pid
|
150
|
+
Process.kill("INT", @pid)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
122
155
|
def server_pipe_and_pid(server_path)
|
123
|
-
|
156
|
+
cmdline = [server_path]
|
157
|
+
cmdline << "--ignore-ssl-errors" if @ignore_ssl_errors
|
158
|
+
pipe = IO.popen(cmdline.join(" "))
|
124
159
|
[pipe, pipe.pid]
|
125
160
|
end
|
126
161
|
|
@@ -185,5 +220,14 @@ class Capybara::Driver::Webkit
|
|
185
220
|
response.force_encoding("UTF-8") if response.respond_to?(:force_encoding)
|
186
221
|
response
|
187
222
|
end
|
223
|
+
|
224
|
+
def default_proxy_options
|
225
|
+
{
|
226
|
+
:host => "localhost",
|
227
|
+
:port => "0",
|
228
|
+
:user => "",
|
229
|
+
:pass => ""
|
230
|
+
}
|
231
|
+
end
|
188
232
|
end
|
189
233
|
end
|