Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ _Released 03/10/2026_
- Adds an option to enable word wrap for Studio panel code. Addressed in [#33411](https://github.com/cypress-io/cypress/pull/33411).

**Bugfixes:**

- Fixed an issue where sending SIGINT (e.g. Ctrl+C) to exit Cypress left the terminal displaying raw characters. Fixes [#33367](https://github.com/cypress-io/cypress/issues/33367). Addressed in [#33431](https://github.com/cypress-io/cypress/pull/33431).
- Fixed an issue in develop mode (when running Cypress via gulp with file watching) where closing the Electron window did not exit the gulp process, leaving it running. Addressed in [#33431](https://github.com/cypress-io/cypress/pull/33431).
- Fixed an issue where internal tags on stderr streams were surfacing to the end user CLI during component testing. Addresses [#32769](https://github.com/cypress-io/cypress/issues/32769). Addressed in [#33400](https://github.com/cypress-io/cypress/pull/33400).
Expand All @@ -19,6 +20,10 @@ _Released 03/10/2026_
- Upgraded `basic-ftp` to `5.2.0` to address [CVE-2026-27699](https://github.com/advisories/GHSA-5rq4-664w-9x2c) vulnerability reported in security scans. Addresses [#33436](https://github.com/cypress-io/cypress/issues/33436).
- Upgraded `fast-xml-parser` to `4.5.4` to address [CVE-2026-25896](https://github.com/advisories/GHSA-m7jm-9gc2-mpf2) vulnerability reported in security scans. Addresses [#33434](https://github.com/cypress-io/cypress/issues/33434).

**Misc:**

- Rerun tests on `pagehide` or `unload` instead of on `beforeunload`. Addresses [#33456](https://github.com/cypress-io/cypress/pull/33456).

## 15.11.0

_Released 02/24/2026_
Expand Down
29 changes: 23 additions & 6 deletions packages/app/src/runner/event-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class EventManager {
studioStore: ReturnType<typeof useStudioStore>
promptStore: ReturnType<typeof usePromptStore>
specDirtyDataStore: ReturnType<typeof useSpecDirtyDataStore>
_deferCleanupToUnload = false

constructor (
// import '@packages/driver'
Expand Down Expand Up @@ -361,8 +362,13 @@ export class EventManager {
// event as a proxy for AUT unloads.
const unloadEvent = this.isBrowserFamily('chromium') ? 'pagehide' : 'unload'

$window.on(unloadEvent, (e) => {
this._clearAllCookies()
$window.on(unloadEvent, () => {
if (this._deferCleanupToUnload) {
this._runFullUnloadCleanup()
this._deferCleanupToUnload = false
} else {
this._clearAllCookies()
}
})

// when our window triggers beforeunload
Expand All @@ -372,11 +378,15 @@ export class EventManager {
// that Cypress knows not to set any more
// cookies
$window.on('beforeunload', () => {
telemetry.getSpan('cypress:app')?.end()
this.reporterBus.emit('reporter:restart:test:run')
if (this.specDirtyDataStore.isDirty()) {
// Used to handle Studio unsaved changes. It defers the cleanup to the unload event
// so that the test is not rerun if the user cancels the beforeunload dialog.
this._deferCleanupToUnload = true

this._clearAllCookies()
this._setUnload()
return
}

this._runFullUnloadCleanup()
})

this.addPromptListeners()
Expand Down Expand Up @@ -998,6 +1008,13 @@ export class EventManager {
this.ws.emit('reload:browser', window.location.toString(), browser && browser.name)
}

_runFullUnloadCleanup () {
telemetry.getSpan('cypress:app')?.end()
this.reporterBus.emit('reporter:restart:test:run')
this._clearAllCookies()
this._setUnload()
}

// clear all the cypress specific cookies
// whenever our app starts
// and additional when we stop running our tests
Expand Down
Loading