otherinbox-capybara-webkit 0.12.0 → 0.12.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/GOALS +9 -0
- data/README.md +1 -1
- data/capybara-webkit.gemspec +1 -1
- data/lib/capybara/webkit.rb +11 -4
- data/lib/capybara/{driver/webkit → webkit}/browser.rb +27 -3
- data/lib/capybara/{driver/webkit → webkit}/connection.rb +45 -47
- data/lib/capybara/{driver/webkit → webkit}/cookie_jar.rb +1 -1
- data/lib/capybara/webkit/driver.rb +150 -0
- data/lib/capybara/webkit/errors.rb +10 -0
- data/lib/capybara/{driver/webkit → webkit}/node.rb +2 -2
- data/lib/capybara/{driver/webkit → webkit}/socket_debugger.rb +1 -1
- data/lib/capybara/{driver/webkit → webkit}/version.rb +1 -1
- data/lib/capybara_webkit_builder.rb +17 -3
- data/spec/browser_spec.rb +38 -25
- data/spec/connection_spec.rb +5 -5
- data/spec/cookie_jar_spec.rb +3 -3
- data/spec/driver_rendering_spec.rb +19 -26
- data/spec/driver_resize_window_spec.rb +3 -3
- data/spec/driver_spec.rb +907 -829
- data/spec/integration/driver_spec.rb +4 -3
- data/spec/spec_helper.rb +14 -6
- data/spec/support/app_runner.rb +91 -0
- data/src/Authenticate.cpp +18 -0
- data/src/Authenticate.h +12 -0
- data/src/Body.h +3 -5
- data/src/ClearCookies.cpp +3 -5
- data/src/ClearCookies.h +3 -5
- data/src/Command.cpp +4 -15
- data/src/Command.h +3 -14
- data/src/CommandFactory.cpp +10 -6
- data/src/CommandFactory.h +3 -2
- data/src/CommandParser.cpp +1 -1
- data/src/Connection.cpp +22 -11
- data/src/Connection.h +4 -2
- data/src/ConsoleMessages.cpp +2 -1
- data/src/ConsoleMessages.h +3 -5
- data/src/CurrentUrl.cpp +2 -1
- data/src/CurrentUrl.h +3 -5
- data/src/EnableLogging.cpp +10 -0
- data/src/EnableLogging.h +12 -0
- data/src/Evaluate.cpp +2 -1
- data/src/Evaluate.h +3 -5
- data/src/Execute.cpp +2 -1
- data/src/Execute.h +3 -5
- data/src/Find.cpp +3 -2
- data/src/Find.h +3 -5
- data/src/FrameFocus.cpp +3 -2
- data/src/FrameFocus.h +3 -4
- data/src/GetCookies.cpp +3 -4
- data/src/GetCookies.h +3 -5
- data/src/GetWindowHandle.cpp +11 -0
- data/src/GetWindowHandle.h +10 -0
- data/src/GetWindowHandles.cpp +20 -0
- data/src/GetWindowHandles.h +10 -0
- data/src/Header.cpp +2 -1
- data/src/Header.h +3 -5
- data/src/Headers.cpp +2 -1
- data/src/Headers.h +3 -5
- data/src/IgnoreSslErrors.cpp +4 -3
- data/src/IgnoreSslErrors.h +3 -5
- data/src/JavascriptInvocation.cpp +1 -1
- data/src/JavascriptInvocation.h +1 -1
- data/src/NetworkAccessManager.cpp +19 -1
- data/src/NetworkAccessManager.h +10 -0
- data/src/Node.cpp +6 -1
- data/src/Node.h +4 -5
- data/src/NullCommand.cpp +5 -2
- data/src/NullCommand.h +4 -3
- data/src/PageLoadingCommand.cpp +12 -7
- data/src/PageLoadingCommand.h +6 -9
- data/src/Render.cpp +2 -1
- data/src/Render.h +3 -5
- data/src/RequestedUrl.cpp +2 -1
- data/src/RequestedUrl.h +3 -5
- data/src/Reset.cpp +3 -17
- data/src/Reset.h +3 -8
- data/src/ResizeWindow.cpp +2 -1
- data/src/ResizeWindow.h +3 -5
- data/src/Server.cpp +2 -3
- data/src/Server.h +0 -2
- data/src/SetCookie.cpp +3 -4
- data/src/SetCookie.h +3 -5
- data/src/SetProxy.cpp +2 -1
- data/src/SetProxy.h +3 -5
- data/src/SetSkipImageLoading.cpp +3 -2
- data/src/SetSkipImageLoading.h +3 -5
- data/src/SocketCommand.cpp +21 -0
- data/src/SocketCommand.h +29 -0
- data/src/Source.cpp +2 -1
- data/src/Source.h +3 -4
- data/src/Status.cpp +2 -1
- data/src/Status.h +3 -5
- data/src/UnsupportedContentHandler.cpp +1 -1
- data/src/Url.cpp +2 -1
- data/src/Url.h +3 -5
- data/src/Visit.cpp +3 -2
- data/src/Visit.h +3 -5
- data/src/WebPage.cpp +86 -39
- data/src/WebPage.h +22 -8
- data/src/WebPageManager.cpp +117 -0
- data/src/WebPageManager.h +56 -0
- data/src/WindowFocus.cpp +32 -0
- data/src/WindowFocus.h +15 -0
- data/src/body.cpp +2 -1
- data/src/find_command.h +6 -2
- data/src/webkit_server.pro +14 -0
- data/templates/Command.cpp +2 -4
- data/templates/Command.h +3 -3
- metadata +29 -10
- data/lib/capybara/driver/webkit.rb +0 -135
@@ -1,135 +0,0 @@
|
|
1
|
-
require "capybara"
|
2
|
-
require "capybara/driver/webkit/version"
|
3
|
-
require "capybara/driver/webkit/node"
|
4
|
-
require "capybara/driver/webkit/connection"
|
5
|
-
require "capybara/driver/webkit/browser"
|
6
|
-
require "capybara/driver/webkit/socket_debugger"
|
7
|
-
require "capybara/driver/webkit/cookie_jar"
|
8
|
-
|
9
|
-
class Capybara::Driver::Webkit
|
10
|
-
class WebkitInvalidResponseError < StandardError
|
11
|
-
end
|
12
|
-
|
13
|
-
class WebkitNoResponseError < StandardError
|
14
|
-
end
|
15
|
-
|
16
|
-
class NodeNotAttachedError < Capybara::ElementNotFound
|
17
|
-
end
|
18
|
-
|
19
|
-
attr_reader :browser
|
20
|
-
|
21
|
-
def initialize(app, options={})
|
22
|
-
@app = app
|
23
|
-
@options = options
|
24
|
-
@rack_server = Capybara::Server.new(@app)
|
25
|
-
@rack_server.boot if Capybara.run_server
|
26
|
-
@browser = options[:browser] || Browser.new(Connection.new(options))
|
27
|
-
end
|
28
|
-
|
29
|
-
def current_url
|
30
|
-
browser.current_url
|
31
|
-
end
|
32
|
-
|
33
|
-
def requested_url
|
34
|
-
browser.requested_url
|
35
|
-
end
|
36
|
-
|
37
|
-
def visit(path)
|
38
|
-
browser.visit(url(path))
|
39
|
-
end
|
40
|
-
|
41
|
-
def find(query)
|
42
|
-
browser.find(query).map { |native| Node.new(self, native) }
|
43
|
-
end
|
44
|
-
|
45
|
-
def source
|
46
|
-
browser.source
|
47
|
-
end
|
48
|
-
|
49
|
-
def body
|
50
|
-
browser.body
|
51
|
-
end
|
52
|
-
|
53
|
-
def header(key, value)
|
54
|
-
browser.header(key, value)
|
55
|
-
end
|
56
|
-
|
57
|
-
def execute_script(script)
|
58
|
-
value = browser.execute_script script
|
59
|
-
value.empty? ? nil : value
|
60
|
-
end
|
61
|
-
|
62
|
-
def evaluate_script(script)
|
63
|
-
browser.evaluate_script script
|
64
|
-
end
|
65
|
-
|
66
|
-
def console_messages
|
67
|
-
browser.console_messages
|
68
|
-
end
|
69
|
-
|
70
|
-
def error_messages
|
71
|
-
browser.error_messages
|
72
|
-
end
|
73
|
-
|
74
|
-
def response_headers
|
75
|
-
browser.response_headers
|
76
|
-
end
|
77
|
-
|
78
|
-
def status_code
|
79
|
-
browser.status_code
|
80
|
-
end
|
81
|
-
|
82
|
-
def resize_window(width, height)
|
83
|
-
browser.resize_window(width, height)
|
84
|
-
end
|
85
|
-
|
86
|
-
def within_frame(frame_id_or_index)
|
87
|
-
browser.frame_focus(frame_id_or_index)
|
88
|
-
begin
|
89
|
-
yield
|
90
|
-
ensure
|
91
|
-
browser.frame_focus
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def within_window(handle)
|
96
|
-
raise Capybara::NotSupportedByDriverError
|
97
|
-
end
|
98
|
-
|
99
|
-
def wait?
|
100
|
-
true
|
101
|
-
end
|
102
|
-
|
103
|
-
def wait_until(*args)
|
104
|
-
end
|
105
|
-
|
106
|
-
def reset!
|
107
|
-
browser.reset!
|
108
|
-
end
|
109
|
-
|
110
|
-
def has_shortcircuit_timeout?
|
111
|
-
false
|
112
|
-
end
|
113
|
-
|
114
|
-
def render(path, options={})
|
115
|
-
options[:width] ||= 1000
|
116
|
-
options[:height] ||= 10
|
117
|
-
|
118
|
-
browser.render path, options[:width], options[:height]
|
119
|
-
end
|
120
|
-
|
121
|
-
def server_port
|
122
|
-
@rack_server.port
|
123
|
-
end
|
124
|
-
|
125
|
-
def cookies
|
126
|
-
@cookie_jar ||= CookieJar.new(browser)
|
127
|
-
end
|
128
|
-
|
129
|
-
private
|
130
|
-
|
131
|
-
def url(path)
|
132
|
-
@rack_server.url(path)
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|