-
Notifications
You must be signed in to change notification settings - Fork 229
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
Spectron sometimes launches multiple instances of electron app #279
Comments
Same issue as #60 |
@bksantiago not really. Yes, empty terminal windows being launched is a part of the issue reported here. The other part of the issue is that the electron application itself is spawned multiple times on running tests. |
We're also experiencing this issue while trying to set up simple Spectron tests for a VS Code extension - multiple instances of VS Code open up. |
@davidkpiano hi david, could u kindly share a simple example of Spectron tests for a VS Code extension ? It would be much appreciated. I am totally new to it, and google give me this page when I searched related keywords. |
Any update on this issue? |
@nikhil-zinjurde Did you/your team ever figure out what was causing this issue? |
We managed to get around this issue by disabling Dev mode on our Electron app before we start execution. Since then, we haven't observed this issue. |
Just back-referencing why it's opening empty windows.
|
@nikhil-zinjurde -- Do you mean launching the electron application with Developer Tools disabled? |
Yes, precisely. We provide electron application .exe path to app instance with new Application () constructor. Then, we make sure to disable Developer Tools. Then, we run the Spectron tests which launches the application (still with additional blank terminal windows). But, the issue of multple electron instances has gone way. The Spectron version we are using is 3.8.0, that works well with electron version of our application |
@nikhil-zinjurde By disabling the Developer Tools, did you just set Or did you do something via the spectron side of things? Cause I've tried the devTools: false approach in my electron code and still running into 2 electron instances getting started. |
We are testing with the following and having good luck so far: app = new Application({ |
Hey @JimmyMac6996 I appreciate your example. Did you have to do anything else to get that to work? I'm still getting the 2 windows behavior with updating my application creation to include the chromeDriverArgs. Looking at the Main Process Logs (client.getMainProcessLogs()), immediately after application.start() completes, it's logging The app 'ready' event fires twice, thus the 2 windows being created. The logs make it seem like it's not honoring disabling the extensions. Our Electron version is 4, so maybe that's why we're running into this issue? |
Well... guess my logging should've clued me in. I decided to check the console of the first window that gets open, cause the main process logs were mentioning an error, and turns out the we were attempting to import the angular service worker module. This was left over from before we switched to using electron and we don't actually use it anywhere. So removed the import and amazingly enough.... only ONE window! I also removed the chromeDriverArgs and it's still working fine. |
Our issues was not every time and sounds different, we are executing our tests from ADO/VSTS on a VM. 1 time out of 10 test runs, it would get hung up in the app.start code and never get back out, and would just keep opening our electron application over and over until there where so many instances the VM crashed from running out of memory/resources. Glad you tracked down your issue. :-) |
I experienced this problem when using the incorrect version of spectron for my version of electron. // package.json
{
"devDependencies": {
"spectron": "^8.0.0",
"electron": "5.0.6"
}
} right: // package.json
{
"devDependencies": {
"spectron": "^7.0.0",
"electron": "5.0.6"
}
} Make sure you've got the right one installed. |
It's the good versions for me and it keeps opening windows. |
Again. It has nothing to do with the version, but the technique used to spawn the process, as mentioned here #279 (comment). |
@SleeplessByte it's not command windows, but Electron app windows who are spawned for me. #843 |
If it's a different issue, you shouldn't be commenting here. If it's the same issue, my comment stands. This issue might be interesting to you: #60, and in particular this comment: #60 (comment) |
I think that the reason for this issue is that testing suites are executed in different electron instances: https://webdriver.io/blog/2021/03/23/grouping-specs/ |
Okay, I was having the same issue. And solved by setting remote debugging port. chromeDriverArgs: ['remote-debugging-port=9222']: const Application = require('spectron').Application describe('Application launch', function () {
}) |
This is an issue that we are facing while testing our electron apps with Spectron. It seems to go into a recursive mode of launching multiple instances, along with multiple empty terminal windows as reported in issue #60 (Empty terminals display on Windows).
It is resulting in test failures on our test environment quite frequently. Moreover, #60 issue hinders us from choosing the app window by index. So, any help or resolution on these both issues is very much appreciated.
Here is a screen capture of the issue.
The text was updated successfully, but these errors were encountered: