Skip to content

Commit

Permalink
chore: allow omitting network requests from the Cypress log
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Dec 9, 2024
1 parent a90104e commit a3abbc5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ before(() => {
beforeEach(() => {
const baseUrl = Cypress.env('dhis2BaseUrl')
const instanceVersion = Cypress.env('dhis2InstanceVersion')
const hideRequestsFromLog = Cypress.env('hideRequestsFromLog')
const envVariableName = computeEnvVariableName(instanceVersion)
const { name, value, ...options } = JSON.parse(Cypress.env(envVariableName))

if (hideRequestsFromLog) {
// disable Cypress's default behavior of logging all XMLHttpRequests and fetches
cy.intercept({ resourceType: /xhr|fetch/ }, { log: false })
}
localStorage.setItem(LOCAL_STORAGE_KEY, baseUrl)
cy.setCookie(name, value, options)

Expand Down

0 comments on commit a3abbc5

Please sign in to comment.