Skip to content

Commit cf8a643

Browse files
check browser version to determine every nth frame
1 parent d857e7f commit cf8a643

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-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: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ const _connectToChromeRemoteInterface = function (port, onError, browserDisplayN
260260
})
261261
}
262262

263-
const _maybeRecordVideo = async function (client, options) {
263+
const _maybeRecordVideo = async function (client, options, browserMajorVersion) {
264264
if (!options.onScreencastFrame) {
265265
debug('options.onScreencastFrame is false')
266266

@@ -273,7 +273,7 @@ const _maybeRecordVideo = async function (client, options) {
273273
client.send('Page.screencastFrameAck', { sessionId: meta.sessionId })
274274
})
275275

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

278278
return client
279279
}
@@ -528,7 +528,7 @@ export = {
528528
await originalBrowserKill.apply(launchedBrowser, args)
529529
}
530530

531-
await this._maybeRecordVideo(criClient, options)
531+
await this._maybeRecordVideo(criClient, options, browser.majorVersion)
532532
await this._navigateUsingCRI(criClient, url)
533533
await this._handleDownloads(criClient, options.downloadsFolder, automation)
534534

0 commit comments

Comments
 (0)