Skip to content
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

Merged
merged 2 commits into from
Nov 3, 2021
Merged

add fetch collector #126

merged 2 commits into from
Nov 3, 2021

Conversation

Erik-Outreach
Copy link
Contributor

No description provided.

}

cy.window().then((window) => {
const document = window.document;
Copy link
Owner

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?

Copy link
Contributor Author

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'
);

Copy link
Owner

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.

Copy link
Contributor Author

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.

Copy link
Owner

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test case added

@archfz
Copy link
Owner

archfz commented Nov 2, 2021

Looks solid. Just some minor comments. Good job.

@Erik-Outreach
Copy link
Contributor Author

Looks solid. Just some minor comments. Good job.

Thanks! Btw how often is this released? Keen to keep using the official npm package :)

@archfz
Copy link
Owner

archfz commented Nov 2, 2021

As soon as its merged I ll release it. Enabled pipeline on fork PRs. Check why the tests are failing

@Erik-Outreach
Copy link
Contributor Author

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.

@archfz archfz merged commit c11efdc into archfz:develop Nov 3, 2021
@archfz
Copy link
Owner

archfz commented Nov 3, 2021

Release in 3.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants