capybara-webkit 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +28 -28
- data/README.md +39 -4
- data/capybara-webkit.gemspec +2 -2
- data/lib/capybara-webkit.rb +4 -0
- data/lib/capybara/driver/webkit.rb +23 -3
- data/lib/capybara/driver/webkit/browser.rb +44 -6
- data/lib/capybara/driver/webkit/node.rb +15 -4
- data/lib/capybara/driver/webkit/socket_debugger.rb +43 -0
- data/lib/capybara_webkit_builder.rb +9 -2
- data/spec/browser_spec.rb +26 -0
- data/spec/driver_rendering_spec.rb +80 -0
- data/spec/driver_spec.rb +186 -15
- data/spec/integration/driver_spec.rb +4 -0
- data/spec/integration/session_spec.rb +2 -2
- data/src/Body.h +12 -0
- data/src/Connection.cpp +5 -2
- data/src/Header.cpp +18 -0
- data/src/Header.h +11 -0
- data/src/NetworkAccessManager.cpp +22 -0
- data/src/NetworkAccessManager.h +18 -0
- data/src/Render.cpp +19 -0
- data/src/Render.h +12 -0
- data/src/Reset.cpp +3 -0
- data/src/Server.cpp +5 -2
- data/src/Server.h +1 -0
- data/src/Source.cpp +9 -2
- data/src/Source.h +7 -0
- data/src/WebPage.cpp +79 -5
- data/src/WebPage.h +9 -0
- data/src/body.cpp +11 -0
- data/src/capybara.js +19 -4
- data/src/find_command.h +3 -0
- data/src/main.cpp +2 -1
- data/src/webkit_server.pro +2 -2
- metadata +34 -9
- data/spec/support/socket_debugger.rb +0 -42
data/src/find_command.h
CHANGED
data/src/main.cpp
CHANGED
@@ -11,9 +11,10 @@ int main(int argc, char **argv) {
|
|
11
11
|
Server server;
|
12
12
|
|
13
13
|
if (server.start()) {
|
14
|
+
std::cout << "Capybara-webkit server started, listening on port: " << server.server_port() << std::endl;
|
14
15
|
return app.exec();
|
15
16
|
} else {
|
16
|
-
std::cerr << "Couldn't start server" << std::endl;
|
17
|
+
std::cerr << "Couldn't start capybara-webkit server" << std::endl;
|
17
18
|
return 1;
|
18
19
|
}
|
19
20
|
}
|
data/src/webkit_server.pro
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
TEMPLATE = app
|
2
2
|
TARGET = webkit_server
|
3
3
|
DESTDIR = .
|
4
|
-
HEADERS = WebPage.h Server.h Connection.h Command.h Visit.h Find.h Reset.h Node.h JavascriptInvocation.h Url.h Source.h Evaluate.h Execute.h FrameFocus.h Response.h
|
5
|
-
SOURCES = main.cpp WebPage.cpp Server.cpp Connection.cpp Command.cpp Visit.cpp Find.cpp Reset.cpp Node.cpp JavascriptInvocation.cpp Url.cpp Source.cpp Evaluate.cpp Execute.cpp FrameFocus.cpp Response.cpp
|
4
|
+
HEADERS = WebPage.h Server.h Connection.h Command.h Visit.h Find.h Reset.h Node.h JavascriptInvocation.h Url.h Source.h Evaluate.h Execute.h FrameFocus.h Response.h NetworkAccessManager.h Header.h Render.h body.h
|
5
|
+
SOURCES = main.cpp WebPage.cpp Server.cpp Connection.cpp Command.cpp Visit.cpp Find.cpp Reset.cpp Node.cpp JavascriptInvocation.cpp Url.cpp Source.cpp Evaluate.cpp Execute.cpp FrameFocus.cpp Response.cpp NetworkAccessManager.cpp Header.cpp Render.cpp body.cpp
|
6
6
|
RESOURCES = webkit_server.qrc
|
7
7
|
QT += network webkit
|
8
8
|
CONFIG += console
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capybara-webkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 0.6.0
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- thoughtbot
|
@@ -25,20 +30,25 @@ autorequire:
|
|
25
30
|
bindir: bin
|
26
31
|
cert_chain: []
|
27
32
|
|
28
|
-
date: 2011-
|
33
|
+
date: 2011-08-12 00:00:00 -04:00
|
29
34
|
default_executable:
|
30
35
|
dependencies:
|
31
36
|
- !ruby/object:Gem::Dependency
|
32
|
-
|
37
|
+
type: :runtime
|
33
38
|
requirement: &id001 !ruby/object:Gem::Requirement
|
34
39
|
none: false
|
35
40
|
requirements:
|
36
41
|
- - ~>
|
37
42
|
- !ruby/object:Gem::Version
|
38
|
-
|
39
|
-
|
40
|
-
|
43
|
+
hash: 23
|
44
|
+
segments:
|
45
|
+
- 1
|
46
|
+
- 0
|
47
|
+
- 0
|
48
|
+
version: 1.0.0
|
41
49
|
version_requirements: *id001
|
50
|
+
name: capybara
|
51
|
+
prerelease: false
|
42
52
|
description:
|
43
53
|
email: support@thoughtbot.com
|
44
54
|
executables: []
|
@@ -50,6 +60,7 @@ extra_rdoc_files: []
|
|
50
60
|
files:
|
51
61
|
- .gitignore
|
52
62
|
- .rspec
|
63
|
+
- CONTRIBUTING.md
|
53
64
|
- Gemfile
|
54
65
|
- Gemfile.lock
|
55
66
|
- LICENSE
|
@@ -62,12 +73,15 @@ files:
|
|
62
73
|
- lib/capybara/driver/webkit.rb
|
63
74
|
- lib/capybara/driver/webkit/browser.rb
|
64
75
|
- lib/capybara/driver/webkit/node.rb
|
76
|
+
- lib/capybara/driver/webkit/socket_debugger.rb
|
65
77
|
- lib/capybara_webkit_builder.rb
|
78
|
+
- spec/browser_spec.rb
|
79
|
+
- spec/driver_rendering_spec.rb
|
66
80
|
- spec/driver_spec.rb
|
67
81
|
- spec/integration/driver_spec.rb
|
68
82
|
- spec/integration/session_spec.rb
|
69
83
|
- spec/spec_helper.rb
|
70
|
-
-
|
84
|
+
- src/Body.h
|
71
85
|
- src/Command.cpp
|
72
86
|
- src/Command.h
|
73
87
|
- src/Connection.cpp
|
@@ -80,10 +94,16 @@ files:
|
|
80
94
|
- src/Find.h
|
81
95
|
- src/FrameFocus.cpp
|
82
96
|
- src/FrameFocus.h
|
97
|
+
- src/Header.cpp
|
98
|
+
- src/Header.h
|
83
99
|
- src/JavascriptInvocation.cpp
|
84
100
|
- src/JavascriptInvocation.h
|
101
|
+
- src/NetworkAccessManager.cpp
|
102
|
+
- src/NetworkAccessManager.h
|
85
103
|
- src/Node.cpp
|
86
104
|
- src/Node.h
|
105
|
+
- src/Render.cpp
|
106
|
+
- src/Render.h
|
87
107
|
- src/Reset.cpp
|
88
108
|
- src/Reset.h
|
89
109
|
- src/Response.cpp
|
@@ -98,6 +118,7 @@ files:
|
|
98
118
|
- src/Visit.h
|
99
119
|
- src/WebPage.cpp
|
100
120
|
- src/WebPage.h
|
121
|
+
- src/body.cpp
|
101
122
|
- src/capybara.js
|
102
123
|
- src/find_command.h
|
103
124
|
- src/main.cpp
|
@@ -120,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
141
|
requirements:
|
121
142
|
- - ">="
|
122
143
|
- !ruby/object:Gem::Version
|
123
|
-
hash:
|
144
|
+
hash: 3
|
124
145
|
segments:
|
125
146
|
- 0
|
126
147
|
version: "0"
|
@@ -129,6 +150,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
150
|
requirements:
|
130
151
|
- - ">="
|
131
152
|
- !ruby/object:Gem::Version
|
153
|
+
hash: 3
|
154
|
+
segments:
|
155
|
+
- 0
|
132
156
|
version: "0"
|
133
157
|
requirements: []
|
134
158
|
|
@@ -138,8 +162,9 @@ signing_key:
|
|
138
162
|
specification_version: 3
|
139
163
|
summary: Headless Webkit driver for Capybara
|
140
164
|
test_files:
|
165
|
+
- spec/browser_spec.rb
|
166
|
+
- spec/driver_rendering_spec.rb
|
141
167
|
- spec/driver_spec.rb
|
142
168
|
- spec/integration/driver_spec.rb
|
143
169
|
- spec/integration/session_spec.rb
|
144
170
|
- spec/spec_helper.rb
|
145
|
-
- spec/support/socket_debugger.rb
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# Wraps the TCP socket and prints data sent and received. Used for debugging
|
2
|
-
# the wire protocol. You can use this by passing a :socket_class to Browser.
|
3
|
-
class SocketDebugger
|
4
|
-
def self.open(host, port)
|
5
|
-
real_socket = TCPSocket.open(host, port)
|
6
|
-
new(real_socket)
|
7
|
-
end
|
8
|
-
|
9
|
-
def initialize(socket)
|
10
|
-
@socket = socket
|
11
|
-
end
|
12
|
-
|
13
|
-
def read(length)
|
14
|
-
received @socket.read(length)
|
15
|
-
end
|
16
|
-
|
17
|
-
def puts(line)
|
18
|
-
sent line
|
19
|
-
@socket.puts(line)
|
20
|
-
end
|
21
|
-
|
22
|
-
def print(content)
|
23
|
-
sent content
|
24
|
-
@socket.print(content)
|
25
|
-
end
|
26
|
-
|
27
|
-
def gets
|
28
|
-
received @socket.gets
|
29
|
-
end
|
30
|
-
|
31
|
-
private
|
32
|
-
|
33
|
-
def sent(content)
|
34
|
-
Kernel.puts " >> " + content.to_s
|
35
|
-
end
|
36
|
-
|
37
|
-
def received(content)
|
38
|
-
Kernel.puts " << " + content.to_s
|
39
|
-
content
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|