question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hide XHR requests from the command log

See original GitHub issue

Current behavior:

All XHR requests are printed to the command log, which can be distracting. There is no option to filter them. In https://github.com/cypress-io/cypress/issues/1184 it was mentioned this is possible by whitelisting requests with Cypress.Server.defaults, but that breaks stubbing.

Desired behavior:

Having an option, to only log stubbed XHR requests to the command log.

Maybe the best fix would be not a config option, but a toggle on the test runner, that can hide these logs.

Test code to reproduce

Test any app that does network requests.

Versions

Any OS and version.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:47
  • Comments:22 (3 by maintainers)

github_iconTop GitHub Comments

28reactions
simenbrekkencommented, Oct 15, 2021

I ran into this problem myself and after a deep-dive into Cypress’ logging internals I discovered a novel workaround, simply hide fetch/XHR command log entries with CSS.

https://gist.github.com/simenbrekken/3d2248f9e50c1143bf9dbe02e67f5399

17reactions
agelicocommented, Aug 11, 2021

Updated to v8.2.0 and development turned into nightmare: all useless server pollings are back in the UI, couldn’t find anything in intercept() to hide requests from UI and no plugin to bring server() functionality back. It looks pretty much like screenshots in #1184 all over again, and would gladly upvote changes requested here.

Did anyone find a way around it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hide XHR calls on Cypress test runner - Stack Overflow
Try this, works for me. Add the following to cypress/support/index.js: // Hide fetch/XHR requests const app = window.top; ...
Read more >
Muting Noisy XHR Logs in Cypress - DEV Community ‍ ‍
Hide fetch/XHR requests from command log if (Cypress.config("hideXHRInCommandLog")) { const app = window.top; if ( app && !app.document.head ...
Read more >
cypress-io/cypress - Gitter
How can i hide or remove the xhr request from the cybress test cases ? ... what is the command to run a...
Read more >
How to hide xhr logs in Chrome developer console and ...
You cannot. Even if you could, if the user used Fiddler, Wireshark and similar, the requests would have been visible anyway, so it...
Read more >
Cypress App
There are some places in the Command Log that display a link to the relevant file ... Network XHR Requests; URL hash changes;...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found