@@ -16,6 +16,9 @@ import (
1616 k6types "go.k6.io/k6/lib/types"
1717)
1818
19+ // TestURLSkipRequest checks that, since https://github.com/grafana/k6/commit/f29064ef, k6 doesn't
20+ // handle navigation requests for local urls, like: blob:... or data:..., and so it doesn't emit errors
21+ // neither (e.g. in case of a non-existing blob), in contraposition to what Playwright does.
1922func TestURLSkipRequest (t * testing.T ) {
2023 t .Parallel ()
2124
@@ -29,25 +32,25 @@ func TestURLSkipRequest(t *testing.T) {
2932 require .NoError (t , err )
3033 tb .logCache .assertContains (t , "skipping request handling of data URL" )
3134
32- // In this test, we're checking that the network manager is skipping request handling
33- // of certain URLs, but Browser navigation still happens.
35+ // In this test, we're checking that the network manager is skipping request handling of certain URLs,
36+ // but Browser navigation still happens.
3437 //
35- // Under that assumption, it's important to notice that the Blob URL that we use
36- // for this test case isn't valid, and we cannot use a valid one because we lack
37- // general support for Blob and URL WebAPIs .
38+ // However, until Chrome 139.x, there was a subtle bug causing no valid NavigationEvent to be emitted.
39+ // An event being considered valid by having a document id that matches the document id of the frame
40+ // that navigated to that url. So, until that, we expected the following [p.Goto] call to timeout .
3841 //
39- // So, here the Browser tries to navigate to a non-existing Blob URL, which
40- // doesn't produce any valid NavigationEvent, causing the method to timeout .
42+ // Since Chrome 140.x, this bug has been fixed, and now the navigation to a non-existing blob behaves
43+ // similarly to what happens in the lines above, no timing out but succeeding with normality .
4144 //
42- // Ideally, we could capture NavigationEvents that navigate to chrome-error://.
43- // However, as that isn't supported yet, and it's not trivial, we just make
44- // the timeout to finish quickly, for the sake of the test.
45+ // Note that, in spite of non-existing blob (we cannot define a valid one because k6 lacks general support
46+ // for Blob and URL WebAPIs), this doesn't return any error because as stated in the TestURLSkipRequest docs,
47+ // k6 intentionally skips that request handling, thus not throwing the net::ERR_FILE_NOT_FOUND that Chrome
48+ // throws in such case, as Playwright does.
4549 _ , err = p .Goto (
4650 "blob:something" ,
47- & common.FrameGotoOptions {Timeout : 200 * time . Millisecond },
51+ & common.FrameGotoOptions {Timeout : common . DefaultTimeout },
4852 )
49- require .Error (t , err )
50- require .ErrorContains (t , err , `navigating frame to "blob:something": navigating to "blob:something": timed out after 200ms` )
53+ require .NoError (t , err )
5154 tb .logCache .assertContains (t , "skipping request handling of blob URL" )
5255}
5356
0 commit comments