Skip to content
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

Support passing electron remote debug flag via cypress browser launch API #293

Closed
afsmith92 opened this issue May 25, 2023 · 2 comments
Closed
Assignees
Labels
Status: help wanted Extra attention is needed Type: enhancement New feature or request.

Comments

@afsmith92
Copy link

Description
As documented in the readme, using this plugin with Electron requires passing CLI arguments

$ ELECTRON_EXTRA_LAUNCH_ARGS=--remote-debugging-port=9222 cypress run --browser electron

Is there a reason or limitation why this flag couldn't optionally be passed in via the cypress browser launch API instead?

setupNodeEvents(on, config) {
  on('before:browser:launch', (browser = {}, launchOptions) => {
    if (browser.family === 'electron') {
      launchOptions.args.push('--remote-debugging-port=9222');
    }

    return launchOptions;
  })
}

Unfortunately in the environment where I'm running my tests, I'm not able to pass the CLI flag, and ideally I'd be able to use the cypress browser launch API.

Possible solution
Currently the plugin checks if the CLI argument is present -- this check would need to be relaxed.

@afsmith92 afsmith92 added Status: help wanted Extra attention is needed Type: enhancement New feature or request. labels May 25, 2023
@derevnjuk
Copy link
Member

@afsmith92 thanks for contributing. Unfortunately, Cypress currently has limitations that prevent this feature from being implemented. Cypress ignores the switcher passed via launch options. This means that even if you try to modify the launchOptions.args array to include --remote-debugging-port=9222, Cypress will not recognize it. According to the Cypress documentation, you have to use the env variable: https://docs.cypress.io/api/plugins/browser-launch-api#Modify-Electron-app-switches

Additionally, there is a bug in Cypress starting from v12.12.0 that prevents overriding the port. This bug is described in issue #288, it also restricts the ability to modify the port for Electron.

So, you may need to consider alternative approaches or workarounds in your testing environment to achieve your desired outcome.

@afsmith92
Copy link
Author

Thanks for the explanation! I'll close this.

@afsmith92 afsmith92 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: help wanted Extra attention is needed Type: enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants