Skip to content

Commit 0c718e0

Browse files
feat: add toggle to hide fetch requests (#32658)
* chore: add toggle to hide fetch requests * Add test * Fix tests * Update with code review * Update with code review, add test * Add changelog entry * typo --------- Co-authored-by: Jennifer Shehane <[email protected]>
1 parent 74bae64 commit 0c718e0

File tree

21 files changed

+136
-11
lines changed

21 files changed

+136
-11
lines changed

cli/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ _Released 10/7/2025 (PENDING)_
66
**Features:**
77

88
- Cypress Studio is now available by default. You no longer have to set the `experimentalStudio` flag. Addresses [#30997](https://github.com/cypress-io/cypress/issues/30997). Addressed in [#32571](https://github.com/cypress-io/cypress/pull/32571).
9+
- An option is now available to 'Hide HTTP Requests' in the Cypress Command Log. This can be found in the new dropdown menu at the top of the Command Log. Addresses [#7362](https://github.com/cypress-io/cypress/issues/7362). Addressed in [#32658](https://github.com/cypress-io/cypress/pull/32658).
910
- Added the `--posix-exit-codes` flag for the `run` command. When this flag is passed, Cypress will exit with 1 if any tests fail, rather than the number of failed tests. Addresses [#32605](https://github.com/cypress-io/cypress/issues/32605) and [#24695](https://github.com/cypress-io/cypress/issues/24695). Addressed in [#32609](https://github.com/cypress-io/cypress/pull/32609).
1011
- `cy.prompt` is now a reserved Cypress command, currently gated behind a feature flag that requires an invite from Cypress. This means any custom commands named 'prompt' will no longer work. Stay tuned for updates on when this feature will become more widely available. Addresses [#31826](https://github.com/cypress-io/cypress/issues/31826).
1112

@@ -17,7 +18,7 @@ _Released 10/7/2025 (PENDING)_
1718

1819
**Misc:**
1920

20-
- Added a dropdown menu in the Command Log that includes actions like Open in IDE and Add New Test in Studio, along with test preferences such as Auto-Scroll. Addresses [#32556](https://github.com/cypress-io/cypress/issues/32556) and [#32558](https://github.com/cypress-io/cypress/issues/32558). Addressed in [#32611](https://github.com/cypress-io/cypress/pull/32611).
21+
- Added a dropdown menu in the Command Log that includes actions like Open in IDE and Add New Test in Studio, along with test preferences such as Auto-Scroll and Hide HTTP Requests. Addresses [#32556](https://github.com/cypress-io/cypress/issues/32556) and [#32558](https://github.com/cypress-io/cypress/issues/32558). Addressed in [#32611](https://github.com/cypress-io/cypress/pull/32611).
2122
- Updated the Studio test editing header to include a Back button. This change ensures the Specs button remains functional for expanding or collapsing the specs panel. Addresses [#32556](https://github.com/cypress-io/cypress/issues/32556) and [#32558](https://github.com/cypress-io/cypress/issues/32558). Addressed in [#32611](https://github.com/cypress-io/cypress/pull/32611).
2223
- Fixed the Studio panel resizing when dragging. Addressed in [#32584](https://github.com/cypress-io/cypress/pull/32584).
2324
- The Next button now maintains consistent visibility during stepping sessions when using `cy.pause`, staying visible but disabled when no immediate next command is available, providing clear visual feedback to users about stepping state. Addresses [#32476](https://github.com/cypress-io/cypress/issues/32476). Addressed in [#32536](https://github.com/cypress-io/cypress/pull/32536).

packages/app/src/navigation/SidebarNavigation.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ fragment SidebarNavigation_Settings on Query {
121121
isSideNavigationOpen
122122
isSpecsListOpen
123123
autoScrollingEnabled
124+
showFetchRequests
124125
reporterWidth
125126
specListWidth
126127
}

packages/app/src/runner/SpecRunnerOpenMode.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ fragment SpecRunner_Preferences on Query {
176176
isSideNavigationOpen
177177
isSpecsListOpen
178178
autoScrollingEnabled
179+
showFetchRequests
179180
reporterWidth
180181
specListWidth
181182
studioWidth
@@ -355,6 +356,8 @@ onMounted(() => {
355356
356357
preferences.update('autoScrollingEnabled', props.gql.localSettings.preferences.autoScrollingEnabled ?? true)
357358
359+
preferences.update('showFetchRequests', props.gql.localSettings.preferences.showFetchRequests ?? true)
360+
358361
// if the CYPRESS_NO_COMMAND_LOG environment variable is set,
359362
// don't use the widths or the open status of specs list from GraphQL
360363
if (!hideCommandLog) {
@@ -437,6 +440,7 @@ onMounted(() => {
437440
eventManager.on('save:app:state', (state) => {
438441
preferences.update('isSpecsListOpen', state.isSpecsListOpen)
439442
preferences.update('autoScrollingEnabled', state.autoScrollingEnabled)
443+
preferences.update('showFetchRequests', state.showFetchRequests)
440444
})
441445
})
442446

packages/app/src/runner/event-manager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,7 @@ export class EventManager {
883883
numPending: runState.pending,
884884
autoScrollingEnabled: runState.autoScrollingEnabled,
885885
isSpecsListOpen: runState.isSpecsListOpen,
886+
showFetchRequests: runState.showFetchRequests,
886887
scrollTop: runState.scrollTop,
887888
studioActive: hasActiveStudio,
888889
studioSingleTestActive,

packages/app/src/runner/reporter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ function renderReporter (
4747
runner: eventManager.reporterBus,
4848
autoScrollingEnabled: runnerUiStore.autoScrollingEnabled,
4949
isSpecsListOpen: runnerUiStore.isSpecsListOpen,
50+
showFetchRequests: runnerUiStore.showFetchRequests,
5051
error: null,
5152
resetStatsOnSpecChange: true,
5253
// Studio can only be enabled for e2e testing

packages/app/src/store/runner-ui-store.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface RunnerUiState {
2222
showChooseExternalEditorModal: boolean
2323
autoScrollingEnabled: boolean
2424
isSpecsListOpen: boolean
25+
showFetchRequests: boolean
2526
specListWidth: number
2627
reporterWidth: number
2728
studioWidth: number
@@ -39,6 +40,7 @@ export const useRunnerUiStore = defineStore({
3940
showChooseExternalEditorModal: false,
4041
autoScrollingEnabled: true,
4142
isSpecsListOpen: false,
43+
showFetchRequests: true,
4244
specListWidth: runnerConstants.defaultSpecListWidth,
4345
reporterWidth: runnerConstants.defaultReporterWidth,
4446
studioWidth: runnerConstants.defaultStudioWidth,

packages/data-context/graphql/schemaTypes/objectTypes/gql-LocalSettings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const LocalSettingsPreferences = objectType({
88
t.boolean('autoScrollingEnabled')
99
t.string('preferredEditorBinary')
1010
t.boolean('isSpecsListOpen')
11+
t.boolean('showFetchRequests')
1112
t.int('reporterWidth')
1213
t.int('specListWidth')
1314
t.int('studioWidth')

packages/data-context/schemas/schema.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,6 +1421,7 @@ type LocalSettingsPreferences {
14211421
Determine if the browser should launch when the browser flag is passed alone
14221422
"""
14231423
shouldLaunchBrowserFromOpenBrowser: Boolean
1424+
showFetchRequests: Boolean
14241425
specListWidth: Int
14251426
studioWidth: Int
14261427
wasBrowserSetInCLI: Boolean

packages/frontend-shared/cypress/support/mock-graphql/clientTestContext.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export function makeClientTestContext (): ClientTestContext {
8585
__typename: 'LocalSettingsPreferences',
8686
autoScrollingEnabled: true,
8787
isSideNavigationOpen: false,
88+
showFetchRequests: true,
8889
desktopNotificationsEnabled: false,
8990
dismissNotificationBannerUntil: null,
9091
},

packages/reporter/cypress/e2e/commands.cy.ts

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,4 +1087,59 @@ describe('commands', { viewportHeight: 1000 }, () => {
10871087
cy.percySnapshot()
10881088
})
10891089
})
1090+
1091+
context('show fetch requests', () => {
1092+
it('toggles visibility of fetch requests', () => {
1093+
addCommand(runner, {
1094+
name: 'visit',
1095+
renderProps: {
1096+
message: 'visit https://example.com',
1097+
},
1098+
})
1099+
1100+
// Add fetch/request commands (event: true means it's a network request)
1101+
Array.from({ length: 3 }).forEach((_, index) => {
1102+
addCommand(runner, {
1103+
name: 'request',
1104+
event: true,
1105+
renderProps: {
1106+
indicator: 'successful',
1107+
wentToOrigin: true,
1108+
message: `GET /api/data/${index + 1}`,
1109+
},
1110+
})
1111+
})
1112+
1113+
cy.get('.command-name-visit').should('have.length', 2)
1114+
cy.contains('visit https://example.com').should('be.visible')
1115+
1116+
cy.get('.command-name-request').should('have.length', 3)
1117+
cy.contains('GET /api/data/1').should('be.visible')
1118+
1119+
cy.window().its('state.showFetchRequests').should('be.true')
1120+
1121+
cy.get('[data-cy="runnable-options-button"]').click()
1122+
cy.get('[data-cy="more-options-runnable-popover"]').should('be.visible')
1123+
1124+
cy.window().its('state.showFetchRequests').should('be.true')
1125+
1126+
cy.get('[data-cy="show-http-requests-switch"]').click()
1127+
1128+
cy.window().its('state.showFetchRequests').should('be.false')
1129+
1130+
cy.get('.command-name-request').should('not.exist')
1131+
1132+
// This one has event = true, so it should be visible
1133+
cy.contains('(xhr stub)GET --- /posts')
1134+
1135+
cy.get('.command-name-visit').should('exist')
1136+
1137+
cy.get('[data-cy="show-http-requests-switch"]').click()
1138+
1139+
cy.window().its('state.showFetchRequests').should('be.true')
1140+
1141+
cy.get('.command-name-request').should('have.length', 3)
1142+
cy.contains('GET /api/data/1').should('be.visible')
1143+
})
1144+
})
10901145
})

0 commit comments

Comments
 (0)