Open wojtkowiak opened 8 years ago
I noticed a quit trouble with my case of a browser-kyosk project. It happened after about 300 executions. I am using Linux, Ubuntu 14+ with:
"electron-prebuilt": "^1.3.8",
"spectron": "~3.4.0"
My case uses a a browser launcher script to launch and quit, first. When the script ends, an external (Forever daemon) system notices, and then it runs the node script again. Therefore, I have a sort of infinite testing cycle, which is by design. In this case it's a plain code (not using Mocha, etc) - the following source is the core of it aside from the external synchronous loop system.
From a visual perspective, it got stuck, with the browser window open. When I killed, then I noticed another was there. So prior to get stuck, I believe that a twice were shown somehow. Looking in logs, all of the iterations showed a proper "Quit" output. I would think that it was Forever that caused the trouble but since the browser is open, I then thought about this report here.
var app = new Application({
path: electron, args:['.']
})
console.log('node version: ' + process.version);
app.start().then(function ok() {
app.client.waitUntilTextExists('#message', 'success', 10000).then(
function success() {
console.log('Success, content loaded!!!');
app.stop().then(function ok() {
console.log('Quit ')
}, function nok() {
console.log('not quit properly!');
});
}, function nok() {
console.log("Not loaded...");
app.stop().then(function ok() {
console.log('Quit ')
}, function nok() {
console.log("not quit really");
});
});
}, function nok() {
console.log('Start not ok!')
});
I wonder if the chromedriver could be a reason here - mainly because I found this http://stackoverflow.com/questions/34563724/how-to-make-sure-only-single-chromedriver-exe-instance-is-running-in-background. And then it would be interesting to know exactly if spectron truly have full control over the chromedriver instance.
It looks like there's a one-second delay before the value of this.running
is changed:
I am having the same problem. I have some tests that are checking to make sure the app quits when all windows have closed. app.isRunning()
and app.running
still remain true after the app quits.
I hacked out a work around by executing the pgrep
command for the time being, but it will not work in windows, and it is not as nice as having app.isRunning()
working:
exec('pgrep <APPNAME>', (err, stdout) => {
if (err) {
// pgrep command did not work
// electron app is not running
} else {
// pgrep found some processes associated with <APPNAME>
// electron app is still running
}
})
is there any new solution for this problem. I can not get a test working, to check if the application has quit()
Having the same issue and seems app.stop()
or app.quit()
does not close the app at all :(
Testing if my app is quitting correctly :smile: After
app.quit
t.context.app.isRunning()
still reportstrue
. https://github.com/electron/spectron/blob/aaf7b6964ed32f43c0955b0cb1af5eeb99938db0/lib/application.js#L86t.context.app.stop()
will fail withError: chrome not reachable
. Manually doingt.context.app.running = false;
fixes it. Not sure if this should be handled but maybe a note in the readme would be useful. I am leaving it to your judgment ;)