Closed ankur22 closed 11 months ago
Have you tried it without a promise (without Browser.on
)? If you haven't, we might so we can see if it's the on
method or the isConnected
method.
Have you tried it without a promise (without
Browser.on
)? If you haven't, we might so we can see if it's theon
method or theisConnected
method.
Good point. I've tested it without calling browser.on
and it still exhibits the incorrect behaviour. I will update the script above to avoid any confusion.
@ankur22 Is this still relevant since we manage the browser processes?
Good point, let's close this 🎉
Tested against: https://github.com/grafana/xk6-browser/commit/dbede120c63df43995813a847a25b0e66e289592
The
browser.isConnected
function doesn't seem to fully work as expected -- it doesn't correctly detect that there is no browser process running and therefore no valid CDP connection. Here's the test script I ran. When the test goes to sleep for 20seconds, that's when I force quit the browser process:I was expecting the final
'should be connected before ending iteration'
to fail since the browser process was killed and therefore there shouldn't be a valid connection still open.Please remember to update the
k6-docs
and remove reference to this issue (look for<BWIPT id="453"/>
andxk6-browser/issues/453
).