-
Notifications
You must be signed in to change notification settings - Fork 39
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 fetch collector #126
add fetch collector #126
Conversation
} | ||
|
||
cy.window().then((window) => { | ||
const document = window.document; |
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.
What is the purpose of the button? Wouldn't it have been more easier to directly trigger window.fetch(..)
here? And using and intercept await its response?
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.
window.fetch would result in a xhr query because of fetch-polyfill. This is also testing the case of not-intercepted requests.
`cy:fetch ${ICONS.warning} GET https://www.mocky.io/v2/5ec993803000009700a6ce1f\n${PADDING} Status: 400\n${PADDING} Response body: {\n${PADDING} "status": "Wrong!",\n${PADDING} "data": {\n${PADDING} "corpo": "corpo da resposta",\n${PADDING} "titulo": "titulo da resposta"\n${PADDING} }\n${PADDING} }\n`, | ||
'intercepted non-success fetch contains url, status and a response body' | ||
); | ||
|
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.
It would be nice to have a case for aborted / timeout as well.
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.
there's a way to force timeout but cypress itself doesn't handle that well (an error entry is added and the query command remains in a pending state). I can probably add now a test using forceNetworkError which seems to provide a better output.
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.
If that doesn't affect other tests I say go for it.
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.
test case added
Looks solid. Just some minor comments. Good job. |
Thanks! Btw how often is this released? Keen to keep using the official npm package :) |
As soon as its merged I ll release it. Enabled pipeline on fork PRs. Check why the tests are failing |
Seems failures were unrelated, just a bit of flakiness from using live pages in tests. It's all green now. |
Release in 3.4.0 |
No description provided.