capybara-webkit 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/capybara-webkit.gemspec +1 -1
- data/lib/capybara/driver/webkit.rb +1 -1
- data/lib/capybara/driver/webkit/node.rb +1 -1
- data/spec/integration/session_spec.rb +65 -2
- data/spec/spec_helper.rb +3 -0
- metadata +4 -5
- data/.rvmrc +0 -1
data/README.md
CHANGED
@@ -6,11 +6,11 @@ A [capybara](https://github.com/jnicklas/capybara) driver that uses [WebKit](htt
|
|
6
6
|
Dependencies
|
7
7
|
------------
|
8
8
|
|
9
|
-
capybara-webkit depends on a WebKit implementation from Qt, a cross-platform development toolkit. You'll need to download the Qt
|
9
|
+
capybara-webkit depends on a WebKit implementation from Qt, a cross-platform development toolkit. You'll need to download the Qt Framework to build and install the gem.
|
10
10
|
|
11
11
|
* [Download Qt](http://qt.nokia.com/downloads/downloads)
|
12
12
|
|
13
|
-
If you're on OS X, the installer at the above link will set up everything you need.
|
13
|
+
If you're on OS X, the installer at the above link will set up everything you need. You can download just the framework, as the full SDK isn't required to build the gem.
|
14
14
|
|
15
15
|
If you're on Ubuntu, you can install the libqt4-dev package.
|
16
16
|
|
data/capybara-webkit.gemspec
CHANGED
@@ -2,11 +2,74 @@ require 'spec_helper'
|
|
2
2
|
require 'capybara-webkit'
|
3
3
|
|
4
4
|
describe Capybara::Session do
|
5
|
+
subject { Capybara::Session.new(:reusable_webkit, @app) }
|
6
|
+
after { subject.reset! }
|
7
|
+
|
8
|
+
context "slow javascript app" do
|
9
|
+
before(:all) do
|
10
|
+
@app = lambda do |env|
|
11
|
+
body = <<-HTML
|
12
|
+
<html><body>
|
13
|
+
<form action="/next" id="submit_me"><input type="submit" value="Submit" /></form>
|
14
|
+
<p id="change_me">Hello</p>
|
15
|
+
|
16
|
+
<script type="text/javascript">
|
17
|
+
var form = document.getElementById('submit_me');
|
18
|
+
form.addEventListener("submit", function (event) {
|
19
|
+
event.preventDefault();
|
20
|
+
setTimeout(function () {
|
21
|
+
document.getElementById("change_me").innerHTML = 'Good' + 'bye';
|
22
|
+
}, 500);
|
23
|
+
});
|
24
|
+
</script>
|
25
|
+
</body></html>
|
26
|
+
HTML
|
27
|
+
[200,
|
28
|
+
{ 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s },
|
29
|
+
[body]]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
before do
|
34
|
+
@default_wait_time = Capybara.default_wait_time
|
35
|
+
Capybara.default_wait_time = 1
|
36
|
+
end
|
37
|
+
|
38
|
+
after { Capybara.default_wait_time = @default_wait_time }
|
39
|
+
|
40
|
+
it "waits for a request to load" do
|
41
|
+
subject.visit("/")
|
42
|
+
subject.find_button("Submit").click
|
43
|
+
subject.should have_content("Goodbye");
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
context "simple app" do
|
48
|
+
before(:all) do
|
49
|
+
@app = lambda do |env|
|
50
|
+
body = <<-HTML
|
51
|
+
<html><body>
|
52
|
+
<strong>Hello</strong>
|
53
|
+
</body></html>
|
54
|
+
HTML
|
55
|
+
[200,
|
56
|
+
{ 'Content-Type' => 'text/html', 'Content-Length' => body.length.to_s },
|
57
|
+
[body]]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it "inspects nodes" do
|
62
|
+
subject.visit("/")
|
63
|
+
subject.all(:xpath, "//strong").first.inspect.should include("strong")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe Capybara::Session, "with TestApp" do
|
5
69
|
before do
|
6
|
-
@session = Capybara::Session.new(:
|
70
|
+
@session = Capybara::Session.new(:reusable_webkit, TestApp)
|
7
71
|
end
|
8
72
|
|
9
|
-
# TODO: needs to only use one Browser throughout tests
|
10
73
|
# it_should_behave_like "session"
|
11
74
|
# it_should_behave_like "session with javascript support"
|
12
75
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -20,3 +20,6 @@ require File.join(spec_dir,"spec_helper")
|
|
20
20
|
require 'capybara/driver/webkit/browser'
|
21
21
|
$webkit_browser = Capybara::Driver::Webkit::Browser.new(:socket_class => TCPSocket)
|
22
22
|
|
23
|
+
Capybara.register_driver :reusable_webkit do |app|
|
24
|
+
Capybara::Driver::Webkit.new(app, :browser => $webkit_browser)
|
25
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-webkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- thoughtbot
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-04-
|
21
|
+
date: 2011-04-14 00:00:00 -04:00
|
22
22
|
default_executable:
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
@@ -62,7 +62,6 @@ extra_rdoc_files: []
|
|
62
62
|
files:
|
63
63
|
- .gitignore
|
64
64
|
- .rspec
|
65
|
-
- .rvmrc
|
66
65
|
- Gemfile
|
67
66
|
- Gemfile.lock
|
68
67
|
- LICENSE
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use ruby-1.8.7-p334
|