Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ _Released 10/20/2025 (PENDING)_

**Bugfixes:**

- Fixed an issue where grouped command text jumps up and down when expanding and collapsing in the command log. Addressed in [#32757](https://github.com/cypress-io/cypress/pull/32757).
- Fixed an issue where command snapshots were not correctly displayed in Studio. Addressed in [#32808](https://github.com/cypress-io/cypress/pull/32808).
- Chrome's autofill popup is now disabled when filling address and credit card forms during test execution. We also added some other Chrome flags and preferences that are common when automating browsers. Fixes [#25608](https://github.com/cypress-io/cypress/issues/25608). Addressed in [#32811](https://github.com/cypress-io/cypress/pull/32811).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Changelog Duplicate Entry for Command Snapshot Fix

The cli/CHANGELOG.md file contains a duplicate entry for the bugfix "Fixed an issue where command snapshots were not correctly displayed in Studio. Addressed in [#32808]".

Fix in Cursor Fix in Web

- Fixed an issue where grouped command text jumps up and down when expanding and collapsing in the command log. Addressed in [#32757](https://github.com/cypress-io/cypress/pull/32757).
- Fixed an issue with grouped console prop items having a hard to read blue color in the console log and duplicate `:` characters being displayed. Addressed in [#32776](https://github.com/cypress-io/cypress/pull/32776).
- Added more context to the error message shown when `cy.prompt()` fails to download. Addressed in [#32822](https://github.com/cypress-io/cypress/pull/32822).

Expand Down
60 changes: 55 additions & 5 deletions packages/server/lib/browsers/chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@ const pathToTheme = extension.getPathToTheme()

let browserCriClient: BrowserCriClient | undefined

// Generates default Chrome preferences that Cypress applies to all Chrome instances
const _getDefaultChromePreferences = (): ChromePreferences => {
return {
default: {
autofill: {
profile_enabled: false, // Disable Chrome's "Save address" pop up
credit_card_enabled: false, // Disable Chrome's "Save card" pop up
},
},
defaultSecure: {},
localState: {
browser: {
// Hide security warnings when potentially dangerous command-line flags are used.
command_line_flag_security_warnings_enabled: false,
// Setting the policy controls the presentation of promotional content,
// including the welcome pages that help users sign in to Google Chrome, set
// Google Chrome as users' default browser, or otherwise inform them of product features.
promotions_enabled: false,
},
},
}
}

/**
* Reads all known preference files (CHROME_PREFERENCE_PATHS) from disk and return
* @param userDir
Expand Down Expand Up @@ -78,6 +101,16 @@ const _getChromePreferences = (userDir: string): Bluebird<ChromePreferences> =>
}))
}

// Reads raw preferences from disk and merges them with defaults
const _getChromePreferencesWithDefaults = async (userDir: string): Promise<ChromePreferences> => {
const existingPrefs = await _getChromePreferences(userDir)

// Merge default preferences with existing preferences
const defaultPrefs = module.exports._getDefaultChromePreferences()

return _mergeChromePreferences(defaultPrefs, existingPrefs)
}

const _mergeChromePreferences = (originalPrefs: ChromePreferences, newPrefs: ChromePreferences): ChromePreferences => {
return _.mapValues(CHROME_PREFERENCE_PATHS, (_v, prefPath) => {
const original = _.cloneDeep(originalPrefs[prefPath])
Expand Down Expand Up @@ -118,10 +151,16 @@ const _writeChromePreferences = (userDir: string, originalPrefs: ChromePreferenc
const newJson = newPrefs[key]

if (!newJson || _.isEqual(originalJson, newJson)) {
debug('skipping writing preferences for %s: no changes detected', key)

return
}

return fs.outputJson(path.join(userDir, CHROME_PREFERENCE_PATHS[key]), newJson)
const prefPath = path.join(userDir, CHROME_PREFERENCE_PATHS[key])

debug('writing Chrome preferences to %s: %o', prefPath, newJson)

return fs.outputJson(prefPath, newJson)
})
.return()
}
Expand Down Expand Up @@ -296,6 +335,10 @@ export = {

_getChromePreferences,

_getChromePreferencesWithDefaults,

_getDefaultChromePreferences,

_mergeChromePreferences,

_writeChromePreferences,
Expand Down Expand Up @@ -535,15 +578,15 @@ export = {

const userDir = utils.getProfileDir(browser, isTextTerminal)

const [port, preferences] = await Bluebird.all([
const [port, rawPreferences] = await Bluebird.all([
protocol.getRemoteDebuggingPort(),
_getChromePreferences(userDir),
])

const defaultArgs = this._getArgs(browser, options, port)

const defaultLaunchOptions = utils.getDefaultLaunchOptions({
preferences,
preferences: rawPreferences,
args: defaultArgs,
})

Expand All @@ -554,10 +597,16 @@ export = {
utils.executeBeforeBrowserLaunch(browser, defaultLaunchOptions, options),
])

// Merge preferences BEFORE writing them to disk
// Start with defaults merged with raw preferences
let finalPreferences = _mergeChromePreferences(module.exports._getDefaultChromePreferences(), rawPreferences)

if (launchOptions.preferences) {
launchOptions.preferences = _mergeChromePreferences(preferences, launchOptions.preferences as ChromePreferences)
finalPreferences = _mergeChromePreferences(finalPreferences, launchOptions.preferences as ChromePreferences)
}

debug('final Chrome preferences to be written: %o', finalPreferences)

const [extDest] = await Bluebird.all([
this._writeExtension(
browser,
Expand All @@ -567,7 +616,8 @@ export = {
_disableRestorePagesPrompt(userDir),
// Chrome adds a lock file to the user data dir. If we are restarting the run and browser, we need to remove it.
fs.unlink(path.join(userDir, 'SingletonLock')).catch(() => {}),
_writeChromePreferences(userDir, preferences, launchOptions.preferences as ChromePreferences),
// Write the final merged preferences BEFORE launching the browser
_writeChromePreferences(userDir, rawPreferences, finalPreferences),
])
// normalize the --load-extensions argument by
// massaging what the user passed into our own
Expand Down
37 changes: 32 additions & 5 deletions packages/server/lib/util/chromium_flags.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
const disabledFeatures = [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of this was just alphabetizing and also adding new flags

// Disable manual option and popup prompt of Chrome translation
// https://github.com/cypress-io/cypress/issues/28225
'Translate',
// Uncomment to force the deprecation of unload events
// 'DeprecateUnloadByUserAndOrigin',

// Hide toolbar button that opens dialog for controlling media sessions.
'GlobalMediaControls',

// Disables the Interest Feed Content Suggestions,
// which is a feature that shows content suggestions based on the user's interests.
// https://www.google.com/interests/saved
'InterestFeedContentSuggestions',

// Hides the Lens feature in the URL address bar.
'LensOverlay',

// Avoid the startup dialog for _Do you want the application 'Chromium.app' to accept incoming network connections?_.
// Also disables the Chrome Media Router https://chromium.googlesource.com/chromium/src/+/HEAD/docs/media/media_router.md
// which creates background networking activity to discover cast targets. A superset of disabling `DialMediaRouteProvider`.
'MediaRouter',

// Disable the Chrome Optimization Guide https://chromium.googlesource.com/chromium/src/+/HEAD/components/optimization_guide/)
// and networking with its service API
'OptimizationHints',

// Disables "Enhanced ad privacy in Chrome" dialog
// https://github.com/cypress-io/cypress/issues/29199
'PrivacySandboxSettings4',
// Uncomment to force the deprecation of unload events
// 'DeprecateUnloadByUserAndOrigin',

// Disable manual option and popup prompt of Chrome translation
// https://github.com/cypress-io/cypress/issues/28225
'Translate',
]

// Common Chrome Flags for Automation
Expand All @@ -20,6 +42,11 @@ const DEFAULT_FLAGS = [
'no-first-run',
'noerrdialogs',
'enable-fixed-layout',
// Disables Domain Reliability Monitoring, which tracks whether the browser has
// difficulty contacting Google-owned sites and uploads reports to Google.
'disable-domain-reliability',
// Disable field trial tests configured in fieldtrial_testing_config.json.
'disable-field-trial-config',
'disable-popup-blocking',
'disable-password-generation',
'disable-single-click-autofill',
Expand Down
Loading
Loading