browser: add page.on('requestfailed') event handler - #5481
Conversation
page.on('requestfailed') eventpage.on('requestfailed') event handler
mstoykov
left a comment
There was a problem hiding this comment.
Thank you for the PR, and sorry for the slow reviews - the holidays and catching up has been getting in the way.
Over all looks really good, my only concern is the skipping of the test in the middle. I really do not want this to be happening, either we know that this hsouldn't work in some cases and we skip early or we are running the test. This test currently will practically never fail - it will just be skipped. Which isn't good for tests.
|
@mstoykov Thanks a lot for taking a look at it, i hope you had a great holiday. I have updated the test to follow a more deterministic approach where:
|
ankur22
left a comment
There was a problem hiding this comment.
Awesome! Thanks for this 🚀
…entRequestFinished
|
@ankur22 Thanks i have addressed the lint issue and resolved the conflict. :) |
What?
This PR Adds the
page.on('requestfailed')event handler to the k6 browser module, following the Playwright API.This event fires when a network request fails to reach the server:
in the following cases : DNS errors, connection refused, timeouts, etc.
It does not fire for HTTP 4xx/5xx responses, which are successful network requests.
Note: I have closely followed the implementation of
page.on('request')andpage.on('response')events.Why?
Reasons mentioned in the issue #4299 description.
Checklist
make check) and all pass.Checklist: Documentation (only for k6 maintainers and if relevant)
Please do not merge this PR until the following items are filled out.
Related PR(s)/Issue(s)
Closes: #4299
Parent: #4232