File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,14 @@ def subscribe
157
157
end
158
158
end
159
159
160
+ @page . on ( "Network.loadingFailed" ) do |params |
161
+ exchange = select ( params [ "requestId" ] ) . last
162
+
163
+ if exchange && params [ 'canceled' ]
164
+ exchange . error = :canceled
165
+ end
166
+ end
167
+
160
168
@page . on ( "Log.entryAdded" ) do |params |
161
169
entry = params [ "entry" ] || { }
162
170
if entry [ "source" ] == "network" && entry [ "level" ] == "error"
Original file line number Diff line number Diff line change @@ -67,6 +67,12 @@ module Ferrum
67
67
expect ( browser . network . idle? ) . to be true
68
68
end
69
69
70
+ it "captures canceled requests" do
71
+ browser . go_to ( "/ferrum/with_ajax_connection_canceled" )
72
+ expect ( browser . at_xpath ( "//h1[text() = 'Canceled']" ) ) . to be
73
+ expect ( browser . network . idle? ) . to be true
74
+ end
75
+
70
76
it "keeps a running list between multiple web page views" do
71
77
browser . go_to ( "/ferrum/with_js" )
72
78
expect ( traffic . length ) . to eq ( 4 )
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < meta http-equiv ="Content-type " content ="text/html; charset=utf-8 "/>
5
+ < title > ferrum with_js</ title >
6
+ < script src ="/ferrum/jquery.min.js " type ="text/javascript " charset ="utf-8 "> </ script >
7
+ </ head >
8
+ < body >
9
+ < h1 > Here</ h1 >
10
+ < script >
11
+ $ . ajax ( "http://localhost:12345/slow_response" ) . abort ( ) ;
12
+ $ ( "h1" ) . text ( "Canceled" ) ;
13
+ </ script >
14
+ </ body >
15
+ </ html >
You can’t perform that action at this time.
0 commit comments