capybara-webkit 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/GOALS +9 -0
- data/Gemfile.lock +15 -12
- data/LICENSE +1 -1
- data/NEWS.md +18 -0
- data/README.md +81 -2
- data/capybara-webkit.gemspec +1 -1
- data/lib/capybara/webkit.rb +11 -6
- data/lib/capybara/{driver/webkit → webkit}/browser.rb +90 -4
- data/lib/capybara/{driver/webkit → webkit}/connection.rb +48 -47
- data/lib/capybara/{driver/webkit → webkit}/cookie_jar.rb +1 -1
- data/lib/capybara/webkit/driver.rb +186 -0
- data/lib/capybara/webkit/errors.rb +10 -0
- data/lib/capybara/{driver/webkit → webkit}/node.rb +12 -4
- data/lib/capybara/{driver/webkit → webkit}/socket_debugger.rb +4 -1
- data/lib/capybara/{driver/webkit → webkit}/version.rb +1 -1
- data/lib/capybara_webkit_builder.rb +17 -3
- data/spec/browser_spec.rb +95 -7
- data/spec/connection_spec.rb +16 -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 +1200 -822
- data/spec/integration/driver_spec.rb +4 -3
- data/spec/selenium_compatibility_spec.rb +49 -0
- data/spec/spec_helper.rb +14 -6
- data/spec/support/app_runner.rb +94 -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/ClearPromptText.cpp +11 -0
- data/src/ClearPromptText.h +9 -0
- data/src/Command.cpp +4 -15
- data/src/Command.h +3 -14
- data/src/CommandFactory.cpp +20 -6
- data/src/CommandFactory.h +3 -2
- data/src/CommandParser.cpp +1 -1
- data/src/Connection.cpp +22 -21
- data/src/Connection.h +5 -6
- data/src/ConsoleMessages.cpp +2 -1
- data/src/ConsoleMessages.h +3 -5
- data/src/CurrentUrl.cpp +9 -48
- data/src/CurrentUrl.h +8 -8
- 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/GetTimeout.cpp +9 -0
- data/src/GetTimeout.h +11 -0
- 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 +8 -2
- data/src/Headers.h +3 -5
- data/src/IgnoreSslErrors.cpp +4 -3
- data/src/IgnoreSslErrors.h +3 -5
- data/src/JavascriptAlertMessages.cpp +10 -0
- data/src/JavascriptAlertMessages.h +9 -0
- data/src/JavascriptConfirmMessages.cpp +10 -0
- data/src/JavascriptConfirmMessages.h +9 -0
- data/src/JavascriptInvocation.cpp +1 -1
- data/src/JavascriptInvocation.h +1 -1
- data/src/JavascriptPromptMessages.cpp +10 -0
- data/src/JavascriptPromptMessages.h +9 -0
- data/src/NetworkAccessManager.cpp +38 -5
- data/src/NetworkAccessManager.h +20 -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/Response.cpp +4 -0
- data/src/Response.h +1 -0
- data/src/Server.cpp +2 -3
- data/src/Server.h +0 -2
- data/src/SetConfirmAction.cpp +11 -0
- data/src/SetConfirmAction.h +9 -0
- data/src/SetCookie.cpp +3 -4
- data/src/SetCookie.h +3 -5
- data/src/SetPromptAction.cpp +11 -0
- data/src/SetPromptAction.h +9 -0
- data/src/SetPromptText.cpp +11 -0
- data/src/SetPromptText.h +9 -0
- data/src/SetProxy.cpp +2 -1
- data/src/SetProxy.h +3 -5
- data/src/SetSkipImageLoading.cpp +12 -0
- data/src/SetSkipImageLoading.h +9 -0
- data/src/SetTimeout.cpp +19 -0
- data/src/SetTimeout.h +9 -0
- data/src/SocketCommand.cpp +21 -0
- data/src/SocketCommand.h +29 -0
- data/src/Source.cpp +3 -2
- data/src/Source.h +3 -4
- data/src/Status.cpp +2 -1
- data/src/Status.h +3 -5
- data/src/TimeoutCommand.cpp +69 -0
- data/src/TimeoutCommand.h +41 -0
- data/src/UnsupportedContentHandler.cpp +11 -17
- data/src/UnsupportedContentHandler.h +5 -3
- 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 +129 -44
- data/src/WebPage.h +37 -11
- data/src/WebPageManager.cpp +127 -0
- data/src/WebPageManager.h +59 -0
- data/src/WindowFocus.cpp +32 -0
- data/src/WindowFocus.h +15 -0
- data/src/body.cpp +2 -1
- data/src/capybara.js +38 -10
- data/src/find_command.h +17 -2
- data/src/main.cpp +0 -2
- data/src/webkit_server.pro +36 -0
- data/templates/Command.cpp +2 -4
- data/templates/Command.h +3 -3
- metadata +106 -27
- data/ChangeLog +0 -70
- data/lib/capybara/driver/webkit.rb +0 -136
@@ -1,136 +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
|
-
@browser.ignore_ssl_errors if options[:ignore_ssl_errors]
|
28
|
-
end
|
29
|
-
|
30
|
-
def current_url
|
31
|
-
browser.current_url
|
32
|
-
end
|
33
|
-
|
34
|
-
def requested_url
|
35
|
-
browser.requested_url
|
36
|
-
end
|
37
|
-
|
38
|
-
def visit(path)
|
39
|
-
browser.visit(url(path))
|
40
|
-
end
|
41
|
-
|
42
|
-
def find(query)
|
43
|
-
browser.find(query).map { |native| Node.new(self, native) }
|
44
|
-
end
|
45
|
-
|
46
|
-
def source
|
47
|
-
browser.source
|
48
|
-
end
|
49
|
-
|
50
|
-
def body
|
51
|
-
browser.body
|
52
|
-
end
|
53
|
-
|
54
|
-
def header(key, value)
|
55
|
-
browser.header(key, value)
|
56
|
-
end
|
57
|
-
|
58
|
-
def execute_script(script)
|
59
|
-
value = browser.execute_script script
|
60
|
-
value.empty? ? nil : value
|
61
|
-
end
|
62
|
-
|
63
|
-
def evaluate_script(script)
|
64
|
-
browser.evaluate_script script
|
65
|
-
end
|
66
|
-
|
67
|
-
def console_messages
|
68
|
-
browser.console_messages
|
69
|
-
end
|
70
|
-
|
71
|
-
def error_messages
|
72
|
-
browser.error_messages
|
73
|
-
end
|
74
|
-
|
75
|
-
def response_headers
|
76
|
-
browser.response_headers
|
77
|
-
end
|
78
|
-
|
79
|
-
def status_code
|
80
|
-
browser.status_code
|
81
|
-
end
|
82
|
-
|
83
|
-
def resize_window(width, height)
|
84
|
-
browser.resize_window(width, height)
|
85
|
-
end
|
86
|
-
|
87
|
-
def within_frame(frame_id_or_index)
|
88
|
-
browser.frame_focus(frame_id_or_index)
|
89
|
-
begin
|
90
|
-
yield
|
91
|
-
ensure
|
92
|
-
browser.frame_focus
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def within_window(handle)
|
97
|
-
raise Capybara::NotSupportedByDriverError
|
98
|
-
end
|
99
|
-
|
100
|
-
def wait?
|
101
|
-
true
|
102
|
-
end
|
103
|
-
|
104
|
-
def wait_until(*args)
|
105
|
-
end
|
106
|
-
|
107
|
-
def reset!
|
108
|
-
browser.reset!
|
109
|
-
end
|
110
|
-
|
111
|
-
def has_shortcircuit_timeout?
|
112
|
-
false
|
113
|
-
end
|
114
|
-
|
115
|
-
def render(path, options={})
|
116
|
-
options[:width] ||= 1000
|
117
|
-
options[:height] ||= 10
|
118
|
-
|
119
|
-
browser.render path, options[:width], options[:height]
|
120
|
-
end
|
121
|
-
|
122
|
-
def server_port
|
123
|
-
@rack_server.port
|
124
|
-
end
|
125
|
-
|
126
|
-
def cookies
|
127
|
-
@cookie_jar ||= CookieJar.new(browser)
|
128
|
-
end
|
129
|
-
|
130
|
-
private
|
131
|
-
|
132
|
-
def url(path)
|
133
|
-
@rack_server.url(path)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|