Skip to content

Commit 9265669

Browse files
fix: everyNthFrame should only be applied for Chrome 89+ (#18392)
Co-authored-by: Zach Bloomquist <github@chary.us>
1 parent 98ecdd5 commit 9265669

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/server/lib/browsers/cdp_automation.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ export type CyCookie = Pick<chrome.cookies.Cookie, 'name' | 'value' | 'expiratio
1919
// https://developer.chrome.com/extensions/cookies#method-getAll
2020
type CyCookieFilter = chrome.cookies.GetAllDetails
2121

22-
export const screencastOpts: Protocol.Page.StartScreencastRequest = {
23-
format: 'jpeg',
24-
everyNthFrame: Number(process.env.CYPRESS_EVERY_NTH_FRAME || 5),
22+
export function screencastOpts (everyNthFrame = Number(process.env.CYPRESS_EVERY_NTH_FRAME || 5)): Protocol.Page.StartScreencastRequest {
23+
return {
24+
format: 'jpeg',
25+
everyNthFrame,
26+
}
2527
}
2628

2729
function convertSameSiteExtensionToCdp (str: CyCookie['sameSite']): Protocol.Network.CookieSameSite | undefined {

packages/server/lib/browsers/chrome.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const debug = debugModule('cypress:server:browsers:chrome')
2525
const LOAD_EXTENSION = '--load-extension='
2626
const CHROME_VERSIONS_WITH_BUGGY_ROOT_LAYER_SCROLLING = '66 67'.split(' ')
2727
const CHROME_VERSION_INTRODUCING_PROXY_BYPASS_ON_LOOPBACK = 72
28+
const CHROME_VERSION_WITH_FPS_INCREASE = 89
2829

2930
const CHROME_PREFERENCE_PATHS = {
3031
default: path.join('Default', 'Preferences'),
@@ -260,7 +261,7 @@ const _connectToChromeRemoteInterface = function (port, onError, browserDisplayN
260261
})
261262
}
262263

263-
const _maybeRecordVideo = async function (client, options) {
264+
const _maybeRecordVideo = async function (client, options, browserMajorVersion) {
264265
if (!options.onScreencastFrame) {
265266
debug('options.onScreencastFrame is false')
266267

@@ -273,7 +274,7 @@ const _maybeRecordVideo = async function (client, options) {
273274
client.send('Page.screencastFrameAck', { sessionId: meta.sessionId })
274275
})
275276

276-
await client.send('Page.startScreencast', screencastOpts)
277+
await client.send('Page.startScreencast', browserMajorVersion >= CHROME_VERSION_WITH_FPS_INCREASE ? screencastOpts() : screencastOpts(1))
277278

278279
return client
279280
}
@@ -528,7 +529,7 @@ export = {
528529
await originalBrowserKill.apply(launchedBrowser, args)
529530
}
530531

531-
await this._maybeRecordVideo(criClient, options)
532+
await this._maybeRecordVideo(criClient, options, browser.majorVersion)
532533
await this._navigateUsingCRI(criClient, url)
533534
await this._handleDownloads(criClient, options.downloadsFolder, automation)
534535

0 commit comments

Comments
 (0)