question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting Electron Dimensions Does Not Work In CI

See original GitHub issue

Current behavior

I was following the instructions at https://docs.cypress.io/api/plugins/browser-launch-api#Set-screen-size-when-running-headless to try to set the Electron headless dimensions when running in CI because at the moment the videos are very low quality. I have copied the exact code shown and it works fine locally but does not seem to have any affect when running on TeamCity. I’ve previously been doing this with Chrome and it worked fine but Electron does not work on CI for some reason.

Desired behavior

I would like any way to have decent looking recordings when setting the Electron viewport to 1367x768, currently the recording sidebar takes almost half the screen and I can’t really see the browser view. image

Test code to reproduce

index.js

module.exports = (on, config) => {
    on("before:browser:launch", (browser = {}, launchOptions) => {
        console.log(
            "launching browser %s is headless? %s",
            browser.name,
            browser.isHeadless,
        );

        // the browser width and height we want to get
        // our screenshots and videos will be of that resolution
        const width = 1920;
        const height = 1080;

        console.log("setting the browser window size to %d x %d", width, height);

        if (browser.name === "chrome" && browser.isHeadless) {
            launchOptions.args.push(`--window-size=${width},${height}`);

            // force screen to be non-retina and just use our given resolution
            launchOptions.args.push("--force-device-scale-factor=1");
        }

        if (browser.name === "electron" && browser.isHeadless) {
            launchOptions.preferences.width = width;
            launchOptions.preferences.height = height;
        }

        if (browser.name === "firefox" && browser.isHeadless) {
            launchOptions.args.push(`--width=${width}`);
            launchOptions.args.push(`--height=${height}`);
        }

        return launchOptions;
    })

    return config;
}

cypress.json

    "viewportWidth": 1366,
    "viewportHeight": 768,

Versions

6.8.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kucebcommented, Apr 1, 2021

this will be fixed in #15686

0reactions
GregLahayecommented, Apr 8, 2021

Thanks all, our recordings look great in 7.0.0. Will be upgrading after performance issues are sorted out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

electron-builder vs electron-packager [closed] - Stack Overflow
Update August 2019. I've been using electron-builder for more than a year now, packaging my app for macOS, Windows 10, and Ubuntu Desktop....
Read more >
Common Configuration - electron-builder
If not specified inside of the build configuration, productName property defined at the top level of package.json is used. If not specified at...
Read more >
Precision Measurements with the Single Electron Transistor
7.8 Superconducting SET Backaction: Conclusions and Future Work . ... coupling to the system that the SET is measuring (not shown in this...
Read more >
Atom size electron vortex beams with selectable orbital ...
The main problem of using holographic dislocation masks is, that all different vortex states (e.g. L = +1, L = 0, L =...
Read more >
Black-Box Description of Electron Correlation with the Spin ...
When we truncate the CI expansion at singles, we do not gain any ... using a 6-31G basis set, and the CI dimensions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found