Make the screenshot/video size configurable #587
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
Like also to see this feature/option! |
any news about this issue? would really be helpfull. sometimes it is not possible/very hard to read tiny texts on recorded video :( |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This worked for me and adjusted all attached screenshots to x1080. In cypress\plugins\index.js: module.exports = (on,config) => {
on('before:browser:launch', (browser = {}, launchOptions) => {
if (browser.name === 'electron') {
launchOptions.preferences['width'] = 1920;
launchOptions.preferences['height'] = 1080;
launchOptions.preferences['resizable'] = false;
return launchOptions
}
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.push('--window-size=1920,1080')
return launchOptions
}
})
}; |
@Phenomite where did you add that code? |
Oh yes sorry, updated. |
In the latest version of Cypress (4.0.0 and up), the signature of the on('before:browser:launch', (browser = {}, launchOptions) => {
if (browser.name === 'electron' && browser.isHeadless) {
launchOptions.preferences['width'] = 1920;
launchOptions.preferences['height'] = 1080;
launchOptions.preferences['resizable'] = false;
return launchOptions
}
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push('--window-size=1920,1080')
return launchOptions
}
}) I can confirm that this works perfectly both for screenshots and videos, so this is great news |
Do you need to return unmodified launchOptions, or is implicitly returning undefined fine? This is a feature I'm interested in using. Should I copy from the above, or is this supposed to be added to some future release? How does the cypress config viewPort relate to this? I had imagined that the video should capture the viewPort, and then it could be optional if we also want to capture the test runner that wraps the app. But that is maybe out of scope for this ticket. |
You can see high-resolution movies in action in http://github.com/bahmutov/cypress-movie
Example still from the movie showing the resolution |
I've finally figured out why I could not get any videos and screenshots larger dan 1024x768, no matter what I did for settings. It will not record videos or make screenshots larger then the defined screen size voor the computer it is running on (which are VMs in our case). When I set my own screen to a smaller resolution then the resolution set in the settings, it will max out to the resolution of the screen. |
@jvanoostveen Looking into this, I haven't been able to verify this locally on my Mac, using Electron headless (which is the default) or any other browser. I've been setting my screen size to 3800 x 3800 and the video recording and screenshots taken on failure are that size. I'd like to narrow down why the screen size overwrites don't work in some environments as it does in others. Do you have any more specifics to share about your environment and the workarounds used that eventually made it work? |
In the end I have no workarounds, just the settings mentioned in #14430, although with some tweaks ( Cypress 6.2.1 |
@jennifer-shehane I was wondering if you found the time to look at it, if it a limitation / bug in the code or limitation when running it on Windows. |
Exactly same behavior in ours CI server. Port-view is set to 1920x1080, and if tests are run locally, screenshots and videos are made with 1920x1080, but on CI server V,) everything is saved with 1024x768. |
Right now the resolution of the screenshots and the recorded video is fixed at 1280x720. This should be configurable
The text was updated successfully, but these errors were encountered: