poltergeist 1.8.0 → 1.8.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 +1 -1
- data/lib/capybara/poltergeist/browser.rb +2 -1
- data/lib/capybara/poltergeist/client/agent.coffee +8 -9
- data/lib/capybara/poltergeist/client/browser.coffee +4 -1
- data/lib/capybara/poltergeist/client/compiled/agent.js +8 -5
- data/lib/capybara/poltergeist/client/compiled/browser.js +3 -3
- data/lib/capybara/poltergeist/client/compiled/main.js +3 -1
- data/lib/capybara/poltergeist/client/compiled/web_page.js +36 -20
- data/lib/capybara/poltergeist/client/main.coffee +2 -0
- data/lib/capybara/poltergeist/client/node.coffee +0 -3
- data/lib/capybara/poltergeist/client/web_page.coffee +24 -7
- data/lib/capybara/poltergeist/errors.rb +5 -4
- data/lib/capybara/poltergeist/network_traffic.rb +1 -0
- data/lib/capybara/poltergeist/network_traffic/error.rb +19 -0
- data/lib/capybara/poltergeist/network_traffic/request.rb +3 -2
- data/lib/capybara/poltergeist/version.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba9a64217db44bbe9dcbe55e34cac615640688df
|
4
|
+
data.tar.gz: 7bd5f0ae85f2565e1b6c07f4030644f59eccbb1f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93141f4f1e6438da75f912f4174f5f7f987d9fcff0dbaab0fa7eff384a6501067b6fcbf06eb06f9589e71457a8ee563ab84ff11d0ff9b83828fbd8e531b9eb00
|
7
|
+
data.tar.gz: 54b08a29b4707dfdb8c3a7ff2a7c16194ca100e87cfc89d1e5f11f17f7f151121260cfdf10584949100f66de17ff57b5ed574273268580e75ca7729533a484f9
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ provided by [PhantomJS](http://phantomjs.org/).
|
|
9
9
|
**If you're viewing this at https://github.com/teampoltergeist/poltergeist,
|
10
10
|
you're reading the documentation for the master branch.
|
11
11
|
[View documentation for the latest release
|
12
|
-
(1.8.
|
12
|
+
(1.8.1).](https://github.com/teampoltergeist/poltergeist/tree/v1.8.1)**
|
13
13
|
|
14
14
|
## Getting help ##
|
15
15
|
|
@@ -250,7 +250,8 @@ module Capybara::Poltergeist
|
|
250
250
|
command('network_traffic').values.map do |event|
|
251
251
|
NetworkTraffic::Request.new(
|
252
252
|
event['request'],
|
253
|
-
event['responseParts'].map { |response| NetworkTraffic::Response.new(response) }
|
253
|
+
event['responseParts'].map { |response| NetworkTraffic::Response.new(response) },
|
254
|
+
event['error'] ? NetworkTraffic::Error.new(event['error']) : nil
|
254
255
|
)
|
255
256
|
end
|
256
257
|
end
|
@@ -107,13 +107,13 @@ class PoltergeistAgent.Node
|
|
107
107
|
|
108
108
|
isObsolete: ->
|
109
109
|
obsolete = (element) =>
|
110
|
-
if element.parentNode?
|
111
|
-
if
|
112
|
-
false
|
110
|
+
if (parent = element.parentNode)?
|
111
|
+
if parent == document
|
112
|
+
return false
|
113
113
|
else
|
114
|
-
obsolete
|
114
|
+
obsolete parent
|
115
115
|
else
|
116
|
-
true
|
116
|
+
return true
|
117
117
|
obsolete @element
|
118
118
|
|
119
119
|
changed: ->
|
@@ -256,9 +256,7 @@ class PoltergeistAgent.Node
|
|
256
256
|
tagName: ->
|
257
257
|
@element.tagName
|
258
258
|
|
259
|
-
isVisible: (element) ->
|
260
|
-
element ||= @element
|
261
|
-
|
259
|
+
isVisible: (element = @element) ->
|
262
260
|
while (element)
|
263
261
|
style = window.getComputedStyle(element)
|
264
262
|
return false if style.display == 'none' or
|
@@ -312,7 +310,8 @@ class PoltergeistAgent.Node
|
|
312
310
|
offset
|
313
311
|
|
314
312
|
position: ->
|
315
|
-
|
313
|
+
# Elements inside an SVG return underfined for getClientRects???
|
314
|
+
rect = @element.getClientRects()[0] || @element.getBoundingClientRect()
|
316
315
|
throw new PoltergeistAgent.ObsoleteNode unless rect
|
317
316
|
frameOffset = this.frameOffset()
|
318
317
|
|
@@ -54,6 +54,8 @@ class Poltergeist.Browser
|
|
54
54
|
page.handle = "#{@_counter++}"
|
55
55
|
@pages.push(page)
|
56
56
|
|
57
|
+
return
|
58
|
+
|
57
59
|
getPageByHandle: (handle) ->
|
58
60
|
@pages.filter((p) -> !p.closed && p.handle == handle)[0]
|
59
61
|
|
@@ -68,6 +70,7 @@ class Poltergeist.Browser
|
|
68
70
|
|
69
71
|
setModalMessage: (msg) ->
|
70
72
|
@processed_modal_messages.push(msg)
|
73
|
+
return
|
71
74
|
|
72
75
|
add_extension: (extension) ->
|
73
76
|
@currentPage.injectExtension extension
|
@@ -106,6 +109,7 @@ class Poltergeist.Browser
|
|
106
109
|
command.sendError(new Poltergeist.StatusFailError(url))
|
107
110
|
else
|
108
111
|
command.sendResponse(status: @currentPage.status)
|
112
|
+
return
|
109
113
|
|
110
114
|
current_url: ->
|
111
115
|
@current_command.sendResponse @currentPage.currentUrl()
|
@@ -268,7 +272,6 @@ class Poltergeist.Browser
|
|
268
272
|
mouse_event: (page_id, id, name) ->
|
269
273
|
# Get the node before changing state, in case there is an exception
|
270
274
|
node = this.node(page_id, id)
|
271
|
-
|
272
275
|
# If the event triggers onNavigationRequested, we will transition to the 'loading'
|
273
276
|
# state and wait for onLoadFinished before sending a response.
|
274
277
|
@currentPage.state = 'mouse_event'
|
@@ -186,11 +186,12 @@ PoltergeistAgent.Node = (function() {
|
|
186
186
|
var obsolete;
|
187
187
|
obsolete = (function(_this) {
|
188
188
|
return function(element) {
|
189
|
-
|
190
|
-
|
189
|
+
var parent;
|
190
|
+
if ((parent = element.parentNode) != null) {
|
191
|
+
if (parent === document) {
|
191
192
|
return false;
|
192
193
|
} else {
|
193
|
-
return obsolete(
|
194
|
+
return obsolete(parent);
|
194
195
|
}
|
195
196
|
} else {
|
196
197
|
return true;
|
@@ -381,7 +382,9 @@ PoltergeistAgent.Node = (function() {
|
|
381
382
|
|
382
383
|
Node.prototype.isVisible = function(element) {
|
383
384
|
var style;
|
384
|
-
|
385
|
+
if (element == null) {
|
386
|
+
element = this.element;
|
387
|
+
}
|
385
388
|
while (element) {
|
386
389
|
style = window.getComputedStyle(element);
|
387
390
|
if (style.display === 'none' || style.visibility === 'hidden' || parseFloat(style.opacity) === 0) {
|
@@ -449,7 +452,7 @@ PoltergeistAgent.Node = (function() {
|
|
449
452
|
|
450
453
|
Node.prototype.position = function() {
|
451
454
|
var frameOffset, pos, rect;
|
452
|
-
rect = this.element.getClientRects()[0];
|
455
|
+
rect = this.element.getClientRects()[0] || this.element.getBoundingClientRect();
|
453
456
|
if (!rect) {
|
454
457
|
throw new PoltergeistAgent.ObsoleteNode;
|
455
458
|
}
|
@@ -63,7 +63,7 @@ Poltergeist.Browser = (function() {
|
|
63
63
|
return response;
|
64
64
|
};
|
65
65
|
})(this);
|
66
|
-
|
66
|
+
this.page.onPageCreated = (function(_this) {
|
67
67
|
return function(newPage) {
|
68
68
|
var page;
|
69
69
|
page = new Poltergeist.WebPage(newPage);
|
@@ -92,7 +92,7 @@ Poltergeist.Browser = (function() {
|
|
92
92
|
};
|
93
93
|
|
94
94
|
Browser.prototype.setModalMessage = function(msg) {
|
95
|
-
|
95
|
+
this.processed_modal_messages.push(msg);
|
96
96
|
};
|
97
97
|
|
98
98
|
Browser.prototype.add_extension = function(extension) {
|
@@ -123,7 +123,7 @@ Poltergeist.Browser = (function() {
|
|
123
123
|
});
|
124
124
|
} else {
|
125
125
|
command = this.current_command;
|
126
|
-
|
126
|
+
this.currentPage.waitState('default', (function(_this) {
|
127
127
|
return function() {
|
128
128
|
if (_this.currentPage.statusCode === null && _this.currentPage.status === 'fail') {
|
129
129
|
return command.sendError(new Poltergeist.StatusFailError(url));
|
@@ -50,8 +50,10 @@ Poltergeist = (function() {
|
|
50
50
|
Poltergeist.prototype.send = function(data) {
|
51
51
|
if (this.running) {
|
52
52
|
this.connection.send(data);
|
53
|
-
|
53
|
+
this.running = false;
|
54
|
+
return true;
|
54
55
|
}
|
56
|
+
return false;
|
55
57
|
};
|
56
58
|
|
57
59
|
return Poltergeist;
|
@@ -4,7 +4,7 @@ var slice = [].slice,
|
|
4
4
|
Poltergeist.WebPage = (function() {
|
5
5
|
var command, delegate, fn1, fn2, i, j, len, len1, ref, ref1;
|
6
6
|
|
7
|
-
WebPage.CALLBACKS = ['onConsoleMessage', 'onLoadFinished', 'onInitialized', 'onLoadStarted', 'onResourceRequested', 'onResourceReceived', '
|
7
|
+
WebPage.CALLBACKS = ['onConsoleMessage', 'onError', 'onLoadFinished', 'onInitialized', 'onLoadStarted', 'onResourceRequested', 'onResourceReceived', 'onResourceError', 'onNavigationRequested', 'onUrlChanged', 'onPageCreated', 'onClosing'];
|
8
8
|
|
9
9
|
WebPage.DELEGATES = ['open', 'sendEvent', 'uploadFile', 'release', 'render', 'renderBase64', 'goBack', 'goForward'];
|
10
10
|
|
@@ -103,10 +103,11 @@ Poltergeist.WebPage = (function() {
|
|
103
103
|
return stackString += " in " + frame["function"];
|
104
104
|
}
|
105
105
|
});
|
106
|
-
|
106
|
+
this.errors.push({
|
107
107
|
message: message,
|
108
108
|
stack: stackString
|
109
109
|
});
|
110
|
+
return true;
|
110
111
|
};
|
111
112
|
|
112
113
|
WebPage.prototype.onResourceRequestedNative = function(request, net) {
|
@@ -118,18 +119,20 @@ Poltergeist.WebPage = (function() {
|
|
118
119
|
if (ref2 = request.url, indexOf.call(this._blockedUrls, ref2) < 0) {
|
119
120
|
this._blockedUrls.push(request.url);
|
120
121
|
}
|
121
|
-
|
122
|
+
net.abort();
|
122
123
|
} else {
|
123
124
|
this.lastRequestId = request.id;
|
124
125
|
if (this.normalizeURL(request.url) === this.redirectURL) {
|
125
126
|
this.redirectURL = null;
|
126
127
|
this.requestId = request.id;
|
127
128
|
}
|
128
|
-
|
129
|
+
this._networkTraffic[request.id] = {
|
129
130
|
request: request,
|
130
|
-
responseParts: []
|
131
|
+
responseParts: [],
|
132
|
+
error: null
|
131
133
|
};
|
132
134
|
}
|
135
|
+
return true;
|
133
136
|
};
|
134
137
|
|
135
138
|
WebPage.prototype.onResourceReceivedNative = function(response) {
|
@@ -139,28 +142,37 @@ Poltergeist.WebPage = (function() {
|
|
139
142
|
}
|
140
143
|
if (this.requestId === response.id) {
|
141
144
|
if (response.redirectURL) {
|
142
|
-
|
145
|
+
this.redirectURL = this.normalizeURL(response.redirectURL);
|
143
146
|
} else {
|
144
147
|
this.statusCode = response.status;
|
145
|
-
|
148
|
+
this._responseHeaders = response.headers;
|
146
149
|
}
|
147
150
|
}
|
151
|
+
return true;
|
152
|
+
};
|
153
|
+
|
154
|
+
WebPage.prototype.onResourceErrorNative = function(errorResponse) {
|
155
|
+
var ref2;
|
156
|
+
if ((ref2 = this._networkTraffic[errorResponse.id]) != null) {
|
157
|
+
ref2.error = errorResponse;
|
158
|
+
}
|
159
|
+
return true;
|
148
160
|
};
|
149
161
|
|
150
162
|
WebPage.prototype.injectAgent = function() {
|
151
|
-
var extension, k, len2, ref2
|
163
|
+
var extension, k, len2, ref2;
|
152
164
|
if (this["native"]().evaluate(function() {
|
153
165
|
return typeof __poltergeist;
|
154
166
|
}) === "undefined") {
|
155
167
|
this["native"]().injectJs(phantom.libraryPath + "/agent.js");
|
156
168
|
ref2 = WebPage.EXTENSIONS;
|
157
|
-
results = [];
|
158
169
|
for (k = 0, len2 = ref2.length; k < len2; k++) {
|
159
170
|
extension = ref2[k];
|
160
|
-
|
171
|
+
this["native"]().injectJs(extension);
|
161
172
|
}
|
162
|
-
return
|
173
|
+
return true;
|
163
174
|
}
|
175
|
+
return false;
|
164
176
|
};
|
165
177
|
|
166
178
|
WebPage.prototype.injectExtension = function(file) {
|
@@ -215,7 +227,8 @@ Poltergeist.WebPage = (function() {
|
|
215
227
|
|
216
228
|
WebPage.prototype.setHttpAuth = function(user, password) {
|
217
229
|
this["native"]().settings.userName = user;
|
218
|
-
|
230
|
+
this["native"]().settings.password = password;
|
231
|
+
return true;
|
219
232
|
};
|
220
233
|
|
221
234
|
WebPage.prototype.networkTraffic = function() {
|
@@ -223,7 +236,8 @@ Poltergeist.WebPage = (function() {
|
|
223
236
|
};
|
224
237
|
|
225
238
|
WebPage.prototype.clearNetworkTraffic = function() {
|
226
|
-
|
239
|
+
this._networkTraffic = {};
|
240
|
+
return true;
|
227
241
|
};
|
228
242
|
|
229
243
|
WebPage.prototype.blockedUrls = function() {
|
@@ -231,7 +245,8 @@ Poltergeist.WebPage = (function() {
|
|
231
245
|
};
|
232
246
|
|
233
247
|
WebPage.prototype.clearBlockedUrls = function() {
|
234
|
-
|
248
|
+
this._blockedUrls = [];
|
249
|
+
return true;
|
235
250
|
};
|
236
251
|
|
237
252
|
WebPage.prototype.content = function() {
|
@@ -252,7 +267,8 @@ Poltergeist.WebPage = (function() {
|
|
252
267
|
};
|
253
268
|
|
254
269
|
WebPage.prototype.clearErrors = function() {
|
255
|
-
|
270
|
+
this.errors = [];
|
271
|
+
return true;
|
256
272
|
};
|
257
273
|
|
258
274
|
WebPage.prototype.responseHeaders = function() {
|
@@ -323,13 +339,12 @@ Poltergeist.WebPage = (function() {
|
|
323
339
|
};
|
324
340
|
|
325
341
|
WebPage.prototype.addTempHeader = function(header) {
|
326
|
-
var name,
|
327
|
-
results = [];
|
342
|
+
var name, value;
|
328
343
|
for (name in header) {
|
329
344
|
value = header[name];
|
330
|
-
|
345
|
+
this._tempHeaders[name] = value;
|
331
346
|
}
|
332
|
-
return
|
347
|
+
return this._tempHeaders;
|
333
348
|
};
|
334
349
|
|
335
350
|
WebPage.prototype.removeTempHeaders = function() {
|
@@ -455,7 +470,7 @@ Poltergeist.WebPage = (function() {
|
|
455
470
|
WebPage.prototype.bindCallback = function(name) {
|
456
471
|
var that;
|
457
472
|
that = this;
|
458
|
-
|
473
|
+
this["native"]()[name] = function() {
|
459
474
|
var result;
|
460
475
|
if (that[name + 'Native'] != null) {
|
461
476
|
result = that[name + 'Native'].apply(that, arguments);
|
@@ -464,6 +479,7 @@ Poltergeist.WebPage = (function() {
|
|
464
479
|
return that[name].apply(that, arguments);
|
465
480
|
}
|
466
481
|
};
|
482
|
+
return true;
|
467
483
|
};
|
468
484
|
|
469
485
|
WebPage.prototype.runCommand = function(name, args) {
|
@@ -31,11 +31,8 @@ class Poltergeist.Node
|
|
31
31
|
|
32
32
|
mouseEvent: (name) ->
|
33
33
|
this.scrollIntoView()
|
34
|
-
|
35
34
|
pos = this.mouseEventPosition()
|
36
|
-
|
37
35
|
test = this.mouseEventTest(pos.x, pos.y)
|
38
|
-
|
39
36
|
if test.status == 'success'
|
40
37
|
if name == 'rightclick'
|
41
38
|
@page.mouseEvent('click', pos.x, pos.y, 'right')
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class Poltergeist.WebPage
|
2
|
-
@CALLBACKS = ['onConsoleMessage',
|
2
|
+
@CALLBACKS = ['onConsoleMessage','onError',
|
3
3
|
'onLoadFinished', 'onInitialized', 'onLoadStarted',
|
4
|
-
'onResourceRequested', 'onResourceReceived', '
|
4
|
+
'onResourceRequested', 'onResourceReceived', 'onResourceError',
|
5
5
|
'onNavigationRequested', 'onUrlChanged', 'onPageCreated',
|
6
6
|
'onClosing']
|
7
7
|
|
@@ -75,6 +75,7 @@ class Poltergeist.WebPage
|
|
75
75
|
stackString += " in #{frame.function}" if frame.function && frame.function != ''
|
76
76
|
|
77
77
|
@errors.push(message: message, stack: stackString)
|
78
|
+
return true
|
78
79
|
|
79
80
|
onResourceRequestedNative: (request, net) ->
|
80
81
|
abort = @urlBlacklist.some (blacklisted_url) ->
|
@@ -93,7 +94,9 @@ class Poltergeist.WebPage
|
|
93
94
|
@_networkTraffic[request.id] = {
|
94
95
|
request: request,
|
95
96
|
responseParts: []
|
97
|
+
error: null
|
96
98
|
}
|
99
|
+
return true
|
97
100
|
|
98
101
|
onResourceReceivedNative: (response) ->
|
99
102
|
@_networkTraffic[response.id]?.responseParts.push(response)
|
@@ -104,12 +107,19 @@ class Poltergeist.WebPage
|
|
104
107
|
else
|
105
108
|
@statusCode = response.status
|
106
109
|
@_responseHeaders = response.headers
|
110
|
+
return true
|
111
|
+
|
112
|
+
onResourceErrorNative: (errorResponse) ->
|
113
|
+
@_networkTraffic[errorResponse.id]?.error = errorResponse
|
114
|
+
return true
|
107
115
|
|
108
116
|
injectAgent: ->
|
109
117
|
if this.native().evaluate(-> typeof __poltergeist) == "undefined"
|
110
118
|
this.native().injectJs "#{phantom.libraryPath}/agent.js"
|
111
119
|
for extension in WebPage.EXTENSIONS
|
112
120
|
this.native().injectJs extension
|
121
|
+
return true
|
122
|
+
return false
|
113
123
|
|
114
124
|
injectExtension: (file) ->
|
115
125
|
WebPage.EXTENSIONS.push file
|
@@ -145,18 +155,21 @@ class Poltergeist.WebPage
|
|
145
155
|
setHttpAuth: (user, password) ->
|
146
156
|
this.native().settings.userName = user
|
147
157
|
this.native().settings.password = password
|
158
|
+
return true
|
148
159
|
|
149
160
|
networkTraffic: ->
|
150
161
|
@_networkTraffic
|
151
162
|
|
152
163
|
clearNetworkTraffic: ->
|
153
164
|
@_networkTraffic = {}
|
165
|
+
return true
|
154
166
|
|
155
167
|
blockedUrls: ->
|
156
168
|
@_blockedUrls
|
157
169
|
|
158
170
|
clearBlockedUrls: ->
|
159
171
|
@_blockedUrls = []
|
172
|
+
return true
|
160
173
|
|
161
174
|
content: ->
|
162
175
|
this.native().frameContent
|
@@ -171,6 +184,7 @@ class Poltergeist.WebPage
|
|
171
184
|
|
172
185
|
clearErrors: ->
|
173
186
|
@errors = []
|
187
|
+
return true
|
174
188
|
|
175
189
|
responseHeaders: ->
|
176
190
|
headers = {}
|
@@ -210,8 +224,9 @@ class Poltergeist.WebPage
|
|
210
224
|
|
211
225
|
elementBounds: (selector) ->
|
212
226
|
this.native().evaluate(
|
213
|
-
(selector) ->
|
214
|
-
|
227
|
+
(selector) ->
|
228
|
+
document.querySelector(selector).getBoundingClientRect()
|
229
|
+
, selector
|
215
230
|
)
|
216
231
|
|
217
232
|
setUserAgent: (userAgent) ->
|
@@ -226,6 +241,7 @@ class Poltergeist.WebPage
|
|
226
241
|
addTempHeader: (header) ->
|
227
242
|
for name, value of header
|
228
243
|
@_tempHeaders[name] = value
|
244
|
+
@_tempHeaders
|
229
245
|
|
230
246
|
removeTempHeaders: ->
|
231
247
|
allHeaders = this.getCustomHeaders()
|
@@ -236,7 +252,7 @@ class Poltergeist.WebPage
|
|
236
252
|
pushFrame: (name) ->
|
237
253
|
if this.native().switchToFrame(name)
|
238
254
|
@frames.push(name)
|
239
|
-
true
|
255
|
+
return true
|
240
256
|
else
|
241
257
|
frame_no = this.native().evaluate(
|
242
258
|
(frame_name) ->
|
@@ -245,9 +261,9 @@ class Poltergeist.WebPage
|
|
245
261
|
, name)
|
246
262
|
if frame_no? and this.native().switchToFrame(frame_no)
|
247
263
|
@frames.push(name)
|
248
|
-
true
|
264
|
+
return true
|
249
265
|
else
|
250
|
-
false
|
266
|
+
return false
|
251
267
|
|
252
268
|
popFrame: ->
|
253
269
|
@frames.pop()
|
@@ -320,6 +336,7 @@ class Poltergeist.WebPage
|
|
320
336
|
|
321
337
|
if result != false && that[name]? # For externally set callbacks
|
322
338
|
that[name].apply(that, arguments)
|
339
|
+
return true
|
323
340
|
|
324
341
|
# Any error raised here or inside the evaluate will get reported to
|
325
342
|
# phantom.onError. If result is null, that means there was an error
|
@@ -29,14 +29,15 @@ module Capybara
|
|
29
29
|
response['name']
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
33
|
-
|
32
|
+
def error_parameters
|
33
|
+
response['args'].join("\n")
|
34
34
|
end
|
35
35
|
|
36
36
|
def message
|
37
37
|
"There was an error inside the PhantomJS portion of Poltergeist. " \
|
38
|
-
"
|
39
|
-
"\
|
38
|
+
"If this is the error returned, and not the cause of a more detailed error response, " \
|
39
|
+
"this is probably a bug, so please report it. " \
|
40
|
+
"\n\n#{name}: #{error_parameters}"
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Capybara::Poltergeist::NetworkTraffic
|
2
|
+
class Error
|
3
|
+
def initialize(data)
|
4
|
+
@data = data
|
5
|
+
end
|
6
|
+
|
7
|
+
def url
|
8
|
+
@data['url']
|
9
|
+
end
|
10
|
+
|
11
|
+
def code
|
12
|
+
@data['errorCode']
|
13
|
+
end
|
14
|
+
|
15
|
+
def description
|
16
|
+
@data['errorString']
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,10 +1,11 @@
|
|
1
1
|
module Capybara::Poltergeist::NetworkTraffic
|
2
2
|
class Request
|
3
|
-
attr_reader :response_parts
|
3
|
+
attr_reader :response_parts, :error
|
4
4
|
|
5
|
-
def initialize(data, response_parts = [])
|
5
|
+
def initialize(data, response_parts = [], error = nil)
|
6
6
|
@data = data
|
7
7
|
@response_parts = response_parts
|
8
|
+
@error = error
|
8
9
|
end
|
9
10
|
|
10
11
|
def url
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poltergeist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Leighton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -86,14 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 3.
|
89
|
+
version: 3.4.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 3.
|
96
|
+
version: 3.4.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec-core
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "!="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.4.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "!="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.4.0
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: sinatra
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,6 +226,7 @@ files:
|
|
212
226
|
- lib/capybara/poltergeist/inspector.rb
|
213
227
|
- lib/capybara/poltergeist/json.rb
|
214
228
|
- lib/capybara/poltergeist/network_traffic.rb
|
229
|
+
- lib/capybara/poltergeist/network_traffic/error.rb
|
215
230
|
- lib/capybara/poltergeist/network_traffic/request.rb
|
216
231
|
- lib/capybara/poltergeist/network_traffic/response.rb
|
217
232
|
- lib/capybara/poltergeist/node.rb
|