cuprite 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -6
- data/lib/capybara/cuprite/browser.rb +3 -3
- data/lib/capybara/cuprite/driver.rb +16 -6
- data/lib/capybara/cuprite/page.rb +3 -3
- data/lib/capybara/cuprite/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61e6eae56b712430083dd1dc25ae7888016899b9504fcb2795525fe2df0d9b63
|
4
|
+
data.tar.gz: 26f55efb799bff8ffa704fd1955dc01b03c11db3f44806f3a1c8284d84237ae8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8eb4c7caeeaf86f24ebef9bf37edf6bf3e6ccf474633be8c69a1b4296abfcb5df040ede0c5feccecc930393312408800a928f3671aeb658a7d5beadb08a3c0a
|
7
|
+
data.tar.gz: 44387ad8fa9b9a87a236d2df3d754155ad4ed280348d65da2479b1a5a08e6be215ebf2ad652c1159188f08f6f231fbeeeddd2ce767d5bc9a53b1c0e7f39fbdf1
|
data/README.md
CHANGED
@@ -179,15 +179,12 @@ this option is enabled, you can insert `page.driver.debug` into your tests to
|
|
179
179
|
pause the test and launch a browser which gives you the Chrome inspector to view
|
180
180
|
all your open pages and inspect them.
|
181
181
|
|
182
|
-
You
|
183
|
-
as the current javascript driver. By example, in your helper file:
|
182
|
+
You could set the inspector option via an environment variable:
|
184
183
|
|
185
184
|
```ruby
|
186
|
-
Capybara.register_driver :
|
187
|
-
Capybara::Cuprite::Driver.new(app, inspector:
|
185
|
+
Capybara.register_driver :cuprite do |app|
|
186
|
+
Capybara::Cuprite::Driver.new(app, inspector: ENV['INSPECTOR'])
|
188
187
|
end
|
189
|
-
|
190
|
-
Capybara.javascript_driver = :cuprite_debug
|
191
188
|
```
|
192
189
|
|
193
190
|
## License ##
|
@@ -23,12 +23,12 @@ module Capybara::Cuprite
|
|
23
23
|
|
24
24
|
def url_whitelist=(patterns)
|
25
25
|
@url_whitelist = prepare_wildcards(patterns)
|
26
|
-
page.
|
26
|
+
page.network.intercept if @client && !@url_whitelist.empty?
|
27
27
|
end
|
28
28
|
|
29
29
|
def url_blacklist=(patterns)
|
30
30
|
@url_blacklist = prepare_wildcards(patterns)
|
31
|
-
page.
|
31
|
+
page.network.intercept if @client && !@url_blacklist.empty?
|
32
32
|
end
|
33
33
|
|
34
34
|
def visit(*args)
|
@@ -36,7 +36,7 @@ module Capybara::Cuprite
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def status_code
|
39
|
-
status
|
39
|
+
network.status
|
40
40
|
end
|
41
41
|
|
42
42
|
def find(method, selector)
|
@@ -216,11 +216,21 @@ module Capybara::Cuprite
|
|
216
216
|
end
|
217
217
|
|
218
218
|
def network_traffic(type = nil)
|
219
|
-
browser.
|
219
|
+
traffic = browser.network.traffic
|
220
|
+
|
221
|
+
case type.to_s
|
222
|
+
when "all"
|
223
|
+
traffic
|
224
|
+
when "blocked"
|
225
|
+
traffic.select(&:blocked?)
|
226
|
+
else
|
227
|
+
# when request isn't blocked
|
228
|
+
traffic.reject(&:blocked?)
|
229
|
+
end
|
220
230
|
end
|
221
231
|
|
222
232
|
def clear_network_traffic
|
223
|
-
browser.
|
233
|
+
browser.network.clear(:traffic)
|
224
234
|
end
|
225
235
|
|
226
236
|
def set_proxy(ip, port, type = nil, user = nil, password = nil, bypass = nil)
|
@@ -228,7 +238,7 @@ module Capybara::Cuprite
|
|
228
238
|
server = type ? "#{type}=#{ip}:#{port}" : "#{ip}:#{port}"
|
229
239
|
@options[:browser_options].merge!("proxy-server" => server)
|
230
240
|
@options[:browser_options].merge!("proxy-bypass-list" => bypass) if bypass
|
231
|
-
browser.authorize(type: :proxy, user: user, password: password)
|
241
|
+
browser.network.authorize(type: :proxy, user: user, password: password)
|
232
242
|
end
|
233
243
|
|
234
244
|
def headers
|
@@ -248,7 +258,7 @@ module Capybara::Cuprite
|
|
248
258
|
end
|
249
259
|
|
250
260
|
def response_headers
|
251
|
-
browser.
|
261
|
+
browser.network.response&.headers
|
252
262
|
end
|
253
263
|
|
254
264
|
def cookies
|
@@ -273,11 +283,11 @@ module Capybara::Cuprite
|
|
273
283
|
end
|
274
284
|
|
275
285
|
def clear_memory_cache
|
276
|
-
browser.
|
286
|
+
browser.network.clear(:cache)
|
277
287
|
end
|
278
288
|
|
279
289
|
def basic_authorize(user, password)
|
280
|
-
browser.authorize(user: user, password: password)
|
290
|
+
browser.network.authorize(user: user, password: password)
|
281
291
|
end
|
282
292
|
alias_method :authorize, :basic_authorize
|
283
293
|
|
@@ -109,10 +109,10 @@ module Capybara::Cuprite
|
|
109
109
|
def prepare_page
|
110
110
|
super
|
111
111
|
|
112
|
-
|
112
|
+
network.intercept if !Array(@browser.url_whitelist).empty? ||
|
113
113
|
!Array(@browser.url_blacklist).empty?
|
114
114
|
|
115
|
-
on(:
|
115
|
+
on(:request) do |request, index, total|
|
116
116
|
if @browser.url_blacklist && !@browser.url_blacklist.empty?
|
117
117
|
if @browser.url_blacklist.any? { |r| request.match?(r) }
|
118
118
|
request.abort and return
|
@@ -134,7 +134,7 @@ module Capybara::Cuprite
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
|
137
|
+
on("Page.javascriptDialogOpening") do |params|
|
138
138
|
accept_modal = @accept_modal.last
|
139
139
|
if accept_modal == true || accept_modal == false
|
140
140
|
@accept_modal.pop
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuprite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Vorotilin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|