Skip to content

Commit 9734c2c

Browse files
mjhenkesmschileAtofStryker
authored
Update network request guide to include info about disabling logging (#5124)
* update command log guide to inform users they can disable logging * add missing curly brace * Update docs/guides/guides/network-requests.mdx Co-authored-by: Matt Schile <mschile@cypress.io> * add link to example of turning off all intercept logs * lint fixes * Update docs/guides/guides/network-requests.mdx Co-authored-by: Bill Glesias <bglesias@gmail.com> --------- Co-authored-by: Matt Schile <mschile@cypress.io> Co-authored-by: Bill Glesias <bglesias@gmail.com>
1 parent 88df4ee commit 9734c2c

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

docs/guides/guides/network-requests.mdx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,9 @@ cy.wait('@new-user').then(console.log)
525525

526526
## Command Log
527527

528-
Cypress logs all `XMLHttpRequest`s and `fetch`es made by the application under
529-
test in the Command Log. Here is an example of what this looks like:
528+
By default, Cypress logs all `XMLHttpRequest`s and `fetch`es made by the
529+
application under test in the Command Log. Here is an example of what this looks
530+
like:
530531

531532
<!-- Code to reproduce screenshot:
532533
cy.visit('https://jsonplaceholder.cypress.io')
@@ -541,6 +542,21 @@ test in the Command Log. Here is an example of what this looks like:
541542
alt="Screenshot of fetch and XHR requests"
542543
/>
543544

545+
:::info
546+
547+
**Note:** Logging can be disabled by passing `{ log: false }` with the static
548+
response.
549+
550+
```js
551+
cy.intercept('/users*', { body: ['user1', 'user2'], log: false }).as('getUsers')
552+
```
553+
554+
To disable logs for all xhr/fetch requests, checkout our
555+
[example](/api/commands/intercept#Disabling-logs-for-a-request) on the intercept
556+
api page.
557+
558+
:::
559+
544560
The circular indicator on the left side indicates if the request went to the
545561
destination server or not. If the circle is solid, the request went to the
546562
destination server; if it is outlined, the response was stubbed by

0 commit comments

Comments
 (0)