-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the screenshot/video size configurable #587
Comments
This comment has been minimized.
This comment has been minimized.
Like also to see this feature/option! 👍 HD, FHD or even UHD with all kidding aside... 😄 Not sure if this is technically possible but it would be nice indeed. |
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 has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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. |
We are working on setting the size of the window that screenshots and videos will be captured to a higher default resolution (1920x1080) across browsers. #15686 We think this will help many of the requests to have higher resolution screenshots and videos to review. It does not however satisfy the whole requirements of this issue of having an easy configurable way to change the size yourself. It should also resolve some of the issues with not being able to override the Electron size, even with our suggested workarounds. #15686 |
That doesn't seem to be working in cypress |
I have the same issue using a Mac Pro M1 with two external screens, electron headless always runs using When running on the Github CI it runs with a value of I tried other approaches like setting the value like shown here without success:
Here is another example of someone have 2x resolution on headless mac: #6485 (comment) Unfortunately, this change seems broken: #17375 |
any new solution for Chrome? |
Bump this. |
Running into this issue as well. Electron headless switches between 2x screenshots on Mac and 1x everywhere else without an option or workaround. |
Tho it sounds much worse than workaround, I have something similar: I currently running Cypress tests for making new snapshots in Docker container with Linux on board |
Problem is Chrome and not Cypress. Chrome headless is broken, there is no solution |
We're seeing this on Electron not Chrome. |
It doesn't matter. It's Chromium based. The same issue. |
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: