otherinbox-capybara-webkit 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. data/.gitignore +19 -0
  2. data/.rspec +2 -0
  3. data/Appraisals +7 -0
  4. data/CONTRIBUTING.md +47 -0
  5. data/ChangeLog +70 -0
  6. data/Gemfile +3 -0
  7. data/Gemfile.lock +68 -0
  8. data/LICENSE +19 -0
  9. data/NEWS.md +36 -0
  10. data/README.md +114 -0
  11. data/Rakefile +65 -0
  12. data/bin/Info.plist +22 -0
  13. data/capybara-webkit.gemspec +28 -0
  14. data/extconf.rb +2 -0
  15. data/gemfiles/1.0.gemfile +7 -0
  16. data/gemfiles/1.0.gemfile.lock +70 -0
  17. data/gemfiles/1.1.gemfile +7 -0
  18. data/gemfiles/1.1.gemfile.lock +70 -0
  19. data/lib/capybara-webkit.rb +1 -0
  20. data/lib/capybara/driver/webkit.rb +135 -0
  21. data/lib/capybara/driver/webkit/browser.rb +168 -0
  22. data/lib/capybara/driver/webkit/connection.rb +120 -0
  23. data/lib/capybara/driver/webkit/cookie_jar.rb +55 -0
  24. data/lib/capybara/driver/webkit/node.rb +118 -0
  25. data/lib/capybara/driver/webkit/socket_debugger.rb +43 -0
  26. data/lib/capybara/driver/webkit/version.rb +7 -0
  27. data/lib/capybara/webkit.rb +11 -0
  28. data/lib/capybara/webkit/matchers.rb +37 -0
  29. data/lib/capybara_webkit_builder.rb +68 -0
  30. data/spec/browser_spec.rb +248 -0
  31. data/spec/capybara_webkit_builder_spec.rb +37 -0
  32. data/spec/connection_spec.rb +54 -0
  33. data/spec/cookie_jar_spec.rb +48 -0
  34. data/spec/driver_rendering_spec.rb +80 -0
  35. data/spec/driver_resize_window_spec.rb +59 -0
  36. data/spec/driver_spec.rb +1552 -0
  37. data/spec/integration/driver_spec.rb +20 -0
  38. data/spec/integration/session_spec.rb +137 -0
  39. data/spec/self_signed_ssl_cert.rb +42 -0
  40. data/spec/spec_helper.rb +46 -0
  41. data/src/Body.h +12 -0
  42. data/src/ClearCookies.cpp +15 -0
  43. data/src/ClearCookies.h +11 -0
  44. data/src/Command.cpp +19 -0
  45. data/src/Command.h +31 -0
  46. data/src/CommandFactory.cpp +38 -0
  47. data/src/CommandFactory.h +16 -0
  48. data/src/CommandParser.cpp +76 -0
  49. data/src/CommandParser.h +33 -0
  50. data/src/Connection.cpp +71 -0
  51. data/src/Connection.h +37 -0
  52. data/src/ConsoleMessages.cpp +10 -0
  53. data/src/ConsoleMessages.h +12 -0
  54. data/src/CurrentUrl.cpp +68 -0
  55. data/src/CurrentUrl.h +16 -0
  56. data/src/Evaluate.cpp +84 -0
  57. data/src/Evaluate.h +22 -0
  58. data/src/Execute.cpp +16 -0
  59. data/src/Execute.h +12 -0
  60. data/src/Find.cpp +19 -0
  61. data/src/Find.h +13 -0
  62. data/src/FrameFocus.cpp +66 -0
  63. data/src/FrameFocus.h +28 -0
  64. data/src/GetCookies.cpp +20 -0
  65. data/src/GetCookies.h +14 -0
  66. data/src/Header.cpp +18 -0
  67. data/src/Header.h +11 -0
  68. data/src/Headers.cpp +10 -0
  69. data/src/Headers.h +12 -0
  70. data/src/IgnoreSslErrors.cpp +12 -0
  71. data/src/IgnoreSslErrors.h +12 -0
  72. data/src/JavascriptInvocation.cpp +14 -0
  73. data/src/JavascriptInvocation.h +19 -0
  74. data/src/NetworkAccessManager.cpp +29 -0
  75. data/src/NetworkAccessManager.h +19 -0
  76. data/src/NetworkCookieJar.cpp +101 -0
  77. data/src/NetworkCookieJar.h +15 -0
  78. data/src/Node.cpp +14 -0
  79. data/src/Node.h +13 -0
  80. data/src/NullCommand.cpp +10 -0
  81. data/src/NullCommand.h +11 -0
  82. data/src/PageLoadingCommand.cpp +46 -0
  83. data/src/PageLoadingCommand.h +40 -0
  84. data/src/Render.cpp +18 -0
  85. data/src/Render.h +12 -0
  86. data/src/RequestedUrl.cpp +12 -0
  87. data/src/RequestedUrl.h +12 -0
  88. data/src/Reset.cpp +29 -0
  89. data/src/Reset.h +15 -0
  90. data/src/ResizeWindow.cpp +16 -0
  91. data/src/ResizeWindow.h +12 -0
  92. data/src/Response.cpp +24 -0
  93. data/src/Response.h +15 -0
  94. data/src/Server.cpp +24 -0
  95. data/src/Server.h +21 -0
  96. data/src/SetCookie.cpp +16 -0
  97. data/src/SetCookie.h +11 -0
  98. data/src/SetProxy.cpp +22 -0
  99. data/src/SetProxy.h +11 -0
  100. data/src/SetSkipImageLoading.cpp +11 -0
  101. data/src/SetSkipImageLoading.h +11 -0
  102. data/src/Source.cpp +18 -0
  103. data/src/Source.h +19 -0
  104. data/src/Status.cpp +12 -0
  105. data/src/Status.h +12 -0
  106. data/src/UnsupportedContentHandler.cpp +32 -0
  107. data/src/UnsupportedContentHandler.h +18 -0
  108. data/src/Url.cpp +12 -0
  109. data/src/Url.h +12 -0
  110. data/src/Visit.cpp +12 -0
  111. data/src/Visit.h +12 -0
  112. data/src/WebPage.cpp +246 -0
  113. data/src/WebPage.h +58 -0
  114. data/src/body.cpp +10 -0
  115. data/src/capybara.js +315 -0
  116. data/src/find_command.h +30 -0
  117. data/src/main.cpp +31 -0
  118. data/src/webkit_server.pro +87 -0
  119. data/src/webkit_server.qrc +5 -0
  120. data/templates/Command.cpp +10 -0
  121. data/templates/Command.h +12 -0
  122. data/webkit_server.pro +4 -0
  123. metadata +300 -0
@@ -0,0 +1,30 @@
1
+ #define CHECK_COMMAND(expectedName) \
2
+ if (strcmp(#expectedName, name) == 0) { \
3
+ return new expectedName(m_page, arguments, this); \
4
+ }
5
+
6
+ CHECK_COMMAND(Visit)
7
+ CHECK_COMMAND(Find)
8
+ CHECK_COMMAND(Reset)
9
+ CHECK_COMMAND(Node)
10
+ CHECK_COMMAND(Url)
11
+ CHECK_COMMAND(Source)
12
+ CHECK_COMMAND(Evaluate)
13
+ CHECK_COMMAND(Execute)
14
+ CHECK_COMMAND(FrameFocus)
15
+ CHECK_COMMAND(Header)
16
+ CHECK_COMMAND(Render)
17
+ CHECK_COMMAND(Body)
18
+ CHECK_COMMAND(Status)
19
+ CHECK_COMMAND(Headers)
20
+ CHECK_COMMAND(SetCookie)
21
+ CHECK_COMMAND(ClearCookies)
22
+ CHECK_COMMAND(GetCookies)
23
+ CHECK_COMMAND(Headers)
24
+ CHECK_COMMAND(SetProxy)
25
+ CHECK_COMMAND(ConsoleMessages)
26
+ CHECK_COMMAND(RequestedUrl)
27
+ CHECK_COMMAND(CurrentUrl)
28
+ CHECK_COMMAND(ResizeWindow)
29
+ CHECK_COMMAND(IgnoreSslErrors)
30
+ CHECK_COMMAND(SetSkipImageLoading)
data/src/main.cpp ADDED
@@ -0,0 +1,31 @@
1
+ #include "Server.h"
2
+ #include <QtGui>
3
+ #include <iostream>
4
+ #ifdef Q_OS_UNIX
5
+ #include <unistd.h>
6
+ #endif
7
+
8
+ int main(int argc, char **argv) {
9
+ #ifdef Q_OS_UNIX
10
+ if (setpgid(0, 0) < 0) {
11
+ std::cerr << "Unable to set new process group." << std::endl;
12
+ return 1;
13
+ }
14
+ #endif
15
+
16
+ QApplication app(argc, argv);
17
+ app.setApplicationName("capybara-webkit");
18
+ app.setOrganizationName("thoughtbot, inc");
19
+ app.setOrganizationDomain("thoughtbot.com");
20
+
21
+ Server server(0);
22
+
23
+ if (server.start()) {
24
+ std::cout << "Capybara-webkit server started, listening on port: " << server.server_port() << std::endl;
25
+ return app.exec();
26
+ } else {
27
+ std::cerr << "Couldn't start capybara-webkit server" << std::endl;
28
+ return 1;
29
+ }
30
+ }
31
+
@@ -0,0 +1,87 @@
1
+ TEMPLATE = app
2
+ TARGET = webkit_server
3
+ DESTDIR = .
4
+ HEADERS = \
5
+ IgnoreSslErrors.h \
6
+ ResizeWindow.h \
7
+ CurrentUrl.h \
8
+ RequestedUrl.h \
9
+ ConsoleMessages.h \
10
+ WebPage.h \
11
+ Server.h \
12
+ Connection.h \
13
+ Command.h \
14
+ Visit.h \
15
+ Find.h \
16
+ Reset.h \
17
+ Node.h \
18
+ JavascriptInvocation.h \
19
+ Url.h \
20
+ Source.h \
21
+ Evaluate.h \
22
+ Execute.h \
23
+ FrameFocus.h \
24
+ Response.h \
25
+ NetworkAccessManager.h \
26
+ NetworkCookieJar.h \
27
+ Header.h \
28
+ Render.h \
29
+ body.h \
30
+ Status.h \
31
+ Headers.h \
32
+ UnsupportedContentHandler.h \
33
+ SetCookie.h \
34
+ ClearCookies.h \
35
+ GetCookies.h \
36
+ CommandParser.h \
37
+ CommandFactory.h \
38
+ SetProxy.h \
39
+ NullCommand.h \
40
+ PageLoadingCommand.h \
41
+ SetSkipImageLoading.h \
42
+
43
+ SOURCES = \
44
+ IgnoreSslErrors.cpp \
45
+ ResizeWindow.cpp \
46
+ CurrentUrl.cpp \
47
+ RequestedUrl.cpp \
48
+ ConsoleMessages.cpp \
49
+ main.cpp \
50
+ WebPage.cpp \
51
+ Server.cpp \
52
+ Connection.cpp \
53
+ Command.cpp \
54
+ Visit.cpp \
55
+ Find.cpp \
56
+ Reset.cpp \
57
+ Node.cpp \
58
+ JavascriptInvocation.cpp \
59
+ Url.cpp \
60
+ Source.cpp \
61
+ Evaluate.cpp \
62
+ Execute.cpp \
63
+ FrameFocus.cpp \
64
+ Response.cpp \
65
+ NetworkAccessManager.cpp \
66
+ NetworkCookieJar.cpp \
67
+ Header.cpp \
68
+ Render.cpp \
69
+ body.cpp \
70
+ Status.cpp \
71
+ Headers.cpp \
72
+ UnsupportedContentHandler.cpp \
73
+ SetCookie.cpp \
74
+ ClearCookies.cpp \
75
+ GetCookies.cpp \
76
+ CommandParser.cpp \
77
+ CommandFactory.cpp \
78
+ SetProxy.cpp \
79
+ NullCommand.cpp \
80
+ PageLoadingCommand.cpp \
81
+ SetSkipImageLoading.cpp \
82
+
83
+ RESOURCES = webkit_server.qrc
84
+ QT += network webkit
85
+ CONFIG += console
86
+ CONFIG -= app_bundle
87
+
@@ -0,0 +1,5 @@
1
+ <RCC>
2
+ <qresource prefix="/">
3
+ <file>capybara.js</file>
4
+ </qresource>
5
+ </RCC>
@@ -0,0 +1,10 @@
1
+ #include "NAME.h"
2
+ #include "WebPage.h"
3
+
4
+ NAME::NAME(WebPage *page, QObject *parent) : Command(page, parent) {
5
+ }
6
+
7
+ void NAME::start(QStringList &arguments) {
8
+ Q_UNUSED(arguments);
9
+ }
10
+
@@ -0,0 +1,12 @@
1
+ #include "Command.h"
2
+
3
+ class WebPage;
4
+
5
+ class NAME : public Command {
6
+ Q_OBJECT
7
+
8
+ public:
9
+ NAME(WebPage *page, QObject *parent = 0);
10
+ virtual void start(QStringList &arguments);
11
+ };
12
+
data/webkit_server.pro ADDED
@@ -0,0 +1,4 @@
1
+ TEMPLATE = subdirs
2
+ CONFIG += ordered
3
+ SUBDIRS += src/webkit_server.pro
4
+
metadata ADDED
@@ -0,0 +1,300 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: otherinbox-capybara-webkit
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.12.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - thoughtbot
9
+ - Joe Ferris
10
+ - Matt Mongeau
11
+ - Mike Burns
12
+ - Jason Morrison
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+ date: 2012-05-18 00:00:00.000000000 Z
17
+ dependencies:
18
+ - !ruby/object:Gem::Dependency
19
+ name: capybara
20
+ requirement: !ruby/object:Gem::Requirement
21
+ none: false
22
+ requirements:
23
+ - - ! '>='
24
+ - !ruby/object:Gem::Version
25
+ version: 1.0.0
26
+ - - <
27
+ - !ruby/object:Gem::Version
28
+ version: '1.2'
29
+ type: :runtime
30
+ prerelease: false
31
+ version_requirements: !ruby/object:Gem::Requirement
32
+ none: false
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: 1.0.0
37
+ - - <
38
+ - !ruby/object:Gem::Version
39
+ version: '1.2'
40
+ - !ruby/object:Gem::Dependency
41
+ name: json
42
+ requirement: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ version: 2.6.0
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ version: 2.6.0
72
+ - !ruby/object:Gem::Dependency
73
+ name: sinatra
74
+ requirement: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ type: :development
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ - !ruby/object:Gem::Dependency
89
+ name: mini_magick
90
+ requirement: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ type: :development
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ - !ruby/object:Gem::Dependency
105
+ name: rake
106
+ requirement: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ type: :development
113
+ prerelease: false
114
+ version_requirements: !ruby/object:Gem::Requirement
115
+ none: false
116
+ requirements:
117
+ - - ! '>='
118
+ - !ruby/object:Gem::Version
119
+ version: '0'
120
+ - !ruby/object:Gem::Dependency
121
+ name: appraisal
122
+ requirement: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ~>
126
+ - !ruby/object:Gem::Version
127
+ version: 0.4.0
128
+ type: :development
129
+ prerelease: false
130
+ version_requirements: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ~>
134
+ - !ruby/object:Gem::Version
135
+ version: 0.4.0
136
+ description:
137
+ email: support@thoughtbot.com
138
+ executables: []
139
+ extensions:
140
+ - extconf.rb
141
+ extra_rdoc_files: []
142
+ files:
143
+ - .gitignore
144
+ - .rspec
145
+ - Appraisals
146
+ - CONTRIBUTING.md
147
+ - ChangeLog
148
+ - Gemfile
149
+ - Gemfile.lock
150
+ - LICENSE
151
+ - NEWS.md
152
+ - README.md
153
+ - Rakefile
154
+ - bin/Info.plist
155
+ - capybara-webkit.gemspec
156
+ - extconf.rb
157
+ - gemfiles/1.0.gemfile
158
+ - gemfiles/1.0.gemfile.lock
159
+ - gemfiles/1.1.gemfile
160
+ - gemfiles/1.1.gemfile.lock
161
+ - lib/capybara-webkit.rb
162
+ - lib/capybara/driver/webkit.rb
163
+ - lib/capybara/driver/webkit/browser.rb
164
+ - lib/capybara/driver/webkit/connection.rb
165
+ - lib/capybara/driver/webkit/cookie_jar.rb
166
+ - lib/capybara/driver/webkit/node.rb
167
+ - lib/capybara/driver/webkit/socket_debugger.rb
168
+ - lib/capybara/driver/webkit/version.rb
169
+ - lib/capybara/webkit.rb
170
+ - lib/capybara/webkit/matchers.rb
171
+ - lib/capybara_webkit_builder.rb
172
+ - spec/browser_spec.rb
173
+ - spec/capybara_webkit_builder_spec.rb
174
+ - spec/connection_spec.rb
175
+ - spec/cookie_jar_spec.rb
176
+ - spec/driver_rendering_spec.rb
177
+ - spec/driver_resize_window_spec.rb
178
+ - spec/driver_spec.rb
179
+ - spec/integration/driver_spec.rb
180
+ - spec/integration/session_spec.rb
181
+ - spec/self_signed_ssl_cert.rb
182
+ - spec/spec_helper.rb
183
+ - src/Body.h
184
+ - src/ClearCookies.cpp
185
+ - src/ClearCookies.h
186
+ - src/Command.cpp
187
+ - src/Command.h
188
+ - src/CommandFactory.cpp
189
+ - src/CommandFactory.h
190
+ - src/CommandParser.cpp
191
+ - src/CommandParser.h
192
+ - src/Connection.cpp
193
+ - src/Connection.h
194
+ - src/ConsoleMessages.cpp
195
+ - src/ConsoleMessages.h
196
+ - src/CurrentUrl.cpp
197
+ - src/CurrentUrl.h
198
+ - src/Evaluate.cpp
199
+ - src/Evaluate.h
200
+ - src/Execute.cpp
201
+ - src/Execute.h
202
+ - src/Find.cpp
203
+ - src/Find.h
204
+ - src/FrameFocus.cpp
205
+ - src/FrameFocus.h
206
+ - src/GetCookies.cpp
207
+ - src/GetCookies.h
208
+ - src/Header.cpp
209
+ - src/Header.h
210
+ - src/Headers.cpp
211
+ - src/Headers.h
212
+ - src/IgnoreSslErrors.cpp
213
+ - src/IgnoreSslErrors.h
214
+ - src/JavascriptInvocation.cpp
215
+ - src/JavascriptInvocation.h
216
+ - src/NetworkAccessManager.cpp
217
+ - src/NetworkAccessManager.h
218
+ - src/NetworkCookieJar.cpp
219
+ - src/NetworkCookieJar.h
220
+ - src/Node.cpp
221
+ - src/Node.h
222
+ - src/NullCommand.cpp
223
+ - src/NullCommand.h
224
+ - src/PageLoadingCommand.cpp
225
+ - src/PageLoadingCommand.h
226
+ - src/Render.cpp
227
+ - src/Render.h
228
+ - src/RequestedUrl.cpp
229
+ - src/RequestedUrl.h
230
+ - src/Reset.cpp
231
+ - src/Reset.h
232
+ - src/ResizeWindow.cpp
233
+ - src/ResizeWindow.h
234
+ - src/Response.cpp
235
+ - src/Response.h
236
+ - src/Server.cpp
237
+ - src/Server.h
238
+ - src/SetCookie.cpp
239
+ - src/SetCookie.h
240
+ - src/SetProxy.cpp
241
+ - src/SetProxy.h
242
+ - src/SetSkipImageLoading.cpp
243
+ - src/SetSkipImageLoading.h
244
+ - src/Source.cpp
245
+ - src/Source.h
246
+ - src/Status.cpp
247
+ - src/Status.h
248
+ - src/UnsupportedContentHandler.cpp
249
+ - src/UnsupportedContentHandler.h
250
+ - src/Url.cpp
251
+ - src/Url.h
252
+ - src/Visit.cpp
253
+ - src/Visit.h
254
+ - src/WebPage.cpp
255
+ - src/WebPage.h
256
+ - src/body.cpp
257
+ - src/capybara.js
258
+ - src/find_command.h
259
+ - src/main.cpp
260
+ - src/webkit_server.pro
261
+ - src/webkit_server.qrc
262
+ - templates/Command.cpp
263
+ - templates/Command.h
264
+ - webkit_server.pro
265
+ homepage: http://github.com/thoughtbot/capybara-webkit
266
+ licenses: []
267
+ post_install_message:
268
+ rdoc_options: []
269
+ require_paths:
270
+ - lib
271
+ required_ruby_version: !ruby/object:Gem::Requirement
272
+ none: false
273
+ requirements:
274
+ - - ! '>='
275
+ - !ruby/object:Gem::Version
276
+ version: '0'
277
+ required_rubygems_version: !ruby/object:Gem::Requirement
278
+ none: false
279
+ requirements:
280
+ - - ! '>='
281
+ - !ruby/object:Gem::Version
282
+ version: '0'
283
+ requirements: []
284
+ rubyforge_project:
285
+ rubygems_version: 1.8.21
286
+ signing_key:
287
+ specification_version: 3
288
+ summary: Headless Webkit driver for Capybara
289
+ test_files:
290
+ - spec/browser_spec.rb
291
+ - spec/capybara_webkit_builder_spec.rb
292
+ - spec/connection_spec.rb
293
+ - spec/cookie_jar_spec.rb
294
+ - spec/driver_rendering_spec.rb
295
+ - spec/driver_resize_window_spec.rb
296
+ - spec/driver_spec.rb
297
+ - spec/integration/driver_spec.rb
298
+ - spec/integration/session_spec.rb
299
+ - spec/self_signed_ssl_cert.rb
300
+ - spec/spec_helper.rb