capybara-webkit 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/.gitignore +13 -0
  2. data/.rspec +2 -0
  3. data/Gemfile +6 -0
  4. data/Gemfile.lock +55 -0
  5. data/LICENSE +19 -0
  6. data/README.md +37 -0
  7. data/Rakefile +76 -0
  8. data/capybara-webkit.gemspec +15 -0
  9. data/extconf.rb +2 -0
  10. data/lib/capybara-webkit.rb +7 -0
  11. data/lib/capybara/driver/webkit.rb +84 -0
  12. data/lib/capybara/driver/webkit/browser.rb +86 -0
  13. data/lib/capybara/driver/webkit/node.rb +87 -0
  14. data/spec/driver_spec.rb +465 -0
  15. data/spec/integration/driver_spec.rb +21 -0
  16. data/spec/integration/session_spec.rb +12 -0
  17. data/spec/spec_helper.rb +22 -0
  18. data/spec/support/socket_debugger.rb +42 -0
  19. data/src/Command.cpp +15 -0
  20. data/src/Command.h +28 -0
  21. data/src/Connection.cpp +130 -0
  22. data/src/Connection.h +36 -0
  23. data/src/Evaluate.cpp +84 -0
  24. data/src/Evaluate.h +22 -0
  25. data/src/Execute.cpp +17 -0
  26. data/src/Execute.h +12 -0
  27. data/src/Find.cpp +20 -0
  28. data/src/Find.h +13 -0
  29. data/src/JavascriptInvocation.cpp +14 -0
  30. data/src/JavascriptInvocation.h +19 -0
  31. data/src/Node.cpp +14 -0
  32. data/src/Node.h +13 -0
  33. data/src/Reset.cpp +16 -0
  34. data/src/Reset.h +12 -0
  35. data/src/Server.cpp +21 -0
  36. data/src/Server.h +20 -0
  37. data/src/Source.cpp +14 -0
  38. data/src/Source.h +12 -0
  39. data/src/Url.cpp +14 -0
  40. data/src/Url.h +12 -0
  41. data/src/Visit.cpp +20 -0
  42. data/src/Visit.h +16 -0
  43. data/src/WebPage.cpp +81 -0
  44. data/src/WebPage.h +29 -0
  45. data/src/capybara.js +98 -0
  46. data/src/find_command.h +13 -0
  47. data/src/main.cpp +20 -0
  48. data/src/webkit_server.pro +9 -0
  49. data/src/webkit_server.qrc +5 -0
  50. data/templates/Command.cpp +10 -0
  51. data/templates/Command.h +12 -0
  52. data/webkit_server.pro +4 -0
  53. metadata +140 -0
@@ -0,0 +1,13 @@
1
+ #define CHECK_COMMAND(expectedName) \
2
+ if (strcmp(#expectedName, name) == 0) { \
3
+ return new expectedName(m_page, 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)
data/src/main.cpp ADDED
@@ -0,0 +1,20 @@
1
+ #include "Server.h"
2
+ #include <QtGui>
3
+ #include <iostream>
4
+
5
+ int main(int argc, char **argv) {
6
+ QApplication app(argc, argv);
7
+ app.setApplicationName("capybara-webkit");
8
+ app.setOrganizationName("thoughtbot, inc");
9
+ app.setOrganizationDomain("thoughtbot.com");
10
+
11
+ Server server;
12
+
13
+ if (server.start()) {
14
+ return app.exec();
15
+ } else {
16
+ std::cerr << "Couldn't start server" << std::endl;
17
+ return 1;
18
+ }
19
+ }
20
+
@@ -0,0 +1,9 @@
1
+ TEMPLATE = app
2
+ TARGET = webkit_server
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
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
6
+ RESOURCES = webkit_server.qrc
7
+ QT += network webkit
8
+ CONFIG += console
9
+
@@ -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,140 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capybara-webkit
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - thoughtbot
14
+ - Joe Ferris
15
+ - Jason Morrison
16
+ - Tristan Dunn
17
+ autorequire:
18
+ bindir: bin
19
+ cert_chain: []
20
+
21
+ date: 2011-04-06 00:00:00 -04:00
22
+ default_executable:
23
+ dependencies:
24
+ - !ruby/object:Gem::Dependency
25
+ type: :runtime
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ hash: 13
32
+ segments:
33
+ - 0
34
+ - 4
35
+ - 1
36
+ version: 0.4.1
37
+ version_requirements: *id001
38
+ name: capybara
39
+ prerelease: false
40
+ description:
41
+ email: support@thoughtbot.com
42
+ executables: []
43
+
44
+ extensions:
45
+ - extconf.rb
46
+ extra_rdoc_files: []
47
+
48
+ files:
49
+ - .gitignore
50
+ - .rspec
51
+ - Gemfile
52
+ - Gemfile.lock
53
+ - LICENSE
54
+ - README.md
55
+ - Rakefile
56
+ - capybara-webkit.gemspec
57
+ - extconf.rb
58
+ - lib/capybara-webkit.rb
59
+ - lib/capybara/driver/webkit.rb
60
+ - lib/capybara/driver/webkit/browser.rb
61
+ - lib/capybara/driver/webkit/node.rb
62
+ - spec/driver_spec.rb
63
+ - spec/integration/driver_spec.rb
64
+ - spec/integration/session_spec.rb
65
+ - spec/spec_helper.rb
66
+ - spec/support/socket_debugger.rb
67
+ - src/Command.cpp
68
+ - src/Command.h
69
+ - src/Connection.cpp
70
+ - src/Connection.h
71
+ - src/Evaluate.cpp
72
+ - src/Evaluate.h
73
+ - src/Execute.cpp
74
+ - src/Execute.h
75
+ - src/Find.cpp
76
+ - src/Find.h
77
+ - src/JavascriptInvocation.cpp
78
+ - src/JavascriptInvocation.h
79
+ - src/Node.cpp
80
+ - src/Node.h
81
+ - src/Reset.cpp
82
+ - src/Reset.h
83
+ - src/Server.cpp
84
+ - src/Server.h
85
+ - src/Source.cpp
86
+ - src/Source.h
87
+ - src/Url.cpp
88
+ - src/Url.h
89
+ - src/Visit.cpp
90
+ - src/Visit.h
91
+ - src/WebPage.cpp
92
+ - src/WebPage.h
93
+ - src/capybara.js
94
+ - src/find_command.h
95
+ - src/main.cpp
96
+ - src/webkit_server.pro
97
+ - src/webkit_server.qrc
98
+ - templates/Command.cpp
99
+ - templates/Command.h
100
+ - webkit_server.pro
101
+ has_rdoc: true
102
+ homepage: http://github.com/thoughtbot/capybara-webkit
103
+ licenses: []
104
+
105
+ post_install_message:
106
+ rdoc_options: []
107
+
108
+ require_paths:
109
+ - lib
110
+ required_ruby_version: !ruby/object:Gem::Requirement
111
+ none: false
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ hash: 3
116
+ segments:
117
+ - 0
118
+ version: "0"
119
+ required_rubygems_version: !ruby/object:Gem::Requirement
120
+ none: false
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ hash: 3
125
+ segments:
126
+ - 0
127
+ version: "0"
128
+ requirements: []
129
+
130
+ rubyforge_project:
131
+ rubygems_version: 1.6.1
132
+ signing_key:
133
+ specification_version: 3
134
+ summary: Headless Webkit driver for Capybara
135
+ test_files:
136
+ - spec/driver_spec.rb
137
+ - spec/integration/driver_spec.rb
138
+ - spec/integration/session_spec.rb
139
+ - spec/spec_helper.rb
140
+ - spec/support/socket_debugger.rb