Skip to content

Commit

Permalink
Improve quality on Cypress videos
Browse files Browse the repository at this point in the history
  • Loading branch information
valtterikantanen committed Nov 28, 2024
1 parent a834821 commit afcf72e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,17 @@
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
on('before:browser:launch', (browser = {}, launchOptions) => {
// By manually setting the browser width and height in headless
// mode, screenshots and videos will have a better quality
// https://www.cypress.io/blog/generate-high-resolution-videos-and-screenshots
const width = 2560
const height = 1440

if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push(`--window-size=${width},${height}`)
launchOptions.args.push('--force-device-scale-factor=1')
}
return launchOptions
})
}

0 comments on commit afcf72e

Please sign in to comment.