-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add page.on('response')
#4296
Add page.on('response')
#4296
Conversation
05b8969
to
6ac9bd0
Compare
3dd1239
to
78ccfc3
Compare
6ac9bd0
to
09fbe5d
Compare
50e414d
to
e51b45d
Compare
221509d
to
294a817
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments about this one would be similar to #4290. They are very alike.
2709a6c
to
522a411
Compare
294a817
to
fea5839
Compare
fea5839
to
0833a1d
Compare
What's your take on this @inancgumus ? Anything specific I should pay attention to or know to effectively review it? 🙇🏻 |
@oleiade For my take, please check out the resolved discussions in #4290, as this PR is pretty much the same as the other PR. There is also this shortcoming. Let me know if you need anything else 🙇 |
6b8b7f9
to
6f26ce7
Compare
0833a1d
to
8502bf3
Compare
6f26ce7
to
2ba86e4
Compare
8502bf3
to
8906bbf
Compare
d31f032
to
7411356
Compare
7411356
to
24e07a9
Compare
This is where the response will be set for the page.on handler to read.
This method is to be called when a new response has been received from the WuT to chrome. It takes the response and sends it to the page.on handler where the user test script can read the response data.
There seems to be a race condition with chrome and CDP requests when trying to retrieve the response body. If the call to retrieve the response body is too "quick", then we get an error back. However with retries and a sleep it seems to solve the issue with the small tests i have performed. I suspect this will be a greater issue in the wild.
The refactor tries to work with the dynamic server values. It also works with the defined types in common instead of a map.
Work with slices.IndexFunc and sort HeadersArray before comparing the response and expected.
24e07a9
to
70bb936
Compare
@oleiade Could you check this PR out? 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redid a short pass. LGTM (as far as I can tell 😅 ) 🚀
What?
This implements the
page.on('response')
API from Playwright. When the handler is created, all subsequent responses will be directed to the handler, where the user can interact with the read only response object. The response is intercepted after it is received from the website under test to the browser.An example usage is:
Why?
This can be useful to:
Checklist
make lint
) and all checks pass.make tests
) and all tests pass.Related PR(s)/Issue(s)
page.on('response')
#4234page.on('response')
k6-docs#1878page.on('request|response')
k6-DefinitelyTyped#80