Skip to content

Commit

Permalink
fix: everyNthFrame should only be applied for Chrome 89+ (#18392)
Browse files Browse the repository at this point in the history
Co-authored-by: Zach Bloomquist <github@chary.us>
  • Loading branch information
davidmunechika and flotwig committed Oct 8, 2021
1 parent 98ecdd5 commit 9265669
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 5 additions & 3 deletions packages/server/lib/browsers/cdp_automation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ export type CyCookie = Pick<chrome.cookies.Cookie, 'name' | 'value' | 'expiratio
// https://developer.chrome.com/extensions/cookies#method-getAll
type CyCookieFilter = chrome.cookies.GetAllDetails

export const screencastOpts: Protocol.Page.StartScreencastRequest = {
format: 'jpeg',
everyNthFrame: Number(process.env.CYPRESS_EVERY_NTH_FRAME || 5),
export function screencastOpts (everyNthFrame = Number(process.env.CYPRESS_EVERY_NTH_FRAME || 5)): Protocol.Page.StartScreencastRequest {
return {
format: 'jpeg',
everyNthFrame,
}
}

function convertSameSiteExtensionToCdp (str: CyCookie['sameSite']): Protocol.Network.CookieSameSite | undefined {
Expand Down
7 changes: 4 additions & 3 deletions packages/server/lib/browsers/chrome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const debug = debugModule('cypress:server:browsers:chrome')
const LOAD_EXTENSION = '--load-extension='
const CHROME_VERSIONS_WITH_BUGGY_ROOT_LAYER_SCROLLING = '66 67'.split(' ')
const CHROME_VERSION_INTRODUCING_PROXY_BYPASS_ON_LOOPBACK = 72
const CHROME_VERSION_WITH_FPS_INCREASE = 89

const CHROME_PREFERENCE_PATHS = {
default: path.join('Default', 'Preferences'),
Expand Down Expand Up @@ -260,7 +261,7 @@ const _connectToChromeRemoteInterface = function (port, onError, browserDisplayN
})
}

const _maybeRecordVideo = async function (client, options) {
const _maybeRecordVideo = async function (client, options, browserMajorVersion) {
if (!options.onScreencastFrame) {
debug('options.onScreencastFrame is false')

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

await client.send('Page.startScreencast', screencastOpts)
await client.send('Page.startScreencast', browserMajorVersion >= CHROME_VERSION_WITH_FPS_INCREASE ? screencastOpts() : screencastOpts(1))

return client
}
Expand Down Expand Up @@ -528,7 +529,7 @@ export = {
await originalBrowserKill.apply(launchedBrowser, args)
}

await this._maybeRecordVideo(criClient, options)
await this._maybeRecordVideo(criClient, options, browser.majorVersion)
await this._navigateUsingCRI(criClient, url)
await this._handleDownloads(criClient, options.downloadsFolder, automation)

Expand Down

4 comments on commit 9265669

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9265669 Oct 8, 2021

Choose a reason for hiding this comment

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

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.6.0/circle-develop-9265669a7e1c93393f74d6dc6871e85eab4dcbe8/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9265669 Oct 8, 2021

Choose a reason for hiding this comment

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

AppVeyor has built the win32 ia32 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.6.0/appveyor-develop-9265669a7e1c93393f74d6dc6871e85eab4dcbe8/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9265669 Oct 8, 2021

Choose a reason for hiding this comment

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

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.6.0/appveyor-develop-9265669a7e1c93393f74d6dc6871e85eab4dcbe8/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 9265669 Oct 8, 2021

Choose a reason for hiding this comment

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

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.6.0/circle-develop-9265669a7e1c93393f74d6dc6871e85eab4dcbe8/cypress.tgz

Please sign in to comment.