capybara-webkit 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/Appraisals +4 -0
- data/Gemfile.lock +3 -7
- data/NEWS.md +7 -0
- data/README.md +16 -118
- data/Rakefile +3 -1
- data/capybara-webkit.gemspec +1 -1
- data/gemfiles/2.1.gemfile.lock +2 -3
- data/gemfiles/2.2.gemfile.lock +2 -2
- data/gemfiles/2.3.gemfile.lock +2 -2
- data/gemfiles/2.4.gemfile +7 -0
- data/gemfiles/2.4.gemfile.lock +77 -0
- data/lib/capybara/webkit/browser.rb +38 -2
- data/lib/capybara/webkit/connection.rb +26 -3
- data/lib/capybara/webkit/driver.rb +74 -0
- data/lib/capybara/webkit/errors.rb +6 -0
- data/lib/capybara/webkit/version.rb +1 -1
- data/spec/connection_spec.rb +27 -0
- data/spec/driver_spec.rb +352 -12
- data/spec/selenium_compatibility_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/src/AcceptAlert.cpp +11 -0
- data/src/AcceptAlert.h +10 -0
- data/src/CommandFactory.cpp +2 -0
- data/src/Connection.cpp +8 -3
- data/src/Connection.h +1 -0
- data/src/FindModal.cpp +29 -0
- data/src/FindModal.h +16 -0
- data/src/NetworkAccessManager.cpp +6 -6
- data/src/NetworkAccessManager.h +1 -1
- data/src/SetConfirmAction.cpp +10 -2
- data/src/SetPromptAction.cpp +13 -2
- data/src/WebPage.cpp +105 -10
- data/src/WebPage.h +12 -2
- data/src/WebPageManager.cpp +6 -0
- data/src/capybara.js +9 -8
- data/src/find_command.h +2 -0
- data/src/webkit_server.pro +4 -0
- metadata +10 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d61a9d2568a46053dfe21bf58cc9263454c4b489
|
4
|
+
data.tar.gz: e9689291ccf578f1a2c79e72c3ceb6b0d545dc4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0553617872da58e661c35a40ed83195d5ee013f0f8ca04bb2519f2bff1342b5023580fc3dc5ac6427c645a16511662133036aef648900401cbf46b2bd0ba734a
|
7
|
+
data.tar.gz: 6dfe749f35bf08f94c31467034eecc7e94e11205bce989a8643addf46d69e0f5295384e39e00ea23c0f21ae463719b8521e42564ee7b5bebbada5d56d2a1f8db
|
data/.travis.yml
CHANGED
@@ -12,19 +12,19 @@ env:
|
|
12
12
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
13
13
|
matrix:
|
14
14
|
include:
|
15
|
-
- rvm: 1.9.3
|
16
|
-
gemfile: gemfiles/2.1.gemfile
|
17
|
-
env: QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
|
18
15
|
- rvm: 1.9.3
|
19
16
|
gemfile: gemfiles/2.2.gemfile
|
20
17
|
env: QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
|
21
18
|
- rvm: 1.9.3
|
22
19
|
gemfile: gemfiles/2.3.gemfile
|
23
20
|
env: QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
|
21
|
+
- rvm: 1.9.3
|
22
|
+
gemfile: gemfiles/2.4.gemfile
|
23
|
+
env: QMAKE=/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
|
24
24
|
gemfile:
|
25
|
-
- gemfiles/2.1.gemfile
|
26
25
|
- gemfiles/2.2.gemfile
|
27
26
|
- gemfiles/2.3.gemfile
|
27
|
+
- gemfiles/2.4.gemfile
|
28
28
|
before_install:
|
29
29
|
- sudo apt-add-repository -y ppa:ubuntu-sdk-team/ppa
|
30
30
|
- sudo apt-get update
|
data/Appraisals
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
capybara-webkit (1.
|
5
|
-
capybara (>= 2.0.2, < 2.
|
4
|
+
capybara-webkit (1.3.0)
|
5
|
+
capybara (>= 2.0.2, < 2.5.0)
|
6
6
|
json
|
7
7
|
|
8
8
|
GEM
|
@@ -12,7 +12,7 @@ GEM
|
|
12
12
|
appraisal (0.4.0)
|
13
13
|
bundler
|
14
14
|
rake
|
15
|
-
capybara (2.
|
15
|
+
capybara (2.4.1)
|
16
16
|
mime-types (>= 1.16)
|
17
17
|
nokogiri (>= 1.3.3)
|
18
18
|
rack (>= 1.0.0)
|
@@ -25,7 +25,6 @@ GEM
|
|
25
25
|
ffi (1.9.3-java)
|
26
26
|
ffi (1.9.3-x86-mingw32)
|
27
27
|
json (1.8.1)
|
28
|
-
json (1.8.1-java)
|
29
28
|
launchy (2.4.2)
|
30
29
|
addressable (~> 2.3)
|
31
30
|
launchy (2.4.2-java)
|
@@ -38,9 +37,6 @@ GEM
|
|
38
37
|
multi_json (1.8.4)
|
39
38
|
nokogiri (1.6.2.1)
|
40
39
|
mini_portile (= 0.6.0)
|
41
|
-
nokogiri (1.6.2.1-java)
|
42
|
-
nokogiri (1.6.2.1-x86-mingw32)
|
43
|
-
mini_portile (= 0.6.0)
|
44
40
|
rack (1.5.2)
|
45
41
|
rack-protection (1.3.2)
|
46
42
|
rack
|
data/NEWS.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
New for 1.3.0:
|
2
|
+
|
3
|
+
* Capybara 2.4 compatibility.
|
4
|
+
* Raise better errors if server fails to start
|
5
|
+
* Offline application cache support.
|
6
|
+
* Wildcard URL blacklist support.
|
7
|
+
|
1
8
|
New for 1.2.0:
|
2
9
|
* Capybara 2.3 compatibility.
|
3
10
|
* Kill webkit_server when parent process closes stdin.
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ development toolkit. You'll need to download the Qt libraries to build and
|
|
14
14
|
install the gem. You can find instructions for downloading and installing QT on
|
15
15
|
the
|
16
16
|
[capybara-webkit wiki](https://github.com/thoughtbot/capybara-webkit/wiki/Installing-Qt-and-compiling-capybara-webkit).
|
17
|
-
capybara-webkit requires Qt version 4.8.
|
17
|
+
capybara-webkit requires Qt version 4.8 or greater.
|
18
18
|
|
19
19
|
Windows Support
|
20
20
|
---------------
|
@@ -47,7 +47,13 @@ CI
|
|
47
47
|
|
48
48
|
If you're like us, you'll be using capybara-webkit on CI.
|
49
49
|
|
50
|
-
On Linux platforms, capybara-webkit requires an X server to run, although it doesn't create any visible windows. Xvfb works fine for this. You can setup Xvfb yourself and set a DISPLAY variable,
|
50
|
+
On Linux platforms, capybara-webkit requires an X server to run, although it doesn't create any visible windows. Xvfb works fine for this. You can setup Xvfb yourself and set a DISPLAY variable, try out the [headless gem](https://github.com/leonid-shevtsov/headless), or use the xvfb-run utility as follows:
|
51
|
+
|
52
|
+
```
|
53
|
+
xvfb-run -a bundle exec spec
|
54
|
+
```
|
55
|
+
|
56
|
+
This automatically sets up a virtual X server on a free server number.
|
51
57
|
|
52
58
|
Usage
|
53
59
|
-----
|
@@ -76,6 +82,13 @@ If you're using capybara-webkit with Sinatra, don't forget to set
|
|
76
82
|
Capybara.app = MySinatraApp.new
|
77
83
|
```
|
78
84
|
|
85
|
+
Offline Application Cache
|
86
|
+
-------------------------
|
87
|
+
|
88
|
+
The offline application cache needs a directory to write to for the cached files. Capybara-webkit
|
89
|
+
will look at if the working directory has a tmp directory and when it exists offline application
|
90
|
+
cache will be enabled.
|
91
|
+
|
79
92
|
Non-Standard Driver Methods
|
80
93
|
---------------------------
|
81
94
|
|
@@ -101,33 +114,6 @@ page.driver.error_messages
|
|
101
114
|
=> [{:source=>"http://example.com", :line_number=>1, :message=>"SyntaxError: Parse error"}]
|
102
115
|
```
|
103
116
|
|
104
|
-
**alert_messages, confirm_messages, prompt_messages**: returns arrays of Javascript dialog messages for each dialog type
|
105
|
-
|
106
|
-
```js
|
107
|
-
// In Javascript:
|
108
|
-
alert("HI");
|
109
|
-
confirm("Ok?");
|
110
|
-
prompt("Number?", "42");
|
111
|
-
```
|
112
|
-
|
113
|
-
```ruby
|
114
|
-
# In Ruby:
|
115
|
-
page.driver.alert_messages
|
116
|
-
=> ["Hi"]
|
117
|
-
page.driver.confirm_messages
|
118
|
-
=> ["Ok?"]
|
119
|
-
page.driver.prompt_messages
|
120
|
-
=> ["Number?"]
|
121
|
-
```
|
122
|
-
|
123
|
-
**resize_window**: change the viewport size to the given width and height
|
124
|
-
|
125
|
-
```ruby
|
126
|
-
page.driver.resize_window(500, 300)
|
127
|
-
page.driver.evaluate_script("window.innerWidth")
|
128
|
-
=> 500
|
129
|
-
```
|
130
|
-
|
131
117
|
**cookies**: allows read-only access of cookies for the current session
|
132
118
|
|
133
119
|
```ruby
|
@@ -135,94 +121,6 @@ page.driver.cookies["alpha"]
|
|
135
121
|
=> "abc"
|
136
122
|
```
|
137
123
|
|
138
|
-
**accept_js_confirms!**: accept any Javascript confirm that is triggered by the page's Javascript
|
139
|
-
|
140
|
-
```js
|
141
|
-
// In Javascript:
|
142
|
-
if (confirm("Ok?"))
|
143
|
-
console.log("Hi");
|
144
|
-
else
|
145
|
-
console.log("Bye");
|
146
|
-
```
|
147
|
-
|
148
|
-
```ruby
|
149
|
-
# In Ruby:
|
150
|
-
page.driver.accept_js_confirms!
|
151
|
-
visit "/"
|
152
|
-
page.driver.console_messages.first[:message]
|
153
|
-
=> "Hi"
|
154
|
-
```
|
155
|
-
|
156
|
-
**dismiss_js_confirms!**: dismiss any Javascript confirm that is triggered by the page's Javascript
|
157
|
-
|
158
|
-
```js
|
159
|
-
// In Javascript:
|
160
|
-
if (confirm("Ok?"))
|
161
|
-
console.log("Hi");
|
162
|
-
else
|
163
|
-
console.log("Bye");
|
164
|
-
```
|
165
|
-
|
166
|
-
```ruby
|
167
|
-
# In Ruby:
|
168
|
-
page.driver.dismiss_js_confirms!
|
169
|
-
visit "/"
|
170
|
-
page.driver.console_messages.first[:message]
|
171
|
-
=> "Bye"
|
172
|
-
```
|
173
|
-
|
174
|
-
**accept_js_prompts!**: accept any Javascript prompt that is triggered by the page's Javascript
|
175
|
-
|
176
|
-
```js
|
177
|
-
// In Javascript:
|
178
|
-
var a = prompt("Number?", "0")
|
179
|
-
console.log(a);
|
180
|
-
```
|
181
|
-
|
182
|
-
```ruby
|
183
|
-
# In Ruby:
|
184
|
-
page.driver.accept_js_prompts!
|
185
|
-
visit "/"
|
186
|
-
page.driver.console_messages.first[:message]
|
187
|
-
=> "0"
|
188
|
-
```
|
189
|
-
|
190
|
-
**dismiss_js_prompts!**: dismiss any Javascript prompt that is triggered by the page's Javascript
|
191
|
-
|
192
|
-
```js
|
193
|
-
// In Javascript:
|
194
|
-
var a = prompt("Number?", "0")
|
195
|
-
if (a != null)
|
196
|
-
console.log(a);
|
197
|
-
else
|
198
|
-
console.log("you said no"));
|
199
|
-
```
|
200
|
-
|
201
|
-
```ruby
|
202
|
-
# In Ruby:
|
203
|
-
page.driver.dismiss_js_prompts!
|
204
|
-
visit "/"
|
205
|
-
page.driver.console_messages.first[:message]
|
206
|
-
=> "you said no"
|
207
|
-
```
|
208
|
-
|
209
|
-
**js_prompt_input=(value)**: set the text to use if a Javascript prompt is encountered and accepted
|
210
|
-
|
211
|
-
```js
|
212
|
-
// In Javascript:
|
213
|
-
var a = prompt("Number?", "0")
|
214
|
-
console.log(a);
|
215
|
-
```
|
216
|
-
|
217
|
-
```ruby
|
218
|
-
# In Ruby:
|
219
|
-
page.driver.js_prompt_input = "42"
|
220
|
-
page.driver.accept_js_prompts!
|
221
|
-
visit "/"
|
222
|
-
page.driver.console_messages.first[:message]
|
223
|
-
=> "42"
|
224
|
-
```
|
225
|
-
|
226
124
|
**header**: set the given HTTP header for subsequent requests
|
227
125
|
|
228
126
|
```ruby
|
@@ -248,4 +146,4 @@ The names and logos for thoughtbot are trademarks of thoughtbot, inc.
|
|
248
146
|
License
|
249
147
|
-------
|
250
148
|
|
251
|
-
capybara-webkit is Copyright (c) 2010-
|
149
|
+
capybara-webkit is Copyright (c) 2010-2014 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.
|
data/Rakefile
CHANGED
@@ -3,7 +3,9 @@ require 'rspec/core/rake_task'
|
|
3
3
|
require_relative './lib/capybara_webkit_builder'
|
4
4
|
require 'appraisal'
|
5
5
|
|
6
|
-
|
6
|
+
namespace :bundler do
|
7
|
+
Bundler::GemHelper.install_tasks
|
8
|
+
end
|
7
9
|
|
8
10
|
desc "Generate a Makefile using qmake"
|
9
11
|
file 'Makefile' do
|
data/capybara-webkit.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.required_ruby_version = ">= 1.9.0"
|
21
21
|
|
22
|
-
s.add_runtime_dependency("capybara", ">= 2.0.2", "< 2.
|
22
|
+
s.add_runtime_dependency("capybara", ">= 2.0.2", "< 2.5.0")
|
23
23
|
s.add_runtime_dependency("json")
|
24
24
|
|
25
25
|
s.add_development_dependency("rspec", "~> 2.14.0")
|
data/gemfiles/2.1.gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../
|
3
3
|
specs:
|
4
|
-
capybara-webkit (1.
|
5
|
-
capybara (>= 2.0.2, < 2.
|
4
|
+
capybara-webkit (1.3.0)
|
5
|
+
capybara (>= 2.0.2, < 2.5.0)
|
6
6
|
json
|
7
7
|
|
8
8
|
GEM
|
@@ -24,7 +24,6 @@ GEM
|
|
24
24
|
ffi (1.9.3)
|
25
25
|
ffi (1.9.3-java)
|
26
26
|
json (1.8.1)
|
27
|
-
json (1.8.1-java)
|
28
27
|
launchy (2.4.2)
|
29
28
|
addressable (~> 2.3)
|
30
29
|
launchy (2.4.2-java)
|
data/gemfiles/2.2.gemfile.lock
CHANGED
data/gemfiles/2.3.gemfile.lock
CHANGED
@@ -0,0 +1,77 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../
|
3
|
+
specs:
|
4
|
+
capybara-webkit (1.3.0)
|
5
|
+
capybara (>= 2.0.2, < 2.5.0)
|
6
|
+
json
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
addressable (2.3.6)
|
12
|
+
appraisal (0.4.1)
|
13
|
+
bundler
|
14
|
+
rake
|
15
|
+
capybara (2.4.1)
|
16
|
+
mime-types (>= 1.16)
|
17
|
+
nokogiri (>= 1.3.3)
|
18
|
+
rack (>= 1.0.0)
|
19
|
+
rack-test (>= 0.5.4)
|
20
|
+
xpath (~> 2.0)
|
21
|
+
childprocess (0.5.3)
|
22
|
+
ffi (~> 1.0, >= 1.0.11)
|
23
|
+
diff-lcs (1.2.5)
|
24
|
+
ffi (1.9.3)
|
25
|
+
json (1.8.1)
|
26
|
+
launchy (2.4.2)
|
27
|
+
addressable (~> 2.3)
|
28
|
+
mime-types (2.3)
|
29
|
+
mini_magick (3.7.0)
|
30
|
+
subexec (~> 0.2.1)
|
31
|
+
mini_portile (0.6.0)
|
32
|
+
multi_json (1.10.1)
|
33
|
+
nokogiri (1.6.2.1)
|
34
|
+
mini_portile (= 0.6.0)
|
35
|
+
rack (1.5.2)
|
36
|
+
rack-protection (1.5.3)
|
37
|
+
rack
|
38
|
+
rack-test (0.6.2)
|
39
|
+
rack (>= 1.0)
|
40
|
+
rake (10.3.2)
|
41
|
+
rspec (2.14.1)
|
42
|
+
rspec-core (~> 2.14.0)
|
43
|
+
rspec-expectations (~> 2.14.0)
|
44
|
+
rspec-mocks (~> 2.14.0)
|
45
|
+
rspec-core (2.14.8)
|
46
|
+
rspec-expectations (2.14.5)
|
47
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
48
|
+
rspec-mocks (2.14.6)
|
49
|
+
rubyzip (1.1.6)
|
50
|
+
selenium-webdriver (2.42.0)
|
51
|
+
childprocess (>= 0.5.0)
|
52
|
+
multi_json (~> 1.0)
|
53
|
+
rubyzip (~> 1.0)
|
54
|
+
websocket (~> 1.0.4)
|
55
|
+
sinatra (1.4.5)
|
56
|
+
rack (~> 1.4)
|
57
|
+
rack-protection (~> 1.4)
|
58
|
+
tilt (~> 1.3, >= 1.3.4)
|
59
|
+
subexec (0.2.3)
|
60
|
+
tilt (1.4.1)
|
61
|
+
websocket (1.0.7)
|
62
|
+
xpath (2.0.0)
|
63
|
+
nokogiri (~> 1.3)
|
64
|
+
|
65
|
+
PLATFORMS
|
66
|
+
ruby
|
67
|
+
|
68
|
+
DEPENDENCIES
|
69
|
+
appraisal (~> 0.4.0)
|
70
|
+
capybara (~> 2.4.0)
|
71
|
+
capybara-webkit!
|
72
|
+
launchy
|
73
|
+
mini_magick
|
74
|
+
rake
|
75
|
+
rspec (~> 2.14.0)
|
76
|
+
selenium-webdriver
|
77
|
+
sinatra
|
@@ -126,26 +126,54 @@ module Capybara::Webkit
|
|
126
126
|
JSON.parse(command('GetWindowHandles'))
|
127
127
|
end
|
128
128
|
|
129
|
-
|
129
|
+
def window_handles
|
130
|
+
warn '[DEPRECATION] Capybara::Webkit::Browser#window_handles ' \
|
131
|
+
'is deprecated. Please use Capybara::Session#windows instead.'
|
132
|
+
get_window_handles
|
133
|
+
end
|
130
134
|
|
131
135
|
def get_window_handle
|
132
136
|
command('GetWindowHandle')
|
133
137
|
end
|
134
138
|
|
135
|
-
|
139
|
+
def window_handle
|
140
|
+
warn '[DEPRECATION] Capybara::Webkit::Browser#window_handle ' \
|
141
|
+
'is deprecated. Please use Capybara::Session#current_window instead.'
|
142
|
+
get_window_handle
|
143
|
+
end
|
144
|
+
|
145
|
+
def accept_confirm(options)
|
146
|
+
command("SetConfirmAction", "Yes", options[:text])
|
147
|
+
end
|
136
148
|
|
137
149
|
def accept_js_confirms
|
138
150
|
command("SetConfirmAction", "Yes")
|
139
151
|
end
|
140
152
|
|
153
|
+
def reject_confirm(options)
|
154
|
+
command("SetConfirmAction", "No", options[:text])
|
155
|
+
end
|
156
|
+
|
141
157
|
def reject_js_confirms
|
142
158
|
command("SetConfirmAction", "No")
|
143
159
|
end
|
144
160
|
|
161
|
+
def accept_prompt(options)
|
162
|
+
if options[:with]
|
163
|
+
command("SetPromptAction", "Yes", options[:text], options[:with])
|
164
|
+
else
|
165
|
+
command("SetPromptAction", "Yes", options[:text])
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
145
169
|
def accept_js_prompts
|
146
170
|
command("SetPromptAction", "Yes")
|
147
171
|
end
|
148
172
|
|
173
|
+
def reject_prompt(options)
|
174
|
+
command("SetPromptAction", "No", options[:text])
|
175
|
+
end
|
176
|
+
|
149
177
|
def reject_js_prompts
|
150
178
|
command("SetPromptAction", "No")
|
151
179
|
end
|
@@ -158,6 +186,14 @@ module Capybara::Webkit
|
|
158
186
|
command("ClearPromptText")
|
159
187
|
end
|
160
188
|
|
189
|
+
def accept_alert(options)
|
190
|
+
command("AcceptAlert", options[:text])
|
191
|
+
end
|
192
|
+
|
193
|
+
def find_modal(id)
|
194
|
+
command("FindModal", id)
|
195
|
+
end
|
196
|
+
|
161
197
|
def url_blacklist=(black_list)
|
162
198
|
command("SetUrlBlacklist", *Array(black_list))
|
163
199
|
end
|